Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce flat config #361

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

feat: introduce flat config #361

wants to merge 1 commit into from

Conversation

sbellone
Copy link
Contributor

@sbellone sbellone commented Oct 2, 2024

Introduce flat configs (blog, doc), required to migrate to ESLint 9 (#342).
Migration guide: https://eslint.org/docs/latest/use/configure/migration-guide

To keep our config compatible with legacy versions, I've created new configs in a separate flat/ directory.
You can see the new usage in the updated README or in the packages/test/eslint.config.js files:

// eslint.config.js
const algolia = require('eslint-config-algolia/flat/base');
module.exports = [
  ...algolia,
];

Notes

I've tried to keep changes minimal, configs in the flat/ dir are meant to be a simple port.
A lot of plugins already expose ways to work with flat configs, I simply followed their doc, for example:

Only the import plugin is not fully compatible and I had to disable import/no-named-as-default for now.

I've been able to reuse the rules in rules/ by just deleting the deprecated properties:

  • plugins now moved at the top level
  • overrides is moved as an entry of the flat config

Changes

  • new flat configs in the flat/ dir
  • new eslint.config.js files
  • tests are run with both legacy and flat configs
  • new dependencies required: @eslint/js and global

Refs


SFCC-391

@sbellone sbellone self-assigned this Oct 2, 2024
@sbellone sbellone requested a review from millotp October 3, 2024 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant