@abinnovision/eslint-config-base 3.2.0-beta.6 → 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 +54 -49
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,49 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
ESLint configuration for JavaScript and TypeScript projects.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
```shell
|
|
8
|
+
yarn add --dev @abinnovision/eslint-config-base eslint
|
|
9
|
+
```
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
and working configuration out of the box.
|
|
11
|
+
## ESLint Config Format
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
This package requires
|
|
14
|
+
ESLint's [flat config](https://eslint.org/docs/latest/use/configure/configuration-files)
|
|
15
|
+
format (not legacy `.eslintrc`).
|
|
14
16
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
| `
|
|
19
|
-
| `eslint-plugin-import` | Import ordering, grouping, and validation |
|
|
20
|
-
| `eslint-plugin-unused-imports` | Detect and auto-fix unused imports and variables |
|
|
21
|
-
| `@vitest/eslint-plugin` | Vitest-specific rules for test files (vitest flavour) |
|
|
22
|
-
| `globals` | Environment globals (e.g. Node.js for config files) |
|
|
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+** |
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
TypeScript config files are preferred. Install `jiti` as a dev dependency:
|
|
25
23
|
|
|
26
24
|
```shell
|
|
27
|
-
yarn add --dev
|
|
25
|
+
yarn add --dev jiti
|
|
28
26
|
```
|
|
29
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
|
+
|
|
30
31
|
## Usage
|
|
31
32
|
|
|
32
|
-
```
|
|
33
|
-
// eslint.config.js
|
|
33
|
+
```typescript
|
|
34
34
|
import { base } from "@abinnovision/eslint-config-base";
|
|
35
|
+
import { defineConfig } from "eslint/config";
|
|
35
36
|
|
|
36
|
-
export default [{ extends: [base] }];
|
|
37
|
+
export default defineConfig([{ extends: [base] }]);
|
|
37
38
|
```
|
|
38
39
|
|
|
39
|
-
### TypeScript Configuration
|
|
40
|
-
|
|
41
40
|
If your `tsconfig.json` is not in the project root:
|
|
42
41
|
|
|
43
|
-
```
|
|
44
|
-
// eslint.config.js
|
|
42
|
+
```typescript
|
|
45
43
|
import { base } from "@abinnovision/eslint-config-base";
|
|
44
|
+
import { defineConfig } from "eslint/config";
|
|
46
45
|
|
|
47
|
-
export default [
|
|
46
|
+
export default defineConfig([
|
|
48
47
|
{
|
|
49
48
|
extends: [base],
|
|
50
49
|
languageOptions: {
|
|
@@ -53,55 +52,61 @@ export default [
|
|
|
53
52
|
},
|
|
54
53
|
},
|
|
55
54
|
},
|
|
56
|
-
];
|
|
55
|
+
]);
|
|
57
56
|
```
|
|
58
57
|
|
|
59
58
|
## Flavours
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
Flavours are optional rule sets that complement `base`. They must always be used
|
|
61
|
+
alongside it.
|
|
62
62
|
|
|
63
63
|
### NestJS
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
```typescript
|
|
66
|
+
import { base, nestjs } from "@abinnovision/eslint-config-base";
|
|
67
|
+
import { defineConfig } from "eslint/config";
|
|
66
68
|
|
|
67
|
-
|
|
68
|
-
import { nestjs } from "@abinnovision/eslint-config-base";
|
|
69
|
-
|
|
70
|
-
export default [{ extends: [nestjs] }];
|
|
69
|
+
export default defineConfig([{ extends: [base, nestjs] }]);
|
|
71
70
|
```
|
|
72
71
|
|
|
73
72
|
### Vitest
|
|
74
73
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
```javascript
|
|
74
|
+
```typescript
|
|
78
75
|
import { base, vitest } from "@abinnovision/eslint-config-base";
|
|
76
|
+
import { defineConfig } from "eslint/config";
|
|
79
77
|
|
|
80
|
-
export default [{ extends: [base
|
|
78
|
+
export default defineConfig([{ extends: [base, vitest] }]);
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Stylistic
|
|
82
|
+
|
|
83
|
+
Enforces consistent code style (formatting, spacing, naming conventions).
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { base, stylistic } from "@abinnovision/eslint-config-base";
|
|
87
|
+
import { defineConfig } from "eslint/config";
|
|
88
|
+
|
|
89
|
+
export default defineConfig([{ extends: [base, stylistic] }]);
|
|
81
90
|
```
|
|
82
91
|
|
|
83
92
|
### Config Files
|
|
84
93
|
|
|
85
|
-
|
|
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:
|
|
86
99
|
|
|
87
|
-
```
|
|
100
|
+
```typescript
|
|
88
101
|
import { base, configFiles } from "@abinnovision/eslint-config-base";
|
|
102
|
+
import { defineConfig } from "eslint/config";
|
|
89
103
|
|
|
90
|
-
export default [
|
|
104
|
+
export default defineConfig([
|
|
91
105
|
{ extends: [base] },
|
|
92
|
-
{
|
|
93
|
-
|
|
94
|
-
extends: [configFiles],
|
|
95
|
-
},
|
|
96
|
-
];
|
|
106
|
+
{ files: ["**/*.config.{ts,js}"], extends: [configFiles] },
|
|
107
|
+
]);
|
|
97
108
|
```
|
|
98
109
|
|
|
99
|
-
## Related Packages
|
|
100
|
-
|
|
101
|
-
- [@abinnovision/eslint-config-react](../eslint-config-react) - React
|
|
102
|
-
configuration
|
|
103
|
-
- [@abinnovision/prettier-config](../prettier-config) - Code formatting
|
|
104
|
-
|
|
105
110
|
## License
|
|
106
111
|
|
|
107
112
|
Apache-2.0
|