@keeex/eslint-config 2.6.2 → 2.7.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/package.json +98 -1
- package/src/dependencies.js +19 -4
- package/src/pathutils.js +1 -1
package/package.json
CHANGED
|
@@ -1 +1,98 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"allowScripts": {
|
|
3
|
+
"unrs-resolver": false
|
|
4
|
+
},
|
|
5
|
+
"author": "KeeeX SAS",
|
|
6
|
+
"bin": {
|
|
7
|
+
"kxeslint-dump": "src/bin/kxeslint-dump.js",
|
|
8
|
+
"kxeslint-setup": "src/bin/kxeslint-setup.js"
|
|
9
|
+
},
|
|
10
|
+
"contributors": [
|
|
11
|
+
{
|
|
12
|
+
"email": "gabriel@keeex.net",
|
|
13
|
+
"name": "Gabriel Paul \"Cley Faye\" Risterucci"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"prompts": "^2.4.2",
|
|
18
|
+
"semver": "^7.8.5"
|
|
19
|
+
},
|
|
20
|
+
"description": "Common eslint configuration",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": "./src/index.js",
|
|
23
|
+
"./prettier.config.js": "./prettier.config.js"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"prettier.config.js",
|
|
27
|
+
"src"
|
|
28
|
+
],
|
|
29
|
+
"homepage": "https://keeex.me/oss",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"name": "@keeex/eslint-config",
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@eslint/compat": "^2.0.0",
|
|
34
|
+
"@eslint/js": "9.x",
|
|
35
|
+
"@typescript-eslint/parser": "^8.51.0",
|
|
36
|
+
"eslint": "^9.39.4",
|
|
37
|
+
"eslint-import-resolver-typescript": "3.x || 4.x",
|
|
38
|
+
"eslint-plugin-import-x": "4.x",
|
|
39
|
+
"eslint-plugin-mocha": "10.x || >11.0.0",
|
|
40
|
+
"eslint-plugin-promise": "7.x",
|
|
41
|
+
"eslint-plugin-react": "7.x",
|
|
42
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
43
|
+
"eslint-plugin-tsdoc": "0.x",
|
|
44
|
+
"globals": "16.x || 17.x",
|
|
45
|
+
"prettier": "3.x",
|
|
46
|
+
"typescript-eslint": "8.x"
|
|
47
|
+
},
|
|
48
|
+
"peerDependenciesMeta": {
|
|
49
|
+
"@eslint/compat": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
52
|
+
"eslint": {
|
|
53
|
+
"optional": false
|
|
54
|
+
},
|
|
55
|
+
"eslint-import-resolver-typescript": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"eslint-import-resolver-webpack": {
|
|
59
|
+
"optional": true
|
|
60
|
+
},
|
|
61
|
+
"eslint-plugin-deprecation": {
|
|
62
|
+
"optional": true
|
|
63
|
+
},
|
|
64
|
+
"eslint-plugin-import-x": {
|
|
65
|
+
"optional": true
|
|
66
|
+
},
|
|
67
|
+
"eslint-plugin-mocha": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"eslint-plugin-promise": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"eslint-plugin-react": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"eslint-plugin-react-hooks": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"eslint-plugin-tsdoc": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"globals": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"prettier": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"typescript-eslint": {
|
|
89
|
+
"optional": true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"publishConfig": {
|
|
93
|
+
"access": "public"
|
|
94
|
+
},
|
|
95
|
+
"scripts": {},
|
|
96
|
+
"type": "module",
|
|
97
|
+
"version": "2.7.0"
|
|
98
|
+
}
|
package/src/dependencies.js
CHANGED
|
@@ -30,7 +30,7 @@ export const needDependencies = (name) => name in requiredDependencies;
|
|
|
30
30
|
*
|
|
31
31
|
* This assumes that the command is run at the root of the project.
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
const getPkgJson = () => {
|
|
34
34
|
if (!pkgJson) {
|
|
35
35
|
try {
|
|
36
36
|
const data = fs.readFileSync("./package.json", "utf8");
|
|
@@ -75,7 +75,7 @@ const dependencyStatus = (name) => {
|
|
|
75
75
|
* @param version {string} - A specific version string (or tag) to install if the dependency is
|
|
76
76
|
* missing
|
|
77
77
|
*/
|
|
78
|
-
|
|
78
|
+
const addDependency = (depName, version) => {
|
|
79
79
|
requiredDependencies[depName] = {version: version ?? true, force: false};
|
|
80
80
|
};
|
|
81
81
|
|
|
@@ -126,6 +126,21 @@ export const listDependencies = () => {
|
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
+
let kxNpmPresent = null;
|
|
130
|
+
|
|
131
|
+
const isKxNpmPresent = () => {
|
|
132
|
+
kxNpmPresent ??= runProcess("which", ["kxnpm"]);
|
|
133
|
+
return kxNpmPresent;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const runNpmInstall = (pkgNames) => {
|
|
137
|
+
if (isKxNpmPresent()) {
|
|
138
|
+
return runProcess("kxnpm", "-a", "install", "--save-dev", "--force", ...pkgNames, "--");
|
|
139
|
+
}
|
|
140
|
+
console.warn("kxnpm not found, you might have issues when installing packages automatically");
|
|
141
|
+
return runProcess("npm", "install", "--save-dev", "--force", ...pkgNames);
|
|
142
|
+
};
|
|
143
|
+
|
|
129
144
|
/**
|
|
130
145
|
* Run the required installation/removal.
|
|
131
146
|
*
|
|
@@ -150,7 +165,7 @@ export const installAndRemoveDeps = () => {
|
|
|
150
165
|
if (typeof target === "string") return `${c}@${target}`;
|
|
151
166
|
return c;
|
|
152
167
|
});
|
|
153
|
-
if (!
|
|
168
|
+
if (!runNpmInstall(installNames)) {
|
|
154
169
|
process.exitCode = 1;
|
|
155
170
|
return false;
|
|
156
171
|
}
|
|
@@ -162,7 +177,7 @@ export const installAndRemoveDeps = () => {
|
|
|
162
177
|
export const configToDependencies = (eslintConfig) => {
|
|
163
178
|
addDependency("eslint", "9.x");
|
|
164
179
|
addDependency("prettier", "3.x");
|
|
165
|
-
if (eslintConfig.globals) addDependency("globals", "
|
|
180
|
+
if (eslintConfig.globals) addDependency("globals", "17.x");
|
|
166
181
|
if (eslintConfig.import !== false) {
|
|
167
182
|
addDependency("eslint-plugin-import-x", "4.x");
|
|
168
183
|
if (eslintConfig.typescript) addDependency("eslint-import-resolver-typescript", "4.x");
|
package/src/pathutils.js
CHANGED
|
@@ -35,7 +35,7 @@ export const getEnvDirectories = (environments, configEnv, defaultDir) => {
|
|
|
35
35
|
return dirs;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
const getExtensions = (fileTypes) => {
|
|
39
39
|
const result = [];
|
|
40
40
|
const esm = fileTypes.esm ?? true;
|
|
41
41
|
const cjs = fileTypes.cjs ?? false;
|