Install below packages:
yarn add -D @dwzq/eslint-config \
@eslint/js \
eslint \
eslint-plugin-eslint-comments \
@stylistic/eslint-plugin-js
Install below package if needed:
yarn add -D @stylistic/eslint-plugin-jsx \
@stylistic/eslint-plugin-plus \
@stylistic/eslint-plugin-ts \
eslint-plugin-n \
eslint-plugin-react \
eslint-plugin-react-hooks \
eslint-plugin-solid \
eslint-plugin-vue \
typescript \
typescript-eslint
This project now uses only "flat config". An "eslint.config.js" file in the project root directory is required.
Note: According to different "type"
setting in package.json
,
the different file format (CommonJS / Module) will be required.
// Example eslint.config.js
import {generateConfig} from '@dwzq/eslint-config'
export default await generateConfig({
type: 'node',
ts : {
rootDir: import.meta.dirname,
},
})
Check type declaration in source code for options.
- ESLint Rules
- ESLint Configuring
- ESLint Stylistic
- ESLint TS Plugin
- ESLint React Plugin
- ESLint node Plugin
- Enable
@stylistic/jsx-self-closing-comp
- Use
@eslint/compat
for Compatibility of React Plugin & ESLint v9
- Upgrade
@stylistic
to v2.1
- Rollback ESLint to v8(due to react plugin is incompatible to v9)
- Separate
@stylistic
rules
- Use
@stylistic/eslint-plugin
i.o. 4 separated plugins
- Upgrade ESLint to v9
- Upgrade to flat config
- Remove Jest env (use import instead of global);
- Fix wrong scope;
- Simplify code structure;
- update rules;
- remove dependencies check totally;
- allow
!!
forno-implicit-coercion
rule; - disable
newline-per-chained-call
rule;
- disable eslint-dependencies for node proj;
- un-ban
{}
for TS 4.8;
- disable
default-case
, enable@typescript-eslint/switch-exhaustiveness-check
;
- Set peerDependencies optional;
- Upgrade rules;
- Totally refactored in order to simplify usage;
- Disable
"prefer-object-has-own"
for TS due to TS hasn't support it yet;
- Upgrade rules;
- Revert changes about "tsconfig.json" in v0.13 since performance of ESLint has been improved;
- Move parserOption.project from rule presets to full presets;
- Upgrade rules (mainly ESLint v8);
- Migrate to Yarn Berry;
- Consider peer & opt. dependencies when linting implicit dependencies.
- Upgrade rules;
- Apply
"implicit-dependencies"
to only"src"
dir;
- Disable
"@typescript-eslint/space-infix-ops"
until provides more detailed config;
- Relax
"@typescript-eslint/consistent-type-assertions"
for better "Opaque Type" expr;
- Fix missing scope of React rules;
- Include
"eslint-plugin-implicit-dependencies"
;
- Disable
"checksVoidReturn"
of"@typescript-eslint/no-misused-promises"
;
- Regular update;
- Upgrade "ESLint" to 7.15;
- Upgrade "typescript-eslint" to 4.10;
- Upgrade TS, etc.;
- Fix deprecated "avoid-escape" option in "quotes" rules;
- Upgrade TS plugin to v4.8.0;
- Turn off rules obsoleted in React 17;
- Upgrade TS plugin to v4.7.0;
- Allow constant condition in loop;
- Update rules (mainly eslint-typescript);
- Add
impliedStrict: true
to base preset.
- Use ESLint's "extends" instead of merge config obj programmatically, to solve some preset overriding bugs;
- Disable
"@typescript-eslint/consistent-type-definitions"
because interfaces & type-aliases are just different stuff. - No longer force "ecmaVersion: 2020" for TS files since plugin team has fixed this.
- Use single additional
"tsconfig.eslint.json"
instead of"**/tsconfig.json"
to resolve performance issue. - Disable
"@typescript-eslint/no-invalid-void-type"
for"typesafe-actions"
. -
"typeParameter"
allows both"UPPER_CASE"
and"PascalCase"
. - Move required
"env"
,"parserOptions"
, etc. into presets. - For TS presets, set
"ecmaVersion"
to 2020, see: typescript-eslint/typescript-eslint #2468. - Enable
"no-magic-number"
. - Upgrade
"typescript-eslint"
to v4.1.0. - Upgrade ESLint to v7.9.0.
- Separate TS rules require type info out.
- Fix wrong
parserOptions.project
setting.
- Fix wrong
parserOptions.project
setting.
- 1st ver;