@itstandu/code-style 1.2.1 → 1.2.3
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/eslint/base.js +0 -3
- package/eslint/javascript.js +1 -0
- package/eslint/recommended.js +1 -1
- package/eslint/typescript.js +26 -0
- package/package.json +1 -1
package/eslint/base.js
CHANGED
package/eslint/javascript.js
CHANGED
package/eslint/recommended.js
CHANGED
|
@@ -40,7 +40,7 @@ module.exports = {
|
|
|
40
40
|
|
|
41
41
|
// Import hygiene
|
|
42
42
|
'import/no-unresolved': 'off',
|
|
43
|
-
'import/no-cycle': '
|
|
43
|
+
'import/no-cycle': 'off', // Requires TypeScript resolver - enable in TypeScript config
|
|
44
44
|
'import/no-self-import': 'error',
|
|
45
45
|
'import/no-useless-path-segments': 'error',
|
|
46
46
|
'import/no-mutable-exports': 'error',
|
package/eslint/typescript.js
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
const base = require('./base');
|
|
2
2
|
|
|
3
|
+
// Try to load TypeScript resolver, but don't fail if not available
|
|
4
|
+
let typescriptResolver = null;
|
|
5
|
+
try {
|
|
6
|
+
require.resolve('eslint-import-resolver-typescript');
|
|
7
|
+
typescriptResolver = {
|
|
8
|
+
typescript: {
|
|
9
|
+
alwaysTryTypes: true,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
} catch (e) {
|
|
13
|
+
// Resolver not available, skip
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const settings = {
|
|
17
|
+
...base.settings,
|
|
18
|
+
'import/resolver': {
|
|
19
|
+
...base.settings['import/resolver'],
|
|
20
|
+
...typescriptResolver,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
3
24
|
module.exports = {
|
|
4
25
|
...base,
|
|
26
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
5
27
|
languageOptions: {
|
|
6
28
|
...base.languageOptions,
|
|
7
29
|
parser: require('@typescript-eslint/parser'),
|
|
@@ -16,6 +38,7 @@ module.exports = {
|
|
|
16
38
|
...base.plugins,
|
|
17
39
|
'@typescript-eslint': require('@typescript-eslint/eslint-plugin'),
|
|
18
40
|
},
|
|
41
|
+
settings,
|
|
19
42
|
rules: {
|
|
20
43
|
...base.rules,
|
|
21
44
|
|
|
@@ -75,5 +98,8 @@ module.exports = {
|
|
|
75
98
|
'@typescript-eslint/no-redundant-type-constituents': 'warn',
|
|
76
99
|
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
|
77
100
|
'@typescript-eslint/no-useless-empty-export': 'warn',
|
|
101
|
+
|
|
102
|
+
// Import hygiene (only enable if TypeScript resolver is available)
|
|
103
|
+
'import/no-cycle': typescriptResolver ? 'warn' : 'off',
|
|
78
104
|
},
|
|
79
105
|
};
|
package/package.json
CHANGED