Migrate ESLint from eslintrc to flat config

Proprietary

Replaces each eslintrc configuration (.eslintrc.* or the eslintConfig of package.json) with an equivalent eslint.config flat configuration, folding nested eslintrc files into it as files-scoped blocks, .eslintignore into its global ignores and the /* eslint-env */ comments flat config ignores into files-scoped globals. Shareable configs are loaded through FlatCompat, and the package.json scripts that run ESLint drop the options flat config no longer accepts. An ESLint 8 older than 8.57, the first to read every flat config file name, is upgraded to 8.57. A project on ESLint 7 or older, unless upgradeOlderEslint is set, or one linted through a tool that only reads eslintrc (Create React App, @hapi/lab, Vue CLI), is left as it is and marked. So are the .mjs and .cjs files a lint script now reaches, which flat config lints by default and eslintrc skipped.

org.openrewrite.javascript.eslint.MigrateToFlatConfig

Optional

Also migrate a project on ESLint 7 or older, declaring ESLint 8.57 in its place. That is a major upgrade, for which the project's plugins may need upgrading too. Default is false, which leaves such a project as it is and marks it.

mod run . --recipe=org.openrewrite.javascript.eslint.MigrateToFlatConfig

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.