@darksheep/eslint 5.2.0 → 5.3.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 +31 -0
- package/package.json +9 -7
- package/src/index.js +2 -0
- package/src/plugins/json.js +16 -0
- package/src/plugins/sonarjs.js +0 -9
- package/src/plugins/yml.js +41 -0
- package/src/utilities/editorconfig.js +12 -2
- package/src/utilities/expand-glob.js +1 -1
- package/types/src/plugins/yml.d.ts +5 -0
- package/types/src/utilities/editorconfig.d.ts +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.3.0](https://github.com/DarkSheepSoftware/eslint/compare/v5.2.1...v5.3.0) (2024-08-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### 🌟 Features
|
|
7
|
+
|
|
8
|
+
* Add basic yml support ([ad7dd61](https://github.com/DarkSheepSoftware/eslint/commit/ad7dd610d52b1c1c9c0f9daea39ad5ad185c64d1))
|
|
9
|
+
* Allow editor config to configure yml/indent ([b8655bc](https://github.com/DarkSheepSoftware/eslint/commit/b8655bc56871bebf4fc1157085d9498ebe45b324))
|
|
10
|
+
* Better json formatting ([68da6b2](https://github.com/DarkSheepSoftware/eslint/commit/68da6b266a904e4c780c13b1cc6f08511826111b))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### 🩹 Fixes
|
|
14
|
+
|
|
15
|
+
* Disable sonar/no-duplicate-string ([8ac453d](https://github.com/DarkSheepSoftware/eslint/commit/8ac453d0e435997283c716596bfed1135467854a))
|
|
16
|
+
* Ignore line count in json files ([cc955da](https://github.com/DarkSheepSoftware/eslint/commit/cc955da408803c5ed1cfde7fd1fceb7735ba9b43))
|
|
17
|
+
* resolve issues in yml files ([315e888](https://github.com/DarkSheepSoftware/eslint/commit/315e8885ccf6f7e010c721166ec57f6449d5a8f9))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### 📦 Dependencies
|
|
21
|
+
|
|
22
|
+
* **pkg:** pin dependencies ([#561](https://github.com/DarkSheepSoftware/eslint/issues/561)) ([e14c5e6](https://github.com/DarkSheepSoftware/eslint/commit/e14c5e609fbe8a5363f620e98a890bc53d7a5c19))
|
|
23
|
+
* **pkg:** update dependency eslint-plugin-perfectionist to v3.1.3 ([#558](https://github.com/DarkSheepSoftware/eslint/issues/558)) ([e911049](https://github.com/DarkSheepSoftware/eslint/commit/e9110492400b1a3880764ce3cccb0be5ade2e918))
|
|
24
|
+
|
|
25
|
+
## [5.2.1](https://github.com/DarkSheepSoftware/eslint/compare/v5.2.0...v5.2.1) (2024-08-07)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### 📦 Dependencies
|
|
29
|
+
|
|
30
|
+
* **pkg:** update dependency eslint-plugin-jsdoc to v49 ([#556](https://github.com/DarkSheepSoftware/eslint/issues/556)) ([237bb6c](https://github.com/DarkSheepSoftware/eslint/commit/237bb6c7d7175a7416ad44848887431a92a13591))
|
|
31
|
+
* **pkg:** update dependency eslint-plugin-jsdoc to v50 ([#557](https://github.com/DarkSheepSoftware/eslint/issues/557)) ([4074731](https://github.com/DarkSheepSoftware/eslint/commit/407473198d3aad3e3e9b50a4a3be01f4bf70a539))
|
|
32
|
+
* **pkg:** update dependency eslint-plugin-promise to v7.1.0 ([#553](https://github.com/DarkSheepSoftware/eslint/issues/553)) ([c944b6b](https://github.com/DarkSheepSoftware/eslint/commit/c944b6b74da46756f64693d4fce7260e62dda569))
|
|
33
|
+
|
|
3
34
|
## [5.2.0](https://github.com/DarkSheepSoftware/eslint/compare/v5.1.5...v5.2.0) (2024-08-06)
|
|
4
35
|
|
|
5
36
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darksheep/eslint",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/DarkSheepSoftware/eslint"
|
|
@@ -28,19 +28,21 @@
|
|
|
28
28
|
"@typescript-eslint/eslint-plugin": "8.0.1",
|
|
29
29
|
"@typescript-eslint/parser": "8.0.1",
|
|
30
30
|
"editorconfig": "2.0.0",
|
|
31
|
-
"eslint-plugin-jsdoc": "
|
|
31
|
+
"eslint-plugin-jsdoc": "50.0.0",
|
|
32
32
|
"eslint-plugin-jsonc": "2.16.0",
|
|
33
33
|
"eslint-plugin-n": "17.10.2",
|
|
34
34
|
"eslint-plugin-package-json": "0.15.2",
|
|
35
|
-
"eslint-plugin-perfectionist": "3.1.
|
|
36
|
-
"eslint-plugin-promise": "7.
|
|
35
|
+
"eslint-plugin-perfectionist": "3.1.3",
|
|
36
|
+
"eslint-plugin-promise": "7.1.0",
|
|
37
37
|
"eslint-plugin-react": "7.35.0",
|
|
38
38
|
"eslint-plugin-regexp": "2.6.0",
|
|
39
39
|
"eslint-plugin-security": "3.0.1",
|
|
40
40
|
"eslint-plugin-sonarjs": "1.0.4",
|
|
41
41
|
"eslint-plugin-unicorn": "55.0.0",
|
|
42
42
|
"eslint-plugin-unused-imports": "4.0.1",
|
|
43
|
-
"
|
|
43
|
+
"eslint-plugin-yml": "1.14.0",
|
|
44
|
+
"jsonc-eslint-parser": "2.4.0",
|
|
45
|
+
"yaml-eslint-parser": "1.2.3"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
48
|
"@darksheep/eslint-formatter-github": "2.0.1",
|
|
@@ -50,7 +52,7 @@
|
|
|
50
52
|
"@types/estree": "~1.0.2",
|
|
51
53
|
"@types/node": "~20.14.0",
|
|
52
54
|
"eslint": "~9.8.0",
|
|
53
|
-
"type-fest": "~4.
|
|
55
|
+
"type-fest": "~4.24.0",
|
|
54
56
|
"typescript": "~5.5.0"
|
|
55
57
|
},
|
|
56
58
|
"peerDependencies": {
|
|
@@ -66,7 +68,7 @@
|
|
|
66
68
|
"node": "^20 || ^21 || ^22"
|
|
67
69
|
},
|
|
68
70
|
"volta": {
|
|
69
|
-
"node": "22.
|
|
71
|
+
"node": "22.6.0",
|
|
70
72
|
"yarn": "4.4.0"
|
|
71
73
|
}
|
|
72
74
|
}
|
package/src/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import { createEslintStyleConfig } from './plugins/style.js';
|
|
|
21
21
|
import { createEslintTypescriptConfig } from './plugins/typescript.js';
|
|
22
22
|
import { createEslintUnicornConfig } from './plugins/unicorn.js';
|
|
23
23
|
import { createEslintUnusedImportsConfig } from './plugins/unused-imports.js';
|
|
24
|
+
import { createEslintYmlConfig } from './plugins/yml.js';
|
|
24
25
|
|
|
25
26
|
const configBuilders = [
|
|
26
27
|
createEslintIgnoresConfig,
|
|
@@ -33,6 +34,7 @@ const configBuilders = [
|
|
|
33
34
|
createEslintPerfectionistConfig,
|
|
34
35
|
createEslintPackageJsonConfig,
|
|
35
36
|
createEslintJsonConfig,
|
|
37
|
+
createEslintYmlConfig,
|
|
36
38
|
createEslintPromiseConfig,
|
|
37
39
|
createEslintTypescriptConfig,
|
|
38
40
|
createEslintReactConfig,
|
package/src/plugins/json.js
CHANGED
|
@@ -13,6 +13,16 @@ export async function createEslintJsonConfig() {
|
|
|
13
13
|
languageOptions: { parser },
|
|
14
14
|
// @ts-expect-error jsonc does not match the plugin interface
|
|
15
15
|
plugins: { jsonc },
|
|
16
|
+
rules: {
|
|
17
|
+
'jsonc/array-bracket-newline': [ 'error', 'consistent' ],
|
|
18
|
+
'jsonc/array-bracket-spacing': [ 'error', 'always' ],
|
|
19
|
+
'jsonc/array-element-newline': [ 'error', 'consistent' ],
|
|
20
|
+
'jsonc/key-spacing': [ 'error' ],
|
|
21
|
+
'jsonc/object-curly-newline': [ 'error', { consistent: true } ],
|
|
22
|
+
'jsonc/object-curly-spacing': [ 'error', 'always' ],
|
|
23
|
+
'jsonc/object-property-newline': [ 'error', { allowAllPropertiesOnSameLine: true } ],
|
|
24
|
+
'max-lines': 'off',
|
|
25
|
+
},
|
|
16
26
|
},
|
|
17
27
|
{
|
|
18
28
|
name: 'json/.json',
|
|
@@ -32,5 +42,11 @@ export async function createEslintJsonConfig() {
|
|
|
32
42
|
// @ts-expect-error Record<string, string> vs Record<string, 'error'>
|
|
33
43
|
rules: jsonc.configs['recommended-with-json5'].rules,
|
|
34
44
|
},
|
|
45
|
+
{
|
|
46
|
+
name: 'json/tsconfig.json',
|
|
47
|
+
files: [ '**/tsconfig.json' ],
|
|
48
|
+
rules: { 'jsonc/no-comments': 'off' },
|
|
49
|
+
},
|
|
50
|
+
{ ignores: [ '.github/release-please/manifest.json' ] },
|
|
35
51
|
];
|
|
36
52
|
}
|
package/src/plugins/sonarjs.js
CHANGED
|
@@ -12,15 +12,6 @@ export function createEslintSonarJSConfig() {
|
|
|
12
12
|
rules: {
|
|
13
13
|
...sonarjs.configs.recommended.rules,
|
|
14
14
|
'sonarjs/cognitive-complexity': 'error',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: 'sonarjs/tests',
|
|
19
|
-
files: [
|
|
20
|
-
'**/*.test.*',
|
|
21
|
-
'*.test.*',
|
|
22
|
-
],
|
|
23
|
-
rules: {
|
|
24
15
|
'sonarjs/no-duplicate-string': 'off',
|
|
25
16
|
},
|
|
26
17
|
},
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import yml from 'eslint-plugin-yml';
|
|
2
|
+
import parser from 'yaml-eslint-parser';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get ESLint config for yml check
|
|
6
|
+
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
7
|
+
*/
|
|
8
|
+
export async function createEslintYmlConfig() {
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
name: 'yml/core',
|
|
12
|
+
files: [ '**/*.yaml', '**/*.yml' ],
|
|
13
|
+
languageOptions: { parser },
|
|
14
|
+
// @ts-expect-error jsonc does not match the plugin interface
|
|
15
|
+
plugins: { yml },
|
|
16
|
+
rules: {
|
|
17
|
+
'yml/block-mapping-colon-indicator-newline': 'error',
|
|
18
|
+
'yml/block-mapping-question-indicator-newline': 'error',
|
|
19
|
+
'yml/block-mapping': 'error',
|
|
20
|
+
'yml/block-sequence-hyphen-indicator-newline': [ 'error', 'never' ],
|
|
21
|
+
'yml/block-sequence': 'error',
|
|
22
|
+
'yml/flow-mapping-curly-newline': 'error',
|
|
23
|
+
'yml/flow-mapping-curly-spacing': [ 'error', 'always' ],
|
|
24
|
+
'yml/flow-sequence-bracket-newline': 'error',
|
|
25
|
+
'yml/flow-sequence-bracket-spacing': [ 'error', 'always' ],
|
|
26
|
+
'yml/key-spacing': 'error',
|
|
27
|
+
'yml/no-empty-document': 'error',
|
|
28
|
+
'yml/no-empty-key': 'error',
|
|
29
|
+
'yml/no-empty-sequence-entry': 'error',
|
|
30
|
+
'yml/no-irregular-whitespace': 'error',
|
|
31
|
+
'yml/no-multiple-empty-lines': [ 'error', { max: 1 } ],
|
|
32
|
+
'yml/no-tab-indent': 'error',
|
|
33
|
+
'yml/no-trailing-zeros': 'error',
|
|
34
|
+
'yml/plain-scalar': 'error',
|
|
35
|
+
'yml/quotes': [ 'error' ],
|
|
36
|
+
'yml/require-string-key': 'error',
|
|
37
|
+
'yml/spaced-comment': 'error',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
}
|
|
@@ -14,6 +14,7 @@ import { findUp } from './filesystem.js';
|
|
|
14
14
|
* @property {string} TRAIL trailing spaces
|
|
15
15
|
* @property {string} INDENT indent size
|
|
16
16
|
* @property {string} [INDENT_BINARY] indent binary ops size
|
|
17
|
+
* @property {unknown} [INDENT_OPTIONS] options to pass to the indent rule
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -51,14 +52,14 @@ function convert(input, RULES) {
|
|
|
51
52
|
|
|
52
53
|
if (input?.indent_style === 'space') {
|
|
53
54
|
const size = Number.parseInt(input?.indent_size ?? 4, 10);
|
|
54
|
-
output[RULES.INDENT] = [ 'error', size,
|
|
55
|
+
output[RULES.INDENT] = [ 'error', size, RULES.INDENT_OPTIONS ?? {} ];
|
|
55
56
|
if (RULES.INDENT_BINARY != null) {
|
|
56
57
|
output[RULES.INDENT_BINARY] = [ 'error', size ];
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
if (input?.indent_style === 'tab') {
|
|
61
|
-
output[RULES.INDENT] = [ 'error', 'tab',
|
|
62
|
+
output[RULES.INDENT] = [ 'error', 'tab', RULES.INDENT_OPTIONS ?? {} ];
|
|
62
63
|
if (RULES.INDENT_BINARY != null) {
|
|
63
64
|
output[RULES.INDENT_BINARY] = [ 'error', 'tab' ];
|
|
64
65
|
}
|
|
@@ -77,6 +78,7 @@ const extToRules = [
|
|
|
77
78
|
TRAIL: 'style/no-trailing-spaces',
|
|
78
79
|
INDENT: 'style/indent',
|
|
79
80
|
INDENT_BINARY: 'style/indent-binary-ops',
|
|
81
|
+
INDENT_OPTIONS: { SwitchCase: 1 },
|
|
80
82
|
},
|
|
81
83
|
],
|
|
82
84
|
[
|
|
@@ -87,6 +89,14 @@ const extToRules = [
|
|
|
87
89
|
INDENT: 'jsonc/indent',
|
|
88
90
|
},
|
|
89
91
|
],
|
|
92
|
+
[
|
|
93
|
+
[ '.yml', '.yaml' ], {
|
|
94
|
+
EOL: 'style/eol-last',
|
|
95
|
+
LF: 'style/linebreak-style',
|
|
96
|
+
TRAIL: 'style/no-trailing-spaces',
|
|
97
|
+
INDENT: 'yml/indent',
|
|
98
|
+
},
|
|
99
|
+
],
|
|
90
100
|
];
|
|
91
101
|
|
|
92
102
|
/**
|