Skip to content

Broken next-lint-to-eslint-cli codemod #85679

@Git-I985

Description

@Git-I985

Link to the code that reproduces this issue

https://github.com/Git-I985/next-lint-to-eslint-cli-codemod-issue

To Reproduce

  • Install dependencies (npm install or whatever).
  • Run npx @next/codemod@canary next-lint-to-eslint-cli according to docs
  • On step ✔ On which files or directory should the codemods be applied? … type . (dot, current folder)

Current vs. Expected behavior

Current behavior

I get the following errors

Migrating from next lint to the ESLint CLI...
   Found legacy ESLint config: .eslintrc.cjs
   Running "npx @eslint/migrate-config /Users/xxx/Code/next-lint-to-eslint-cli-codemod-issue/.eslintrc.cjs" to convert legacy config...
/Users/xxx/.npm/_npx/6a090669e21b4303/node_modules/@next/codemod/transforms/next-lint-to-eslint-cli.js:855
                throw new Error(`Failed to run "${command}" to migrate the legacy ESLint config "${eslintConfigFilename}".\n` +
                      ^

Error: Failed to run "npx @eslint/migrate-config /Users/xxx/Code/next-lint-to-eslint-cli-codemod-issue/.eslintrc.cjs" to migrate the legacy ESLint config ".eslintrc.cjs".
Please try the migration to Flat config manually.
Learn more: https://eslint.org/docs/latest/use/configure/migration-guide
    at Object.transformer [as default] (/Users/xxx/.npm/_npx/6a090669e21b4303/node_modules/@next/codemod/transforms/next-lint-to-eslint-cli.js:855:23)
    at Command.runTransform (/Users/xxx/.npm/_npx/6a090669e21b4303/node_modules/@next/codemod/bin/transform.js:83:48)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  [cause]: Error: Failed to find the expected output file "/Users/xxx/Code/next-lint-to-eslint-cli-codemod-issue/eslint.config.mjs" generated by the migration tool.
      at Object.transformer [as default] (/Users/xxx/.npm/_npx/6a090669e21b4303/node_modules/@next/codemod/transforms/next-lint-to-eslint-cli.js:847:27)
      at Command.runTransform (/Users/xxx/.npm/_npx/6a090669e21b4303/node_modules/@next/codemod/bin/transform.js:83:48)
      at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
}

Node.js v22.17.0

Expected behavior

I shouldn’t receive this error

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6041
  Available memory (MB): 49152
  Available CPU cores: 12
Binaries:
  Node: 22.17.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 9.11.0
Relevant Packages:
  next: 16.0.1 // Latest available version is detected (16.0.1).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Instrumentation, Linting, Not sure

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

Show generated config
const {
  defineConfig,
  globalIgnores,
} = require("eslint/config");

const {
  fixupConfigRules,
  fixupPluginRules,
} = require("@eslint/compat");

const tsParser = require("@typescript-eslint/parser");
const typescriptEslint = require("@typescript-eslint/eslint-plugin");
const svgJsx = require("eslint-plugin-svg-jsx");
const js = require("@eslint/js");

const {
  FlatCompat,
} = require("@eslint/eslintrc");

const compat = new FlatCompat({
  baseDirectory: __dirname,
  recommendedConfig: js.configs.recommended,
  allConfig: js.configs.all
});

module.exports = defineConfig([{
  extends: fixupConfigRules(compat.extends(
      "plugin:import/recommended",
      "plugin:import/react",
      "plugin:import/typescript",
      "next/core-web-vitals",
      "plugin:@typescript-eslint/recommended",
  )),

  languageOptions: {
      parser: tsParser,
  },

  plugins: {
      "@typescript-eslint": fixupPluginRules(typescriptEslint),
      "svg-jsx": svgJsx,
  },

  "rules": {
      "svg-jsx/camel-case-dash": "error",
      "svg-jsx/camel-case-colon": "error",
      "svg-jsx/no-style-string": "error",
      "no-unused-vars": "off",
      "@typescript-eslint/no-unused-vars": ["warn"],
      "@typescript-eslint/no-explicit-any": ["warn"],
      "@typescript-eslint/ban-ts-comment": ["warn"],
      "@typescript-eslint/no-empty-object-type": ["warn"],
      "@typescript-eslint/no-require-imports": ["warn"],
      "prefer-const": ["warn"],
      "prefer-spread": ["warn"],

      "no-restricted-syntax": ["error", {
          selector: "JSXOpeningElement[name.name='feGaussianBlur']",
          message: "<feGaussianBlur> has spotty Safari support",
      }],

      "no-restricted-imports": ["error", {
          paths: [{
              name: "next-intl/server",
              importNames: ["getTranslations"],
              message: "Do not import messages API from next-intl directly, use wrapper instead",
          }, {
              name: "next-intl",
              importNames: ["useTranslations"],
              message: "Do not import messages API from next-intl directly, use wrapper instead",
          }],
      }],

      "import/no-duplicates": ["error"],

      "import/no-unused-modules": ["warn", {
          "unusedExports": true,
          missingExports: true,
          ignoreExports: [],
      }],

      "import/no-unresolved": ["error", {
          "ignore": ["\\.png", "\\.svg", "\\.jpg", "\\.jpeg", "server-only"],
      }],
  },
}, globalIgnores([])]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    InstrumentationRelated to Next.js Instrumentation.LintingRelated to `next lint` or ESLint with Next.js.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions