@darksheep/eslint 5.1.5 → 5.2.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/CHANGELOG.md +14 -0
- package/package.json +8 -6
- package/src/configs/eslint-base.js +4 -4
- package/src/configs/eslint-complexity.js +25 -22
- package/src/configs/eslint-ignores.js +1 -0
- package/src/configs/eslint-recommended.js +4 -1
- package/src/configs/eslint-style.js +4 -1
- package/src/plugins/eslint-comments.js +3 -2
- package/src/plugins/jsdoc.js +2 -0
- package/src/plugins/json.js +5 -3
- package/src/plugins/node.js +4 -0
- package/src/plugins/package-json.js +1 -0
- package/src/plugins/perfectionist.js +6 -7
- package/src/plugins/promise.js +1 -0
- package/src/plugins/react.js +2 -0
- package/src/plugins/regexp.js +8 -7
- package/src/plugins/sca.js +2 -0
- package/src/plugins/security.js +10 -1
- package/src/plugins/sonarjs.js +2 -0
- package/src/plugins/style.js +1 -0
- package/src/plugins/typescript.js +3 -4
- package/src/plugins/unicorn.js +6 -7
- package/src/plugins/unused-imports.js +1 -0
- package/src/utilities/editorconfig.js +2 -0
- package/src/utilities/eslint-files.js +0 -8
- package/types/src/plugins/regexp.d.ts +1 -2
- package/types/src/plugins/unicorn.d.ts +1 -2
- package/types/src/utilities/eslint-files.d.ts +0 -5
- package/src/bin/eslint.cjs +0 -11
- package/types/src/bin/eslint.d.cts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.2.0](https://github.com/DarkSheepSoftware/eslint/compare/v5.1.5...v5.2.0) (2024-08-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### 🌟 Features
|
|
7
|
+
|
|
8
|
+
* remove deprecated rules and add config names ([5765861](https://github.com/DarkSheepSoftware/eslint/commit/57658619314ced4312467ae58bfcc09cee98cf8b))
|
|
9
|
+
* Unbundle eslint ([f0550b5](https://github.com/DarkSheepSoftware/eslint/commit/f0550b5910327b0e9f74e4ee78ca296d279f37b0))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### 📦 Dependencies
|
|
13
|
+
|
|
14
|
+
* **pkg:** update dependency eslint-plugin-perfectionist to v3.1.2 ([#550](https://github.com/DarkSheepSoftware/eslint/issues/550)) ([c0da407](https://github.com/DarkSheepSoftware/eslint/commit/c0da407889520a13f401411974f397c34360bc46))
|
|
15
|
+
* **pkg:** update typescript-eslint monorepo to v8.0.1 ([#551](https://github.com/DarkSheepSoftware/eslint/issues/551)) ([1dfbc75](https://github.com/DarkSheepSoftware/eslint/commit/1dfbc75f37d53aa4ee0df19ab90d01a0964adb68))
|
|
16
|
+
|
|
3
17
|
## [5.1.5](https://github.com/DarkSheepSoftware/eslint/compare/v5.1.4...v5.1.5) (2024-08-05)
|
|
4
18
|
|
|
5
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darksheep/eslint",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/DarkSheepSoftware/eslint"
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"types": "./types/src/index.d.ts",
|
|
16
|
-
"bin": "./src/bin/eslint.cjs",
|
|
17
16
|
"files": [
|
|
18
17
|
"src",
|
|
19
18
|
"types"
|
|
@@ -26,15 +25,14 @@
|
|
|
26
25
|
"@eslint/eslintrc": "3.1.0",
|
|
27
26
|
"@eslint/js": "9.8.0",
|
|
28
27
|
"@stylistic/eslint-plugin": "2.6.1",
|
|
29
|
-
"@typescript-eslint/eslint-plugin": "8.0.
|
|
30
|
-
"@typescript-eslint/parser": "8.0.
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "8.0.1",
|
|
29
|
+
"@typescript-eslint/parser": "8.0.1",
|
|
31
30
|
"editorconfig": "2.0.0",
|
|
32
|
-
"eslint": "9.8.0",
|
|
33
31
|
"eslint-plugin-jsdoc": "48.11.0",
|
|
34
32
|
"eslint-plugin-jsonc": "2.16.0",
|
|
35
33
|
"eslint-plugin-n": "17.10.2",
|
|
36
34
|
"eslint-plugin-package-json": "0.15.2",
|
|
37
|
-
"eslint-plugin-perfectionist": "3.1.
|
|
35
|
+
"eslint-plugin-perfectionist": "3.1.2",
|
|
38
36
|
"eslint-plugin-promise": "7.0.0",
|
|
39
37
|
"eslint-plugin-react": "7.35.0",
|
|
40
38
|
"eslint-plugin-regexp": "2.6.0",
|
|
@@ -51,9 +49,13 @@
|
|
|
51
49
|
"@types/eslint__js": "~8.42.3",
|
|
52
50
|
"@types/estree": "~1.0.2",
|
|
53
51
|
"@types/node": "~20.14.0",
|
|
52
|
+
"eslint": "~9.8.0",
|
|
54
53
|
"type-fest": "~4.23.0",
|
|
55
54
|
"typescript": "~5.5.0"
|
|
56
55
|
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"eslint": "~9.8.0"
|
|
58
|
+
},
|
|
57
59
|
"peerDependenciesMeta": {
|
|
58
60
|
"typescript": {
|
|
59
61
|
"optional": true
|
|
@@ -12,7 +12,6 @@ const rules = {
|
|
|
12
12
|
'no-implied-eval': 'error',
|
|
13
13
|
'no-invalid-this': 'error',
|
|
14
14
|
'no-new-func': 'error',
|
|
15
|
-
'no-process-env': 'off',
|
|
16
15
|
'no-proto': 'error',
|
|
17
16
|
'no-script-url': 'error',
|
|
18
17
|
'no-unexpected-multiline': 'error',
|
|
@@ -36,7 +35,7 @@ const rules = {
|
|
|
36
35
|
'no-const-assign': 'error',
|
|
37
36
|
'no-dupe-class-members': 'error',
|
|
38
37
|
'no-duplicate-imports': 'error',
|
|
39
|
-
'no-new-
|
|
38
|
+
'no-new-native-nonconstructor': 'error',
|
|
40
39
|
'no-restricted-imports': 'error',
|
|
41
40
|
'no-this-before-super': 'error',
|
|
42
41
|
'no-useless-computed-key': 'error',
|
|
@@ -67,6 +66,7 @@ const rules = {
|
|
|
67
66
|
|
|
68
67
|
'eqeqeq': [ 'error', 'always', { null: 'ignore' } ],
|
|
69
68
|
'no-extra-bind': 'error',
|
|
69
|
+
'no-loss-of-precision': 'error',
|
|
70
70
|
'no-useless-call': 'error',
|
|
71
71
|
'no-useless-catch': 'error',
|
|
72
72
|
'no-useless-concat': 'error',
|
|
@@ -76,7 +76,6 @@ const rules = {
|
|
|
76
76
|
'no-octal': 'error',
|
|
77
77
|
'no-octal-escape': 'error',
|
|
78
78
|
'no-return-assign': 'error',
|
|
79
|
-
'no-return-await': 'error',
|
|
80
79
|
'prefer-promise-reject-errors': 'error',
|
|
81
80
|
'require-await': 'off',
|
|
82
81
|
|
|
@@ -93,7 +92,7 @@ const rules = {
|
|
|
93
92
|
'no-array-constructor': 'error',
|
|
94
93
|
'no-lonely-if': 'error',
|
|
95
94
|
'no-negated-condition': 'error',
|
|
96
|
-
'no-
|
|
95
|
+
'no-object-constructor': 'error',
|
|
97
96
|
'no-nested-ternary': 'warn',
|
|
98
97
|
'no-unneeded-ternary': 'warn',
|
|
99
98
|
|
|
@@ -114,6 +113,7 @@ const rules = {
|
|
|
114
113
|
*/
|
|
115
114
|
export async function createEslintBaseConfig() {
|
|
116
115
|
return [ {
|
|
116
|
+
name: 'darksheep/base',
|
|
117
117
|
linterOptions: {
|
|
118
118
|
noInlineConfig: false,
|
|
119
119
|
reportUnusedDisableDirectives: true,
|
|
@@ -3,26 +3,29 @@
|
|
|
3
3
|
* @returns {import('eslint').Linter.FlatConfig[]}
|
|
4
4
|
*/
|
|
5
5
|
export function createEslintComplexityConfig() {
|
|
6
|
-
return [ {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
'
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
6
|
+
return [ {
|
|
7
|
+
name: 'darksheep/complexity',
|
|
8
|
+
rules: {
|
|
9
|
+
'max-depth': [ 'error', 4 ],
|
|
10
|
+
'complexity': 'off',
|
|
11
|
+
'max-lines': [
|
|
12
|
+
'warn',
|
|
13
|
+
{
|
|
14
|
+
max: 512,
|
|
15
|
+
skipBlankLines: true,
|
|
16
|
+
skipComments: true,
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
'max-lines-per-function': [
|
|
20
|
+
'warn',
|
|
21
|
+
{
|
|
22
|
+
max: 120,
|
|
23
|
+
skipBlankLines: true,
|
|
24
|
+
skipComments: true,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
'max-nested-callbacks': [ 'warn', 3 ],
|
|
28
|
+
'max-params': [ 'error', 5 ],
|
|
29
|
+
},
|
|
30
|
+
} ];
|
|
28
31
|
}
|
|
@@ -5,5 +5,8 @@ import js from '@eslint/js';
|
|
|
5
5
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
6
6
|
*/
|
|
7
7
|
export async function createEslintRecommendsConfig() {
|
|
8
|
-
return [
|
|
8
|
+
return [ {
|
|
9
|
+
name: 'eslint/recomended',
|
|
10
|
+
...js.configs.recommended,
|
|
11
|
+
} ];
|
|
9
12
|
}
|
|
@@ -7,6 +7,7 @@ import eslintComments from '@eslint-community/eslint-plugin-eslint-comments';
|
|
|
7
7
|
export function createEslintCommentsConfig() {
|
|
8
8
|
return [
|
|
9
9
|
{
|
|
10
|
+
name: 'eslint-comments/custom',
|
|
10
11
|
plugins: {
|
|
11
12
|
'eslint-comments': eslintComments,
|
|
12
13
|
},
|
|
@@ -18,8 +19,8 @@ export function createEslintCommentsConfig() {
|
|
|
18
19
|
'eslint-comments/no-unused-disable': 'error',
|
|
19
20
|
'eslint-comments/no-unused-enable': 'error',
|
|
20
21
|
|
|
21
|
-
'line-comment-position': 'off',
|
|
22
|
-
'multiline-comment-style': 'off',
|
|
22
|
+
// 'line-comment-position': 'off',
|
|
23
|
+
// 'multiline-comment-style': 'off',
|
|
23
24
|
'no-inline-comments': 'off',
|
|
24
25
|
},
|
|
25
26
|
},
|
package/src/plugins/jsdoc.js
CHANGED
|
@@ -14,6 +14,7 @@ export async function createEslintJSDocConfig(root) {
|
|
|
14
14
|
|
|
15
15
|
return [
|
|
16
16
|
{
|
|
17
|
+
name: 'jsdoc/javascript',
|
|
17
18
|
plugins: { jsdoc },
|
|
18
19
|
settings: {
|
|
19
20
|
jsdoc: {
|
|
@@ -53,6 +54,7 @@ export async function createEslintJSDocConfig(root) {
|
|
|
53
54
|
},
|
|
54
55
|
},
|
|
55
56
|
{
|
|
57
|
+
name: 'jsdoc/typescript',
|
|
56
58
|
files: getTypescriptFiles(),
|
|
57
59
|
rules: {
|
|
58
60
|
'jsdoc/no-types': 'warn',
|
package/src/plugins/json.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import jsonc from 'eslint-plugin-jsonc';
|
|
2
2
|
import parser from 'jsonc-eslint-parser';
|
|
3
3
|
|
|
4
|
-
import { getJsonFiles } from '../utilities/eslint-files.js';
|
|
5
|
-
|
|
6
4
|
/**
|
|
7
5
|
* Get ESLint config for imports check
|
|
8
6
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
@@ -10,22 +8,26 @@ import { getJsonFiles } from '../utilities/eslint-files.js';
|
|
|
10
8
|
export async function createEslintJsonConfig() {
|
|
11
9
|
return [
|
|
12
10
|
{
|
|
13
|
-
|
|
11
|
+
name: 'json/core',
|
|
12
|
+
files: [ '**/*.json', '**/*.jsonc', '**/*.json5' ],
|
|
14
13
|
languageOptions: { parser },
|
|
15
14
|
// @ts-expect-error jsonc does not match the plugin interface
|
|
16
15
|
plugins: { jsonc },
|
|
17
16
|
},
|
|
18
17
|
{
|
|
18
|
+
name: 'json/.json',
|
|
19
19
|
files: [ '**/*.json' ],
|
|
20
20
|
// @ts-expect-error Record<string, string> vs Record<string, 'error'>
|
|
21
21
|
rules: jsonc.configs['recommended-with-json'].rules,
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
+
name: 'json/.jsonc',
|
|
24
25
|
files: [ '**/*.jsonc' ],
|
|
25
26
|
// @ts-expect-error Record<string, string> vs Record<string, 'error'>
|
|
26
27
|
rules: jsonc.configs['recommended-with-jsonc'].rules,
|
|
27
28
|
},
|
|
28
29
|
{
|
|
30
|
+
name: 'json/.json5',
|
|
29
31
|
files: [ '**/*.json5' ],
|
|
30
32
|
// @ts-expect-error Record<string, string> vs Record<string, 'error'>
|
|
31
33
|
rules: jsonc.configs['recommended-with-json5'].rules,
|
package/src/plugins/node.js
CHANGED
|
@@ -22,6 +22,7 @@ const commonRules = {
|
|
|
22
22
|
'n/callback-return': 'error',
|
|
23
23
|
'n/handle-callback-err': 'error',
|
|
24
24
|
'n/no-process-exit': 'warn',
|
|
25
|
+
'n/no-process-env': 'warn',
|
|
25
26
|
'n/no-path-concat': 'error',
|
|
26
27
|
|
|
27
28
|
'n/no-callback-literal': 'off',
|
|
@@ -77,6 +78,7 @@ export async function createEslintNodeConfig(root) {
|
|
|
77
78
|
|
|
78
79
|
return [
|
|
79
80
|
{
|
|
81
|
+
name: 'node/common',
|
|
80
82
|
files: commonFiles,
|
|
81
83
|
ignores: exampleFiles,
|
|
82
84
|
plugins: { n },
|
|
@@ -103,6 +105,7 @@ export async function createEslintNodeConfig(root) {
|
|
|
103
105
|
},
|
|
104
106
|
},
|
|
105
107
|
{
|
|
108
|
+
name: 'node/module-and-typescript',
|
|
106
109
|
files: [ ...typescriptFiles, ...moduleFiles ],
|
|
107
110
|
ignores: exampleFiles,
|
|
108
111
|
plugins: { n },
|
|
@@ -128,6 +131,7 @@ export async function createEslintNodeConfig(root) {
|
|
|
128
131
|
},
|
|
129
132
|
},
|
|
130
133
|
{
|
|
134
|
+
name: 'node/test-files',
|
|
131
135
|
files: getTestFiles(),
|
|
132
136
|
plugins: { n },
|
|
133
137
|
rules: { 'n/no-sync': 'off' },
|
|
@@ -202,20 +202,18 @@ const typescriptRules = {
|
|
|
202
202
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
203
203
|
*/
|
|
204
204
|
export async function createEslintPerfectionistConfig(root) {
|
|
205
|
-
const commonFiles = await getCommonFiles(root);
|
|
206
|
-
const moduleFiles = await getModuleFiles(root);
|
|
207
|
-
const typescriptFiles = getTypescriptFiles();
|
|
208
|
-
|
|
209
205
|
return [
|
|
210
206
|
{
|
|
211
|
-
|
|
207
|
+
name: 'perfectionist/common',
|
|
208
|
+
files: await getCommonFiles(root),
|
|
212
209
|
plugins: { perfectionist },
|
|
213
210
|
rules: {
|
|
214
211
|
...commonRules,
|
|
215
212
|
},
|
|
216
213
|
},
|
|
217
214
|
{
|
|
218
|
-
|
|
215
|
+
name: 'perfectionist/module',
|
|
216
|
+
files: await getModuleFiles(root),
|
|
219
217
|
plugins: { perfectionist },
|
|
220
218
|
rules: {
|
|
221
219
|
...commonRules,
|
|
@@ -223,7 +221,8 @@ export async function createEslintPerfectionistConfig(root) {
|
|
|
223
221
|
},
|
|
224
222
|
},
|
|
225
223
|
{
|
|
226
|
-
|
|
224
|
+
name: 'perfectionist/typescript',
|
|
225
|
+
files: getTypescriptFiles(),
|
|
227
226
|
plugins: { perfectionist },
|
|
228
227
|
rules: {
|
|
229
228
|
...commonRules,
|
package/src/plugins/promise.js
CHANGED
package/src/plugins/react.js
CHANGED
|
@@ -98,6 +98,7 @@ export async function createEslintReactConfig(root) {
|
|
|
98
98
|
|
|
99
99
|
return [
|
|
100
100
|
{
|
|
101
|
+
name: 'react/jsx',
|
|
101
102
|
files: [ '**/*.jsx' ],
|
|
102
103
|
languageOptions: {
|
|
103
104
|
parserOptions: {
|
|
@@ -111,6 +112,7 @@ export async function createEslintReactConfig(root) {
|
|
|
111
112
|
rules: rules,
|
|
112
113
|
},
|
|
113
114
|
{
|
|
115
|
+
name: 'react/tsx',
|
|
114
116
|
files: [ '**/*.tsx' ],
|
|
115
117
|
languageOptions: {
|
|
116
118
|
parserOptions: {
|
package/src/plugins/regexp.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import regexp from 'eslint-plugin-regexp';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Get ESLint config for the regexp plugin
|
|
5
|
-
* @param {import('node:url').URL} root root url
|
|
6
5
|
* @returns {import('eslint').Linter.FlatConfig[]}
|
|
7
6
|
*/
|
|
8
|
-
export function createEslintRegexpConfig(
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
export function createEslintRegexpConfig() {
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
name: 'regexp/recommended',
|
|
11
|
+
...regexp.configs['flat/recommended'],
|
|
12
|
+
},
|
|
13
|
+
];
|
|
13
14
|
}
|
package/src/plugins/sca.js
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
export async function createEslintSCAConfig(root) {
|
|
14
14
|
return [
|
|
15
15
|
{
|
|
16
|
+
name: 'sca/javascript',
|
|
16
17
|
files: [
|
|
17
18
|
...await getCommonFiles(root),
|
|
18
19
|
...await getModuleFiles(root),
|
|
@@ -31,6 +32,7 @@ export async function createEslintSCAConfig(root) {
|
|
|
31
32
|
},
|
|
32
33
|
},
|
|
33
34
|
{
|
|
35
|
+
name: 'sca/typescript',
|
|
34
36
|
files: getTypescriptFiles(),
|
|
35
37
|
plugins: { sca },
|
|
36
38
|
rules: {
|
package/src/plugins/security.js
CHANGED
|
@@ -6,10 +6,19 @@ import security from 'eslint-plugin-security';
|
|
|
6
6
|
*/
|
|
7
7
|
export function createEslintSecurityConfig() {
|
|
8
8
|
return [ {
|
|
9
|
-
|
|
9
|
+
name: 'security/recommended',
|
|
10
10
|
plugins: { security },
|
|
11
11
|
rules: {
|
|
12
|
+
...security.configs.recommended.rules,
|
|
13
|
+
'security/detect-object-injection': 0,
|
|
14
|
+
|
|
15
|
+
// I dont particularly care here..
|
|
12
16
|
'security/detect-non-literal-fs-filename': 0,
|
|
17
|
+
'security/detect-non-literal-require': 0,
|
|
18
|
+
|
|
19
|
+
// eslint-plugin-regexp does this better...
|
|
20
|
+
'security/detect-non-literal-regexp': 0,
|
|
21
|
+
'security/detect-unsafe-regex': 0,
|
|
13
22
|
},
|
|
14
23
|
} ];
|
|
15
24
|
}
|
package/src/plugins/sonarjs.js
CHANGED
|
@@ -7,6 +7,7 @@ import sonarjs from 'eslint-plugin-sonarjs';
|
|
|
7
7
|
export function createEslintSonarJSConfig() {
|
|
8
8
|
return [
|
|
9
9
|
{
|
|
10
|
+
name: 'sonarjs/recommended',
|
|
10
11
|
plugins: { sonarjs },
|
|
11
12
|
rules: {
|
|
12
13
|
...sonarjs.configs.recommended.rules,
|
|
@@ -14,6 +15,7 @@ export function createEslintSonarJSConfig() {
|
|
|
14
15
|
},
|
|
15
16
|
},
|
|
16
17
|
{
|
|
18
|
+
name: 'sonarjs/tests',
|
|
17
19
|
files: [
|
|
18
20
|
'**/*.test.*',
|
|
19
21
|
'*.test.*',
|
package/src/plugins/style.js
CHANGED
|
@@ -27,6 +27,7 @@ export async function createEslintTypescriptConfig(root) {
|
|
|
27
27
|
const typescriptPlugin = idef(await import('@typescript-eslint/eslint-plugin'));
|
|
28
28
|
|
|
29
29
|
return [ {
|
|
30
|
+
name: 'typescript/custom',
|
|
30
31
|
files: getTypescriptFiles(),
|
|
31
32
|
languageOptions: {
|
|
32
33
|
parser: typescriptParser,
|
|
@@ -48,7 +49,7 @@ export async function createEslintTypescriptConfig(root) {
|
|
|
48
49
|
'no-dupe-keys': 'off',
|
|
49
50
|
'no-func-assign': 'off',
|
|
50
51
|
'no-import-assign': 'off',
|
|
51
|
-
'no-new-symbol': 'off',
|
|
52
|
+
// 'no-new-symbol': 'off',
|
|
52
53
|
'no-obj-calls': 'off',
|
|
53
54
|
'no-redeclare': 'off',
|
|
54
55
|
'no-setter-return': 'off',
|
|
@@ -57,7 +58,6 @@ export async function createEslintTypescriptConfig(root) {
|
|
|
57
58
|
'no-unreachable': 'off',
|
|
58
59
|
'no-unsafe-negation': 'off',
|
|
59
60
|
'no-array-constructor': 'off',
|
|
60
|
-
'no-loss-of-precision': 'off',
|
|
61
61
|
|
|
62
62
|
// Rules that prevert some commmon ts issues
|
|
63
63
|
'no-var': 'error',
|
|
@@ -74,14 +74,13 @@ export async function createEslintTypescriptConfig(root) {
|
|
|
74
74
|
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
|
75
75
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
76
76
|
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
|
77
|
-
'@typescript-eslint/no-loss-of-precision': 'error',
|
|
78
77
|
'@typescript-eslint/no-misused-new': 'error',
|
|
79
78
|
'@typescript-eslint/no-namespace': [ 'error', { allowDeclarations: true } ],
|
|
80
79
|
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
81
80
|
'@typescript-eslint/no-this-alias': 'error',
|
|
82
81
|
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
|
83
82
|
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
|
84
|
-
'@typescript-eslint/no-
|
|
83
|
+
'@typescript-eslint/no-require-imports': 'error',
|
|
85
84
|
'@typescript-eslint/prefer-as-const': 'error',
|
|
86
85
|
'@typescript-eslint/triple-slash-reference': 'error',
|
|
87
86
|
},
|
package/src/plugins/unicorn.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import unicorn from 'eslint-plugin-unicorn';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Get ESLint config for the unicorn plugin
|
|
5
|
-
* @param {import('node:url').URL} root root url
|
|
6
5
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
7
6
|
*/
|
|
8
|
-
export async function createEslintUnicornConfig(
|
|
9
|
-
return
|
|
10
|
-
|
|
7
|
+
export async function createEslintUnicornConfig() {
|
|
8
|
+
return [ {
|
|
9
|
+
name: 'unicorn/custom',
|
|
10
|
+
plugins: { unicorn },
|
|
11
11
|
rules: {
|
|
12
12
|
/*
|
|
13
13
|
* Sanity checks
|
|
14
14
|
*/
|
|
15
15
|
'unicorn/better-regex': 'off',
|
|
16
16
|
'unicorn/no-empty-file': 'warn',
|
|
17
|
-
'unicorn/no-unsafe-regex': 'off',
|
|
18
17
|
'unicorn/no-zero-fractions': 'error',
|
|
19
18
|
'unicorn/no-unreadable-array-destructuring': 'error',
|
|
20
19
|
'unicorn/no-useless-undefined': 'error',
|
|
@@ -54,5 +53,5 @@ export async function createEslintUnicornConfig(root) {
|
|
|
54
53
|
'unicorn/require-array-join-separator': 'error',
|
|
55
54
|
'unicorn/text-encoding-identifier-case': 'error',
|
|
56
55
|
},
|
|
57
|
-
}
|
|
56
|
+
} ];
|
|
58
57
|
}
|
|
@@ -195,11 +195,13 @@ export async function createEditorOverrides(root) {
|
|
|
195
195
|
|
|
196
196
|
if (files.includes('*')) {
|
|
197
197
|
addOrMergeConfig(configs, {
|
|
198
|
+
name: `editor-config/${extensions.join(', ')}`,
|
|
198
199
|
files: extensions.map((extension) => `**/*${extension}`),
|
|
199
200
|
rules: convert(body, rules),
|
|
200
201
|
});
|
|
201
202
|
} else {
|
|
202
203
|
addOrMergeConfig(configs, {
|
|
204
|
+
name: `editor-config/${files.join(', ')}`,
|
|
203
205
|
files: files.map((file) => `**/${file}`),
|
|
204
206
|
rules: convert(body, rules),
|
|
205
207
|
});
|
|
@@ -15,14 +15,6 @@ function getFiles(files, type, target) {
|
|
|
15
15
|
return files;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Get a list of globs for common js files
|
|
20
|
-
* @returns {Promise<string[]>}
|
|
21
|
-
*/
|
|
22
|
-
export async function getJsonFiles() {
|
|
23
|
-
return [ '**/*.json', '**/*.jsonc', '**/*.json5' ];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
18
|
/**
|
|
27
19
|
* Get a list of globs for common js files
|
|
28
20
|
* @param {import('node:url').URL} root root url
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get ESLint config for the regexp plugin
|
|
3
|
-
* @param {import('node:url').URL} root root url
|
|
4
3
|
* @returns {import('eslint').Linter.FlatConfig[]}
|
|
5
4
|
*/
|
|
6
|
-
export function createEslintRegexpConfig(
|
|
5
|
+
export function createEslintRegexpConfig(): import("eslint").Linter.FlatConfig[];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get ESLint config for the unicorn plugin
|
|
3
|
-
* @param {import('node:url').URL} root root url
|
|
4
3
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
5
4
|
*/
|
|
6
|
-
export function createEslintUnicornConfig(
|
|
5
|
+
export function createEslintUnicornConfig(): Promise<import("eslint").Linter.FlatConfig[]>;
|
package/src/bin/eslint.cjs
DELETED