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 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@v4
276
+ - uses: actions/checkout@v5
271
277
  with:
272
278
  persist-credentials: false
273
- - uses: actions/setup-node@v4
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.20.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",
@@ -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.1",
71
- "@secretlint/secretlint-rule-github": "9.3.0",
72
- "@secretlint/secretlint-rule-npm": "9.3.0",
73
- "@stryker-mutator/core": "8.7.1",
74
- "@stryker-mutator/tap-runner": "8.7.1",
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
- "@types/yargs": "17.0.33",
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.24.0",
86
- "eslint-plugin-array-func": "5.0.2",
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.31.0",
89
- "eslint-plugin-jsdoc": "50.6.9",
90
- "eslint-plugin-mocha": "10.5.0",
91
- "eslint-plugin-n": "17.17.0",
92
- "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",
93
94
  "eslint-plugin-promise": "7.2.1",
94
- "eslint-plugin-regexp": "2.7.0",
95
- "eslint-plugin-unicorn": "58.0.0",
96
- "fast-check": "4.0.1",
97
- "globals": "16.0.0",
98
- "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",
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.37.4",
104
- "markuplint": "4.11.8",
105
- "npm-check-updates": "17.1.16",
106
- "npm-package-json-lint": "8.0.0",
107
- "prettier": "3.5.3",
108
- "publint": "0.3.10",
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": "9.3.0",
111
- "sort-package-json": "3.0.0",
111
+ "secretlint": "11.2.5",
112
+ "sort-package-json": "3.4.0",
112
113
  "standard": "17.1.2",
113
- "stylelint": "16.17.0",
114
- "svglint": "3.1.0",
115
- "typedoc": "0.28.1",
116
- "typescript": "5.8.3",
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.12"
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 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
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[]} _ 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;
@@ -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,