@keeex/eslint-config 2.1.0 → 2.1.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/package.json +2 -1
- package/prettier.config.js +9 -0
- package/src/config/base.js +1 -0
- package/src/config/importx.js +15 -4
- package/src/defaults.js +3 -1
- package/src/environ.js +4 -0
package/package.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"typescript-eslint": "^8.11.0"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
|
+
"prettier.config.js",
|
|
35
36
|
"src"
|
|
36
37
|
],
|
|
37
38
|
"license": "MIT",
|
|
@@ -120,5 +121,5 @@
|
|
|
120
121
|
"test": "echo No test for this project"
|
|
121
122
|
},
|
|
122
123
|
"type": "module",
|
|
123
|
-
"version": "2.1.
|
|
124
|
+
"version": "2.1.2"
|
|
124
125
|
}
|
package/src/config/base.js
CHANGED
|
@@ -63,6 +63,7 @@ export const apply = (configResult, eslintConfig) => {
|
|
|
63
63
|
"no-div-regex": "warn",
|
|
64
64
|
"no-duplicate-imports": "error",
|
|
65
65
|
"no-else-return": "warn",
|
|
66
|
+
"no-empty": ["error", {allowEmptyCatch: true}],
|
|
66
67
|
"no-eq-null": "error",
|
|
67
68
|
"no-eval": "error",
|
|
68
69
|
"no-extend-native": "error",
|
package/src/config/importx.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import eslintPluginImportX from "eslint-plugin-import-x";
|
|
2
2
|
|
|
3
|
+
import {isFullCheck} from "../environ.js";
|
|
3
4
|
import * as sections from "../sections.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -66,18 +67,28 @@ export const apply = (configResult, eslintConfig) => {
|
|
|
66
67
|
sections.configureRules(override, "import-x", {"no-cycle": "error"});
|
|
67
68
|
}
|
|
68
69
|
if (eslintConfig.typescript) {
|
|
69
|
-
sections.
|
|
70
|
+
const tsOverride = sections.getNamedSection(configResult, "keeex/importx-override-typescript");
|
|
71
|
+
sections.configureRules(tsOverride, "import-x", {
|
|
72
|
+
"default": "off",
|
|
73
|
+
"namespace": "off",
|
|
70
74
|
"no-extraneous-dependencies": ["error", {includeTypes: true}],
|
|
75
|
+
"no-named-as-default-member": "off",
|
|
76
|
+
"no-unresolved": "off",
|
|
71
77
|
});
|
|
78
|
+
if (!isFullCheck()) {
|
|
79
|
+
sections.configureRules(tsOverride, "import-x", {
|
|
80
|
+
"no-named-as-default": "off",
|
|
81
|
+
});
|
|
82
|
+
}
|
|
72
83
|
if (eslintConfig.react) {
|
|
73
|
-
sections.sectionAddOption(
|
|
84
|
+
sections.sectionAddOption(tsOverride, "settings", "import-x/extensions", [".ts", ".tsx"]);
|
|
74
85
|
} else {
|
|
75
|
-
sections.sectionAddOption(
|
|
86
|
+
sections.sectionAddOption(tsOverride, "settings", "import-x/extensions", [".ts"]);
|
|
76
87
|
}
|
|
77
88
|
} else {
|
|
78
89
|
sections.configureRules(override, "import-x", {
|
|
79
90
|
"extensions": ["error", "ignorePackages"],
|
|
80
|
-
"no-deprecated": "warn",
|
|
91
|
+
"no-deprecated": isFullCheck() ? "warn" : "off",
|
|
81
92
|
"no-extraneous-dependencies": "error",
|
|
82
93
|
});
|
|
83
94
|
if (eslintConfig.react) {
|
package/src/defaults.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {isFullCheck} from "./environ.js";
|
|
2
|
+
|
|
1
3
|
/** List of ignored patterns by default */
|
|
2
4
|
export const ignores = ["lib", "web", "gen", "src/gen"];
|
|
3
5
|
|
|
@@ -35,4 +37,4 @@ export const globals = [
|
|
|
35
37
|
];
|
|
36
38
|
|
|
37
39
|
/** Import cycle max depth */
|
|
38
|
-
export const cycleMaxDepth =
|
|
40
|
+
export const cycleMaxDepth = isFullCheck() ? true : 0;
|
package/src/environ.js
CHANGED
|
@@ -5,3 +5,7 @@ export const setDepCheck = () => {
|
|
|
5
5
|
|
|
6
6
|
/** Check the depcheck flag */
|
|
7
7
|
export const isDepCheck = () => process.env.KEEEX_DEPCHECK === "true";
|
|
8
|
+
|
|
9
|
+
/** Enable deeper checks */
|
|
10
|
+
export const isFullCheck = () =>
|
|
11
|
+
process.env.KXESLINT === "full" || process.env.GIT_HOOK_NAME === "pre-push";
|