@mlaursen/eslint-config 7.1.0 → 8.0.0-next.0
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 +77 -13
- package/dist/frontend.d.ts +3 -2
- package/dist/frontend.js +9 -3
- package/dist/index.d.ts +10 -6
- package/dist/index.js +3 -1
- package/dist/next.d.ts +6 -2
- package/dist/next.js +39 -23
- package/dist/testing.d.ts +41 -0
- package/dist/testing.js +103 -0
- package/package.json +3 -1
- package/dist/jest.d.ts +0 -19
- package/dist/jest.js +0 -36
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,8 +79,10 @@ 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)
|
|
@@ -100,9 +133,23 @@ import { config, configs } from "@mlaursen/eslint-config";
|
|
|
100
133
|
export default config(...configs.typescriptTypeChecking(import.meta.dirname));
|
|
101
134
|
```
|
|
102
135
|
|
|
136
|
+
### testing
|
|
137
|
+
|
|
138
|
+
This enables the [jest](#jest) or [vitest](#vitest) rules along with [jestDom](#jestdom).
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
// @ts-check
|
|
142
|
+
import { config, configs } from "@mlaursen/eslint-config";
|
|
143
|
+
|
|
144
|
+
export default config(...configs.testing("jest"));
|
|
145
|
+
|
|
146
|
+
// or vitest
|
|
147
|
+
export default config(...configs.testing("vitest"));
|
|
148
|
+
```
|
|
149
|
+
|
|
103
150
|
### jest
|
|
104
151
|
|
|
105
|
-
This only enables the `eslint-plugin-jest.configs['flat/recommended]` rules on tests files.
|
|
152
|
+
This only enables the `eslint-plugin-jest.configs['flat/recommended]` rules on tests files and should not be used if using [testing](#testing).
|
|
106
153
|
|
|
107
154
|
```js
|
|
108
155
|
// @ts-check
|
|
@@ -113,7 +160,7 @@ export default config(...configs.jest);
|
|
|
113
160
|
|
|
114
161
|
### jestDom
|
|
115
162
|
|
|
116
|
-
This only enables the `eslint-plugin-jest-dom.configs['flat/recommended]` rules on tests files.
|
|
163
|
+
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
164
|
|
|
118
165
|
```js
|
|
119
166
|
// @ts-check
|
|
@@ -122,6 +169,10 @@ import { config, configs } from "@mlaursen/eslint-config";
|
|
|
122
169
|
export default config(...configs.jestDom);
|
|
123
170
|
```
|
|
124
171
|
|
|
172
|
+
### vitest
|
|
173
|
+
|
|
174
|
+
This only enables the `@vitest/eslint-plugin` rules on test files and should not be used if using [testing](#testing).
|
|
175
|
+
|
|
125
176
|
### testingLibraryReact
|
|
126
177
|
|
|
127
178
|
This enables the `eslint-plugin-testing-library/.configs["flat/react]` plugin and rules on test files.
|
|
@@ -130,6 +181,13 @@ This enables the `eslint-plugin-testing-library/.configs["flat/react]` plugin an
|
|
|
130
181
|
// @ts-check
|
|
131
182
|
import { config, configs } from "@mlaursen/eslint-config";
|
|
132
183
|
|
|
184
|
+
export default config(...configs.vitest);
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
```js
|
|
188
|
+
// @ts-check
|
|
189
|
+
import { config, configs } from "@mlaursen/eslint-config";
|
|
190
|
+
|
|
133
191
|
export default config(...configs.testingLibraryReact);
|
|
134
192
|
```
|
|
135
193
|
|
|
@@ -176,19 +234,22 @@ This is a small wrapper around the `@next/eslint-plugin-next` that works with es
|
|
|
176
234
|
// @ts-check
|
|
177
235
|
import { config, configs } from "@mlaursen/eslint-config";
|
|
178
236
|
|
|
179
|
-
export default config(...configs.next);
|
|
237
|
+
export default config(...configs.next(import.meta.dirname));
|
|
180
238
|
```
|
|
181
239
|
|
|
182
240
|
### frontend
|
|
183
241
|
|
|
184
|
-
This is my normal frontend repo setup with `react`, `jsxA11y`, `jest
|
|
185
|
-
`jest-dom`, `typescript`, `testing-library/react`.
|
|
242
|
+
This is my normal frontend repo setup with `react`, `jsxA11y`, `jest` or
|
|
243
|
+
`vitest`, `jest-dom`, `typescript`, `testing-library/react`.
|
|
186
244
|
|
|
187
245
|
```js
|
|
188
246
|
// @ts-check
|
|
189
247
|
import { config, configs } from "@mlaursen/eslint-config";
|
|
190
248
|
|
|
191
|
-
export default config(...configs.frontend);
|
|
249
|
+
export default config(...configs.frontend("jest"));
|
|
250
|
+
|
|
251
|
+
// or with vitest
|
|
252
|
+
export default config(...configs.frontend("vitest"));
|
|
192
253
|
```
|
|
193
254
|
|
|
194
255
|
### frontendTypeChecking
|
|
@@ -199,5 +260,8 @@ Same as the [frontend](#frontend), but enables the strict type checking.
|
|
|
199
260
|
// @ts-check
|
|
200
261
|
import { config, configs } from "@mlaursen/eslint-config";
|
|
201
262
|
|
|
202
|
-
export default config(...configs.frontendTypeChecking(import.meta.dirname));
|
|
263
|
+
export default config(...configs.frontendTypeChecking(import.meta.dirname, "jest"));
|
|
264
|
+
|
|
265
|
+
// or with vitest
|
|
266
|
+
export default config(...configs.frontendTypeChecking(import.meta.dirname, "vitest"));
|
|
203
267
|
```
|
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
|
|
@@ -10,7 +11,7 @@ import { type TSESLint } from "@typescript-eslint/utils";
|
|
|
10
11
|
* );
|
|
11
12
|
* ```
|
|
12
13
|
*/
|
|
13
|
-
export declare const frontend: TSESLint.FlatConfig.ConfigArray;
|
|
14
|
+
export declare const frontend: (testFramework?: TestFramework) => TSESLint.FlatConfig.ConfigArray;
|
|
14
15
|
/**
|
|
15
16
|
* @example
|
|
16
17
|
* ```ts
|
|
@@ -22,4 +23,4 @@ export declare const frontend: TSESLint.FlatConfig.ConfigArray;
|
|
|
22
23
|
* );
|
|
23
24
|
* ```
|
|
24
25
|
*/
|
|
25
|
-
export declare const frontendTypeChecking: (tsconfigRootDir: string) => TSESLint.FlatConfig.ConfigArray;
|
|
26
|
+
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
|
|
@@ -39,7 +39,10 @@ import { typescript, typescriptTypeChecking } from "./typescript.js";
|
|
|
39
39
|
* );
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
export var frontend =
|
|
42
|
+
export var frontend = function (testFramework) {
|
|
43
|
+
if (testFramework === void 0) { testFramework = "jest"; }
|
|
44
|
+
return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(typescript), false), __read(react), false), __read(jsxA11y), false), __read(testing(testFramework)), false), __read(testingLibraryReact), false);
|
|
45
|
+
};
|
|
43
46
|
/**
|
|
44
47
|
* @example
|
|
45
48
|
* ```ts
|
|
@@ -51,4 +54,7 @@ export var frontend = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__
|
|
|
51
54
|
* );
|
|
52
55
|
* ```
|
|
53
56
|
*/
|
|
54
|
-
export var frontendTypeChecking = function (tsconfigRootDir
|
|
57
|
+
export var frontendTypeChecking = function (tsconfigRootDir, testFramework) {
|
|
58
|
+
if (testFramework === void 0) { testFramework = "jest"; }
|
|
59
|
+
return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(typescriptTypeChecking(tsconfigRootDir)), false), __read(react), false), __read(jsxA11y), false), __read(testing(testFramework)), false), __read(testingLibraryReact), false);
|
|
60
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -11,10 +11,12 @@ 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 next: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
17
|
+
readonly next: (importMetaDirname: string, coreVitals?: boolean) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
18
|
+
readonly testing: (framework: import("./testing.js").TestFramework) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
19
|
+
readonly vitest: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
18
20
|
};
|
|
19
21
|
declare const _default: {
|
|
20
22
|
config: typeof config;
|
|
@@ -27,10 +29,12 @@ declare const _default: {
|
|
|
27
29
|
readonly typescriptTypeChecking: (tsconfigRootDir: string) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
28
30
|
readonly testingLibraryDom: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
29
31
|
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;
|
|
32
|
+
readonly frontend: (testFramework?: import("./testing.js").TestFramework) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
33
|
+
readonly frontendTypeChecking: (tsconfigRootDir: string, testFramework?: import("./testing.js").TestFramework) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
32
34
|
readonly jsxA11y: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
33
|
-
readonly next: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
35
|
+
readonly next: (importMetaDirname: string, coreVitals?: boolean) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
36
|
+
readonly testing: (framework: import("./testing.js").TestFramework) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
37
|
+
readonly vitest: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
34
38
|
};
|
|
35
39
|
gitignore: typeof gitignore;
|
|
36
40
|
};
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,11 @@ 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
6
|
import { next } from "./next.js";
|
|
8
7
|
import { react } from "./react.js";
|
|
9
8
|
import { testingLibraryDom, testingLibraryReact } from "./testing-library.js";
|
|
9
|
+
import { jest, jestDom, testing, vitest } from "./testing.js";
|
|
10
10
|
import { typescript, typescriptTypeChecking } from "./typescript.js";
|
|
11
11
|
export * from "./constants.js";
|
|
12
12
|
export { config, gitignore };
|
|
@@ -23,6 +23,8 @@ export var configs = {
|
|
|
23
23
|
frontendTypeChecking: frontendTypeChecking,
|
|
24
24
|
jsxA11y: jsxA11y,
|
|
25
25
|
next: next,
|
|
26
|
+
testing: testing,
|
|
27
|
+
vitest: vitest,
|
|
26
28
|
};
|
|
27
29
|
export default {
|
|
28
30
|
config: config,
|
package/dist/next.d.ts
CHANGED
|
@@ -4,7 +4,11 @@ import { type TSESLint } from "@typescript-eslint/utils";
|
|
|
4
4
|
* ```ts
|
|
5
5
|
* import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
6
6
|
*
|
|
7
|
-
* export default config(
|
|
7
|
+
* export default config(
|
|
8
|
+
* gitignore(import.meta.url),
|
|
9
|
+
* ...configs.typescript,
|
|
10
|
+
* ...configs.next(import.meta.dirname)
|
|
11
|
+
* );
|
|
8
12
|
* ```
|
|
9
13
|
*/
|
|
10
|
-
export declare const next: TSESLint.FlatConfig.ConfigArray;
|
|
14
|
+
export declare const next: (importMetaDirname: string, coreVitals?: boolean) => TSESLint.FlatConfig.ConfigArray;
|
package/dist/next.js
CHANGED
|
@@ -1,32 +1,48 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
+
if (!m) return o;
|
|
4
|
+
var i = m.call(o), r, ar = [], e;
|
|
5
|
+
try {
|
|
6
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
+
}
|
|
8
|
+
catch (error) { e = { error: error }; }
|
|
9
|
+
finally {
|
|
10
|
+
try {
|
|
11
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
7
12
|
}
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
return
|
|
13
|
+
finally { if (e) throw e.error; }
|
|
14
|
+
}
|
|
15
|
+
return ar;
|
|
11
16
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
+
if (ar || !(i in from)) {
|
|
20
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
+
ar[i] = from[i];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
+
};
|
|
26
|
+
import { FlatCompat } from "@eslint/eslintrc";
|
|
15
27
|
/**
|
|
16
28
|
* @example
|
|
17
29
|
* ```ts
|
|
18
30
|
* import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
19
31
|
*
|
|
20
|
-
* export default config(
|
|
32
|
+
* export default config(
|
|
33
|
+
* gitignore(import.meta.url),
|
|
34
|
+
* ...configs.typescript,
|
|
35
|
+
* ...configs.next(import.meta.dirname)
|
|
36
|
+
* );
|
|
21
37
|
* ```
|
|
22
38
|
*/
|
|
23
|
-
export var next =
|
|
24
|
-
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
|
|
39
|
+
export var next = function (importMetaDirname, coreVitals) {
|
|
40
|
+
if (coreVitals === void 0) { coreVitals = false; }
|
|
41
|
+
var compat = new FlatCompat({
|
|
42
|
+
baseDirectory: importMetaDirname,
|
|
43
|
+
});
|
|
44
|
+
var name = "plugin:@next/next" + (coreVitals ? "/core-web-vitals" : "/recommended");
|
|
45
|
+
return __spreadArray([], __read(compat.config({
|
|
46
|
+
extends: [name],
|
|
47
|
+
})), false);
|
|
48
|
+
};
|
|
@@ -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.0",
|
|
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>",
|
|
@@ -22,10 +22,12 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@eslint/compat": "^1.2.8",
|
|
25
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
25
26
|
"@eslint/js": "^9.24.0",
|
|
26
27
|
"@next/eslint-plugin-next": "^15.3.0",
|
|
27
28
|
"@types/eslint-plugin-jsx-a11y": "^6.10.0",
|
|
28
29
|
"@typescript-eslint/utils": "^8.30.1",
|
|
30
|
+
"@vitest/eslint-plugin": "^1.1.43",
|
|
29
31
|
"eslint-plugin-jest": "^28.11.0",
|
|
30
32
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
31
33
|
"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
|
-
];
|