@abinnovision/eslint-config-base 3.2.0-beta.7 → 3.2.0-beta.9
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/dist/index.cjs +9 -3
- package/dist/index.js +9 -3
- 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
|
package/dist/index.cjs
CHANGED
|
@@ -735,8 +735,10 @@ var config4 = (0, import_config4.defineConfig)([
|
|
|
735
735
|
/**
|
|
736
736
|
* Require a blank line before block and line comments.
|
|
737
737
|
* Comments belong to the following code block, so only enforce
|
|
738
|
-
* before, not after.
|
|
739
|
-
*
|
|
738
|
+
* before, not after.
|
|
739
|
+
*
|
|
740
|
+
* Allows comments at the start of blocks, objects, arrays, classes,
|
|
741
|
+
* interfaces, types, enums, and modules without a preceding blank line.
|
|
740
742
|
*
|
|
741
743
|
* @see https://eslint.style/rules/default/lines-around-comment
|
|
742
744
|
*/
|
|
@@ -748,7 +750,11 @@ var config4 = (0, import_config4.defineConfig)([
|
|
|
748
750
|
allowBlockStart: true,
|
|
749
751
|
allowObjectStart: true,
|
|
750
752
|
allowArrayStart: true,
|
|
751
|
-
allowClassStart: true
|
|
753
|
+
allowClassStart: true,
|
|
754
|
+
allowInterfaceStart: true,
|
|
755
|
+
allowTypeStart: true,
|
|
756
|
+
allowEnumStart: true,
|
|
757
|
+
allowModuleStart: true
|
|
752
758
|
}
|
|
753
759
|
],
|
|
754
760
|
/**
|
package/dist/index.js
CHANGED
|
@@ -695,8 +695,10 @@ var config4 = defineConfig4([
|
|
|
695
695
|
/**
|
|
696
696
|
* Require a blank line before block and line comments.
|
|
697
697
|
* Comments belong to the following code block, so only enforce
|
|
698
|
-
* before, not after.
|
|
699
|
-
*
|
|
698
|
+
* before, not after.
|
|
699
|
+
*
|
|
700
|
+
* Allows comments at the start of blocks, objects, arrays, classes,
|
|
701
|
+
* interfaces, types, enums, and modules without a preceding blank line.
|
|
700
702
|
*
|
|
701
703
|
* @see https://eslint.style/rules/default/lines-around-comment
|
|
702
704
|
*/
|
|
@@ -708,7 +710,11 @@ var config4 = defineConfig4([
|
|
|
708
710
|
allowBlockStart: true,
|
|
709
711
|
allowObjectStart: true,
|
|
710
712
|
allowArrayStart: true,
|
|
711
|
-
allowClassStart: true
|
|
713
|
+
allowClassStart: true,
|
|
714
|
+
allowInterfaceStart: true,
|
|
715
|
+
allowTypeStart: true,
|
|
716
|
+
allowEnumStart: true,
|
|
717
|
+
allowModuleStart: true
|
|
712
718
|
}
|
|
713
719
|
],
|
|
714
720
|
/**
|