@storm-software/linting-tools 1.30.0 → 1.30.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/CHANGELOG.md +35 -0
- package/README.md +5 -2
- package/jest.config.ts +11 -0
- package/package.json +2 -2
- package/project.json +96 -0
- package/src/alex/index.ts +82 -0
- package/src/cli/index.ts +289 -0
- package/src/eslint/{json/index.js → constants.ts} +39 -52
- package/src/eslint/graphql/{index.js → index.ts} +4 -12
- package/src/eslint/index.ts +7 -0
- package/src/eslint/javascript/index.ts +22 -0
- package/src/eslint/jest/index.ts +16 -0
- package/src/eslint/json/index.ts +37 -0
- package/src/eslint/next/index.ts +25 -0
- package/src/eslint/react/index.ts +25 -0
- package/src/eslint/rules/import.ts +88 -0
- package/src/eslint/rules/jsx-a11y.ts +8 -0
- package/src/eslint/{react/index.js → rules/react.ts} +3 -44
- package/src/eslint/{javascript/index.js → rules/storm.ts} +3 -144
- package/src/eslint/rules/ts-docs.ts +12 -0
- package/src/eslint/rules/unicorn.ts +23 -0
- package/src/eslint/typescript/index.ts +144 -0
- package/src/manypkg/index.ts +179 -0
- package/tsconfig.json +24 -0
- package/tsconfig.lib.json +11 -0
- package/tsconfig.spec.json +13 -0
- package/LICENSE +0 -201
- package/bin/lint.js +0 -327122
- package/src/cli/index.js +0 -326741
- package/src/eslint/jest/index.js +0 -24
- package/src/eslint/next/index.js +0 -95
- package/src/eslint/typescript/index.js +0 -577
- package/src/manypkg/index.js +0 -30474
- /package/{alex → src/alex}/.alexignore +0 -0
- /package/{alex → src/alex}/.alexrc +0 -0
- /package/{biome → src/biome}/biome.json +0 -0
- /package/{cspell → src/cspell}/config.json +0 -0
- /package/{cspell → src/cspell}/dictionary.txt +0 -0
- /package/{prettier → src/prettier}/.prettierignore +0 -0
- /package/{prettier → src/prettier}/config.json +0 -0
- /package/{tsconfig → src/tsconfig}/reset.d.ts +0 -0
- /package/{tsconfig → src/tsconfig}/tsconfig.root.json +0 -0
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import _path from 'node:path';
|
|
3
|
-
import { createRequire as topLevelCreateRequire } from 'module';
|
|
4
|
-
const require = topLevelCreateRequire(import.meta.url);
|
|
5
|
-
const __filename = _fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = _path.dirname(__filename);
|
|
1
|
+
import { Linter } from "eslint";
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
var config = {
|
|
3
|
+
const config: Linter.Config = {
|
|
10
4
|
root: true,
|
|
11
5
|
overrides: [
|
|
12
6
|
{
|
|
@@ -127,7 +121,5 @@ var config = {
|
|
|
127
121
|
}
|
|
128
122
|
]
|
|
129
123
|
};
|
|
130
|
-
|
|
131
|
-
export
|
|
132
|
-
graphql_default as default
|
|
133
|
-
};
|
|
124
|
+
|
|
125
|
+
export default config;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Linter } from "eslint";
|
|
2
|
+
import importRules from "../rules/import";
|
|
3
|
+
import stormRules from "../rules/storm";
|
|
4
|
+
import unicornRules from "../rules/unicorn";
|
|
5
|
+
|
|
6
|
+
const config: Linter.Config = {
|
|
7
|
+
root: true,
|
|
8
|
+
overrides: [
|
|
9
|
+
{
|
|
10
|
+
files: ["*.js", "*.jsx"],
|
|
11
|
+
extends: ["plugin:@nx/javascript"],
|
|
12
|
+
plugins: ["unicorn", "import"],
|
|
13
|
+
rules: {
|
|
14
|
+
...importRules,
|
|
15
|
+
...unicornRules,
|
|
16
|
+
...stormRules
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default config;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Linter } from "eslint";
|
|
2
|
+
|
|
3
|
+
const config: Linter.Config = {
|
|
4
|
+
root: true,
|
|
5
|
+
overrides: [
|
|
6
|
+
{
|
|
7
|
+
files: ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
|
|
8
|
+
env: {
|
|
9
|
+
jest: true
|
|
10
|
+
},
|
|
11
|
+
rules: {}
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default config;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Linter } from "eslint";
|
|
2
|
+
import { CODE_BLOCK } from "../constants";
|
|
3
|
+
|
|
4
|
+
const JSONC_FILES = [
|
|
5
|
+
"tsconfig.json",
|
|
6
|
+
"tsconfig.base.json",
|
|
7
|
+
"nx.json",
|
|
8
|
+
".vscode/launch.json"
|
|
9
|
+
];
|
|
10
|
+
const config: Linter.Config = {
|
|
11
|
+
root: true,
|
|
12
|
+
overrides: [
|
|
13
|
+
{
|
|
14
|
+
files: "*.json",
|
|
15
|
+
excludedFiles: JSONC_FILES,
|
|
16
|
+
extends: "plugin:jsonc/recommended-with-json"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
files: ["*.jsonc", ...JSONC_FILES],
|
|
20
|
+
extends: "plugin:jsonc/recommended-with-jsonc"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
files: "*.json5",
|
|
24
|
+
extends: "plugin:jsonc/recommended-with-json5"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
files: "*.json{,c,5}",
|
|
28
|
+
excludedFiles: CODE_BLOCK,
|
|
29
|
+
plugins: ["unicorn"],
|
|
30
|
+
rules: {
|
|
31
|
+
"unicorn/filename-case": "error"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default config;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { JS_FILES } from "../constants";
|
|
2
|
+
|
|
3
|
+
const babelOptions = {
|
|
4
|
+
presets: (() => {
|
|
5
|
+
try {
|
|
6
|
+
require.resolve("next/babel");
|
|
7
|
+
return ["next/babel"];
|
|
8
|
+
} catch (e) {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
})()
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const config = {
|
|
15
|
+
root: true,
|
|
16
|
+
extends: ["plugin:@next/next/recommended"],
|
|
17
|
+
overrides: [
|
|
18
|
+
{
|
|
19
|
+
files: JS_FILES,
|
|
20
|
+
parserOptions: { babelOptions }
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default config;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Linter } from "eslint";
|
|
2
|
+
import reactRules from "../rules/react";
|
|
3
|
+
import jsxA11yRules from "../rules/ts-docs";
|
|
4
|
+
|
|
5
|
+
const config: Linter.Config = {
|
|
6
|
+
root: true,
|
|
7
|
+
extends: [
|
|
8
|
+
"plugin:react/recommended",
|
|
9
|
+
"plugin:react-hooks/recommended",
|
|
10
|
+
"plugin:jsx-a11y/recommended",
|
|
11
|
+
"plugin:import/react",
|
|
12
|
+
"prettier"
|
|
13
|
+
],
|
|
14
|
+
settings: {
|
|
15
|
+
react: {
|
|
16
|
+
version: "detect"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
rules: {
|
|
20
|
+
...jsxA11yRules,
|
|
21
|
+
...reactRules
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default config;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Linter } from "eslint";
|
|
2
|
+
|
|
3
|
+
const config: Linter.RulesRecord = {
|
|
4
|
+
/**
|
|
5
|
+
* Disallow non-import statements appearing before import statements.
|
|
6
|
+
*
|
|
7
|
+
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
|
|
8
|
+
*/
|
|
9
|
+
"import/first": "error",
|
|
10
|
+
/**
|
|
11
|
+
* Require a newline after the last import/require.
|
|
12
|
+
*
|
|
13
|
+
* 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
|
|
14
|
+
*/
|
|
15
|
+
"import/newline-after-import": "warn",
|
|
16
|
+
/**
|
|
17
|
+
* Disallow import of modules using absolute paths.
|
|
18
|
+
*
|
|
19
|
+
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-absolute-path.md
|
|
20
|
+
*/
|
|
21
|
+
"import/no-absolute-path": "error",
|
|
22
|
+
/**
|
|
23
|
+
* Disallow cyclical dependencies between modules.
|
|
24
|
+
*
|
|
25
|
+
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md
|
|
26
|
+
*/
|
|
27
|
+
"import/no-cycle": "error",
|
|
28
|
+
/**
|
|
29
|
+
* Disallow default exports.
|
|
30
|
+
*
|
|
31
|
+
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
|
|
32
|
+
*/
|
|
33
|
+
"import/no-default-export": "error",
|
|
34
|
+
/**
|
|
35
|
+
* Disallow the use of extraneous packages.
|
|
36
|
+
*
|
|
37
|
+
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md
|
|
38
|
+
*/
|
|
39
|
+
"import/no-extraneous-dependencies": [
|
|
40
|
+
"error",
|
|
41
|
+
{ includeInternal: true, includeTypes: true }
|
|
42
|
+
],
|
|
43
|
+
/**
|
|
44
|
+
* Disallow mutable exports.
|
|
45
|
+
*
|
|
46
|
+
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-mutable-exports.md
|
|
47
|
+
*/
|
|
48
|
+
"import/no-mutable-exports": "error",
|
|
49
|
+
/**
|
|
50
|
+
* Disallow importing packages through relative paths.
|
|
51
|
+
*
|
|
52
|
+
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-packages.md
|
|
53
|
+
*/
|
|
54
|
+
"import/no-relative-packages": "warn",
|
|
55
|
+
/**
|
|
56
|
+
* Disallow a module from importing itself.
|
|
57
|
+
*
|
|
58
|
+
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-self-import.md
|
|
59
|
+
*/
|
|
60
|
+
"import/no-self-import": "error",
|
|
61
|
+
/**
|
|
62
|
+
* Ensures that there are no useless path segments.
|
|
63
|
+
*
|
|
64
|
+
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md
|
|
65
|
+
*/
|
|
66
|
+
"import/no-useless-path-segments": ["error"],
|
|
67
|
+
/**
|
|
68
|
+
* Enforce a module import order convention.
|
|
69
|
+
*
|
|
70
|
+
* 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
|
|
71
|
+
*/
|
|
72
|
+
"import/order": [
|
|
73
|
+
"warn",
|
|
74
|
+
{
|
|
75
|
+
groups: [
|
|
76
|
+
"builtin", // Node.js built-in modules
|
|
77
|
+
"external", // Packages
|
|
78
|
+
"internal", // Aliased modules
|
|
79
|
+
"parent", // Relative parent
|
|
80
|
+
"sibling", // Relative sibling
|
|
81
|
+
"index" // Relative index
|
|
82
|
+
],
|
|
83
|
+
"newlines-between": "never"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export default config;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import _path from 'node:path';
|
|
3
|
-
import { createRequire as topLevelCreateRequire } from 'module';
|
|
4
|
-
const require = topLevelCreateRequire(import.meta.url);
|
|
5
|
-
const __filename = _fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = _path.dirname(__filename);
|
|
1
|
+
import { Linter } from "eslint";
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
var config = {
|
|
3
|
+
const config: Linter.RulesRecord = {
|
|
10
4
|
// We recommend using TypeScript over `prop-types`, as `prop-types` can add
|
|
11
5
|
// to a project's build size.
|
|
12
6
|
"react/prop-types": "off",
|
|
@@ -105,40 +99,5 @@ var config = {
|
|
|
105
99
|
*/
|
|
106
100
|
"react/self-closing-comp": "warn"
|
|
107
101
|
};
|
|
108
|
-
var react_default = config;
|
|
109
102
|
|
|
110
|
-
|
|
111
|
-
var config2 = {
|
|
112
|
-
/**
|
|
113
|
-
* Require TSDoc comments conform to the TSDoc specification.
|
|
114
|
-
*
|
|
115
|
-
* 🚫 Not fixable - https://github.com/microsoft/tsdoc/tree/master/eslint-plugin
|
|
116
|
-
*/
|
|
117
|
-
"tsdoc/syntax": "error"
|
|
118
|
-
};
|
|
119
|
-
var ts_docs_default = config2;
|
|
120
|
-
|
|
121
|
-
// packages/linting-tools/src/eslint/react/index.ts
|
|
122
|
-
var config3 = {
|
|
123
|
-
root: true,
|
|
124
|
-
extends: [
|
|
125
|
-
"plugin:react/recommended",
|
|
126
|
-
"plugin:react-hooks/recommended",
|
|
127
|
-
"plugin:jsx-a11y/recommended",
|
|
128
|
-
"plugin:import/react",
|
|
129
|
-
"prettier"
|
|
130
|
-
],
|
|
131
|
-
settings: {
|
|
132
|
-
react: {
|
|
133
|
-
version: "detect"
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
rules: {
|
|
137
|
-
...ts_docs_default,
|
|
138
|
-
...react_default
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
var react_default2 = config3;
|
|
142
|
-
export {
|
|
143
|
-
react_default2 as default
|
|
144
|
-
};
|
|
103
|
+
export default config;
|
|
@@ -1,105 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import _path from 'node:path';
|
|
3
|
-
import { createRequire as topLevelCreateRequire } from 'module';
|
|
4
|
-
const require = topLevelCreateRequire(import.meta.url);
|
|
5
|
-
const __filename = _fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = _path.dirname(__filename);
|
|
1
|
+
import { Linter } from "eslint";
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
var config = {
|
|
10
|
-
/**
|
|
11
|
-
* Disallow non-import statements appearing before import statements.
|
|
12
|
-
*
|
|
13
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
|
|
14
|
-
*/
|
|
15
|
-
"import/first": "error",
|
|
16
|
-
/**
|
|
17
|
-
* Require a newline after the last import/require.
|
|
18
|
-
*
|
|
19
|
-
* 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
|
|
20
|
-
*/
|
|
21
|
-
"import/newline-after-import": "warn",
|
|
22
|
-
/**
|
|
23
|
-
* Disallow import of modules using absolute paths.
|
|
24
|
-
*
|
|
25
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-absolute-path.md
|
|
26
|
-
*/
|
|
27
|
-
"import/no-absolute-path": "error",
|
|
28
|
-
/**
|
|
29
|
-
* Disallow cyclical dependencies between modules.
|
|
30
|
-
*
|
|
31
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md
|
|
32
|
-
*/
|
|
33
|
-
"import/no-cycle": "error",
|
|
34
|
-
/**
|
|
35
|
-
* Disallow default exports.
|
|
36
|
-
*
|
|
37
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
|
|
38
|
-
*/
|
|
39
|
-
"import/no-default-export": "error",
|
|
40
|
-
/**
|
|
41
|
-
* Disallow the use of extraneous packages.
|
|
42
|
-
*
|
|
43
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md
|
|
44
|
-
*/
|
|
45
|
-
"import/no-extraneous-dependencies": [
|
|
46
|
-
"error",
|
|
47
|
-
{ includeInternal: true, includeTypes: true }
|
|
48
|
-
],
|
|
49
|
-
/**
|
|
50
|
-
* Disallow mutable exports.
|
|
51
|
-
*
|
|
52
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-mutable-exports.md
|
|
53
|
-
*/
|
|
54
|
-
"import/no-mutable-exports": "error",
|
|
55
|
-
/**
|
|
56
|
-
* Disallow importing packages through relative paths.
|
|
57
|
-
*
|
|
58
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-packages.md
|
|
59
|
-
*/
|
|
60
|
-
"import/no-relative-packages": "warn",
|
|
61
|
-
/**
|
|
62
|
-
* Disallow a module from importing itself.
|
|
63
|
-
*
|
|
64
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-self-import.md
|
|
65
|
-
*/
|
|
66
|
-
"import/no-self-import": "error",
|
|
67
|
-
/**
|
|
68
|
-
* Ensures that there are no useless path segments.
|
|
69
|
-
*
|
|
70
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md
|
|
71
|
-
*/
|
|
72
|
-
"import/no-useless-path-segments": ["error"],
|
|
73
|
-
/**
|
|
74
|
-
* Enforce a module import order convention.
|
|
75
|
-
*
|
|
76
|
-
* 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
|
|
77
|
-
*/
|
|
78
|
-
"import/order": [
|
|
79
|
-
"warn",
|
|
80
|
-
{
|
|
81
|
-
groups: [
|
|
82
|
-
"builtin",
|
|
83
|
-
// Node.js built-in modules
|
|
84
|
-
"external",
|
|
85
|
-
// Packages
|
|
86
|
-
"internal",
|
|
87
|
-
// Aliased modules
|
|
88
|
-
"parent",
|
|
89
|
-
// Relative parent
|
|
90
|
-
"sibling",
|
|
91
|
-
// Relative sibling
|
|
92
|
-
"index"
|
|
93
|
-
// Relative index
|
|
94
|
-
],
|
|
95
|
-
"newlines-between": "never"
|
|
96
|
-
}
|
|
97
|
-
]
|
|
98
|
-
};
|
|
99
|
-
var import_default = config;
|
|
100
|
-
|
|
101
|
-
// packages/linting-tools/src/eslint/rules/storm.ts
|
|
102
|
-
var config2 = {
|
|
3
|
+
const config: Linter.RulesRecord = {
|
|
103
4
|
/**
|
|
104
5
|
* Require return statements in array methods callbacks.
|
|
105
6
|
*
|
|
@@ -330,47 +231,5 @@ var config2 = {
|
|
|
330
231
|
*/
|
|
331
232
|
yoda: "warn"
|
|
332
233
|
};
|
|
333
|
-
var storm_default = config2;
|
|
334
234
|
|
|
335
|
-
|
|
336
|
-
var config3 = {
|
|
337
|
-
/**
|
|
338
|
-
* Require consistent filename case for all linted files.
|
|
339
|
-
*
|
|
340
|
-
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
|
|
341
|
-
*/
|
|
342
|
-
"unicorn/filename-case": [
|
|
343
|
-
"error",
|
|
344
|
-
{
|
|
345
|
-
case: "kebabCase"
|
|
346
|
-
}
|
|
347
|
-
],
|
|
348
|
-
/**
|
|
349
|
-
* Require using the `node:` protocol when importing Node.js built-in modules.
|
|
350
|
-
*
|
|
351
|
-
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
352
|
-
*/
|
|
353
|
-
"unicorn/prefer-node-protocol": "warn"
|
|
354
|
-
};
|
|
355
|
-
var unicorn_default = config3;
|
|
356
|
-
|
|
357
|
-
// packages/linting-tools/src/eslint/javascript/index.ts
|
|
358
|
-
var config4 = {
|
|
359
|
-
root: true,
|
|
360
|
-
overrides: [
|
|
361
|
-
{
|
|
362
|
-
files: ["*.js", "*.jsx"],
|
|
363
|
-
extends: ["plugin:@nx/javascript"],
|
|
364
|
-
plugins: ["unicorn", "import"],
|
|
365
|
-
rules: {
|
|
366
|
-
...import_default,
|
|
367
|
-
...unicorn_default,
|
|
368
|
-
...storm_default
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
]
|
|
372
|
-
};
|
|
373
|
-
var javascript_default = config4;
|
|
374
|
-
export {
|
|
375
|
-
javascript_default as default
|
|
376
|
-
};
|
|
235
|
+
export default config;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Linter } from "eslint";
|
|
2
|
+
|
|
3
|
+
const config: Linter.RulesRecord = {
|
|
4
|
+
/**
|
|
5
|
+
* Require TSDoc comments conform to the TSDoc specification.
|
|
6
|
+
*
|
|
7
|
+
* 🚫 Not fixable - https://github.com/microsoft/tsdoc/tree/master/eslint-plugin
|
|
8
|
+
*/
|
|
9
|
+
"tsdoc/syntax": "error"
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default config;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Linter } from "eslint";
|
|
2
|
+
|
|
3
|
+
const config: Linter.RulesRecord = {
|
|
4
|
+
/**
|
|
5
|
+
* Require consistent filename case for all linted files.
|
|
6
|
+
*
|
|
7
|
+
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
|
|
8
|
+
*/
|
|
9
|
+
"unicorn/filename-case": [
|
|
10
|
+
"error",
|
|
11
|
+
{
|
|
12
|
+
case: "kebabCase"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
/**
|
|
16
|
+
* Require using the `node:` protocol when importing Node.js built-in modules.
|
|
17
|
+
*
|
|
18
|
+
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
19
|
+
*/
|
|
20
|
+
"unicorn/prefer-node-protocol": "warn"
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default config;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Linter } from "eslint";
|
|
2
|
+
import {
|
|
3
|
+
RESTRICTED_GLOBALS,
|
|
4
|
+
RESTRICTED_MODULES,
|
|
5
|
+
RESTRICTED_SYNTAX
|
|
6
|
+
} from "../constants";
|
|
7
|
+
import importRules from "../rules/import";
|
|
8
|
+
import stormRules from "../rules/storm";
|
|
9
|
+
import tsDocsRules from "../rules/ts-docs";
|
|
10
|
+
import unicornRules from "../rules/unicorn";
|
|
11
|
+
|
|
12
|
+
const config: Linter.Config = {
|
|
13
|
+
root: true,
|
|
14
|
+
overrides: [
|
|
15
|
+
{
|
|
16
|
+
files: ["*.ts", "*.tsx"],
|
|
17
|
+
extends: ["plugin:@nx/typescript"],
|
|
18
|
+
rules: {}
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
parser: "@typescript-eslint/parser",
|
|
22
|
+
extends: [
|
|
23
|
+
"eslint:recommended",
|
|
24
|
+
"plugin:@typescript-eslint/recommended",
|
|
25
|
+
"prettier"
|
|
26
|
+
],
|
|
27
|
+
plugins: ["sonarjs", "unicorn", "promise", "import", "eslint-plugin-tsdoc"],
|
|
28
|
+
rules: {
|
|
29
|
+
// Disallows if statements as the only statement in else blocks
|
|
30
|
+
// https://eslint.org/docs/rules/no-lonely-if
|
|
31
|
+
"no-lonely-if": "error",
|
|
32
|
+
// Disallows the use of console
|
|
33
|
+
// https://eslint.org/docs/rules/no-console
|
|
34
|
+
"no-console": "error",
|
|
35
|
+
// Requires method and property shorthand syntax for object literals
|
|
36
|
+
// https://eslint.org/docs/rules/object-shorthand
|
|
37
|
+
"object-shorthand": ["error", "always"],
|
|
38
|
+
// Disallows loops with a body that allows only one iteration
|
|
39
|
+
// https://eslint.org/docs/rules/no-unreachable-loop
|
|
40
|
+
"no-unreachable-loop": "error",
|
|
41
|
+
"sonarjs/no-one-iteration-loop": "off", // similar to 'no-unreachable-loop' but reports less cases
|
|
42
|
+
"prefer-arrow-callback": ["error", { allowNamedFunctions: true }],
|
|
43
|
+
|
|
44
|
+
"sonarjs/no-unused-collection": "error",
|
|
45
|
+
"sonarjs/no-identical-conditions": "error",
|
|
46
|
+
"sonarjs/no-inverted-boolean-check": "error",
|
|
47
|
+
"sonarjs/no-use-of-empty-return-value": "error",
|
|
48
|
+
"sonarjs/no-gratuitous-expressions": "error",
|
|
49
|
+
"sonarjs/no-nested-switch": "error",
|
|
50
|
+
"unicorn/no-lonely-if": "error",
|
|
51
|
+
"sonarjs/no-collapsible-if": "off", // same as 'unicorn/no-lonely-if'
|
|
52
|
+
"unicorn/no-array-push-push": "error",
|
|
53
|
+
"unicorn/no-instanceof-array": "error",
|
|
54
|
+
"unicorn/no-empty-file": "error",
|
|
55
|
+
"unicorn/no-useless-fallback-in-spread": "error",
|
|
56
|
+
"unicorn/prefer-array-find": "error",
|
|
57
|
+
"unicorn/no-useless-spread": "error",
|
|
58
|
+
"unicorn/prefer-includes": "error",
|
|
59
|
+
|
|
60
|
+
// Disallows specified syntax
|
|
61
|
+
// https://eslint.org/docs/rules/no-restricted-syntax
|
|
62
|
+
"no-restricted-syntax": ["error", ...RESTRICTED_SYNTAX],
|
|
63
|
+
"no-else-return": ["error", { allowElseIf: false }],
|
|
64
|
+
"promise/no-nesting": "error",
|
|
65
|
+
|
|
66
|
+
"import/extensions": ["error", "ignorePackages"], // Bob when bundling requires to have `.js` extension
|
|
67
|
+
"import/no-default-export": "error",
|
|
68
|
+
"import/prefer-default-export": "off", // disable opposite of 'import/no-default-export'
|
|
69
|
+
"unicorn/filename-case": "error",
|
|
70
|
+
|
|
71
|
+
"@typescript-eslint/no-unused-vars": [
|
|
72
|
+
"error",
|
|
73
|
+
{
|
|
74
|
+
argsIgnorePattern: "^_",
|
|
75
|
+
varsIgnorePattern: "^_" // allow underscores in destructuring
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
|
|
79
|
+
// Enforce the style of numeric separators by correctly grouping digits
|
|
80
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/numeric-separators-style.md
|
|
81
|
+
"unicorn/numeric-separators-style": "error",
|
|
82
|
+
// Prefer using the node: protocol when importing Node.js builtin modules
|
|
83
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
84
|
+
"unicorn/prefer-node-protocol": "error",
|
|
85
|
+
// Reports any imports that come after non-import statements
|
|
86
|
+
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
|
|
87
|
+
"import/first": "error",
|
|
88
|
+
// Disallow shorthand type conversions
|
|
89
|
+
// https://eslint.org/docs/latest/rules/no-implicit-coercion
|
|
90
|
+
"no-implicit-coercion": [
|
|
91
|
+
"error",
|
|
92
|
+
{
|
|
93
|
+
disallowTemplateShorthand: true,
|
|
94
|
+
// in TypeScript `!!` is preferable https://www.typescriptlang.org/docs/handbook/2/narrowing.html#truthiness-narrowing
|
|
95
|
+
boolean: false
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
// Disallow specified modules when loaded by `import` declarations
|
|
99
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-restricted-import.md
|
|
100
|
+
"n/no-restricted-import": ["error", RESTRICTED_MODULES],
|
|
101
|
+
// Disallow specified modules when loaded by require
|
|
102
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-restricted-require.md
|
|
103
|
+
"n/no-restricted-require": ["error", RESTRICTED_MODULES],
|
|
104
|
+
"no-restricted-modules": "off", // deprecated in favor of corresponding rules from `eslint-plugin-n`
|
|
105
|
+
|
|
106
|
+
// Disallow specified global variables
|
|
107
|
+
// https://eslint.org/docs/latest/rules/no-restricted-globals
|
|
108
|
+
"no-restricted-globals": ["error", ...RESTRICTED_GLOBALS],
|
|
109
|
+
|
|
110
|
+
"@typescript-eslint/no-explicit-any": "error",
|
|
111
|
+
"prefer-const": ["error", { destructuring: "all" }],
|
|
112
|
+
"import/no-duplicates": "error",
|
|
113
|
+
"import/newline-after-import": "off", // prettified by prettier-plugin-sort-imports
|
|
114
|
+
"prefer-object-has-own": "error",
|
|
115
|
+
"logical-assignment-operators": [
|
|
116
|
+
"error",
|
|
117
|
+
"always",
|
|
118
|
+
{ enforceForIfStatements: true }
|
|
119
|
+
],
|
|
120
|
+
"@typescript-eslint/prefer-optional-chain": "error",
|
|
121
|
+
yoda: "error",
|
|
122
|
+
"unicorn/prefer-export-from": ["error", { ignoreUsedVariables: true }],
|
|
123
|
+
"promise/no-multiple-resolved": "error",
|
|
124
|
+
"unicorn/prefer-logical-operator-over-ternary": "error",
|
|
125
|
+
"no-unused-expressions": "off",
|
|
126
|
+
"@typescript-eslint/no-unused-expressions": "error",
|
|
127
|
+
"no-negated-condition": "off",
|
|
128
|
+
"unicorn/no-negated-condition": "error",
|
|
129
|
+
"unicorn/no-array-for-each": "error",
|
|
130
|
+
"unicorn/prefer-string-trim-start-end": "error",
|
|
131
|
+
"no-self-compare": "error",
|
|
132
|
+
eqeqeq: ["error", "always", { null: "ignore" }],
|
|
133
|
+
"import/no-useless-path-segments": "error",
|
|
134
|
+
"require-await": "off",
|
|
135
|
+
"no-return-await": "off",
|
|
136
|
+
|
|
137
|
+
...importRules,
|
|
138
|
+
...unicornRules,
|
|
139
|
+
...tsDocsRules,
|
|
140
|
+
...stormRules
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export default config;
|