metalint 0.19.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.
Files changed (77) hide show
  1. package/README.md +45 -30
  2. package/package.json +155 -37
  3. package/src/bin/argv.js +28 -42
  4. package/src/bin/index.js +1 -1
  5. package/src/core/configuration/flatten.js +14 -14
  6. package/src/core/configuration/normalize.js +28 -28
  7. package/src/core/configuration/override.js +2 -2
  8. package/src/core/configuration/partial.js +1 -1
  9. package/src/core/formatter/checkstyle.js +2 -2
  10. package/src/core/formatter/console.js +19 -43
  11. package/src/core/formatter/csv.js +2 -2
  12. package/src/core/index.js +2 -2
  13. package/src/core/levels.js +8 -10
  14. package/src/core/results.js +10 -4
  15. package/src/core/severities.js +8 -6
  16. package/src/core/utils/array.js +4 -3
  17. package/src/core/utils/file.js +1 -1
  18. package/src/core/utils/glob.js +23 -19
  19. package/src/core/utils/object.js +1 -1
  20. package/src/core/wrapper/addons-linter.js +4 -3
  21. package/src/core/wrapper/ajv.js +2 -2
  22. package/src/core/wrapper/biomejs__js-api.js +271 -0
  23. package/src/core/wrapper/coffeelint__cli.js +1 -1
  24. package/src/core/wrapper/depcheck.js +1 -1
  25. package/src/core/wrapper/doiuse.js +1 -1
  26. package/src/core/wrapper/eslint.js +1 -1
  27. package/src/core/wrapper/htmlhint.js +1 -1
  28. package/src/core/wrapper/htmllint.js +1 -1
  29. package/src/core/wrapper/jshint.js +1 -1
  30. package/src/core/wrapper/jsonlint-mod.js +1 -1
  31. package/src/core/wrapper/mapbox__jsonlint-lines-primitives.js +1 -1
  32. package/src/core/wrapper/markdownlint.js +5 -2
  33. package/src/core/wrapper/markuplint.js +12 -1
  34. package/src/core/wrapper/npm-check-updates.js +1 -1
  35. package/src/core/wrapper/npm-package-json-lint.js +16 -3
  36. package/src/core/wrapper/prantlf__jsonlint.js +1 -1
  37. package/src/core/wrapper/prettier.js +1 -1
  38. package/src/core/wrapper/publint.js +7 -7
  39. package/src/core/wrapper/purgecss.js +29 -17
  40. package/src/core/wrapper/secretlint.js +138 -0
  41. package/src/core/wrapper/sort-package-json.js +1 -1
  42. package/src/core/wrapper/standard.js +1 -1
  43. package/src/core/wrapper/stylelint.js +1 -1
  44. package/src/core/wrapper/svglint.js +1 -1
  45. package/src/core/wrapper/wrapper.js +1 -1
  46. package/src/core/wrapper/yaml-lint.js +1 -1
  47. package/types/bin/argv.d.ts +1 -1
  48. package/types/core/configuration/override.d.ts +0 -1
  49. package/types/core/index.d.ts +1 -1
  50. package/types/core/levels.d.ts +10 -6
  51. package/types/core/results.d.ts +3 -2
  52. package/types/core/severities.d.ts +15 -8
  53. package/types/core/wrapper/addons-linter.d.ts +1 -1
  54. package/types/core/wrapper/ajv.d.ts +1 -1
  55. package/types/core/wrapper/biomejs__js-api.d.ts +38 -0
  56. package/types/core/wrapper/coffeelint__cli.d.ts +1 -1
  57. package/types/core/wrapper/depcheck.d.ts +1 -1
  58. package/types/core/wrapper/doiuse.d.ts +1 -1
  59. package/types/core/wrapper/eslint.d.ts +1 -1
  60. package/types/core/wrapper/htmlhint.d.ts +1 -1
  61. package/types/core/wrapper/htmllint.d.ts +1 -1
  62. package/types/core/wrapper/jshint.d.ts +1 -1
  63. package/types/core/wrapper/jsonlint-mod.d.ts +1 -1
  64. package/types/core/wrapper/mapbox__jsonlint-lines-primitives.d.ts +1 -1
  65. package/types/core/wrapper/markdownlint.d.ts +1 -1
  66. package/types/core/wrapper/markuplint.d.ts +1 -1
  67. package/types/core/wrapper/npm-check-updates.d.ts +1 -1
  68. package/types/core/wrapper/npm-package-json-lint.d.ts +1 -1
  69. package/types/core/wrapper/prantlf__jsonlint.d.ts +1 -1
  70. package/types/core/wrapper/prettier.d.ts +1 -1
  71. package/types/core/wrapper/purgecss.d.ts +1 -1
  72. package/types/core/wrapper/secretlint.d.ts +42 -0
  73. package/types/core/wrapper/sort-package-json.d.ts +1 -1
  74. package/types/core/wrapper/standard.d.ts +1 -1
  75. package/types/core/wrapper/stylelint.d.ts +1 -1
  76. package/types/core/wrapper/svglint.d.ts +1 -1
  77. package/types/core/wrapper/yaml-lint.d.ts +1 -1
package/README.md CHANGED
@@ -2,24 +2,21 @@
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]
10
10
 
11
- > _Un linter pour les gouverner tous._
11
+ > _One linter to rule them all._
12
12
 
13
- ## Description
14
-
15
- **Metalint** est un outil pour analyser tous les fichiers de votre projet.
16
- L'analyse est déléguée à des linters (outils d'analyse statique de code source)
17
- :
13
+ **Metalint** is a tool for analyzing all the files in your project. Analysis is
14
+ delegated to linters (static source code analysis tools):
18
15
 
19
16
  <!-- markdownlint-disable no-inline-html -->
20
17
  <table>
21
18
  <tr>
22
- <th>Langage / Technologie</th>
19
+ <th>Language / Technology</th>
23
20
  <th>Linters</th>
24
21
  </tr>
25
22
  <tr>
@@ -32,6 +29,8 @@ L'analyse est déléguée à des linters (outils d'analyse statique de code sour
32
29
  <tr>
33
30
  <td>CSS</td>
34
31
  <td>
32
+ <a title="@biomejs/js-api"
33
+ href="https://www.npmjs.com/package/@biomejs/js-api">Biome</a>,
35
34
  <a title="doiuse" href="https://www.npmjs.com/package/doiuse">DoIUse</a>,
36
35
  <a title="prettier"
37
36
  href="https://www.npmjs.com/package/prettier">Prettier</a>,
@@ -57,6 +56,8 @@ L'analyse est déléguée à des linters (outils d'analyse statique de code sour
57
56
  <tr>
58
57
  <td>JavaScript</td>
59
58
  <td>
59
+ <a title="@biomejs/js-api"
60
+ href="https://www.npmjs.com/package/@biomejs/js-api">Biome</a>,
60
61
  <a title="eslint" href="https://www.npmjs.com/package/eslint">ESLint</a>,
61
62
  <a title="jshint" href="https://www.npmjs.com/package/jshint">JSHint</a>,
62
63
  <a title="standard"
@@ -70,6 +71,8 @@ L'analyse est déléguée à des linters (outils d'analyse statique de code sour
70
71
  <td>JSON</td>
71
72
  <td>
72
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>,
73
76
  <a title="@mapbox/jsonlint-lines-primitives"
74
77
  href="https://www.npmjs.com/package/@mapbox/jsonlint-lines-primitives">@mapbox/JSON
75
78
  Lint lines-primitives</a>,
@@ -157,30 +160,36 @@ L'analyse est déléguée à des linters (outils d'analyse statique de code sour
157
160
  href="https://www.npmjs.com/package/prettier">Prettier</a>
158
161
  </td>
159
162
  </tr>
163
+ <tr>
164
+ <td></td>
165
+ <td>
166
+ <a title="secretlint"
167
+ href="https://www.npmjs.com/package/secretlint">Secretlint</a>
168
+ </td>
169
+ </tr>
160
170
  </table>
161
171
  <!-- markdownlint-enable no-inline-html -->
162
172
 
163
- ## Installation
173
+ ## Install
164
174
 
165
- Vous pouvez installer Metalint en utilisant [npm][link-npm] :
175
+ You can install Metalint using [npm][link-npm]:
166
176
 
167
177
  ```shell
168
- npm install --save-dev --save-exact metalint
178
+ npm install --save-dev metalint
169
179
  ```
170
180
 
171
181
  ## Configuration
172
182
 
173
- Tous les fichiers de configuration sont à regrouper dans le répertoire
174
- `.metalint/` qui doit être placé à la racine du projet. Le fichier
175
- `metalint.config.js` export un objet JSON indiquant les linters à utiliser pour
176
- chaque fichier. Les autres fichiers contiennent les options spécifiques pour les
177
- linters.
183
+ All configuration files are grouped together in the `.metalint/` directory,
184
+ which should be placed at the root of the project. The `metalint.config.js` file
185
+ exports a JSON object indicating the linters to be used for each file. The other
186
+ files contain the specific options for the linters.
178
187
 
179
- ## Exemple
188
+ ## Example
180
189
 
181
- Dans cet exemple des fichiers de configuration, Metalint analyse les fichiers
182
- JavaScript (non-minifiés), HTML et CSS ; avec respectivement les linters ESLint,
183
- HTMLHint et Stylelint.
190
+ In this example of configuration files, Metalint analyzes JavaScript
191
+ (non-minified), HTML and CSS files; with ESLint, HTMLHint and Stylelint linters
192
+ respectively.
184
193
 
185
194
  ```javascript
186
195
  // .metalint/metalint.config.js
@@ -229,12 +238,18 @@ export default {
229
238
  };
230
239
  ```
231
240
 
232
- ## Intégration
241
+ If you want to see real configurations, you've got the
242
+ [Metalint configuration](https://github.com/regseb/metalint/tree/HEAD/.metalint)
243
+ itself; or the
244
+ [Cast Kodi configuration](https://github.com/regseb/castkodi/tree/HEAD/.metalint)
245
+ (a browser WebExtension developed in JavaScript, HTML, CSS).
246
+
247
+ ## Integration
233
248
 
234
249
  ### npm
235
250
 
236
- Après avoir installé Metalint et les linters dans votre projet npm, vous pouvez
237
- ajouter le script suivant dans votre `package.json` :
251
+ After installing Metalint and the linters in your npm project, you can add the
252
+ following script to your `package.json`:
238
253
 
239
254
  ```json
240
255
  {
@@ -245,23 +260,23 @@ ajouter le script suivant dans votre `package.json` :
245
260
  }
246
261
  ```
247
262
 
248
- Metalint est maintenant utilisable avec les commandes : `npm run lint` et
249
- `npm run lint:fix`
263
+ Metalint can now be used with the following commands: `npm run lint` and
264
+ `npm run lint:fix`.
250
265
 
251
266
  ### GitHub Actions
252
267
 
253
- Pour lancer Metalint dans vos GitHub Actions, vous pouvez utiliser le formateur
254
- `github` pour rapporter les problèmes dans les pull requests.
268
+ To launch Metalint in your GitHub Actions, you can use the `github` formatter to
269
+ report problems in pull requests.
255
270
 
256
271
  ```yaml
257
272
  jobs:
258
273
  lint:
259
274
  runs-on: ubuntu-latest
260
275
  steps:
261
- - uses: actions/checkout@v4
276
+ - uses: actions/checkout@v5
262
277
  with:
263
278
  persist-credentials: false
264
- - uses: actions/setup-node@v4
279
+ - uses: actions/setup-node@v5
265
280
  - name: Install dependencies
266
281
  run: npm ci
267
282
  - name: Lint files
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "metalint",
3
- "version": "0.19.0",
4
- "description": "Un linter pour les gouverner tous.",
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": "./src/bin/index.js",
48
- "repository": "regseb/metalint",
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",
@@ -54,64 +59,177 @@
54
59
  "test": "npm run test:unit",
55
60
  "test:unit": "node --test 'test/unit/**/*.js'",
56
61
  "test:coverage": "stryker run",
62
+ "test:fuzz": "node --test 'test/fuzz/**/*.js'",
57
63
  "jsdocs": "typedoc --tsconfig .tsconfig_jsdocs.json",
58
64
  "prepare": "tsc --project .tsconfig_types.json",
59
65
  "clean": "node .script/clean.js"
60
66
  },
61
- "dependencies": {
62
- "chalk": "5.4.1",
63
- "yargs": "17.7.2"
64
- },
65
67
  "devDependencies": {
68
+ "@biomejs/js-api": "4.0.0",
69
+ "@biomejs/wasm-nodejs": "2.3.1",
66
70
  "@coffeelint/cli": "5.2.11",
67
71
  "@mapbox/jsonlint-lines-primitives": "2.0.2",
68
72
  "@prantlf/jsonlint": "16.0.0",
69
- "@prettier/plugin-xml": "3.4.1",
70
- "@stryker-mutator/core": "8.7.1",
71
- "@stryker-mutator/tap-runner": "8.7.1",
72
- "@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",
73
78
  "@types/htmlhint": "1.1.5",
74
79
  "@types/js-yaml": "4.0.9",
75
80
  "@types/jshint": "2.12.4",
76
81
  "@types/semver-utils": "1.1.3",
77
- "@types/yargs": "17.0.33",
78
- "addons-linter": "7.7.0",
82
+ "addons-linter": "8.4.0",
79
83
  "ajv": "8.17.1",
80
84
  "depcheck": "1.4.7",
81
85
  "doiuse": "6.0.5",
82
- "eslint": "9.17.0",
83
- "eslint-plugin-array-func": "5.0.2",
86
+ "eslint": "9.38.0",
87
+ "eslint-plugin-array-func": "5.1.0",
84
88
  "eslint-plugin-eslint-comments": "3.2.0",
85
- "eslint-plugin-import": "2.31.0",
86
- "eslint-plugin-jsdoc": "50.6.1",
87
- "eslint-plugin-mocha": "10.5.0",
88
- "eslint-plugin-n": "17.15.1",
89
- "eslint-plugin-no-unsanitized": "4.1.2",
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",
90
94
  "eslint-plugin-promise": "7.2.1",
91
- "eslint-plugin-regexp": "2.7.0",
92
- "eslint-plugin-unicorn": "56.0.1",
93
- "globals": "15.14.0",
94
- "htmlhint": "1.1.4",
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",
95
100
  "htmllint": "0.8.0",
96
101
  "jshint": "2.13.6",
97
102
  "jsonlint-mod": "1.7.6",
98
103
  "jszip": "3.10.1",
99
- "markdownlint": "0.37.3",
100
- "markuplint": "4.11.4",
101
- "npm-check-updates": "17.1.13",
102
- "npm-package-json-lint": "8.0.0",
103
- "prettier": "3.4.2",
104
- "publint": "0.2.12",
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",
105
110
  "purgecss": "7.0.2",
106
- "sort-package-json": "2.12.0",
111
+ "secretlint": "11.2.5",
112
+ "sort-package-json": "3.4.0",
107
113
  "standard": "17.1.2",
108
- "stylelint": "16.12.0",
109
- "svglint": "3.1.0",
110
- "typedoc": "0.27.6",
111
- "typescript": "5.7.2",
114
+ "stylelint": "16.25.0",
115
+ "svglint": "4.1.2",
116
+ "typedoc": "0.28.14",
117
+ "typescript": "5.9.3",
112
118
  "yaml-lint": "1.7.0"
113
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
+ },
114
232
  "engines": {
115
- "node": ">=22.12"
233
+ "node": ">=22.13.0"
116
234
  }
117
235
  }
package/src/bin/argv.js CHANGED
@@ -6,24 +6,21 @@
6
6
 
7
7
  import fs from "node:fs/promises";
8
8
  import process from "node:process";
9
- import yargs from "yargs";
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
- * @import { Level } from "../core/levels.js"
21
17
  * @import { TypeofFormatter } from "../core/formatter/formatter.js"
18
+ * @import { Level } from "../core/levels.js"
22
19
  */
23
20
 
24
21
  /**
25
22
  * @typedef {Object} Argv
26
- * @prop {string[]} _ Les paramètres de la ligne de commande.
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 function (argv = hideBin(process.argv)) {
46
- // Désactiver cette règle, car il y a un faux-positif avec la méthode
47
- // yargs.parseSync().
48
- // eslint-disable-next-line n/no-sync
49
- const args = yargs(argv)
50
- .options({
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
- .help(false)
79
- .parseSync();
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 === args._.length
74
+ bases:
75
+ 0 === positionals.length
85
76
  ? ["./"]
86
77
  : await Promise.all(
87
- args._.map(async (base) => {
88
- const stats = await fs.lstat(base.toString());
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: args.config,
95
- fix: normalizeFix(args.fix),
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 === args.formatter
86
+ undefined === values.formatter
101
87
  ? undefined
102
- : await normalizeFormatter(args.formatter),
103
- level: normalizeLevel(args.level),
104
- help: args.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
@@ -22,7 +22,7 @@ try {
22
22
  formatter: argv.formatter,
23
23
  level: argv.level,
24
24
  });
25
- const results = await metalint.lintFiles(argv._);
25
+ const results = await metalint.lintFiles(argv.bases);
26
26
  const severity = await metalint.report(results);
27
27
 
28
28
  let code;
@@ -8,14 +8,14 @@ import Levels from "../levels.js";
8
8
  import { merge } from "../utils/object.js";
9
9
 
10
10
  /**
11
+ * @import { TypeofFormatter } from "../formatter/formatter.js"
12
+ * @import { Level } from "../levels.js"
13
+ * @import { TypeofWrapper } from "../wrapper/wrapper.js"
11
14
  * @import { NormalizedConfig } from "./normalize.js"
12
15
  * @import { NormalizedConfigChecker } from "./normalize.js"
13
16
  * @import { NormalizedConfigLinter } from "./normalize.js"
14
17
  * @import { NormalizedConfigOverride } from "./normalize.js"
15
18
  * @import { NormalizedConfigReporter } from "./normalize.js"
16
- * @import { Level } from "../levels.js"
17
- * @import { TypeofFormatter } from "../formatter/formatter.js"
18
- * @import { TypeofWrapper } from "../wrapper/wrapper.js"
19
19
  */
20
20
 
21
21
  /**
@@ -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 = function (hierarchies, { patterns }) {
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 = function (hierarchy, { fix }) {
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 = function (hierarchy, { level }) {
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 = function (hierarchies, { options }) {
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 = function (hierarchy, { level }) {
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 = function (hierarchies, { formatter, level }) {
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 = function (hierarchy, { fix, level, options }) {
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 = function (hierarchies, { fix, level }) {
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 = function (hierarchy, { fix, level }) {
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 = function (hierarchy, { fix, level }) {
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 = function (hierarchy, argv) {
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,