Notice: The old configuration can be found in the
v3
branch.
jvdx's ESLint configuration, with sensible defaults for ES6, React and
TypeScript projects.
This configuration is specifically for the new
eslint.config.js
flat file configuration format.
It exports a configs
objects with the following rulesets:
-
recommended
- Recommended rules targeting**/*.{js,jsx,mjs,cjs}
files -
react
- React rules targeting**/*.{js,jsx,ts,tsx}
files- These rules should be used in conjunction with the
base
ortypescript
rulesets
- These rules should be used in conjunction with the
-
typescript
- TypeScript rules targeting**/*.{ts,tsx,mts,cts}
See the Configurations section for more details.
Install configuration as well as peer dependencies:
$ npm install --save-dev @jvdx/eslint-config eslint
Use in your eslint.config.js
file anytime you want to extend one of
the configs:
import jvdxConfig from '@jvdx/eslint-config';
export default [
// Apply recommended rules
jvdxConfig.configs.recommended,
// Apply recommended rules and overwrite some configuration properties
{
...jvdxConfig.configs.recommended
files: ['**/*.js'],
},
// Apply recommended + react rules in conjunction
...jvdxConfig.configs.recommended,
...jvdxConfig.configs.react,
// Apply typescript + react rules in conjunction
...jvdxConfig.configs.typescript,
...jvdxConfig.configs.react,
];
- Extends
eslint:recommended
andeslint-config-prettier
- Targets
**/*.{js,jsx,mjs,cjs}
files - Uses the default parser
- Uses no plugins
- Extends
eslint-plugin-react:recommended
,eslint-plugin-react:jsx-runtime
eslint-plugin-react-hooks:recommended
andeslint-plugin-jsx-a11y:recommended
- Targets
**/*.{js,jsx,ts,tsx}
files - Uses the default parser
- Uses
react
,react-hooks
andjsx-a11y
plugins
- Extends
@typescript-eslint/recommended
,eslint:recommended
andeslint-config-prettier
- Targets
**/*.{ts,tsx,mts,cts}
files - Uses the
@typescript-eslint/parser
parser - Uses
@typescript-eslint/eslint-plugin
plugin