@keeex/eslint-config 2.8.1 → 2.9.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/README.md +2 -0
- package/package.json +1 -1
- package/src/config/typescript.js +30 -0
- package/src/defaults.js +1 -1
- package/src/index.js +1 -0
package/README.md
CHANGED
|
@@ -205,6 +205,8 @@ is automatically enabled.
|
|
|
205
205
|
Set to `true` (the default value) to enable all TypeScript rules.
|
|
206
206
|
This includes tsdoc rules.
|
|
207
207
|
|
|
208
|
+
If the tslib configuration uses the `tolerant` setting, relaxed rules are used.
|
|
209
|
+
|
|
208
210
|
## Dependencies
|
|
209
211
|
|
|
210
212
|
This configuration depends on various packages to be available depending on the user settings for
|
package/package.json
CHANGED
package/src/config/typescript.js
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
import * as nodeFs from "node:fs";
|
|
2
|
+
|
|
1
3
|
import tsdocPlugin from "eslint-plugin-tsdoc";
|
|
2
4
|
import tseslint from "typescript-eslint";
|
|
3
5
|
|
|
4
6
|
import * as sections from "../sections.js";
|
|
5
7
|
|
|
8
|
+
const getTslibConfig = () => {
|
|
9
|
+
const pkgData = nodeFs.readFileSync("package.json", "utf8");
|
|
10
|
+
const pkg = JSON.parse(pkgData);
|
|
11
|
+
const tslib = pkg.tslib;
|
|
12
|
+
if (!tslib) return {tolerant: false};
|
|
13
|
+
return {tolerant: Boolean(tslib.tolerant)};
|
|
14
|
+
};
|
|
15
|
+
|
|
6
16
|
const filterForFiles = (rules, files) => rules.map((c) => ({...c, files}));
|
|
7
17
|
|
|
8
18
|
/**
|
|
@@ -80,4 +90,24 @@ export const apply = (configResult, eslintConfig) => {
|
|
|
80
90
|
plugins: {tsdoc: tsdocPlugin},
|
|
81
91
|
rules: {"tsdoc/syntax": "warn"},
|
|
82
92
|
});
|
|
93
|
+
const tslib = getTslibConfig();
|
|
94
|
+
if (tslib.tolerant) {
|
|
95
|
+
const relax = sections.getNamedSection(configResult, "keeex/typescript-migration");
|
|
96
|
+
sections.configureRules(relax, "@typescript-eslint", {
|
|
97
|
+
'@typescript-eslint/ban-ts-comment': ['error', {
|
|
98
|
+
'ts-expect-error': 'allow-with-description',
|
|
99
|
+
'ts-nocheck': 'allow-with-description',
|
|
100
|
+
}],
|
|
101
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
102
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
103
|
+
'@typescript-eslint/no-this-alias': 'warn',
|
|
104
|
+
'@typescript-eslint/no-unnecessary-condition': 'off',
|
|
105
|
+
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
106
|
+
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
107
|
+
'@typescript-eslint/no-unsafe-call': 'off',
|
|
108
|
+
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
109
|
+
'@typescript-eslint/no-unsafe-return': 'off',
|
|
110
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
|
111
|
+
});
|
|
112
|
+
}
|
|
83
113
|
};
|
package/src/defaults.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** List of ignored patterns by default */
|
|
2
|
-
export const ignores = ["lib", "libreactnative", "web", "gen", "src/gen"];
|
|
2
|
+
export const ignores = ["lib", "libreactnative", "web", "gen", "src/gen", "pkg/dist"];
|
|
3
3
|
|
|
4
4
|
/** Default globals affected to all projects */
|
|
5
5
|
export const globals = [
|