Skip to content

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:

Edit: FIXED in 2.31.0 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 from the rules/ dir by just deleting the deprecated properties:

  • plugins is now moved at the top level
  • overrides is now an additional 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
Copy link
Contributor

@millotp millotp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good ! tested on a private repo and it behave nicely, gg !

@sbellone
Copy link
Contributor Author

Thanks for the extensive testing that permitted to highlight a couple of misses! 🙏

@sbellone sbellone merged commit 31c4572 into master Oct 10, 2024
@sbellone sbellone deleted the feat/flat-config branch October 10, 2024 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants