eslint-config-silverwind 82.0.0 → 82.0.2
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/eslint.config.js +86 -0
- package/package.json +4 -2
package/eslint.config.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import comments from "@eslint-community/eslint-plugin-eslint-comments";
|
|
2
|
+
import js from "@stylistic/eslint-plugin-js";
|
|
3
|
+
import antfu from "eslint-plugin-antfu";
|
|
4
|
+
import arrayFunc from "eslint-plugin-array-func";
|
|
5
|
+
import i from "eslint-plugin-i";
|
|
6
|
+
import noUseExtendNative from "eslint-plugin-no-use-extend-native";
|
|
7
|
+
import regexp from "eslint-plugin-regexp";
|
|
8
|
+
import sonarjs from "eslint-plugin-sonarjs";
|
|
9
|
+
import unicorn from "eslint-plugin-unicorn";
|
|
10
|
+
import vitest from "eslint-plugin-vitest";
|
|
11
|
+
import globals from "globals";
|
|
12
|
+
import {load} from "js-yaml";
|
|
13
|
+
import {readFileSync} from "node:fs";
|
|
14
|
+
import {deepMerge} from "deepie-merge";
|
|
15
|
+
import confusingBrowserGlobals from "confusing-browser-globals";
|
|
16
|
+
import vitestGlobalsPlugin from "eslint-plugin-vitest-globals";
|
|
17
|
+
|
|
18
|
+
const eslintrc = load(readFileSync(new URL(".eslintrc.yaml", import.meta.url), "utf8"));
|
|
19
|
+
const vitestGlobals = vitestGlobalsPlugin.environments.env.globals;
|
|
20
|
+
|
|
21
|
+
const common = {
|
|
22
|
+
ignores: [
|
|
23
|
+
"**/vendor/**",
|
|
24
|
+
"**/*.snap",
|
|
25
|
+
"!.storybook",
|
|
26
|
+
],
|
|
27
|
+
languageOptions: {
|
|
28
|
+
ecmaVersion: "latest",
|
|
29
|
+
sourceType: "module",
|
|
30
|
+
globals: {
|
|
31
|
+
...globals.browser,
|
|
32
|
+
...globals.node,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
linterOptions: {
|
|
36
|
+
reportUnusedDisableDirectives: "warn"
|
|
37
|
+
},
|
|
38
|
+
plugins: {
|
|
39
|
+
comments,
|
|
40
|
+
js,
|
|
41
|
+
antfu,
|
|
42
|
+
arrayFunc,
|
|
43
|
+
i,
|
|
44
|
+
noUseExtendNative,
|
|
45
|
+
regexp,
|
|
46
|
+
sonarjs,
|
|
47
|
+
unicorn,
|
|
48
|
+
vitest,
|
|
49
|
+
vitestGlobals,
|
|
50
|
+
globals,
|
|
51
|
+
},
|
|
52
|
+
settings: {
|
|
53
|
+
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const confs = [];
|
|
58
|
+
for (const {files, rules} of eslintrc.overrides) {
|
|
59
|
+
const conf = deepMerge(common, {files, rules});
|
|
60
|
+
|
|
61
|
+
if (files.some(file => file.includes("worker"))) {
|
|
62
|
+
conf.languageOptions.globals = {...conf.languageOptions.globals, ...globals.worker};
|
|
63
|
+
conf.rules["no-restricted-globals"] = [...confusingBrowserGlobals, "__dirname", "__filename"];
|
|
64
|
+
} else if (files.some(file => file.includes("test"))) {
|
|
65
|
+
conf.languageOptions.globals = {...conf.languageOptions.globals, ...vitestGlobals};
|
|
66
|
+
} else if (files.some(file => file.includes("config"))) {
|
|
67
|
+
conf.rules["i/no-unused-modules"] = [2, {missingExports: true, unusedExports: false}];
|
|
68
|
+
} else if (files.some(file => file.includes("storybook"))) {
|
|
69
|
+
conf.rules["i/no-unused-modules"] = [0, {missingExports: true, unusedExports: false}];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
confs.push(conf);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default [
|
|
76
|
+
deepMerge(common, {
|
|
77
|
+
files: [
|
|
78
|
+
"**/*.js",
|
|
79
|
+
"**/*.jsx",
|
|
80
|
+
"**/*.ts",
|
|
81
|
+
"**/*.tsx",
|
|
82
|
+
],
|
|
83
|
+
rules: eslintrc.rules,
|
|
84
|
+
}),
|
|
85
|
+
...confs,
|
|
86
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-silverwind",
|
|
3
|
-
"version": "82.0.
|
|
3
|
+
"version": "82.0.2",
|
|
4
4
|
"description": "Exhaustive ESLint configuration",
|
|
5
5
|
"author": "silverwind <me@silverwind.io>",
|
|
6
6
|
"repository": "silverwind/eslint-config-silverwind",
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./index.json",
|
|
10
10
|
"exports": {
|
|
11
|
-
"import": "./
|
|
11
|
+
"import": "./eslint.config.js",
|
|
12
12
|
"require": "./index.json"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
+
"./eslint.config.js",
|
|
15
16
|
"./index.json"
|
|
16
17
|
],
|
|
17
18
|
"dependencies": {
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
"@stylistic/eslint-plugin-js": "1.6.3",
|
|
20
21
|
"confusing-browser-globals": "1.0.11",
|
|
21
22
|
"deepie-merge": "1.0.0",
|
|
23
|
+
"eslint-config-silverwind": "file:",
|
|
22
24
|
"eslint-plugin-antfu": "2.1.2",
|
|
23
25
|
"eslint-plugin-array-func": "4.0.0",
|
|
24
26
|
"eslint-plugin-i": "2.29.1",
|