In this major release we have upgraded all dependencies and modernized the presets
Modern by default
The modern
and modules
presets have been deleted and their rules have been merged into base
, since the JS landscape has changed a lot since we started this repo.
BREAKING CHANGE: base
assumes ESM, modern syntax, and modern runtime features.
Simplified React
The jsx
preset has been merged into react
. Initially, the idea behind this was to support other frameworks that use JSX. This was naive as most of the rules in jsx
where react-flavor specific.
Now there are 3 presets:
react
: works with React Native projects, has rules of hooksreact-stylish
: cosmetic rules, (mostly) auto-fixablereact-web
: it includes accessibility rules on top ofreact
The distinction is clearer, and the path is still open to add a new react-native
preset.
Another important change we made is to assume JSX runtime by default; it has been stable for a while now and we don't expect any new projects to boot without it.
See: https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
BREAKING CHANGE: presets have been renamed/removed, you will need to update your ESLint config.
Prettier, ESM, and modern trailing commas
The prettier
config package has been updated to support both, ESM and CommonJS.
Trailing comma has been updated to always
from es5
, as we are targeting modern JS environments now.
You will notice your editor/scripts will add new commas, e.g.:
static isKnownError(
errors: Record<string, string>,
- code: PropertyKey
+ code: PropertyKey,
): code is keyof typeof errors {
return has(errors, code)
}
Leveraging the community
Previously, most of the rules in the presets were hand-picked.
Since a while ago ESLint plugin authors started to offer a selection of their own presets alongside their plugins.
With these changes, we are picking up the community's suggestions by extending their presets. We will inherit the knowledge of the community and specially plugin authors that know the ins and outs of the rules they created and will continue to do so as we update our dependencies.
Most of the rules in the plugin's presets were already turned on by us in our preset, in this commit we extend the presets and also remove the redundant rules.
BREAKING CHANGE: a few new rules have been enabled that weren't before, so you will probably need to fix them after upgrading.