metalint 0.20.0 → 0.21.1
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 +10 -4
- package/package.json +154 -41
- package/src/bin/argv.js +27 -41
- package/src/bin/index.js +1 -1
- package/src/core/configuration/flatten.js +11 -11
- package/src/core/configuration/normalize.js +24 -24
- package/src/core/configuration/override.js +2 -2
- package/src/core/formatter/checkstyle.js +2 -2
- package/src/core/formatter/console.js +19 -43
- package/src/core/formatter/csv.js +2 -2
- package/src/core/index.js +1 -1
- package/src/core/levels.js +0 -5
- package/src/core/results.js +4 -2
- package/src/core/severities.js +0 -5
- package/src/core/utils/array.js +4 -3
- package/src/core/utils/file.js +1 -1
- package/src/core/utils/glob.js +23 -19
- package/src/core/utils/object.js +1 -1
- package/src/core/wrapper/addons-linter.js +3 -2
- package/src/core/wrapper/ajv.js +1 -1
- package/src/core/wrapper/biomejs__js-api.js +271 -0
- package/src/core/wrapper/markuplint.js +11 -0
- package/src/core/wrapper/npm-package-json-lint.js +2 -2
- package/types/bin/argv.d.ts +1 -1
- package/types/core/configuration/override.d.ts +0 -1
- package/types/core/wrapper/biomejs__js-api.d.ts +38 -0
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- Utiliser du HTML (avec l'attribut "align" obsolète) pour faire flotter
|
|
4
4
|
l'image à droite. -->
|
|
5
|
-
<!-- markdownlint-disable-next-line no-inline-html-->
|
|
6
|
-
<img src="asset/logo.svg" align="right" alt="">
|
|
5
|
+
<!-- markdownlint-disable-next-line no-inline-html -->
|
|
6
|
+
<img src="asset/logo.svg" align="right" width="100" height="100" alt="">
|
|
7
7
|
|
|
8
8
|
[![npm][img-npm]][link-npm] [![build][img-build]][link-build]
|
|
9
9
|
[![coverage][img-coverage]][link-coverage] [![semver][img-semver]][link-semver]
|
|
@@ -29,6 +29,8 @@ delegated to linters (static source code analysis tools):
|
|
|
29
29
|
<tr>
|
|
30
30
|
<td>CSS</td>
|
|
31
31
|
<td>
|
|
32
|
+
<a title="@biomejs/js-api"
|
|
33
|
+
href="https://www.npmjs.com/package/@biomejs/js-api">Biome</a>,
|
|
32
34
|
<a title="doiuse" href="https://www.npmjs.com/package/doiuse">DoIUse</a>,
|
|
33
35
|
<a title="prettier"
|
|
34
36
|
href="https://www.npmjs.com/package/prettier">Prettier</a>,
|
|
@@ -54,6 +56,8 @@ delegated to linters (static source code analysis tools):
|
|
|
54
56
|
<tr>
|
|
55
57
|
<td>JavaScript</td>
|
|
56
58
|
<td>
|
|
59
|
+
<a title="@biomejs/js-api"
|
|
60
|
+
href="https://www.npmjs.com/package/@biomejs/js-api">Biome</a>,
|
|
57
61
|
<a title="eslint" href="https://www.npmjs.com/package/eslint">ESLint</a>,
|
|
58
62
|
<a title="jshint" href="https://www.npmjs.com/package/jshint">JSHint</a>,
|
|
59
63
|
<a title="standard"
|
|
@@ -67,6 +71,8 @@ delegated to linters (static source code analysis tools):
|
|
|
67
71
|
<td>JSON</td>
|
|
68
72
|
<td>
|
|
69
73
|
<a title="ajv" href="https://www.npmjs.com/package/ajv">Ajv</a>,
|
|
74
|
+
<a title="@biomejs/js-api"
|
|
75
|
+
href="https://www.npmjs.com/package/@biomejs/js-api">Biome</a>,
|
|
70
76
|
<a title="@mapbox/jsonlint-lines-primitives"
|
|
71
77
|
href="https://www.npmjs.com/package/@mapbox/jsonlint-lines-primitives">@mapbox/JSON
|
|
72
78
|
Lint lines-primitives</a>,
|
|
@@ -267,10 +273,10 @@ jobs:
|
|
|
267
273
|
lint:
|
|
268
274
|
runs-on: ubuntu-latest
|
|
269
275
|
steps:
|
|
270
|
-
- uses: actions/checkout@
|
|
276
|
+
- uses: actions/checkout@v5
|
|
271
277
|
with:
|
|
272
278
|
persist-credentials: false
|
|
273
|
-
- uses: actions/setup-node@
|
|
279
|
+
- uses: actions/setup-node@v5
|
|
274
280
|
- name: Install dependencies
|
|
275
281
|
run: npm ci
|
|
276
282
|
- name: Lint files
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metalint",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.21.1",
|
|
4
|
+
"description": "One linter to rule them all.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"checker",
|
|
7
7
|
"lint",
|
|
@@ -44,8 +44,13 @@
|
|
|
44
44
|
},
|
|
45
45
|
"main": "./src/core/index.js",
|
|
46
46
|
"types": "./types/core/index.d.ts",
|
|
47
|
-
"bin":
|
|
48
|
-
|
|
47
|
+
"bin": {
|
|
48
|
+
"metalint": "src/bin/index.js"
|
|
49
|
+
},
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/regseb/metalint.git"
|
|
53
|
+
},
|
|
49
54
|
"type": "module",
|
|
50
55
|
"scripts": {
|
|
51
56
|
"lint": "node src/bin/index.js",
|
|
@@ -59,64 +64,172 @@
|
|
|
59
64
|
"prepare": "tsc --project .tsconfig_types.json",
|
|
60
65
|
"clean": "node .script/clean.js"
|
|
61
66
|
},
|
|
62
|
-
"dependencies": {
|
|
63
|
-
"chalk": "5.4.1",
|
|
64
|
-
"yargs": "17.7.2"
|
|
65
|
-
},
|
|
66
67
|
"devDependencies": {
|
|
68
|
+
"@biomejs/js-api": "4.0.0",
|
|
69
|
+
"@biomejs/wasm-nodejs": "2.3.1",
|
|
67
70
|
"@coffeelint/cli": "5.2.11",
|
|
68
71
|
"@mapbox/jsonlint-lines-primitives": "2.0.2",
|
|
69
72
|
"@prantlf/jsonlint": "16.0.0",
|
|
70
|
-
"@prettier/plugin-xml": "3.4.
|
|
71
|
-
"@secretlint/secretlint-rule-github": "
|
|
72
|
-
"@secretlint/secretlint-rule-npm": "
|
|
73
|
-
"@stryker-mutator/core": "
|
|
74
|
-
"@stryker-mutator/tap-runner": "
|
|
75
|
-
"@types/eslint-plugin-mocha": "10.4.0",
|
|
73
|
+
"@prettier/plugin-xml": "3.4.2",
|
|
74
|
+
"@secretlint/secretlint-rule-github": "11.2.5",
|
|
75
|
+
"@secretlint/secretlint-rule-npm": "11.2.5",
|
|
76
|
+
"@stryker-mutator/core": "9.2.0",
|
|
77
|
+
"@stryker-mutator/tap-runner": "9.2.0",
|
|
76
78
|
"@types/htmlhint": "1.1.5",
|
|
77
79
|
"@types/js-yaml": "4.0.9",
|
|
78
80
|
"@types/jshint": "2.12.4",
|
|
79
81
|
"@types/semver-utils": "1.1.3",
|
|
80
|
-
"
|
|
81
|
-
"addons-linter": "7.9.0",
|
|
82
|
+
"addons-linter": "8.4.0",
|
|
82
83
|
"ajv": "8.17.1",
|
|
83
84
|
"depcheck": "1.4.7",
|
|
84
85
|
"doiuse": "6.0.5",
|
|
85
|
-
"eslint": "9.
|
|
86
|
-
"eslint-plugin-array-func": "5.0
|
|
86
|
+
"eslint": "9.38.0",
|
|
87
|
+
"eslint-plugin-array-func": "5.1.0",
|
|
87
88
|
"eslint-plugin-eslint-comments": "3.2.0",
|
|
88
|
-
"eslint-plugin-import": "2.
|
|
89
|
-
"eslint-plugin-jsdoc": "
|
|
90
|
-
"eslint-plugin-mocha": "
|
|
91
|
-
"eslint-plugin-n": "17.
|
|
92
|
-
"eslint-plugin-no-unsanitized": "4.1.
|
|
89
|
+
"eslint-plugin-import": "2.32.0",
|
|
90
|
+
"eslint-plugin-jsdoc": "61.1.9",
|
|
91
|
+
"eslint-plugin-mocha": "11.2.0",
|
|
92
|
+
"eslint-plugin-n": "17.23.1",
|
|
93
|
+
"eslint-plugin-no-unsanitized": "4.1.4",
|
|
93
94
|
"eslint-plugin-promise": "7.2.1",
|
|
94
|
-
"eslint-plugin-regexp": "2.
|
|
95
|
-
"eslint-plugin-unicorn": "
|
|
96
|
-
"fast-check": "4.0
|
|
97
|
-
"globals": "16.
|
|
98
|
-
"htmlhint": "1.1
|
|
95
|
+
"eslint-plugin-regexp": "2.10.0",
|
|
96
|
+
"eslint-plugin-unicorn": "62.0.0",
|
|
97
|
+
"fast-check": "4.3.0",
|
|
98
|
+
"globals": "16.4.0",
|
|
99
|
+
"htmlhint": "1.7.1",
|
|
99
100
|
"htmllint": "0.8.0",
|
|
100
101
|
"jshint": "2.13.6",
|
|
101
102
|
"jsonlint-mod": "1.7.6",
|
|
102
103
|
"jszip": "3.10.1",
|
|
103
|
-
"markdownlint": "0.
|
|
104
|
-
"markuplint": "4.
|
|
105
|
-
"npm-check-updates": "
|
|
106
|
-
"npm-package-json-lint": "
|
|
107
|
-
"prettier": "3.
|
|
108
|
-
"publint": "0.3.
|
|
104
|
+
"markdownlint": "0.39.0",
|
|
105
|
+
"markuplint": "4.13.1",
|
|
106
|
+
"npm-check-updates": "19.1.1",
|
|
107
|
+
"npm-package-json-lint": "9.0.0",
|
|
108
|
+
"prettier": "3.6.2",
|
|
109
|
+
"publint": "0.3.15",
|
|
109
110
|
"purgecss": "7.0.2",
|
|
110
|
-
"secretlint": "
|
|
111
|
-
"sort-package-json": "3.
|
|
111
|
+
"secretlint": "11.2.5",
|
|
112
|
+
"sort-package-json": "3.4.0",
|
|
112
113
|
"standard": "17.1.2",
|
|
113
|
-
"stylelint": "16.
|
|
114
|
-
"svglint": "
|
|
115
|
-
"typedoc": "0.28.
|
|
116
|
-
"typescript": "5.
|
|
114
|
+
"stylelint": "16.25.0",
|
|
115
|
+
"svglint": "4.1.2",
|
|
116
|
+
"typedoc": "0.28.14",
|
|
117
|
+
"typescript": "5.9.3",
|
|
117
118
|
"yaml-lint": "1.7.0"
|
|
118
119
|
},
|
|
120
|
+
"peerDependencies": {
|
|
121
|
+
"@biomejs/js-api": ">=4.0.0",
|
|
122
|
+
"@biomejs/wasm-nodejs": ">=2.3.1",
|
|
123
|
+
"@coffeelint/cli": ">=5.2.11",
|
|
124
|
+
"@mapbox/jsonlint-lines-primitives": ">=2.0.2",
|
|
125
|
+
"@prantlf/jsonlint": ">=16.0.0",
|
|
126
|
+
"addons-linter": ">=8.4.0",
|
|
127
|
+
"ajv": ">=8.17.1",
|
|
128
|
+
"depcheck": ">=1.4.7",
|
|
129
|
+
"doiuse": ">=6.0.5",
|
|
130
|
+
"eslint": ">=9.38.0",
|
|
131
|
+
"htmlhint": ">=1.7.1",
|
|
132
|
+
"htmllint": ">=0.8.0",
|
|
133
|
+
"jshint": ">=2.13.6",
|
|
134
|
+
"jsonlint-mod": ">=1.7.6",
|
|
135
|
+
"markdownlint": ">=0.39.0",
|
|
136
|
+
"markuplint": ">=4.13.1",
|
|
137
|
+
"npm-check-updates": ">=19.1.1",
|
|
138
|
+
"npm-package-json-lint": ">=9.0.0",
|
|
139
|
+
"prettier": ">=3.6.2",
|
|
140
|
+
"publint": ">=0.3.15",
|
|
141
|
+
"purgecss": ">=7.0.2",
|
|
142
|
+
"secretlint": ">=11.2.3",
|
|
143
|
+
"sort-package-json": ">=3.4.0",
|
|
144
|
+
"standard": ">=17.1.2",
|
|
145
|
+
"stylelint": ">=16.25.0",
|
|
146
|
+
"svglint": ">=4.1.2",
|
|
147
|
+
"yaml-lint": ">=1.7.0"
|
|
148
|
+
},
|
|
149
|
+
"peerDependenciesMeta": {
|
|
150
|
+
"@biomejs/js-api": {
|
|
151
|
+
"optional": true
|
|
152
|
+
},
|
|
153
|
+
"@biomejs/wasm-nodejs": {
|
|
154
|
+
"optional": true
|
|
155
|
+
},
|
|
156
|
+
"@coffeelint/cli": {
|
|
157
|
+
"optional": true
|
|
158
|
+
},
|
|
159
|
+
"@mapbox/jsonlint-lines-primitives": {
|
|
160
|
+
"optional": true
|
|
161
|
+
},
|
|
162
|
+
"@prantlf/jsonlint": {
|
|
163
|
+
"optional": true
|
|
164
|
+
},
|
|
165
|
+
"addons-linter": {
|
|
166
|
+
"optional": true
|
|
167
|
+
},
|
|
168
|
+
"ajv": {
|
|
169
|
+
"optional": true
|
|
170
|
+
},
|
|
171
|
+
"depcheck": {
|
|
172
|
+
"optional": true
|
|
173
|
+
},
|
|
174
|
+
"doiuse": {
|
|
175
|
+
"optional": true
|
|
176
|
+
},
|
|
177
|
+
"eslint": {
|
|
178
|
+
"optional": true
|
|
179
|
+
},
|
|
180
|
+
"htmlhint": {
|
|
181
|
+
"optional": true
|
|
182
|
+
},
|
|
183
|
+
"htmllint": {
|
|
184
|
+
"optional": true
|
|
185
|
+
},
|
|
186
|
+
"jshint": {
|
|
187
|
+
"optional": true
|
|
188
|
+
},
|
|
189
|
+
"jsonlint-mod": {
|
|
190
|
+
"optional": true
|
|
191
|
+
},
|
|
192
|
+
"markdownlint": {
|
|
193
|
+
"optional": true
|
|
194
|
+
},
|
|
195
|
+
"markuplint": {
|
|
196
|
+
"optional": true
|
|
197
|
+
},
|
|
198
|
+
"npm-check-updates": {
|
|
199
|
+
"optional": true
|
|
200
|
+
},
|
|
201
|
+
"npm-package-json-lint": {
|
|
202
|
+
"optional": true
|
|
203
|
+
},
|
|
204
|
+
"prettier": {
|
|
205
|
+
"optional": true
|
|
206
|
+
},
|
|
207
|
+
"publint": {
|
|
208
|
+
"optional": true
|
|
209
|
+
},
|
|
210
|
+
"purgecss": {
|
|
211
|
+
"optional": true
|
|
212
|
+
},
|
|
213
|
+
"secretlint": {
|
|
214
|
+
"optional": true
|
|
215
|
+
},
|
|
216
|
+
"sort-package-json": {
|
|
217
|
+
"optional": true
|
|
218
|
+
},
|
|
219
|
+
"standard": {
|
|
220
|
+
"optional": true
|
|
221
|
+
},
|
|
222
|
+
"stylelint": {
|
|
223
|
+
"optional": true
|
|
224
|
+
},
|
|
225
|
+
"svglint": {
|
|
226
|
+
"optional": true
|
|
227
|
+
},
|
|
228
|
+
"yaml-lint": {
|
|
229
|
+
"optional": true
|
|
230
|
+
}
|
|
231
|
+
},
|
|
119
232
|
"engines": {
|
|
120
|
-
"node": ">=22.
|
|
233
|
+
"node": ">=22.13.0"
|
|
121
234
|
}
|
|
122
235
|
}
|
package/src/bin/argv.js
CHANGED
|
@@ -6,15 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
import fs from "node:fs/promises";
|
|
8
8
|
import process from "node:process";
|
|
9
|
-
import
|
|
10
|
-
import { hideBin } from "yargs/helpers";
|
|
9
|
+
import { parseArgs } from "node:util";
|
|
11
10
|
import {
|
|
12
11
|
normalizeFix,
|
|
13
12
|
normalizeFormatter,
|
|
14
13
|
normalizeLevel,
|
|
15
14
|
} from "../core/configuration/normalize.js";
|
|
16
|
-
import { FORMATTERS } from "../core/formatter/formatter.js";
|
|
17
|
-
import Levels from "../core/levels.js";
|
|
18
15
|
|
|
19
16
|
/**
|
|
20
17
|
* @import { TypeofFormatter } from "../core/formatter/formatter.js"
|
|
@@ -23,7 +20,7 @@ import Levels from "../core/levels.js";
|
|
|
23
20
|
|
|
24
21
|
/**
|
|
25
22
|
* @typedef {Object} Argv
|
|
26
|
-
* @prop {string[]}
|
|
23
|
+
* @prop {string[]} bases Les paramètres de la ligne de commande.
|
|
27
24
|
* @prop {string} config L'option `--config` de la ligne de
|
|
28
25
|
* commande.
|
|
29
26
|
* @prop {boolean} [fix] L'option `--fix` de la ligne de commande.
|
|
@@ -42,65 +39,54 @@ import Levels from "../core/levels.js";
|
|
|
42
39
|
* @param {string[]} argv Les paramètres et les options de la ligne de commande.
|
|
43
40
|
* @returns {Promise<Argv>} Les paramètres et les options normalisés.
|
|
44
41
|
*/
|
|
45
|
-
export const parse = async
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
export const parse = async (argv = process.argv) => {
|
|
43
|
+
const { values, positionals } = parseArgs({
|
|
44
|
+
// Enlever les deux premiers arguments de la ligne de commande qui sont
|
|
45
|
+
// "node" et "index.js".
|
|
46
|
+
args: argv.slice(2),
|
|
47
|
+
options: {
|
|
51
48
|
config: {
|
|
52
|
-
alias: "c",
|
|
53
|
-
default: ".metalint/metalint.config.js",
|
|
54
|
-
requiresArg: true,
|
|
55
49
|
type: "string",
|
|
50
|
+
short: "c",
|
|
51
|
+
default: ".metalint/metalint.config.js",
|
|
56
52
|
},
|
|
57
53
|
fix: {
|
|
58
54
|
type: "boolean",
|
|
59
55
|
},
|
|
60
56
|
formatter: {
|
|
61
|
-
alias: "f",
|
|
62
|
-
choices: FORMATTERS,
|
|
63
|
-
requiresArg: true,
|
|
64
57
|
type: "string",
|
|
58
|
+
short: "f",
|
|
65
59
|
},
|
|
66
60
|
level: {
|
|
67
|
-
alias: "l",
|
|
68
|
-
choices: Object.keys(Levels).map((l) => l.toLowerCase()),
|
|
69
|
-
default: undefined,
|
|
70
|
-
requiresArg: true,
|
|
71
61
|
type: "string",
|
|
62
|
+
short: "l",
|
|
72
63
|
},
|
|
73
64
|
help: {
|
|
74
|
-
default: false,
|
|
75
65
|
type: "boolean",
|
|
66
|
+
default: false,
|
|
76
67
|
},
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
68
|
+
},
|
|
69
|
+
allowPositionals: true,
|
|
70
|
+
});
|
|
80
71
|
|
|
81
72
|
return {
|
|
82
73
|
// Ajouter une barre oblique à la fin pour les répertoires.
|
|
83
|
-
|
|
84
|
-
0 ===
|
|
74
|
+
bases:
|
|
75
|
+
0 === positionals.length
|
|
85
76
|
? ["./"]
|
|
86
77
|
: await Promise.all(
|
|
87
|
-
|
|
88
|
-
const stats = await fs.lstat(
|
|
89
|
-
return (
|
|
90
|
-
base.toString() + (stats.isDirectory() ? "/" : "")
|
|
91
|
-
);
|
|
78
|
+
positionals.map(async (positional) => {
|
|
79
|
+
const stats = await fs.lstat(positional);
|
|
80
|
+
return positional + (stats.isDirectory() ? "/" : "");
|
|
92
81
|
}),
|
|
93
82
|
),
|
|
94
|
-
config:
|
|
95
|
-
fix: normalizeFix(
|
|
96
|
-
// Ne pas utiliser yargs.coerce() pour convertir les données, car cette
|
|
97
|
-
// méthode est incompatible avec yargs.choices().
|
|
98
|
-
// https://github.com/yargs/yargs/issues/1379
|
|
83
|
+
config: values.config,
|
|
84
|
+
fix: normalizeFix(values.fix),
|
|
99
85
|
formatter:
|
|
100
|
-
undefined ===
|
|
86
|
+
undefined === values.formatter
|
|
101
87
|
? undefined
|
|
102
|
-
: await normalizeFormatter(
|
|
103
|
-
level: normalizeLevel(
|
|
104
|
-
help:
|
|
88
|
+
: await normalizeFormatter(values.formatter),
|
|
89
|
+
level: normalizeLevel(values.level),
|
|
90
|
+
help: values.help,
|
|
105
91
|
};
|
|
106
92
|
};
|
package/src/bin/index.js
CHANGED
|
@@ -74,7 +74,7 @@ import { merge } from "../utils/object.js";
|
|
|
74
74
|
* parente.
|
|
75
75
|
* @returns {string[]} La valeur fusionnée.
|
|
76
76
|
*/
|
|
77
|
-
export const flattenPatterns =
|
|
77
|
+
export const flattenPatterns = (hierarchies, { patterns }) => {
|
|
78
78
|
return [...patterns, ...hierarchies];
|
|
79
79
|
};
|
|
80
80
|
|
|
@@ -88,7 +88,7 @@ export const flattenPatterns = function (hierarchies, { patterns }) {
|
|
|
88
88
|
* parente.
|
|
89
89
|
* @returns {boolean} La valeur fusionnée.
|
|
90
90
|
*/
|
|
91
|
-
export const flattenFix =
|
|
91
|
+
export const flattenFix = (hierarchy, { fix }) => {
|
|
92
92
|
return hierarchy ?? fix;
|
|
93
93
|
};
|
|
94
94
|
|
|
@@ -102,7 +102,7 @@ export const flattenFix = function (hierarchy, { fix }) {
|
|
|
102
102
|
* parente.
|
|
103
103
|
* @returns {Level} La valeur fusionnée.
|
|
104
104
|
*/
|
|
105
|
-
export const flattenLevel =
|
|
105
|
+
export const flattenLevel = (hierarchy, { level }) => {
|
|
106
106
|
return hierarchy ?? level;
|
|
107
107
|
};
|
|
108
108
|
|
|
@@ -116,7 +116,7 @@ export const flattenLevel = function (hierarchy, { level }) {
|
|
|
116
116
|
* `"options"` parente.
|
|
117
117
|
* @returns {Record<string, unknown>} La valeur fusionnée.
|
|
118
118
|
*/
|
|
119
|
-
export const flattenOptions =
|
|
119
|
+
export const flattenOptions = (hierarchies, { options }) => {
|
|
120
120
|
return [options, ...hierarchies].reduce(merge);
|
|
121
121
|
};
|
|
122
122
|
|
|
@@ -130,7 +130,7 @@ export const flattenOptions = function (hierarchies, { options }) {
|
|
|
130
130
|
* `"level"` parente.
|
|
131
131
|
* @returns {FlattenedConfigReporter} La valeur fusionnée.
|
|
132
132
|
*/
|
|
133
|
-
export const flattenReporter =
|
|
133
|
+
export const flattenReporter = (hierarchy, { level }) => {
|
|
134
134
|
return {
|
|
135
135
|
formatter: hierarchy.formatter,
|
|
136
136
|
level: flattenLevel(hierarchy.level, { level }),
|
|
@@ -155,7 +155,7 @@ export const flattenReporter = function (hierarchy, { level }) {
|
|
|
155
155
|
* parente.
|
|
156
156
|
* @returns {FlattenedConfigReporter[]} La valeur fusionnée.
|
|
157
157
|
*/
|
|
158
|
-
export const flattenReporters =
|
|
158
|
+
export const flattenReporters = (hierarchies, { formatter, level }) => {
|
|
159
159
|
if (undefined === formatter) {
|
|
160
160
|
return hierarchies.map((r) => flattenReporter(r, { level }));
|
|
161
161
|
}
|
|
@@ -183,7 +183,7 @@ export const flattenReporters = function (hierarchies, { formatter, level }) {
|
|
|
183
183
|
* `"options"` parente.
|
|
184
184
|
* @returns {FlattenedConfigLinter} La valeur fusionnée.
|
|
185
185
|
*/
|
|
186
|
-
export const flattenLinter =
|
|
186
|
+
export const flattenLinter = (hierarchy, { fix, level, options }) => {
|
|
187
187
|
return {
|
|
188
188
|
wrapper: hierarchy.wrapper,
|
|
189
189
|
fix: flattenFix(hierarchy.fix, { fix }),
|
|
@@ -204,7 +204,7 @@ export const flattenLinter = function (hierarchy, { fix, level, options }) {
|
|
|
204
204
|
* `"level"` parente.
|
|
205
205
|
* @returns {FlattenedConfigLinter[]} La valeur fusionnée.
|
|
206
206
|
*/
|
|
207
|
-
export const flattenLinters =
|
|
207
|
+
export const flattenLinters = (hierarchies, { fix, level }) => {
|
|
208
208
|
const map = new Map();
|
|
209
209
|
for (const hierarchy of hierarchies) {
|
|
210
210
|
if (map.has(hierarchy.wrapper)) {
|
|
@@ -243,7 +243,7 @@ export const flattenLinters = function (hierarchies, { fix, level }) {
|
|
|
243
243
|
* `"level"` parente.
|
|
244
244
|
* @returns {FlattenedConfigOverride} La valeur fusionnée.
|
|
245
245
|
*/
|
|
246
|
-
export const flattenOverride =
|
|
246
|
+
export const flattenOverride = (hierarchy, { fix, level }) => {
|
|
247
247
|
return {
|
|
248
248
|
patterns: hierarchy.patterns,
|
|
249
249
|
linters: flattenLinters(hierarchy.linters, {
|
|
@@ -265,7 +265,7 @@ export const flattenOverride = function (hierarchy, { fix, level }) {
|
|
|
265
265
|
* `"level"` parente.
|
|
266
266
|
* @returns {FlattenedConfigChecker} La valeur fusionnée.
|
|
267
267
|
*/
|
|
268
|
-
export const flattenChecker =
|
|
268
|
+
export const flattenChecker = (hierarchy, { fix, level }) => {
|
|
269
269
|
const base = {
|
|
270
270
|
fix: flattenFix(hierarchy.fix, { fix }),
|
|
271
271
|
level: flattenLevel(hierarchy.level, { level }),
|
|
@@ -298,7 +298,7 @@ export const flattenChecker = function (hierarchy, { fix, level }) {
|
|
|
298
298
|
* commande.
|
|
299
299
|
* @returns {FlattenedConfig} L'objet JSON fusionné.
|
|
300
300
|
*/
|
|
301
|
-
export const flatten =
|
|
301
|
+
export const flatten = (hierarchy, argv) => {
|
|
302
302
|
const fix = flattenFix(argv.fix ?? hierarchy.fix, { fix: false });
|
|
303
303
|
const level = flattenLevel(argv.level ?? hierarchy.level, {
|
|
304
304
|
level: Levels.INFO,
|