@mlaursen/eslint-config 7.1.0 → 8.0.0-next.1
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 +76 -24
- package/dist/frontend.d.ts +7 -4
- package/dist/frontend.js +7 -5
- package/dist/index.d.ts +8 -6
- package/dist/index.js +3 -3
- package/dist/testing.d.ts +41 -0
- package/dist/testing.js +103 -0
- package/package.json +2 -2
- package/dist/jest.d.ts +0 -19
- package/dist/jest.js +0 -36
- package/dist/next.d.ts +0 -10
- package/dist/next.js +0 -32
package/README.md
CHANGED
|
@@ -10,18 +10,42 @@ Starting at `5.0.0`, I only support `eslint@^9` or greater.
|
|
|
10
10
|
npm install -D eslint @mlaursen/eslint-config
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Then create an `eslint.config.mjs` with the following:
|
|
13
|
+
Then create an `eslint.config.mjs` with one of the following:
|
|
14
14
|
|
|
15
15
|
```js
|
|
16
16
|
// @ts-check
|
|
17
17
|
import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
18
18
|
|
|
19
|
-
// choose the config you want to use:
|
|
20
19
|
// somewhat strict type checking
|
|
21
|
-
export default config(gitignore(import.meta.url), ...configs.frontend);
|
|
20
|
+
export default config(gitignore(import.meta.url), ...configs.frontend("jest"));
|
|
21
|
+
|
|
22
|
+
// or with vitest
|
|
23
|
+
// export default config(
|
|
24
|
+
// gitignore(import.meta.url),
|
|
25
|
+
// ...configs.frontend("vitest")
|
|
26
|
+
// );
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
// @ts-check
|
|
31
|
+
import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
22
32
|
|
|
23
33
|
// strict type checking
|
|
24
|
-
export default config(
|
|
34
|
+
export default config(
|
|
35
|
+
gitignore(import.meta.url),
|
|
36
|
+
...configs.frontendTypeChecking(import.meta.dirname, "jest")
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// or with vitest
|
|
40
|
+
// export default config(
|
|
41
|
+
// gitignore(import.meta.url),
|
|
42
|
+
// ...configs.frontendTypeChecking(import.meta.dirname, "vitest")
|
|
43
|
+
// );
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
// @ts-check
|
|
48
|
+
import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
25
49
|
|
|
26
50
|
// NOTE: This is recommended for strict type checking. Callable as:
|
|
27
51
|
// `cross-env STRICT_TYPING=true eslint "**/*.{ts,tsx,mts,mtsx,js,jsx,mjs,cjs}`
|
|
@@ -29,8 +53,15 @@ export default config(gitignore(import.meta.url), ...configs.frontendTypeCheckin
|
|
|
29
53
|
// strict type checking with an environment variable. uncomment the following
|
|
30
54
|
// line to enable it in your editor
|
|
31
55
|
// const strict = true || process.env.STRICT_TYPING === 'true';
|
|
32
|
-
const strict = process.env.STRICT_TYPING ===
|
|
33
|
-
const frontend = strict
|
|
56
|
+
const strict = process.env.STRICT_TYPING === "true";
|
|
57
|
+
const frontend = strict
|
|
58
|
+
? configs.frontendTypeChecking(import.meta.dirname, "jest")
|
|
59
|
+
: configs.frontend("jest");
|
|
60
|
+
|
|
61
|
+
// or with vitest
|
|
62
|
+
// const frontend = strict
|
|
63
|
+
// ? configs.frontendTypeChecking(import.meta.dirname, "vitest")
|
|
64
|
+
// : configs.frontend("vitest");
|
|
34
65
|
export default config(gitignore(import.meta.url), ...frontend);
|
|
35
66
|
```
|
|
36
67
|
|
|
@@ -48,13 +79,14 @@ others can be used individually if needed.
|
|
|
48
79
|
- [base](#base)
|
|
49
80
|
- [typescript](#typescript)
|
|
50
81
|
- [typescriptTypeChecking](#typescripttypechecking)
|
|
82
|
+
- [testing](#testing)
|
|
51
83
|
- [jest](#jest)
|
|
52
84
|
- [jestDom](#jestdom)
|
|
85
|
+
- [vitest](#vitest)
|
|
53
86
|
- [testingLibraryReact](#testinglibraryreact)
|
|
54
87
|
- [testingLibraryDom](#testinglibrarydom)
|
|
55
88
|
- [react](#react)
|
|
56
89
|
- [jsxA11y](#jsxa11y)
|
|
57
|
-
- [next](#next)
|
|
58
90
|
- [frontend](#frontend)
|
|
59
91
|
- [frontendTypeChecking](#frontendtypechecking)
|
|
60
92
|
|
|
@@ -100,9 +132,23 @@ import { config, configs } from "@mlaursen/eslint-config";
|
|
|
100
132
|
export default config(...configs.typescriptTypeChecking(import.meta.dirname));
|
|
101
133
|
```
|
|
102
134
|
|
|
135
|
+
### testing
|
|
136
|
+
|
|
137
|
+
This enables the [jest](#jest) or [vitest](#vitest) rules along with [jestDom](#jestdom).
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
// @ts-check
|
|
141
|
+
import { config, configs } from "@mlaursen/eslint-config";
|
|
142
|
+
|
|
143
|
+
export default config(...configs.testing("jest"));
|
|
144
|
+
|
|
145
|
+
// or vitest
|
|
146
|
+
export default config(...configs.testing("vitest"));
|
|
147
|
+
```
|
|
148
|
+
|
|
103
149
|
### jest
|
|
104
150
|
|
|
105
|
-
This only enables the `eslint-plugin-jest.configs['flat/recommended]` rules on tests files.
|
|
151
|
+
This only enables the `eslint-plugin-jest.configs['flat/recommended]` rules on tests files and should not be used if using [testing](#testing).
|
|
106
152
|
|
|
107
153
|
```js
|
|
108
154
|
// @ts-check
|
|
@@ -113,7 +159,7 @@ export default config(...configs.jest);
|
|
|
113
159
|
|
|
114
160
|
### jestDom
|
|
115
161
|
|
|
116
|
-
This only enables the `eslint-plugin-jest-dom.configs['flat/recommended]` rules on tests files.
|
|
162
|
+
This only enables the `eslint-plugin-jest-dom.configs['flat/recommended]` rules on tests files and should not be used if using [testing](#testing).
|
|
117
163
|
|
|
118
164
|
```js
|
|
119
165
|
// @ts-check
|
|
@@ -122,6 +168,10 @@ import { config, configs } from "@mlaursen/eslint-config";
|
|
|
122
168
|
export default config(...configs.jestDom);
|
|
123
169
|
```
|
|
124
170
|
|
|
171
|
+
### vitest
|
|
172
|
+
|
|
173
|
+
This only enables the `@vitest/eslint-plugin` rules on test files and should not be used if using [testing](#testing).
|
|
174
|
+
|
|
125
175
|
### testingLibraryReact
|
|
126
176
|
|
|
127
177
|
This enables the `eslint-plugin-testing-library/.configs["flat/react]` plugin and rules on test files.
|
|
@@ -130,6 +180,13 @@ This enables the `eslint-plugin-testing-library/.configs["flat/react]` plugin an
|
|
|
130
180
|
// @ts-check
|
|
131
181
|
import { config, configs } from "@mlaursen/eslint-config";
|
|
132
182
|
|
|
183
|
+
export default config(...configs.vitest);
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
```js
|
|
187
|
+
// @ts-check
|
|
188
|
+
import { config, configs } from "@mlaursen/eslint-config";
|
|
189
|
+
|
|
133
190
|
export default config(...configs.testingLibraryReact);
|
|
134
191
|
```
|
|
135
192
|
|
|
@@ -168,27 +225,19 @@ import { config, configs } from "@mlaursen/eslint-config";
|
|
|
168
225
|
export default config(...configs.jsxA11y);
|
|
169
226
|
```
|
|
170
227
|
|
|
171
|
-
### next
|
|
172
|
-
|
|
173
|
-
This is a small wrapper around the `@next/eslint-plugin-next` that works with eslint v9.
|
|
174
|
-
|
|
175
|
-
```js
|
|
176
|
-
// @ts-check
|
|
177
|
-
import { config, configs } from "@mlaursen/eslint-config";
|
|
178
|
-
|
|
179
|
-
export default config(...configs.next);
|
|
180
|
-
```
|
|
181
|
-
|
|
182
228
|
### frontend
|
|
183
229
|
|
|
184
|
-
This is my normal frontend repo setup with `react`, `jsxA11y`, `jest
|
|
185
|
-
`jest-dom`, `typescript`, `testing-library/react`.
|
|
230
|
+
This is my normal frontend repo setup with `react`, `jsxA11y`, `jest` or
|
|
231
|
+
`vitest`, `jest-dom`, `typescript`, `testing-library/react`.
|
|
186
232
|
|
|
187
233
|
```js
|
|
188
234
|
// @ts-check
|
|
189
235
|
import { config, configs } from "@mlaursen/eslint-config";
|
|
190
236
|
|
|
191
|
-
export default config(...configs.frontend);
|
|
237
|
+
export default config(...configs.frontend("jest"));
|
|
238
|
+
|
|
239
|
+
// or with vitest
|
|
240
|
+
export default config(...configs.frontend("vitest"));
|
|
192
241
|
```
|
|
193
242
|
|
|
194
243
|
### frontendTypeChecking
|
|
@@ -199,5 +248,8 @@ Same as the [frontend](#frontend), but enables the strict type checking.
|
|
|
199
248
|
// @ts-check
|
|
200
249
|
import { config, configs } from "@mlaursen/eslint-config";
|
|
201
250
|
|
|
202
|
-
export default config(...configs.frontendTypeChecking(import.meta.dirname));
|
|
251
|
+
export default config(...configs.frontendTypeChecking(import.meta.dirname, "jest"));
|
|
252
|
+
|
|
253
|
+
// or with vitest
|
|
254
|
+
export default config(...configs.frontendTypeChecking(import.meta.dirname, "vitest"));
|
|
203
255
|
```
|
package/dist/frontend.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type TSESLint } from "@typescript-eslint/utils";
|
|
2
|
+
import { type TestFramework } from "./testing.js";
|
|
2
3
|
/**
|
|
3
4
|
* @example
|
|
4
5
|
* ```ts
|
|
@@ -6,11 +7,12 @@ import { type TSESLint } from "@typescript-eslint/utils";
|
|
|
6
7
|
*
|
|
7
8
|
* export default config(
|
|
8
9
|
* gitignore(import.meta.url),
|
|
9
|
-
* ...configs.frontend
|
|
10
|
+
* ...configs.frontend("jest")
|
|
11
|
+
* // ...configs.frontend("vitest")
|
|
10
12
|
* );
|
|
11
13
|
* ```
|
|
12
14
|
*/
|
|
13
|
-
export declare const frontend: TSESLint.FlatConfig.ConfigArray;
|
|
15
|
+
export declare const frontend: (testFramework: TestFramework) => TSESLint.FlatConfig.ConfigArray;
|
|
14
16
|
/**
|
|
15
17
|
* @example
|
|
16
18
|
* ```ts
|
|
@@ -18,8 +20,9 @@ export declare const frontend: TSESLint.FlatConfig.ConfigArray;
|
|
|
18
20
|
*
|
|
19
21
|
* export default config(
|
|
20
22
|
* gitignore(import.meta.url),
|
|
21
|
-
* ...configs.frontendTypeChecking(import.meta.dirname)
|
|
23
|
+
* ...configs.frontendTypeChecking(import.meta.dirname, "jest")
|
|
24
|
+
* // ...configs.frontendTypeChecking(import.meta.dirname, "vitest"),
|
|
22
25
|
* );
|
|
23
26
|
* ```
|
|
24
27
|
*/
|
|
25
|
-
export declare const frontendTypeChecking: (tsconfigRootDir: string) => TSESLint.FlatConfig.ConfigArray;
|
|
28
|
+
export declare const frontendTypeChecking: (tsconfigRootDir: string, testFramework: TestFramework) => TSESLint.FlatConfig.ConfigArray;
|
package/dist/frontend.js
CHANGED
|
@@ -23,10 +23,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
23
23
|
}
|
|
24
24
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
25
|
};
|
|
26
|
-
import { jest, jestDom } from "./jest.js";
|
|
27
26
|
import { jsxA11y } from "./jsxA11y.js";
|
|
28
27
|
import { react } from "./react.js";
|
|
29
28
|
import { testingLibraryReact } from "./testing-library.js";
|
|
29
|
+
import { testing } from "./testing.js";
|
|
30
30
|
import { typescript, typescriptTypeChecking } from "./typescript.js";
|
|
31
31
|
/**
|
|
32
32
|
* @example
|
|
@@ -35,11 +35,12 @@ import { typescript, typescriptTypeChecking } from "./typescript.js";
|
|
|
35
35
|
*
|
|
36
36
|
* export default config(
|
|
37
37
|
* gitignore(import.meta.url),
|
|
38
|
-
* ...configs.frontend
|
|
38
|
+
* ...configs.frontend("jest")
|
|
39
|
+
* // ...configs.frontend("vitest")
|
|
39
40
|
* );
|
|
40
41
|
* ```
|
|
41
42
|
*/
|
|
42
|
-
export var frontend =
|
|
43
|
+
export var frontend = function (testFramework) { return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(typescript), false), __read(react), false), __read(jsxA11y), false), __read(testing(testFramework)), false), __read(testingLibraryReact), false); };
|
|
43
44
|
/**
|
|
44
45
|
* @example
|
|
45
46
|
* ```ts
|
|
@@ -47,8 +48,9 @@ export var frontend = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__
|
|
|
47
48
|
*
|
|
48
49
|
* export default config(
|
|
49
50
|
* gitignore(import.meta.url),
|
|
50
|
-
* ...configs.frontendTypeChecking(import.meta.dirname)
|
|
51
|
+
* ...configs.frontendTypeChecking(import.meta.dirname, "jest")
|
|
52
|
+
* // ...configs.frontendTypeChecking(import.meta.dirname, "vitest"),
|
|
51
53
|
* );
|
|
52
54
|
* ```
|
|
53
55
|
*/
|
|
54
|
-
export var frontendTypeChecking = function (tsconfigRootDir) { return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(
|
|
56
|
+
export var frontendTypeChecking = function (tsconfigRootDir, testFramework) { return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(typescriptTypeChecking(tsconfigRootDir)), false), __read(react), false), __read(jsxA11y), false), __read(testing(testFramework)), false), __read(testingLibraryReact), false); };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,10 +11,11 @@ export declare const configs: {
|
|
|
11
11
|
readonly typescriptTypeChecking: (tsconfigRootDir: string) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
12
12
|
readonly testingLibraryDom: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
13
13
|
readonly testingLibraryReact: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
14
|
-
readonly frontend: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
15
|
-
readonly frontendTypeChecking: (tsconfigRootDir: string) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
14
|
+
readonly frontend: (testFramework: import("./testing.js").TestFramework) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
15
|
+
readonly frontendTypeChecking: (tsconfigRootDir: string, testFramework: import("./testing.js").TestFramework) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
16
16
|
readonly jsxA11y: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
17
|
-
readonly
|
|
17
|
+
readonly testing: (framework: import("./testing.js").TestFramework) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
18
|
+
readonly vitest: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
18
19
|
};
|
|
19
20
|
declare const _default: {
|
|
20
21
|
config: typeof config;
|
|
@@ -27,10 +28,11 @@ declare const _default: {
|
|
|
27
28
|
readonly typescriptTypeChecking: (tsconfigRootDir: string) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
28
29
|
readonly testingLibraryDom: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
29
30
|
readonly testingLibraryReact: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
30
|
-
readonly frontend: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
31
|
-
readonly frontendTypeChecking: (tsconfigRootDir: string) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
31
|
+
readonly frontend: (testFramework: import("./testing.js").TestFramework) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
32
|
+
readonly frontendTypeChecking: (tsconfigRootDir: string, testFramework: import("./testing.js").TestFramework) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
32
33
|
readonly jsxA11y: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
33
|
-
readonly
|
|
34
|
+
readonly testing: (framework: import("./testing.js").TestFramework) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
35
|
+
readonly vitest: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
34
36
|
};
|
|
35
37
|
gitignore: typeof gitignore;
|
|
36
38
|
};
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,10 @@ import { config } from "typescript-eslint";
|
|
|
2
2
|
import { base } from "./base.js";
|
|
3
3
|
import { frontend, frontendTypeChecking } from "./frontend.js";
|
|
4
4
|
import { gitignore } from "./gitignore.js";
|
|
5
|
-
import { jest, jestDom } from "./jest.js";
|
|
6
5
|
import { jsxA11y } from "./jsxA11y.js";
|
|
7
|
-
import { next } from "./next.js";
|
|
8
6
|
import { react } from "./react.js";
|
|
9
7
|
import { testingLibraryDom, testingLibraryReact } from "./testing-library.js";
|
|
8
|
+
import { jest, jestDom, testing, vitest } from "./testing.js";
|
|
10
9
|
import { typescript, typescriptTypeChecking } from "./typescript.js";
|
|
11
10
|
export * from "./constants.js";
|
|
12
11
|
export { config, gitignore };
|
|
@@ -22,7 +21,8 @@ export var configs = {
|
|
|
22
21
|
frontend: frontend,
|
|
23
22
|
frontendTypeChecking: frontendTypeChecking,
|
|
24
23
|
jsxA11y: jsxA11y,
|
|
25
|
-
|
|
24
|
+
testing: testing,
|
|
25
|
+
vitest: vitest,
|
|
26
26
|
};
|
|
27
27
|
export default {
|
|
28
28
|
config: config,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type TSESLint } from "@typescript-eslint/utils";
|
|
2
|
+
export type TestFramework = "jest" | "vitest";
|
|
3
|
+
/**
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { config, configs } from "@mlaursen/eslint-config";
|
|
7
|
+
*
|
|
8
|
+
* export default config(...configs.vitest);
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare const vitest: TSESLint.FlatConfig.ConfigArray;
|
|
12
|
+
/**
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { config, configs } from "@mlaursen/eslint-config";
|
|
16
|
+
*
|
|
17
|
+
* export default config(...configs.jest);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const jest: TSESLint.FlatConfig.ConfigArray;
|
|
21
|
+
/**
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { config, configs } from "@mlaursen/eslint-config";
|
|
25
|
+
*
|
|
26
|
+
* export default config(...configs.jest, ...configs.jestDom);
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare const jestDom: TSESLint.FlatConfig.ConfigArray;
|
|
30
|
+
/**
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { config, configs } from "@mlaursen/eslint-config";
|
|
34
|
+
*
|
|
35
|
+
* export default config(...configs.testing("jest"));
|
|
36
|
+
*
|
|
37
|
+
* // or
|
|
38
|
+
* export default config(...configs.testing("vitest"));
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare const testing: (framework: TestFramework) => TSESLint.FlatConfig.ConfigArray;
|
package/dist/testing.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
29
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
30
|
+
if (ar || !(i in from)) {
|
|
31
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
32
|
+
ar[i] = from[i];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
|
+
};
|
|
37
|
+
import vitestPlugin from "@vitest/eslint-plugin";
|
|
38
|
+
import jestPlugin from "eslint-plugin-jest";
|
|
39
|
+
import jestDomPlugin from "eslint-plugin-jest-dom";
|
|
40
|
+
import { BASE_NAME, DEV_WARNING_PROD_ERROR, TEST_FILES } from "./constants.js";
|
|
41
|
+
/**
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { config, configs } from "@mlaursen/eslint-config";
|
|
45
|
+
*
|
|
46
|
+
* export default config(...configs.vitest);
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export var vitest = [
|
|
50
|
+
{
|
|
51
|
+
name: "".concat(BASE_NAME, "/vitest"),
|
|
52
|
+
files: TEST_FILES,
|
|
53
|
+
plugins: {
|
|
54
|
+
vitest: vitestPlugin,
|
|
55
|
+
},
|
|
56
|
+
rules: __assign(__assign({}, vitestPlugin.configs.recommended.rules), { "vitest/no-alias-methods": "error", "vitest/no-focused-tests": DEV_WARNING_PROD_ERROR, "vitest/no-disabled-tests": DEV_WARNING_PROD_ERROR, "vitest/no-duplicate-hooks": "error", "vitest/no-standalone-expect": "error", "vitest/prefer-expect-resolves": "error", "vitest/prefer-spy-on": "error", "vitest/prefer-vi-mocked": "error" }),
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
/**
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* import { config, configs } from "@mlaursen/eslint-config";
|
|
63
|
+
*
|
|
64
|
+
* export default config(...configs.jest);
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export var jest = [
|
|
68
|
+
__assign({ name: "".concat(BASE_NAME, "/jest"), files: TEST_FILES }, jestPlugin.configs["flat/recommended"]),
|
|
69
|
+
];
|
|
70
|
+
/**
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* import { config, configs } from "@mlaursen/eslint-config";
|
|
74
|
+
*
|
|
75
|
+
* export default config(...configs.jest, ...configs.jestDom);
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export var jestDom = [
|
|
79
|
+
__assign({ name: "".concat(BASE_NAME, "/jest-dom"), files: TEST_FILES }, jestDomPlugin.configs["flat/recommended"]),
|
|
80
|
+
];
|
|
81
|
+
/**
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* import { config, configs } from "@mlaursen/eslint-config";
|
|
85
|
+
*
|
|
86
|
+
* export default config(...configs.testing("jest"));
|
|
87
|
+
*
|
|
88
|
+
* // or
|
|
89
|
+
* export default config(...configs.testing("vitest"));
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export var testing = function (framework) {
|
|
93
|
+
var config;
|
|
94
|
+
switch (framework) {
|
|
95
|
+
case "jest":
|
|
96
|
+
config = jest;
|
|
97
|
+
break;
|
|
98
|
+
case "vitest":
|
|
99
|
+
config = vitest;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
return __spreadArray(__spreadArray([], __read(config), false), __read(jestDom), false);
|
|
103
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mlaursen/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "8.0.0-next.1",
|
|
5
5
|
"description": "An eslint config used by mlaursen for most projects.",
|
|
6
6
|
"repository": "https://github.com/mlaursen/eslint-config.git",
|
|
7
7
|
"author": "Mikkel Laursen <mlaursen03@gmail.com>",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@eslint/compat": "^1.2.8",
|
|
25
25
|
"@eslint/js": "^9.24.0",
|
|
26
|
-
"@next/eslint-plugin-next": "^15.3.0",
|
|
27
26
|
"@types/eslint-plugin-jsx-a11y": "^6.10.0",
|
|
28
27
|
"@typescript-eslint/utils": "^8.30.1",
|
|
28
|
+
"@vitest/eslint-plugin": "^1.1.43",
|
|
29
29
|
"eslint-plugin-jest": "^28.11.0",
|
|
30
30
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
31
31
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
package/dist/jest.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type TSESLint } from "@typescript-eslint/utils";
|
|
2
|
-
/**
|
|
3
|
-
* @example
|
|
4
|
-
* ```ts
|
|
5
|
-
* import { config, configs } from "@mlaursen/eslint-config";
|
|
6
|
-
*
|
|
7
|
-
* export default config(...configs.jest);
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
export declare const jest: TSESLint.FlatConfig.ConfigArray;
|
|
11
|
-
/**
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* import { config, configs } from "@mlaursen/eslint-config";
|
|
15
|
-
*
|
|
16
|
-
* export default config(...configs.jest, ...configs.jestDom);
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare const jestDom: TSESLint.FlatConfig.ConfigArray;
|
package/dist/jest.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import jestPlugin from "eslint-plugin-jest";
|
|
13
|
-
import jestDomPlugin from "eslint-plugin-jest-dom";
|
|
14
|
-
import { BASE_NAME, TEST_FILES } from "./constants.js";
|
|
15
|
-
/**
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* import { config, configs } from "@mlaursen/eslint-config";
|
|
19
|
-
*
|
|
20
|
-
* export default config(...configs.jest);
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export var jest = [
|
|
24
|
-
__assign({ name: "".concat(BASE_NAME, "/jest"), files: TEST_FILES }, jestPlugin.configs["flat/recommended"]),
|
|
25
|
-
];
|
|
26
|
-
/**
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* import { config, configs } from "@mlaursen/eslint-config";
|
|
30
|
-
*
|
|
31
|
-
* export default config(...configs.jest, ...configs.jestDom);
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export var jestDom = [
|
|
35
|
-
__assign({ name: "".concat(BASE_NAME, "/jest-dom"), files: TEST_FILES }, jestDomPlugin.configs["flat/recommended"]),
|
|
36
|
-
];
|
package/dist/next.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type TSESLint } from "@typescript-eslint/utils";
|
|
2
|
-
/**
|
|
3
|
-
* @example
|
|
4
|
-
* ```ts
|
|
5
|
-
* import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
6
|
-
*
|
|
7
|
-
* export default config(gitignore(import.meta.url), ...configs.typescript, ...configs.next);
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
export declare const next: TSESLint.FlatConfig.ConfigArray;
|
package/dist/next.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { fixupPluginRules } from "@eslint/compat";
|
|
13
|
-
import nextPlugin from "@next/eslint-plugin-next";
|
|
14
|
-
import { BASE_NAME } from "./constants.js";
|
|
15
|
-
/**
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
19
|
-
*
|
|
20
|
-
* export default config(gitignore(import.meta.url), ...configs.typescript, ...configs.next);
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export var next = [
|
|
24
|
-
{
|
|
25
|
-
name: "".concat(BASE_NAME, "/next"),
|
|
26
|
-
plugins: {
|
|
27
|
-
// @ts-expect-error There is a bad typing atm
|
|
28
|
-
"@next/next": fixupPluginRules(nextPlugin),
|
|
29
|
-
},
|
|
30
|
-
rules: __assign({}, nextPlugin.configs.recommended.rules),
|
|
31
|
-
},
|
|
32
|
-
];
|