@jvdx/eslint-config
Version:
jvdx's eslint configuration
79 lines (57 loc) • 2.17 kB
Markdown
# @jvdx/eslint-config
> Notice: The old configuration can be found in the `v3` branch.
jvdx's ESLint configuration, with sensible defaults for ES6, React and
TypeScript projects.<br>
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` or `typescript`
rulesets
- `typescript` - TypeScript rules targeting `**/*.{ts,tsx,mts,cts}`
> See the [Configurations](#configurations) section for more details.
## Installation
Install configuration as well as peer dependencies:
```bash
$ npm install --save-dev @jvdx/eslint-config eslint
```
## Usage
Use in your `eslint.config.js` file anytime you want to extend one of
the configs:
```js
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,
];
```
## Configurations
### Recommended
- Extends `eslint:recommended` and `eslint-config-prettier`
- Targets `**/*.{js,jsx,mjs,cjs}` files
- Uses the default parser
- Uses no plugins
### React
- Extends `eslint-plugin-react:recommended`, `eslint-plugin-react:jsx-runtime`
`eslint-plugin-react-hooks:recommended` and `eslint-plugin-jsx-a11y:recommended`
- Targets `**/*.{js,jsx,ts,tsx}` files
- Uses the default parser
- Uses `react`, `react-hooks` and `jsx-a11y` plugins
### TypeScript
- Extends `@typescript-eslint/recommended`, `eslint:recommended` and
`eslint-config-prettier`
- Targets `**/*.{ts,tsx,mts,cts}` files
- Uses the `@typescript-eslint/parser` parser
- Uses `@typescript-eslint/eslint-plugin` plugin