@abinnovision/eslint-config-base 3.2.0-beta.7 → 3.2.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,22 +8,42 @@ ESLint configuration for JavaScript and TypeScript projects.
|
|
|
8
8
|
yarn add --dev @abinnovision/eslint-config-base eslint
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## ESLint Config Format
|
|
12
|
+
|
|
13
|
+
This package requires
|
|
14
|
+
ESLint's [flat config](https://eslint.org/docs/latest/use/configure/configuration-files)
|
|
15
|
+
format (not legacy `.eslintrc`).
|
|
16
|
+
|
|
17
|
+
| Config file | Requirements |
|
|
18
|
+
| ------------------ | --------------------------------------------------------------------- |
|
|
19
|
+
| `eslint.config.ts` | ESLint **9.18+** and [`jiti`](https://github.com/unjs/jiti) **v2.0+** |
|
|
20
|
+
| `eslint.config.js` | ESLint **9.0+** |
|
|
21
|
+
|
|
22
|
+
TypeScript config files are preferred. Install `jiti` as a dev dependency:
|
|
23
|
+
|
|
24
|
+
```shell
|
|
25
|
+
yarn add --dev jiti
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
If ESLint 9.18+ or `jiti` cannot be provided, use `eslint.config.js` (or
|
|
29
|
+
`.mjs`) instead. The imports and configuration are identical.
|
|
30
|
+
|
|
11
31
|
## Usage
|
|
12
32
|
|
|
13
|
-
```
|
|
14
|
-
// eslint.config.js
|
|
33
|
+
```typescript
|
|
15
34
|
import { base } from "@abinnovision/eslint-config-base";
|
|
35
|
+
import { defineConfig } from "eslint/config";
|
|
16
36
|
|
|
17
|
-
export default [{ extends: [base] }];
|
|
37
|
+
export default defineConfig([{ extends: [base] }]);
|
|
18
38
|
```
|
|
19
39
|
|
|
20
40
|
If your `tsconfig.json` is not in the project root:
|
|
21
41
|
|
|
22
|
-
```
|
|
23
|
-
// eslint.config.js
|
|
42
|
+
```typescript
|
|
24
43
|
import { base } from "@abinnovision/eslint-config-base";
|
|
44
|
+
import { defineConfig } from "eslint/config";
|
|
25
45
|
|
|
26
|
-
export default [
|
|
46
|
+
export default defineConfig([
|
|
27
47
|
{
|
|
28
48
|
extends: [base],
|
|
29
49
|
languageOptions: {
|
|
@@ -32,51 +52,59 @@ export default [
|
|
|
32
52
|
},
|
|
33
53
|
},
|
|
34
54
|
},
|
|
35
|
-
];
|
|
55
|
+
]);
|
|
36
56
|
```
|
|
37
57
|
|
|
38
58
|
## Flavours
|
|
39
59
|
|
|
60
|
+
Flavours are optional rule sets that complement `base`. They must always be used
|
|
61
|
+
alongside it.
|
|
62
|
+
|
|
40
63
|
### NestJS
|
|
41
64
|
|
|
42
|
-
```
|
|
43
|
-
import { nestjs } from "@abinnovision/eslint-config-base";
|
|
65
|
+
```typescript
|
|
66
|
+
import { base, nestjs } from "@abinnovision/eslint-config-base";
|
|
67
|
+
import { defineConfig } from "eslint/config";
|
|
44
68
|
|
|
45
|
-
export default [{ extends: [nestjs] }];
|
|
69
|
+
export default defineConfig([{ extends: [base, nestjs] }]);
|
|
46
70
|
```
|
|
47
71
|
|
|
48
72
|
### Vitest
|
|
49
73
|
|
|
50
|
-
```
|
|
74
|
+
```typescript
|
|
51
75
|
import { base, vitest } from "@abinnovision/eslint-config-base";
|
|
76
|
+
import { defineConfig } from "eslint/config";
|
|
52
77
|
|
|
53
|
-
export default [{ extends: [base, vitest] }];
|
|
78
|
+
export default defineConfig([{ extends: [base, vitest] }]);
|
|
54
79
|
```
|
|
55
80
|
|
|
56
81
|
### Stylistic
|
|
57
82
|
|
|
58
83
|
Enforces consistent code style (formatting, spacing, naming conventions).
|
|
59
84
|
|
|
60
|
-
```
|
|
85
|
+
```typescript
|
|
61
86
|
import { base, stylistic } from "@abinnovision/eslint-config-base";
|
|
87
|
+
import { defineConfig } from "eslint/config";
|
|
62
88
|
|
|
63
|
-
export default [{ extends: [base, stylistic] }];
|
|
89
|
+
export default defineConfig([{ extends: [base, stylistic] }]);
|
|
64
90
|
```
|
|
65
91
|
|
|
66
92
|
### Config Files
|
|
67
93
|
|
|
68
|
-
|
|
94
|
+
Relaxes rules for build tool and project configuration files (e.g.
|
|
95
|
+
`vite.config.ts`,
|
|
96
|
+
`webpack.config.js`): enables Node.js globals, allows `console` usage, and
|
|
97
|
+
removes
|
|
98
|
+
function length limits. You provide the file patterns:
|
|
69
99
|
|
|
70
|
-
```
|
|
100
|
+
```typescript
|
|
71
101
|
import { base, configFiles } from "@abinnovision/eslint-config-base";
|
|
102
|
+
import { defineConfig } from "eslint/config";
|
|
72
103
|
|
|
73
|
-
export default [
|
|
104
|
+
export default defineConfig([
|
|
74
105
|
{ extends: [base] },
|
|
75
|
-
{
|
|
76
|
-
|
|
77
|
-
extends: [configFiles],
|
|
78
|
-
},
|
|
79
|
-
];
|
|
106
|
+
{ files: ["**/*.config.{ts,js}"], extends: [configFiles] },
|
|
107
|
+
]);
|
|
80
108
|
```
|
|
81
109
|
|
|
82
110
|
## License
|