@lidofinance/eslint-config 0.0.1 → 0.11.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/.eslintrc.js +14 -0
- package/README.md +60 -6
- package/all-hard.js +10 -10
- package/all.js +10 -10
- package/auto-hard.js +4 -4
- package/auto.js +4 -4
- package/lib/build-config.js +215 -198
- package/lib/env.js +53 -22
- package/package.json +42 -34
- package/prettier.js +15 -0
- package/rulesets/easy.js +205 -203
- package/rulesets/hard.js +70 -70
- package/.eslintrc +0 -12
package/lib/env.js
CHANGED
|
@@ -1,29 +1,60 @@
|
|
|
1
|
-
const fs = require(
|
|
2
|
-
const path = require(
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
3
|
|
|
4
|
-
let packageJsonPath = process.cwd()
|
|
4
|
+
let packageJsonPath = process.cwd();
|
|
5
5
|
|
|
6
|
-
while (!fs.existsSync(path.join(packageJsonPath,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
while (!fs.existsSync(path.join(packageJsonPath, "package.json"))) {
|
|
7
|
+
packageJsonPath = path.dirname(packageJsonPath);
|
|
8
|
+
if (packageJsonPath === path.resolve("/")) {
|
|
9
|
+
packageJsonPath = null;
|
|
10
|
+
break;
|
|
11
|
+
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
let workspacePackageJsonPath = packageJsonPath
|
|
15
|
+
? path.dirname(packageJsonPath)
|
|
16
|
+
: "/";
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
while (!fs.existsSync(path.join(workspacePackageJsonPath, "package.json"))) {
|
|
19
|
+
workspacePackageJsonPath = path.dirname(workspacePackageJsonPath);
|
|
20
|
+
if (workspacePackageJsonPath === path.resolve("/")) {
|
|
21
|
+
workspacePackageJsonPath = null;
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const packageJson =
|
|
27
|
+
packageJsonPath === null
|
|
28
|
+
? null
|
|
29
|
+
: require(path.join(packageJsonPath, "package.json"));
|
|
30
|
+
|
|
31
|
+
let workspaceJson =
|
|
32
|
+
workspacePackageJsonPath === null
|
|
33
|
+
? null
|
|
34
|
+
: require(path.join(workspacePackageJsonPath, "package.json"));
|
|
35
|
+
|
|
36
|
+
if (!workspaceJson?.workspaces) {
|
|
37
|
+
workspaceJson = null;
|
|
29
38
|
}
|
|
39
|
+
|
|
40
|
+
const dependencies = new Set([
|
|
41
|
+
...(packageJson?.dependencies ? Object.keys(packageJson.dependencies) : []),
|
|
42
|
+
...(packageJson?.devDependencies
|
|
43
|
+
? Object.keys(packageJson.devDependencies)
|
|
44
|
+
: []),
|
|
45
|
+
...(workspaceJson?.dependencies
|
|
46
|
+
? Object.keys(workspaceJson?.dependencies)
|
|
47
|
+
: []),
|
|
48
|
+
...(workspaceJson?.devDependencies
|
|
49
|
+
? Object.keys(workspaceJson?.devDependencies)
|
|
50
|
+
: []),
|
|
51
|
+
]);
|
|
52
|
+
|
|
53
|
+
const has = (...libs) => libs.some((name) => dependencies.has(name));
|
|
54
|
+
|
|
55
|
+
module.exports = {
|
|
56
|
+
react: has("react"),
|
|
57
|
+
next: has("next"),
|
|
58
|
+
typescript: has("typescript"),
|
|
59
|
+
jest: has("jest"),
|
|
60
|
+
};
|
package/package.json
CHANGED
|
@@ -1,44 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lidofinance/eslint-config",
|
|
3
|
-
"
|
|
3
|
+
"description": "Automated, non-opinionated ESLint config foundation",
|
|
4
|
+
"repository": "git@github.com:lidofinance/warehouse.git",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"version": "0.11.0",
|
|
4
7
|
"main": "auto.js",
|
|
5
|
-
"license": "unlicensed (yet)",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"typescript": "4.6"
|
|
8
|
-
},
|
|
9
8
|
"scripts": {
|
|
10
|
-
"lint": "eslint
|
|
9
|
+
"lint": "eslint .",
|
|
10
|
+
"lint:fix": "eslint --fix ."
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@typescript-eslint/
|
|
14
|
-
"@typescript-eslint/
|
|
15
|
-
"eslint": "^
|
|
16
|
-
"eslint-
|
|
17
|
-
"eslint-
|
|
18
|
-
"eslint-plugin-
|
|
19
|
-
"eslint-plugin-
|
|
20
|
-
"eslint-plugin-
|
|
21
|
-
"eslint-plugin-
|
|
22
|
-
"eslint-plugin-react
|
|
23
|
-
"eslint-plugin-
|
|
24
|
-
"eslint-plugin-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
13
|
+
"@typescript-eslint/parser": "^5.46.0",
|
|
14
|
+
"@typescript-eslint/eslint-plugin": "^5",
|
|
15
|
+
"eslint-import-resolver-node": "^0.3.6",
|
|
16
|
+
"eslint-config-prettier": "^8.5.0",
|
|
17
|
+
"eslint-import-resolver-typescript": "^3",
|
|
18
|
+
"eslint-plugin-eslint-comments": "^3",
|
|
19
|
+
"eslint-plugin-import": "^2",
|
|
20
|
+
"eslint-plugin-jest": "^27",
|
|
21
|
+
"eslint-plugin-promise": "^6",
|
|
22
|
+
"eslint-plugin-react": "^7",
|
|
23
|
+
"eslint-plugin-react-hooks": "^4",
|
|
24
|
+
"eslint-plugin-sonarjs": "^0.14.0",
|
|
25
|
+
"eslint-plugin-unicorn": "^45",
|
|
26
|
+
"@next/eslint-plugin-next": "^13",
|
|
27
|
+
"eslint-plugin-prettier": "^4",
|
|
28
|
+
"eslint": "^8.29"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"typescript": "^4.7"
|
|
27
32
|
},
|
|
28
33
|
"devDependencies": {
|
|
29
|
-
"
|
|
30
|
-
"@typescript-eslint/parser": "^5.
|
|
31
|
-
"eslint": "^
|
|
32
|
-
"eslint-
|
|
33
|
-
"eslint-
|
|
34
|
-
"eslint-
|
|
35
|
-
"eslint-plugin-
|
|
36
|
-
"eslint-plugin-
|
|
37
|
-
"eslint-plugin-
|
|
38
|
-
"eslint-plugin-
|
|
39
|
-
"eslint-plugin-
|
|
40
|
-
"eslint-plugin-
|
|
41
|
-
"
|
|
42
|
-
"
|
|
34
|
+
"prettier": "^2.8.0",
|
|
35
|
+
"@typescript-eslint/parser": "^5.46.0",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^5",
|
|
37
|
+
"eslint-import-resolver-node": "^0.3.6",
|
|
38
|
+
"eslint-config-prettier": "^8.5.0",
|
|
39
|
+
"eslint-import-resolver-typescript": "^3",
|
|
40
|
+
"eslint-plugin-eslint-comments": "^3",
|
|
41
|
+
"eslint-plugin-import": "^2",
|
|
42
|
+
"eslint-plugin-jest": "^27",
|
|
43
|
+
"eslint-plugin-promise": "^6",
|
|
44
|
+
"eslint-plugin-react": "^7",
|
|
45
|
+
"eslint-plugin-react-hooks": "^4",
|
|
46
|
+
"eslint-plugin-sonarjs": "^0.14.0",
|
|
47
|
+
"eslint-plugin-unicorn": "^45",
|
|
48
|
+
"@next/eslint-plugin-next": "^13",
|
|
49
|
+
"eslint-plugin-prettier": "^4",
|
|
50
|
+
"eslint": "^8.29"
|
|
43
51
|
}
|
|
44
52
|
}
|