vercel / vercel/next.js

Broken next-lint-to-eslint-cli codemod

Open
#85,679 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Instrumentation Linting
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

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([])]);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction repository and run npx @next/codemod@canary next-lint-to-eslint-cli, selecting . when prompted. Read the next-lint-to-eslint-cli.js transform around the reported failure and compare its expected output with the generated eslint.config.cjs; done means the migration completes without the missing-output error.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript, nextjs
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.