@omer-x/eslint-config 2.2.6 → 2.3.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/dist/{jsx-a11y.d.ts → configs/jsx-a11y.d.ts} +1 -1
- package/dist/configs/next.d.ts +2 -0
- package/dist/{react.d.ts → configs/react.d.ts} +1 -1
- package/dist/configs/reminders/next.js +13 -0
- package/dist/{stylistic.js → configs/stylistic.js} +1 -1
- package/dist/configs/unused-imports.d.ts +3 -0
- package/dist/index.js +10 -8
- package/dist/rules/missing-optional-deps.d.ts +2 -0
- package/dist/rules/missing-optional-deps.js +54 -0
- package/package.json +20 -4
- package/dist/next.d.ts +0 -2
- /package/dist/{base.d.ts → configs/base.d.ts} +0 -0
- /package/dist/{base.js → configs/base.js} +0 -0
- /package/dist/{import.d.ts → configs/import.d.ts} +0 -0
- /package/dist/{import.js → configs/import.js} +0 -0
- /package/dist/{jsx-a11y.js → configs/jsx-a11y.js} +0 -0
- /package/dist/{next.js → configs/next.js} +0 -0
- /package/dist/{react.js → configs/react.js} +0 -0
- /package/dist/{stylistic.d.ts → configs/reminders/next.d.ts} +0 -0
- /package/dist/{typescript.d.ts → configs/stylistic.d.ts} +0 -0
- /package/dist/{unused-imports.d.ts → configs/typescript.d.ts} +0 -0
- /package/dist/{typescript.js → configs/typescript.js} +0 -0
- /package/dist/{unused-imports.js → configs/unused-imports.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Linter } from "eslint";
|
|
2
|
-
export declare function loadJsxAccessibilityConfig(): Promise<Linter.Config
|
|
2
|
+
export declare function loadJsxAccessibilityConfig(): Promise<Linter.Config[]>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Linter } from "eslint";
|
|
2
|
-
export declare function loadReactConfig(): Promise<Linter.Config
|
|
2
|
+
export declare function loadReactConfig(): Promise<Linter.Config[]>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { missingOptionalDepsRule } from "../../rules/missing-optional-deps.js";
|
|
2
|
+
export default [{
|
|
3
|
+
plugins: {
|
|
4
|
+
internal: {
|
|
5
|
+
rules: {
|
|
6
|
+
"missing-optional-deps": missingOptionalDepsRule,
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
rules: {
|
|
11
|
+
"internal/missing-optional-deps": "warn",
|
|
12
|
+
},
|
|
13
|
+
}];
|
|
@@ -81,7 +81,7 @@ export default [
|
|
|
81
81
|
"@stylistic/no-mixed-operators": "error",
|
|
82
82
|
"@stylistic/no-mixed-spaces-and-tabs": "error",
|
|
83
83
|
"@stylistic/no-multi-spaces": "error",
|
|
84
|
-
"@stylistic/no-multiple-empty-lines": ["error", { max:
|
|
84
|
+
"@stylistic/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
85
85
|
"@stylistic/no-tabs": "error",
|
|
86
86
|
"@stylistic/no-trailing-spaces": "error",
|
|
87
87
|
"@stylistic/no-whitespace-before-property": "error",
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import base from "./base.js";
|
|
2
|
-
import importPlugin from "./import.js";
|
|
3
|
-
import { loadJsxAccessibilityConfig } from "./jsx-a11y.js";
|
|
4
|
-
import { loadNextConfig } from "./next.js";
|
|
5
|
-
import { loadReactConfig } from "./react.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import base from "./configs/base.js";
|
|
2
|
+
import importPlugin from "./configs/import.js";
|
|
3
|
+
import { loadJsxAccessibilityConfig } from "./configs/jsx-a11y.js";
|
|
4
|
+
import { loadNextConfig } from "./configs/next.js";
|
|
5
|
+
import { loadReactConfig } from "./configs/react.js";
|
|
6
|
+
import nextJsReminder from "./configs/reminders/next.js";
|
|
7
|
+
import stylistic from "./configs/stylistic.js";
|
|
8
|
+
import typescript from "./configs/typescript.js";
|
|
9
|
+
import unusedImports from "./configs/unused-imports.js";
|
|
9
10
|
export default [
|
|
11
|
+
...nextJsReminder,
|
|
10
12
|
...base,
|
|
11
13
|
...stylistic,
|
|
12
14
|
...typescript,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
function isNextProject(root) {
|
|
4
|
+
return (fs.existsSync(path.join(root, "next.config.js")) ||
|
|
5
|
+
fs.existsSync(path.join(root, "next.config.mjs")) ||
|
|
6
|
+
fs.existsSync(path.join(root, "next.config.ts")));
|
|
7
|
+
}
|
|
8
|
+
function hasPackage(name, cwd) {
|
|
9
|
+
try {
|
|
10
|
+
require.resolve(name, { paths: [cwd] });
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export const missingOptionalDepsRule = {
|
|
18
|
+
create(context) {
|
|
19
|
+
const missing = [];
|
|
20
|
+
if (!isNextProject(context.cwd)) {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
if (!hasPackage("@next/eslint-plugin-next", context.cwd)) {
|
|
24
|
+
missing.push("@next/eslint-plugin-next");
|
|
25
|
+
}
|
|
26
|
+
if (!hasPackage("eslint-plugin-react", context.cwd)) {
|
|
27
|
+
missing.push("eslint-plugin-react");
|
|
28
|
+
}
|
|
29
|
+
if (!hasPackage("eslint-plugin-jsx-a11y", context.cwd)) {
|
|
30
|
+
missing.push("eslint-plugin-jsx-a11y");
|
|
31
|
+
}
|
|
32
|
+
if (missing.length === 0) {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
Program(node) {
|
|
37
|
+
context.report({
|
|
38
|
+
message: "Detected a Next.js project, but the following ESLint plugins are not installed:\n" +
|
|
39
|
+
missing.map(p => `- ${p}`).join("\n") +
|
|
40
|
+
"\n\nInstall them with:\n" +
|
|
41
|
+
`npm install -D ${missing.join(" ")}`,
|
|
42
|
+
node,
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
meta: {
|
|
48
|
+
docs: {
|
|
49
|
+
description: "Warn when required optional ESLint plugins are missing",
|
|
50
|
+
},
|
|
51
|
+
schema: [],
|
|
52
|
+
type: "problem",
|
|
53
|
+
},
|
|
54
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omer-x/eslint-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "My favorite eslint rules",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint-config",
|
|
@@ -64,11 +64,26 @@
|
|
|
64
64
|
"dist/"
|
|
65
65
|
],
|
|
66
66
|
"scripts": {
|
|
67
|
+
"dev": "tsc --watch",
|
|
67
68
|
"build": "tsc",
|
|
68
69
|
"lint": "eslint"
|
|
69
70
|
},
|
|
70
71
|
"peerDependencies": {
|
|
71
|
-
"eslint": "
|
|
72
|
+
"@next/eslint-plugin-next": "*",
|
|
73
|
+
"eslint": "^9",
|
|
74
|
+
"eslint-plugin-jsx-a11y": "**",
|
|
75
|
+
"eslint-plugin-react": "*"
|
|
76
|
+
},
|
|
77
|
+
"peerDependenciesMeta": {
|
|
78
|
+
"@next/eslint-plugin-next": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"eslint-plugin-jsx-a11y": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
84
|
+
"eslint-plugin-react": {
|
|
85
|
+
"optional": true
|
|
86
|
+
}
|
|
72
87
|
},
|
|
73
88
|
"dependencies": {
|
|
74
89
|
"@stylistic/eslint-plugin": "^5",
|
|
@@ -78,9 +93,10 @@
|
|
|
78
93
|
"typescript-eslint": "^8"
|
|
79
94
|
},
|
|
80
95
|
"devDependencies": {
|
|
81
|
-
"@next/eslint-plugin-next": "^
|
|
96
|
+
"@next/eslint-plugin-next": "^16.1.6",
|
|
82
97
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
83
|
-
"
|
|
98
|
+
"@types/node": "^25.2.1",
|
|
99
|
+
"eslint": "^9.39.2",
|
|
84
100
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
85
101
|
"eslint-plugin-react": "^7.37.5",
|
|
86
102
|
"typescript": "^5.9.3"
|
package/dist/next.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|