1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56# Directus ESLint Config
Opinionated ESLint config used by the projects in the Directus ecosystem.
- Lint and format JS/TS, Vue, JSON, YAML and TOML files (via ESLint)
- Format HTML, CSS/SCSS, MD and GQL files (via [dprint](https://github.com/dprint/dprint))
- Contains recommended and hand-picked rules
- [eslint-plugin-import-x](https://github.com/un-ts/eslint-plugin-import-x) - Linting of import/export syntax
- [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) - Rules for Node.js
- [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest) - Linting tests
- [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) - Best practice rules for JS/TS
- [eslint-stylistic](https://github.com/eslint-stylistic/eslint-stylistic) - Formatting rules
- and more...
- Includes [eslint-plugin-command](https://github.com/antfu/eslint-plugin-command) for one-off codemod
## Installation
```shell
pnpm add -D eslint @directus/eslint-config
```
## Usage
Create an [ESLint config file](https://eslint.org/docs/latest/use/configure/configuration-files) with the following
content:
_Minimal_
```js
export { default } from '@directus/eslint-config';
```
_When using additional config_
```js
import directusConfig from '@directus/eslint-config';
export default [
...directusConfig,
// Additional config
];
```
## Credits
This config is heavily inspired by and partially based on Anthony's ESLint config preset โค๏ธ\
If you're looking for an ESLint config preset outside of the Directus ecosystem, check it out at
https://github.com/antfu/eslint-config.
Credits also go to all maintainers of the ESLint plugins this config is using.
## Additional Resources
- [Directus Website](https://directus.io)
- [Directus GitHub Repository](https://github.com/directus/directus)