Skip to content

Migrate to ESLint v9#28

Open
AlbertSmit wants to merge 2 commits into
mainfrom
migrate-to-eslint-v9
Open

Migrate to ESLint v9#28
AlbertSmit wants to merge 2 commits into
mainfrom
migrate-to-eslint-v9

Conversation

@AlbertSmit
Copy link
Copy Markdown
Contributor

@AlbertSmit AlbertSmit commented Apr 24, 2026

Migrate @kaliber/eslint-plugin to ESLint v9 (Flat Config)

Why v9 and not v10?

ESLint v10 (released Feb 2026) completely removes the legacy eslintrc configuration system — flat config is the only option. While that's ultimately where we want to be, jumping straight to v10 carries too much risk for our consuming projects:

  • v10 requires Node.js ≥20.19 — not all of our project CI environments are there yet.
  • v10 removes all backwards compatibility for the eslintrc format, meaning consumer projects that still use .eslintrc (all of them, currently) would break immediately upon upgrading.
  • v9 supports both systems simultaneously — it defaults to flat config but still allows eslintrc via the ESLINT_USE_FLAT_CONFIG=false flag. This gives us a transition period where the plugin is fully flat-config-ready, while consumer projects can migrate at their own pace.

In short: v9 is the bridge release. We modernize the plugin now, and consumers can adopt flat config on their own timeline — after which upgrading to v10 becomes trivial.


What changed

Configuration format: .eslintrceslint.config.js

The old JSON-based .eslintrc has been deleted and replaced with eslint.config.js — an array of config objects (flat config). This is the config that consumer projects import:

const kaliberConfig = require('@kaliber/eslint-plugin/eslint.config')

module.exports = [
  ...kaliberConfig,
  // project-specific overrides
]

Plugin structure: meta object

The plugin entry point (index.js) now exports a proper meta object with name and version, as required by ESLint v9's plugin API.

Deprecated stylistic rules → @stylistic/eslint-plugin

ESLint v9 deprecated all built-in formatting/stylistic rules (indent, quotes, semi, brace-style, etc.). These have been migrated to @stylistic/eslint-plugin, the official community-maintained successor:

Before (core) After (@stylistic/)
semi @stylistic/semi
quotes @stylistic/quotes
indent @stylistic/indent
no-mixed-operators @stylistic/no-mixed-operators
… and 20+ more

All rule options and behavior are preserved — only the namespace changed.

Deprecated/renamed core rules

Several core rules were renamed or replaced in v9:

Old rule New rule
no-new-object no-object-constructor
no-new-symbol no-new-native-nonconstructor
no-native-reassign no-global-assign (already existed)
no-negated-in-lhs no-unsafe-negation (already existed)
no-return-await removed (covered by @typescript-eslint)
jsx-a11y/accessible-emoji removed (deprecated upstream)
jsx-a11y/scope removed (deprecated upstream)

Plugin swap: eslint-plugin-importeslint-plugin-import-x

The original eslint-plugin-import does not support flat config. We've switched to eslint-plugin-import-x, a maintained fork with full ESLint v9 compatibility. Rule names use the import-x/ prefix.

API changes in custom rules

ESLint v9 deprecated several context methods used in our custom rules:

Deprecated Replacement
context.getFilename() context.filename
context.getScope() sourceCode.getScope(node)

These changes affect machinery/ast.js and machinery/filename.js.

RuleTester configuration

All test files have been updated to use the new languageOptions format:

// Before
new RuleTester({ parserOptions: { ecmaVersion: 6, sourceType: 'module' } })

// After
new RuleTester({ languageOptions: { ecmaVersion: 2020, sourceType: 'module' } })

Self-linting

Added eslint.self.config.js — a minimal config for linting the plugin's own source code, along with lint and lint:fix npm scripts. Cleaned up all semicolons and trailing whitespace across the codebase.

Globals

The env property (browser, node, jest, etc.) has been replaced with explicit globals from the globals package under languageOptions.globals.


New dependencies

Package Why
@eslint/js Provides js.configs.recommended for flat config
@stylistic/eslint-plugin Replaces deprecated core stylistic rules
eslint-plugin-import-x Flat-config-compatible fork of eslint-plugin-import
globals Explicit global definitions (replaces env)

Test status

  • 183 test files, 175 passing, 0 failing
  • 7 skipped — rules that were removed/renamed upstream and need investigation:
    • no-extra-label, no-iterator, no-new-object, no-new-symbol, no-proto (renamed/removed core rules)
    • import/export (import-x compatibility)
    • react/jsx-pascal-case (test fixture issue)
  • 1 todo — pending further review

Breaking changes for consumers

Important
This is a major version bump (v1.xv2.0.0-beta.1).

  • Projects must switch from .eslintrc extending ./node_modules/@kaliber/eslint-plugin/.eslintrc to an eslint.config.js importing the flat config array.
  • ESLint v9+ is now required as a peer dependency.
  • Node.js ≥18.18.0 is required.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

Important

Review skipped

Too many files!

This PR contains 203 files, which is 53 over the limit of 150.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 642a0743-aa54-4957-983b-6de57f446e4a

📥 Commits

Reviewing files that changed from the base of the PR and between fc8f004 and 473ee56.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (203)
  • .eslintrc
  • README.md
  • eslint.config.js
  • eslint.self.config.js
  • index.js
  • lib/data-x-config.js
  • machinery/ast.js
  • machinery/filename.js
  • machinery/test.js
  • package.json
  • rules/component-properties/index.js
  • rules/core/accessor-pairs.test.js
  • rules/core/array-callback-return.test.js
  • rules/core/arrow-spacing.test.js
  • rules/core/block-spacing.test.js
  • rules/core/brace-style.test.js
  • rules/core/comma-dangle.test.js
  • rules/core/comma-spacing.test.js
  • rules/core/comma-style.test.js
  • rules/core/default-case.test.js
  • rules/core/dot-location.test.js
  • rules/core/eol-last.test.js
  • rules/core/eqeqeq.test.js
  • rules/core/indent.test.js
  • rules/core/key-spacing.test.js
  • rules/core/keyword-spacing.test.js
  • rules/core/new-parens.test.js
  • rules/core/no-array-constructor.test.js
  • rules/core/no-caller.test.js
  • rules/core/no-class-assign.test.js
  • rules/core/no-compare-neg-zero.test.js
  • rules/core/no-cond-assign.test.js
  • rules/core/no-const-assign.test.js
  • rules/core/no-constant-condition.test.js
  • rules/core/no-control-regex.test.js
  • rules/core/no-debugger.test.js
  • rules/core/no-delete-var.test.js
  • rules/core/no-dupe-args.test.js
  • rules/core/no-dupe-class-members.test.js
  • rules/core/no-dupe-keys.test.js
  • rules/core/no-duplicate-case.test.js
  • rules/core/no-empty-character-class.test.js
  • rules/core/no-empty-pattern.test.js
  • rules/core/no-eval.test.js
  • rules/core/no-ex-assign.test.js
  • rules/core/no-extend-native.test.js
  • rules/core/no-extra-bind.test.js
  • rules/core/no-extra-boolean-cast.test.js
  • rules/core/no-extra-parens.test.js
  • rules/core/no-fallthrough/test.js
  • rules/core/no-floating-decimal/test.js
  • rules/core/no-func-assign/test.js
  • rules/core/no-global-assign/test.js
  • rules/core/no-implied-eval/test.js
  • rules/core/no-invalid-regexp/index.js
  • rules/core/no-invalid-regexp/test.js
  • rules/core/no-irregular-whitespace.test.js
  • rules/core/no-label-var/index.js
  • rules/core/no-label-var/test.js
  • rules/core/no-labels/index.js
  • rules/core/no-labels/test.js
  • rules/core/no-lone-blocks/index.js
  • rules/core/no-lone-blocks/test.js
  • rules/core/no-loop-func/index.js
  • rules/core/no-loop-func/test.js
  • rules/core/no-mixed-operators.test.js
  • rules/core/no-mixed-spaces-and-tabs/index.js
  • rules/core/no-mixed-spaces-and-tabs/test.js
  • rules/core/no-multi-str/test.js
  • rules/core/no-native-reassign/test.js
  • rules/core/no-new-func/test.js
  • rules/core/no-new-wrappers/test.js
  • rules/core/no-obj-calls/test.js
  • rules/core/no-octal-escape/test.js
  • rules/core/no-octal/test.js
  • rules/core/no-path-concat/index.js
  • rules/core/no-path-concat/test.js
  • rules/core/no-redeclare/test.js
  • rules/core/no-regex-spaces/test.js
  • rules/core/no-restricted-globals/test.js
  • rules/core/no-restricted-properties/test.js
  • rules/core/no-restricted-syntax/test.js
  • rules/core/no-return-assign/index.js
  • rules/core/no-return-assign/test.js
  • rules/core/no-return-await/index.js
  • rules/core/no-return-await/test.js
  • rules/core/no-script-url/test.js
  • rules/core/no-self-assign/test.js
  • rules/core/no-self-compare/test.js
  • rules/core/no-shadow-restricted-names/test.js
  • rules/core/no-sparse-arrays/test.js
  • rules/core/no-template-curly-in-string/test.js
  • rules/core/no-this-before-super/test.js
  • rules/core/no-throw-literal/test.js
  • rules/core/no-trailing-spaces/index.js
  • rules/core/no-trailing-spaces/test.js
  • rules/core/no-undef/test.js
  • rules/core/no-unexpected-multiline/test.js
  • rules/core/no-unneeded-ternary.test.js
  • rules/core/no-unreachable/test.js
  • rules/core/no-unsafe-negation/index.js
  • rules/core/no-unsafe-negation/test.js
  • rules/core/no-unused-expressions/test.js
  • rules/core/no-unused-labels/test.js
  • rules/core/no-unused-vars/test.js
  • rules/core/no-use-before-define/test.js
  • rules/core/no-useless-computed-key/test.js
  • rules/core/no-useless-concat/test.js
  • rules/core/no-useless-constructor/test.js
  • rules/core/no-useless-escape/test.js
  • rules/core/no-useless-return.test.js
  • rules/core/no-whitespace-before-property/test.js
  • rules/core/no-with/test.js
  • rules/core/object-curly-spacing/index.js
  • rules/core/object-curly-spacing/test.js
  • rules/core/object-shorthand/index.js
  • rules/core/object-shorthand/test.js
  • rules/core/quotes.test.js
  • rules/core/radix/test.js
  • rules/core/require-yield/test.js
  • rules/core/rest-spread-spacing/test.js
  • rules/core/semi-spacing/index.js
  • rules/core/semi-spacing/test.js
  • rules/core/semi/index.js
  • rules/core/semi/test.js
  • rules/core/space-before-blocks/index.js
  • rules/core/space-before-blocks/test.js
  • rules/core/space-before-function-paren/index.js
  • rules/core/space-before-function-paren/test.js
  • rules/core/space-infix-ops/index.js
  • rules/core/space-infix-ops/test.js
  • rules/core/space-unary-ops/test.js
  • rules/core/strict/test.js
  • rules/core/template-tag-spacing/test.js
  • rules/core/use-isnan.test.js
  • rules/core/valid-typeof.test.js
  • rules/data-x-clickout-prefix/index.js
  • rules/data-x-cta-prefix/index.js
  • rules/data-x-form-naming/index.js
  • rules/data-x-latin-only/index.js
  • rules/data-x-onpage-action-format/index.js
  • rules/data-x-onpage-action-format/test.js
  • rules/data-x-required/index.js
  • rules/data-x-sectioning-elements/index.js
  • rules/data-x-toggle-prefix/index.js
  • rules/data-x-unique-id/index.js
  • rules/import-sort/index.js
  • rules/layout-class-name/index.js
  • rules/naming-policy/index.js
  • rules/naming-policy/policy-component-name.js
  • rules/naming-policy/policy-ref-name.js
  • rules/no-default-export/index.js
  • rules/no-default-export/test.js
  • rules/position-center/test.js
  • rules/third-party/import-default.test.js
  • rules/third-party/import-first.test.js
  • rules/third-party/import-named.test.js
  • rules/third-party/import-no-amd.test.js
  • rules/third-party/import-no-duplicates.test.js
  • rules/third-party/import-no-unresolved.test.js
  • rules/third-party/import-no-webpack-loader-syntax.test.js
  • rules/third-party/jsx-a11y-accessible-emoji.test.js
  • rules/third-party/jsx-a11y-alt-text.test.js
  • rules/third-party/jsx-a11y-anchor-has-content.test.js
  • rules/third-party/jsx-a11y-anchor-is-valid.test.js
  • rules/third-party/jsx-a11y-aria-activedescendant-has-tabindex.test.js
  • rules/third-party/jsx-a11y-aria-props.test.js
  • rules/third-party/jsx-a11y-aria-proptypes.test.js
  • rules/third-party/jsx-a11y-aria-role.test.js
  • rules/third-party/jsx-a11y-aria-unsupported-elements.test.js
  • rules/third-party/jsx-a11y-heading-has-content.test.js
  • rules/third-party/jsx-a11y-html-has-lang.test.js
  • rules/third-party/jsx-a11y-iframe-has-title.test.js
  • rules/third-party/jsx-a11y-img-redundant-alt.test.js
  • rules/third-party/jsx-a11y-no-access-key.test.js
  • rules/third-party/jsx-a11y-no-distracting-elements.test.js
  • rules/third-party/jsx-a11y-no-redundant-roles.test.js
  • rules/third-party/jsx-a11y-role-has-required-aria-props.test.js
  • rules/third-party/jsx-a11y-role-supports-aria-props.test.js
  • rules/third-party/jsx-a11y-scope.test.js
  • rules/third-party/react-hooks/exhaustive-deps.test.js
  • rules/third-party/react-hooks/rules-of-hooks.test.js
  • rules/third-party/react/jsx-boolean-value.test.js
  • rules/third-party/react/jsx-curly-spacing.test.js
  • rules/third-party/react/jsx-equals-spacing.test.js
  • rules/third-party/react/jsx-indent-props.test.js
  • rules/third-party/react/jsx-indent.test.js
  • rules/third-party/react/jsx-no-comment-textnodes.test.js
  • rules/third-party/react/jsx-no-duplicate-props.test.js
  • rules/third-party/react/jsx-no-target-blank.test.js
  • rules/third-party/react/jsx-no-undef.test.js
  • rules/third-party/react/jsx-tag-spacing.test.js
  • rules/third-party/react/jsx-uses-vars.test.js
  • rules/third-party/react/jsx-wrap-multilines.test.js
  • rules/third-party/react/no-danger-with-children.test.js
  • rules/third-party/react/no-deprecated.test.js
  • rules/third-party/react/no-direct-mutation-state.test.js
  • rules/third-party/react/no-unused-prop-types.test.js
  • rules/third-party/react/prop-types.test.js
  • rules/third-party/react/require-render-return.test.js
  • rules/third-party/react/self-closing-comp.test.js
  • rules/third-party/react/void-dom-elements-no-children.test.js
  • rules/todo-ticket-reference/index.js

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch migrate-to-eslint-v9

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@socket-security
Copy link
Copy Markdown

socket-security Bot commented Apr 24, 2026

@AlbertSmit AlbertSmit self-assigned this Apr 24, 2026
@AlbertSmit AlbertSmit changed the title Migrate ESLint configuration to flat format and update tests Migrate to ESLint v9 Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant