@debbl/eslint-config 0.0.56 → 0.0.58
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/index.js +28 -5
- package/package.json +8 -9
package/index.js
CHANGED
|
@@ -1,25 +1,48 @@
|
|
|
1
|
-
const
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const { cwd } = require("node:process");
|
|
2
3
|
|
|
3
4
|
const isTS = isPackageExists("typescript");
|
|
4
5
|
const isReact = isPackageExists("react");
|
|
5
6
|
const isVue = isPackageExists("vue");
|
|
6
7
|
const isSolid = isPackageExists("solid-js");
|
|
7
|
-
const isPrettier = isPackageExists("prettier");
|
|
8
8
|
const isTailwindCSS = isPackageExists("tailwindcss");
|
|
9
9
|
|
|
10
10
|
const allowExtends = [
|
|
11
|
-
"@debbl/eslint-config-basic",
|
|
12
|
-
isTS ? "@debbl/eslint-config-ts" : null,
|
|
13
11
|
isReact ? "@debbl/eslint-config-react" : null,
|
|
14
12
|
isVue ? "@debbl/eslint-config-vue" : null,
|
|
15
13
|
isSolid ? "@debbl/eslint-config-solid" : null,
|
|
16
14
|
isTailwindCSS ? "@debbl/eslint-config-tailwindcss" : null,
|
|
17
|
-
isPrettier ? "@debbl/eslint-config-prettier" : null,
|
|
18
15
|
].filter(Boolean);
|
|
19
16
|
|
|
17
|
+
if (allowExtends.length === 0) {
|
|
18
|
+
if (isTS) {
|
|
19
|
+
allowExtends.push("@debbl/eslint-config-ts");
|
|
20
|
+
} else {
|
|
21
|
+
allowExtends.push("@debbl/eslint-config-basic");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// use prettier
|
|
26
|
+
allowExtends.push("@debbl/eslint-config-prettier");
|
|
27
|
+
|
|
20
28
|
// eslint-disable-next-line no-console
|
|
21
29
|
console.info("[@debbl/eslint-config] Current running extends:", allowExtends);
|
|
22
30
|
|
|
31
|
+
// determine if the package is exists
|
|
32
|
+
function isPackageExists(name) {
|
|
33
|
+
const {
|
|
34
|
+
dependencies = [],
|
|
35
|
+
devDependencies = [],
|
|
36
|
+
peerDependencies = [],
|
|
37
|
+
} = require(path.resolve(cwd(), "./package.json"));
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
Object.keys(dependencies || {}).includes(name) ||
|
|
41
|
+
Object.keys(devDependencies || {}).includes(name) ||
|
|
42
|
+
Object.keys(peerDependencies || {}).includes(name)
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
23
46
|
module.exports = {
|
|
24
47
|
extends: allowExtends,
|
|
25
48
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@debbl/eslint-config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.58",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Debbl <me@aiwan.run> (https://github.com/Debbl/)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,14 +16,13 @@
|
|
|
16
16
|
"eslint": ">=8.24.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"
|
|
20
|
-
"@debbl/eslint-config-basic": "0.0.
|
|
21
|
-
"@debbl/eslint-config-prettier": "0.0.
|
|
22
|
-
"@debbl/eslint-config-
|
|
23
|
-
"@debbl/eslint-config-
|
|
24
|
-
"@debbl/eslint-config-
|
|
25
|
-
"@debbl/eslint-config-
|
|
26
|
-
"@debbl/eslint-config-vue": "0.0.56"
|
|
19
|
+
"@debbl/eslint-config-solid": "0.0.58",
|
|
20
|
+
"@debbl/eslint-config-basic": "0.0.58",
|
|
21
|
+
"@debbl/eslint-config-prettier": "0.0.58",
|
|
22
|
+
"@debbl/eslint-config-tailwindcss": "0.0.58",
|
|
23
|
+
"@debbl/eslint-config-react": "0.0.58",
|
|
24
|
+
"@debbl/eslint-config-vue": "0.0.58",
|
|
25
|
+
"@debbl/eslint-config-ts": "0.0.58"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
28
|
"eslint": "^8.48.0"
|