@mlaursen/eslint-config 8.0.0-next.0 → 8.0.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 +33 -12
- package/dist/frontend.d.ts +6 -4
- package/dist/frontend.js +6 -10
- package/dist/index.d.ts +4 -6
- package/dist/index.js +0 -2
- package/package.json +1 -3
- package/dist/next.d.ts +0 -14
- package/dist/next.js +0 -48
package/README.md
CHANGED
|
@@ -69,6 +69,39 @@ The `config` export is the `typescript-eslint.config()` function to provide type
|
|
|
69
69
|
definitions and `gitignore` automatically ignores files from linting based on
|
|
70
70
|
your `.gitignore` rules.
|
|
71
71
|
|
|
72
|
+
## Next.js Setup
|
|
73
|
+
|
|
74
|
+
This is no longer included in this eslint-config since it requires the eslint plugin to be installed
|
|
75
|
+
in the project to work. Here are the setup steps:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
npm install -D @eslint/eslintrc @next/eslint-plugin-next
|
|
79
|
+
yarn add -D @eslint/eslintrc @next/eslint-plugin-next
|
|
80
|
+
pnpm add -D @eslint/eslintrc @next/eslint-plugin-next
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```diff
|
|
84
|
+
// @ts-check
|
|
85
|
+
+import { FlatCompat } from "@eslint/eslintrc";
|
|
86
|
+
import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
87
|
+
|
|
88
|
+
+const compat = new FlatCompat({
|
|
89
|
+
+ baseDirectory: import.meta.dirname,
|
|
90
|
+
+});
|
|
91
|
+
+
|
|
92
|
+
|
|
93
|
+
// somewhat strict type checking
|
|
94
|
+
export default config(
|
|
95
|
+
gitignore(import.meta.url),
|
|
96
|
+
+ ...compat.config({
|
|
97
|
+
+ extends: ["plugin:@next/next/recommended"],
|
|
98
|
+
+ // or with core-web-vitals
|
|
99
|
+
+ // extends: ["plugin:@next/next/core-web-vitals"],
|
|
100
|
+
+ }),
|
|
101
|
+
...configs.frontend("jest")
|
|
102
|
+
);
|
|
103
|
+
```
|
|
104
|
+
|
|
72
105
|
## Configs
|
|
73
106
|
|
|
74
107
|
I normally just use the `frontend` or `frontendTypeChecking` configs, but the
|
|
@@ -87,7 +120,6 @@ others can be used individually if needed.
|
|
|
87
120
|
- [testingLibraryDom](#testinglibrarydom)
|
|
88
121
|
- [react](#react)
|
|
89
122
|
- [jsxA11y](#jsxa11y)
|
|
90
|
-
- [next](#next)
|
|
91
123
|
- [frontend](#frontend)
|
|
92
124
|
- [frontendTypeChecking](#frontendtypechecking)
|
|
93
125
|
|
|
@@ -226,17 +258,6 @@ import { config, configs } from "@mlaursen/eslint-config";
|
|
|
226
258
|
export default config(...configs.jsxA11y);
|
|
227
259
|
```
|
|
228
260
|
|
|
229
|
-
### next
|
|
230
|
-
|
|
231
|
-
This is a small wrapper around the `@next/eslint-plugin-next` that works with eslint v9.
|
|
232
|
-
|
|
233
|
-
```js
|
|
234
|
-
// @ts-check
|
|
235
|
-
import { config, configs } from "@mlaursen/eslint-config";
|
|
236
|
-
|
|
237
|
-
export default config(...configs.next(import.meta.dirname));
|
|
238
|
-
```
|
|
239
|
-
|
|
240
261
|
### frontend
|
|
241
262
|
|
|
242
263
|
This is my normal frontend repo setup with `react`, `jsxA11y`, `jest` or
|
package/dist/frontend.d.ts
CHANGED
|
@@ -7,11 +7,12 @@ import { type TestFramework } from "./testing.js";
|
|
|
7
7
|
*
|
|
8
8
|
* export default config(
|
|
9
9
|
* gitignore(import.meta.url),
|
|
10
|
-
* ...configs.frontend
|
|
10
|
+
* ...configs.frontend("jest")
|
|
11
|
+
* // ...configs.frontend("vitest")
|
|
11
12
|
* );
|
|
12
13
|
* ```
|
|
13
14
|
*/
|
|
14
|
-
export declare const frontend: (testFramework
|
|
15
|
+
export declare const frontend: (testFramework: TestFramework) => TSESLint.FlatConfig.ConfigArray;
|
|
15
16
|
/**
|
|
16
17
|
* @example
|
|
17
18
|
* ```ts
|
|
@@ -19,8 +20,9 @@ export declare const frontend: (testFramework?: TestFramework) => TSESLint.FlatC
|
|
|
19
20
|
*
|
|
20
21
|
* export default config(
|
|
21
22
|
* gitignore(import.meta.url),
|
|
22
|
-
* ...configs.frontendTypeChecking(import.meta.dirname)
|
|
23
|
+
* ...configs.frontendTypeChecking(import.meta.dirname, "jest")
|
|
24
|
+
* // ...configs.frontendTypeChecking(import.meta.dirname, "vitest"),
|
|
23
25
|
* );
|
|
24
26
|
* ```
|
|
25
27
|
*/
|
|
26
|
-
export declare const frontendTypeChecking: (tsconfigRootDir: string, testFramework
|
|
28
|
+
export declare const frontendTypeChecking: (tsconfigRootDir: string, testFramework: TestFramework) => TSESLint.FlatConfig.ConfigArray;
|
package/dist/frontend.js
CHANGED
|
@@ -35,14 +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 = 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
|
+
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); };
|
|
46
44
|
/**
|
|
47
45
|
* @example
|
|
48
46
|
* ```ts
|
|
@@ -50,11 +48,9 @@ export var frontend = function (testFramework) {
|
|
|
50
48
|
*
|
|
51
49
|
* export default config(
|
|
52
50
|
* gitignore(import.meta.url),
|
|
53
|
-
* ...configs.frontendTypeChecking(import.meta.dirname)
|
|
51
|
+
* ...configs.frontendTypeChecking(import.meta.dirname, "jest")
|
|
52
|
+
* // ...configs.frontendTypeChecking(import.meta.dirname, "vitest"),
|
|
54
53
|
* );
|
|
55
54
|
* ```
|
|
56
55
|
*/
|
|
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
|
-
};
|
|
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,9 @@ 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: (testFramework
|
|
15
|
-
readonly frontendTypeChecking: (tsconfigRootDir: string, testFramework
|
|
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: (importMetaDirname: string, coreVitals?: boolean) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
18
17
|
readonly testing: (framework: import("./testing.js").TestFramework) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
19
18
|
readonly vitest: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
20
19
|
};
|
|
@@ -29,10 +28,9 @@ declare const _default: {
|
|
|
29
28
|
readonly typescriptTypeChecking: (tsconfigRootDir: string) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
30
29
|
readonly testingLibraryDom: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
31
30
|
readonly testingLibraryReact: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
32
|
-
readonly frontend: (testFramework
|
|
33
|
-
readonly frontendTypeChecking: (tsconfigRootDir: string, testFramework
|
|
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;
|
|
34
33
|
readonly jsxA11y: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
35
|
-
readonly next: (importMetaDirname: string, coreVitals?: boolean) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
36
34
|
readonly testing: (framework: import("./testing.js").TestFramework) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
37
35
|
readonly vitest: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
38
36
|
};
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import { base } from "./base.js";
|
|
|
3
3
|
import { frontend, frontendTypeChecking } from "./frontend.js";
|
|
4
4
|
import { gitignore } from "./gitignore.js";
|
|
5
5
|
import { jsxA11y } from "./jsxA11y.js";
|
|
6
|
-
import { next } from "./next.js";
|
|
7
6
|
import { react } from "./react.js";
|
|
8
7
|
import { testingLibraryDom, testingLibraryReact } from "./testing-library.js";
|
|
9
8
|
import { jest, jestDom, testing, vitest } from "./testing.js";
|
|
@@ -22,7 +21,6 @@ export var configs = {
|
|
|
22
21
|
frontend: frontend,
|
|
23
22
|
frontendTypeChecking: frontendTypeChecking,
|
|
24
23
|
jsxA11y: jsxA11y,
|
|
25
|
-
next: next,
|
|
26
24
|
testing: testing,
|
|
27
25
|
vitest: vitest,
|
|
28
26
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mlaursen/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "8.0.0
|
|
4
|
+
"version": "8.0.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,9 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@eslint/compat": "^1.2.8",
|
|
25
|
-
"@eslint/eslintrc": "^3.3.1",
|
|
26
25
|
"@eslint/js": "^9.24.0",
|
|
27
|
-
"@next/eslint-plugin-next": "^15.3.0",
|
|
28
26
|
"@types/eslint-plugin-jsx-a11y": "^6.10.0",
|
|
29
27
|
"@typescript-eslint/utils": "^8.30.1",
|
|
30
28
|
"@vitest/eslint-plugin": "^1.1.43",
|
package/dist/next.d.ts
DELETED
|
@@ -1,14 +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(
|
|
8
|
-
* gitignore(import.meta.url),
|
|
9
|
-
* ...configs.typescript,
|
|
10
|
-
* ...configs.next(import.meta.dirname)
|
|
11
|
-
* );
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export declare const next: (importMetaDirname: string, coreVitals?: boolean) => TSESLint.FlatConfig.ConfigArray;
|
package/dist/next.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
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);
|
|
12
|
-
}
|
|
13
|
-
finally { if (e) throw e.error; }
|
|
14
|
-
}
|
|
15
|
-
return ar;
|
|
16
|
-
};
|
|
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";
|
|
27
|
-
/**
|
|
28
|
-
* @example
|
|
29
|
-
* ```ts
|
|
30
|
-
* import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
31
|
-
*
|
|
32
|
-
* export default config(
|
|
33
|
-
* gitignore(import.meta.url),
|
|
34
|
-
* ...configs.typescript,
|
|
35
|
-
* ...configs.next(import.meta.dirname)
|
|
36
|
-
* );
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
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
|
-
};
|