metalint 0.13.0 → 0.14.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
@@ -100,15 +100,21 @@ source) :
100
100
  <tr>
101
101
  <td>package.json</td>
102
102
  <td>
103
+ <!-- markdownlint-disable no-bare-urls -->
104
+ <!-- https://github.com/DavidAnson/markdownlint/issues/961 -->
103
105
  <a title="npm-check-updates"
104
106
  href="https://www.npmjs.com/package/npm-check-updates"
105
107
  >npm-check-updates</a>,
108
+ <!-- markdownlint-enable no-bare-urls -->
109
+ <!-- markdownlint-disable no-bare-urls -->
110
+ <!-- https://github.com/DavidAnson/markdownlint/issues/961 -->
106
111
  <a title="npm-package-json-lint"
107
112
  href="https://www.npmjs.com/package/npm-package-json-lint"
108
113
  >npm-package-json-lint</a>,
114
+ <!-- markdownlint-enable no-bare-urls -->
109
115
  <a title="sort-package-json"
110
- href="https://www.npmjs.com/package/sort-package-json"
111
- >Sort Package.json</a>
116
+ href="https://www.npmjs.com/package/sort-package-json">Sort
117
+ Package.json</a>
112
118
  </td>
113
119
  </tr>
114
120
  <tr>
@@ -228,14 +234,10 @@ ajouter le script suivant dans votre `package.json` :
228
234
 
229
235
  Metalint est maintenant utilisable avec la commande : `npm run lint`
230
236
 
231
- [img-npm]: https://img.shields.io/npm/dm/metalint?label=npm&logo=npm&logoColor=white
232
- [img-build]: https://img.shields.io/github/actions/workflow/status/regseb/metalint/ci.yml?branch=main&logo=github&logoColor=white
233
-
234
- <!-- Attendre que le logo de Stryker soit accepté.
235
- https://github.com/simple-icons/simple-icons/pull/7388 -->
236
-
237
- [img-coverage]: https://img.shields.io/endpoint?label=coverage&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fregseb%2Fmetalint%2Fmain
238
- [img-semver]: https://img.shields.io/badge/semver-2.0.0-blue?logo=semver&logoColor=white
237
+ [img-npm]: https://img.shields.io/npm/dm/metalint?label=npm&logo=npm&logoColor=whitesmoke
238
+ [img-build]: https://img.shields.io/github/actions/workflow/status/regseb/metalint/ci.yml?branch=main&logo=github&logoColor=whitesmoke
239
+ [img-coverage]: https://img.shields.io/endpoint?label=coverage&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fregseb%2Fmetalint%2Fmain&logo=stryker&logoColor=whitesmoke
240
+ [img-semver]: https://img.shields.io/badge/semver-2.0.0-blue?logo=semver&logoColor=whitesmoke
239
241
  [link-npm]: https://www.npmjs.com/package/metalint
240
242
  [link-build]: https://github.com/regseb/metalint/actions/workflows/ci.yml?query=branch%3Amain
241
243
  [link-coverage]: https://dashboard.stryker-mutator.io/reports/github.com/regseb/metalint/main
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metalint",
3
- "version": "0.13.0",
3
+ "version": "0.14.1",
4
4
  "description": "Un linter pour les gouverner tous.",
5
5
  "keywords": [
6
6
  "checker",
@@ -21,6 +21,21 @@
21
21
  "./src/",
22
22
  "./types/"
23
23
  ],
24
+ "exports": {
25
+ ".": {
26
+ "types": "./types/index.d.ts",
27
+ "default": "./src/code/index.js"
28
+ },
29
+ "./api/formatter": {
30
+ "types": "./types/formatter/formatter.d.ts",
31
+ "default": "./src/core/formatter/formatter.js"
32
+ },
33
+ "./api/wrapper": {
34
+ "types": "./types/wrapper/wrapper.d.ts",
35
+ "default": "./src/core/wrapper/wrapper.js"
36
+ },
37
+ "./package.json": "./package.json"
38
+ },
24
39
  "main": "./src/core/index.js",
25
40
  "types": "./types/index.d.ts",
26
41
  "bin": "./src/bin/index.js",
@@ -35,7 +50,6 @@
35
50
  "test:coverage": "stryker run .stryker.config.js",
36
51
  "jsdocs": "typedoc --tsconfig .tsconfig_jsdocs.json",
37
52
  "prepare": "tsc --project .tsconfig_types.json",
38
- "release": "standard-version",
39
53
  "clean": "node .script/clean.js"
40
54
  },
41
55
  "dependencies": {
@@ -45,52 +59,51 @@
45
59
  "devDependencies": {
46
60
  "@coffeelint/cli": "5.2.11",
47
61
  "@prantlf/jsonlint": "14.0.3",
48
- "@prettier/plugin-xml": "3.1.1",
62
+ "@prettier/plugin-xml": "3.2.0",
49
63
  "@stryker-mutator/core": "7.1.1",
50
64
  "@stryker-mutator/mocha-runner": "7.1.1",
51
- "@types/eslint": "8.44.0",
65
+ "@types/eslint": "8.44.2",
52
66
  "@types/htmlhint": "1.1.2",
67
+ "@types/jshint": "2.12.2",
53
68
  "@types/mocha": "10.0.1",
54
69
  "@types/mock-fs": "4.13.1",
55
- "@types/prettier": "2.7.3",
56
- "@types/sinon": "10.0.15",
70
+ "@types/sinon": "10.0.16",
57
71
  "@types/yargs": "17.0.24",
58
- "addons-linter": "6.10.0",
72
+ "addons-linter": "6.13.0",
59
73
  "csslint": "1.0.5",
60
74
  "doiuse": "6.0.2",
61
- "eslint": "8.45.0",
75
+ "eslint": "8.49.0",
62
76
  "eslint-plugin-array-func": "3.1.8",
63
77
  "eslint-plugin-eslint-comments": "3.2.0",
64
- "eslint-plugin-import": "2.27.5",
65
- "eslint-plugin-jsdoc": "46.4.4",
78
+ "eslint-plugin-import": "2.28.1",
79
+ "eslint-plugin-jsdoc": "46.5.1",
66
80
  "eslint-plugin-mocha": "10.1.0",
67
- "eslint-plugin-n": "16.0.1",
81
+ "eslint-plugin-n": "16.0.2",
68
82
  "eslint-plugin-no-unsanitized": "4.0.2",
69
83
  "eslint-plugin-promise": "6.1.1",
70
84
  "eslint-plugin-regexp": "1.15.0",
71
- "eslint-plugin-unicorn": "48.0.0",
85
+ "eslint-plugin-unicorn": "48.0.1",
72
86
  "htmlhint": "1.1.4",
73
87
  "htmllint": "0.8.0",
74
88
  "jshint": "2.13.6",
75
89
  "jsonlint-mod": "1.7.6",
76
- "markdownlint": "0.29.0",
77
- "markuplint": "3.12.0",
90
+ "markdownlint": "0.31.0",
91
+ "markuplint": "3.12.1",
78
92
  "mocha": "10.2.0",
79
93
  "mock-fs": "5.2.0",
80
- "npm-check-updates": "16.10.16",
94
+ "npm-check-updates": "16.13.3",
81
95
  "npm-package-json-lint": "7.0.0",
82
- "prettier": "3.0.0",
96
+ "prettier": "3.0.3",
83
97
  "purgecss": "5.0.0",
84
98
  "sinon": "15.2.0",
85
99
  "sort-package-json": "2.5.1",
86
100
  "standard": "17.1.0",
87
- "standard-version": "9.5.0",
88
- "stylelint": "15.10.2",
89
- "typedoc": "0.24.8",
90
- "typescript": "5.1.6",
101
+ "stylelint": "15.10.3",
102
+ "typedoc": "0.25.1",
103
+ "typescript": "5.2.2",
91
104
  "yaml-lint": "1.7.0"
92
105
  },
93
106
  "engines": {
94
- "node": ">=18.12.0"
107
+ "node": ">=20.0.0"
95
108
  }
96
109
  }
package/src/bin/argv.js CHANGED
@@ -90,7 +90,7 @@ export const parse = async function (argv = process.argv.slice(2)) {
90
90
  ),
91
91
  config: args.config,
92
92
  fix: args.fix,
93
- // Ne pas utiliser yargs.coerce() pour convertir les données car cette
93
+ // Ne pas utiliser yargs.coerce() pour convertir les données, car cette
94
94
  // méthode est incompatible avec yargs.choices().
95
95
  // https://github.com/yargs/yargs/issues/1379
96
96
  formatter:
package/src/bin/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // Désactiver cette règle car elle ne supporte pas les valeurs de la propriété
3
+ // Désactiver cette règle, car elle ne supporte pas les valeurs de la propriété
4
4
  // "files" (du package.json) commençant par "./".
5
5
  // https://github.com/eslint-community/eslint-plugin-n/issues/99
6
6
  // eslint-disable-next-line n/no-unpublished-bin
@@ -49,7 +49,7 @@ if (undefined === import.meta.resolve) {
49
49
  * @param {FlattenedConfigReporter[]} reporters La liste des rapporteurs
50
50
  * utilisés pour afficher les
51
51
  * résultats.
52
- * @returns {Promise<Severity|undefined>} La sévérité la plus élévée des
52
+ * @returns {Promise<Severity|undefined>} La sévérité la plus élevée des
53
53
  * résultats.
54
54
  */
55
55
  const check = async function (files, checkers, root, reporters) {
@@ -61,7 +61,7 @@ const check = async function (files, checkers, root, reporters) {
61
61
  });
62
62
  const results = await metalint(files, checkers, root);
63
63
  for (const [file, notices] of Object.entries(results)) {
64
- // Déterminer la sévérité la plus élévée des résultats.
64
+ // Déterminer la sévérité la plus élevée des résultats.
65
65
  if (undefined !== notices) {
66
66
  for (const notice of notices) {
67
67
  if (undefined === severity || severity > notice.severity) {
@@ -8,7 +8,6 @@ import Levels from "../levels.js";
8
8
  import { merge } from "../utils/object.js";
9
9
 
10
10
  /**
11
- * @typedef {NodeJS.WritableStream} WritableStream
12
11
  * @typedef {import("../formatter/formatter.js").default} TypeofFormatter
13
12
  * @typedef {import("../../type/index.d.ts").FlattenedConfig} FlattenedConfig
14
13
  * @typedef {import("../../type/index.d.ts").FlattenedConfigChecker} FlattenedConfigChecker
@@ -11,7 +11,6 @@ import Levels from "../levels.js";
11
11
  import Wrapper, { WRAPPERS } from "../wrapper/wrapper.js";
12
12
 
13
13
  /**
14
- * @typedef {NodeJS.WritableStream} WritableStream
15
14
  * @typedef {import("../../type/index.d.ts").Level} Level
16
15
  * @typedef {import("../../type/index.d.ts").NormalizedConfig} NormalizedConfig
17
16
  * @typedef {import("../../type/index.d.ts").NormalizedConfigChecker} NormalizedConfigChecker
@@ -481,8 +480,8 @@ export const normalizeCheckers = async function (partials, { dir }) {
481
480
 
482
481
  /**
483
482
  * Normalise la configuration. La structure de l'objet JSON contenant la
484
- * configuration est souple pour rendre le fichier moins verbeuse. Cette
485
- * fonction renseigne les valeurs par défaut pour les propriétes non-présentes.
483
+ * configuration est souple pour rendre le fichier moins verbeux. Cette fonction
484
+ * renseigne les valeurs par défaut pour les propriétés non-présentes.
486
485
  *
487
486
  * @param {*} partial L'objet JSON contenant la configuration.
488
487
  * @param {Object} context Le context de la propriété.
@@ -9,7 +9,7 @@ import Severities from "../severities.js";
9
9
  import Formatter from "./formatter.js";
10
10
 
11
11
  /**
12
- * @typedef {NodeJS.WritableStream} WritableStream
12
+ * @typedef {import("node:stream").Writable} Writable
13
13
  * @typedef {import("../../type/index.js").Level} Level
14
14
  * @typedef {import("../../type/index.js").Notice} Notice
15
15
  */
@@ -46,7 +46,7 @@ export default class CheckstyleFormatter extends Formatter {
46
46
  /**
47
47
  * Le flux où écrire les résultats.
48
48
  *
49
- * @type {WritableStream}
49
+ * @type {Writable}
50
50
  */
51
51
  #writer;
52
52
 
@@ -61,14 +61,13 @@ export default class CheckstyleFormatter extends Formatter {
61
61
  /**
62
62
  * Crée un formateur.
63
63
  *
64
- * @param {Level} level Le niveau de sévérité minimum
65
- * des notifications affichées.
66
- * @param {Object} options Les options du formateur.
67
- * @param {WritableStream} [options.writer] Le flux où écrire les résultats.
68
- * @param {number} [options.indent] La taille des indentations (en
69
- * espace) ou <code>-1</code> (par
70
- * défaut) pour ne pas mettre de
71
- * retour à la ligne.
64
+ * @param {Level} level Le niveau de sévérité minimum des
65
+ * notifications affichées.
66
+ * @param {Object} options Les options du formateur.
67
+ * @param {Writable} [options.writer] Le flux où écrire les résultats.
68
+ * @param {number} [options.indent] La taille des indentations (en espace)
69
+ * ou <code>-1</code> (par défaut) pour
70
+ * ne pas mettre de retour à la ligne.
72
71
  */
73
72
  constructor(level, options) {
74
73
  super(level);
@@ -11,7 +11,7 @@ import Severities from "../severities.js";
11
11
  import Formatter from "./formatter.js";
12
12
 
13
13
  /**
14
- * @typedef {NodeJS.WritableStream} WritableStream
14
+ * @typedef {import("node:stream").Writable} Writable
15
15
  * @typedef {import("../../type/index.js").Level} Level
16
16
  * @typedef {import("../../type/index.js").Location} Location
17
17
  * @typedef {import("../../type/index.js").Notice} Notice
@@ -21,9 +21,9 @@ import Formatter from "./formatter.js";
21
21
  /**
22
22
  * Écrit un message avec un style / couleur.
23
23
  *
24
- * @param {WritableStream} writer Le flux où afficher le message.
25
- * @param {string} message Le message qui sera affiché.
26
- * @param {string} [style] Le code du style.
24
+ * @param {Writable} writer Le flux où afficher le message.
25
+ * @param {string} message Le message qui sera affiché.
26
+ * @param {string} [style] Le code du style.
27
27
  */
28
28
  const print = function (writer, message, style) {
29
29
  let line;
@@ -56,11 +56,11 @@ const print = function (writer, message, style) {
56
56
  /**
57
57
  * Écrit une ligne du code source.
58
58
  *
59
- * @param {number} line Le numéro de la ligne.
60
- * @param {string[]} content Toutes les lignes du fichiers.
61
- * @param {boolean} active La marque indiquant si la problème est dans
62
- * cette ligne.
63
- * @param {WritableStream} writer Le flux où afficher la ligne.
59
+ * @param {number} line Le numéro de la ligne.
60
+ * @param {string[]} content Toutes les lignes du fichier.
61
+ * @param {boolean} active La marque indiquant si le problème est dans cette
62
+ * ligne.
63
+ * @param {Writable} writer Le flux où afficher la ligne.
64
64
  */
65
65
  const printCodeSourceLine = function (line, content, active, writer) {
66
66
  // Vérifier que le numéro de la ligne demandée existe dans le fichier.
@@ -76,10 +76,10 @@ const printCodeSourceLine = function (line, content, active, writer) {
76
76
  /**
77
77
  * Écrit le code source proche des lieux où le problème a été trouvé.
78
78
  *
79
- * @param {Location[]} locations Les positions, dans le code source, du
80
- * problème.
81
- * @param {string[]} content Toutes les lignes du fichiers.
82
- * @param {WritableStream} writer Le flux où afficher les lignes incriminées.
79
+ * @param {Location[]} locations Les positions, dans le code source, du
80
+ * problème.
81
+ * @param {string[]} content Toutes les lignes du fichier.
82
+ * @param {Writable} writer Le flux où afficher les lignes incriminées.
83
83
  */
84
84
  const printCodeSource = function (locations, content, writer) {
85
85
  const characters = [];
@@ -133,7 +133,7 @@ export default class ConsoleFormatter extends Formatter {
133
133
  /**
134
134
  * Le flux où écrire les résultats.
135
135
  *
136
- * @type {WritableStream}
136
+ * @type {Writable}
137
137
  */
138
138
  #writer;
139
139
 
@@ -145,7 +145,7 @@ export default class ConsoleFormatter extends Formatter {
145
145
  #showZeroNotice;
146
146
 
147
147
  /**
148
- * Le marque indiquant s'il faut afficher les fichiers non-analysés.
148
+ * La marque indiquant s'il faut afficher les fichiers non-analysés.
149
149
  *
150
150
  * @type {boolean}
151
151
  */
@@ -154,20 +154,17 @@ export default class ConsoleFormatter extends Formatter {
154
154
  /**
155
155
  * Crée un formateur.
156
156
  *
157
- * @param {Level} level Le niveau de sévérité
158
- * minimum des
159
- * notifications affichées.
160
- * @param {Object} options Les options du
161
- * formateur.
162
- * @param {WritableStream} [options.writer] Le flux écrire les
163
- * résultats.
164
- * @param {boolean} [options.showZeroNotice] La marque indiquant s'il
165
- * faut afficher les
166
- * fichiers sans
167
- * notification.
168
- * @param {boolean} [options.showNoChecked] Le marque indiquant s'il
169
- * faut afficher les
170
- * fichiers non-analysés.
157
+ * @param {Level} level Le niveau de sévérité minimum
158
+ * des notifications affichées.
159
+ * @param {Object} options Les options du formateur.
160
+ * @param {Writable} [options.writer] Le flux où écrire les
161
+ * résultats.
162
+ * @param {boolean} [options.showZeroNotice] La marque indiquant s'il faut
163
+ * afficher les fichiers sans
164
+ * notification.
165
+ * @param {boolean} [options.showNoChecked] Le marque indiquant s'il faut
166
+ * afficher les fichiers
167
+ * non-analysés.
171
168
  */
172
169
  constructor(level, options) {
173
170
  super(level);
@@ -8,7 +8,7 @@ import process from "node:process";
8
8
  import Formatter from "./formatter.js";
9
9
 
10
10
  /**
11
- * @typedef {NodeJS.WritableStream} WritableStream
11
+ * @typedef {import("node:stream").Writable} Writable
12
12
  * @typedef {import("../../type/index.js").Level} Level
13
13
  * @typedef {import("../../type/index.js").Notice} Notice
14
14
  */
@@ -33,23 +33,23 @@ export default class CSVFormatter extends Formatter {
33
33
  /**
34
34
  * Le flux où écrire les résultats.
35
35
  *
36
- * @type {WritableStream}
36
+ * @type {Writable}
37
37
  */
38
38
  #writer;
39
39
 
40
40
  /**
41
41
  * Crée un formateur.
42
42
  *
43
- * @param {Level} level Le niveau de sévérité minimum
44
- * des notifications affichées.
45
- * @param {Object} options Les options du formateur.
46
- * @param {WritableStream} [options.writer] Le flux où écrire les résultats.
43
+ * @param {Level} level Le niveau de sévérité minimum des
44
+ * notifications affichées.
45
+ * @param {Object} options Les options du formateur.
46
+ * @param {Writable} [options.writer] Le flux où écrire les résultats.
47
47
  */
48
48
  constructor(level, options) {
49
49
  super(level);
50
50
  this.#writer = options.writer ?? process.stdout;
51
51
 
52
- // Ecrire la ligne des titres.
52
+ // Écrire la ligne des titres.
53
53
  this.#writer.write("file,line,column,message,linter,rule\r\n");
54
54
  }
55
55
 
@@ -9,7 +9,7 @@ import Severities from "../severities.js";
9
9
  import Formatter from "./formatter.js";
10
10
 
11
11
  /**
12
- * @typedef {NodeJS.WritableStream} WritableStream
12
+ * @typedef {import("node:stream").Writable} Writable
13
13
  * @typedef {import("../../type/index.js").Level} Level
14
14
  * @typedef {import("../../type/index.js").Notice} Notice
15
15
  */
@@ -23,17 +23,17 @@ export default class GitHubFormatter extends Formatter {
23
23
  /**
24
24
  * Le flux où écrire les résultats.
25
25
  *
26
- * @type {WritableStream}
26
+ * @type {Writable}
27
27
  */
28
28
  #writer;
29
29
 
30
30
  /**
31
31
  * Crée un formateur.
32
32
  *
33
- * @param {Level} level Le niveau de sévérité minimum
34
- * des notifications affichées.
35
- * @param {Object} options Les options du formateur.
36
- * @param {WritableStream} [options.writer] Le flux où écrire les résultats.
33
+ * @param {Level} level Le niveau de sévérité minimum des
34
+ * notifications affichées.
35
+ * @param {Object} options Les options du formateur.
36
+ * @param {Writable} [options.writer] Le flux où écrire les résultats.
37
37
  */
38
38
  constructor(level, options) {
39
39
  super(level);
@@ -8,13 +8,13 @@ import process from "node:process";
8
8
  import Formatter from "./formatter.js";
9
9
 
10
10
  /**
11
- * @typedef {NodeJS.WritableStream} WritableStream
11
+ * @typedef {import("node:stream").Writable} Writable
12
12
  * @typedef {import("../../type/index.js").Level} Level
13
13
  * @typedef {import("../../type/index.js").Notice} Notice
14
14
  */
15
15
 
16
16
  /**
17
- * Le formateur qui écrit les résultats brut (au format JSON). La seul
17
+ * Le formateur qui écrit les résultats bruts (au format JSON). La seule
18
18
  * altération des résultats est le remplacement des <code>undefined</code> par
19
19
  * des <code>null</code>.
20
20
  *
@@ -24,7 +24,7 @@ export default class JSONFormatter extends Formatter {
24
24
  /**
25
25
  * Le flux où écrire les résultats.
26
26
  *
27
- * @type {WritableStream}
27
+ * @type {Writable}
28
28
  */
29
29
  #writer;
30
30
 
@@ -46,12 +46,12 @@ export default class JSONFormatter extends Formatter {
46
46
  /**
47
47
  * Crée un formateur.
48
48
  *
49
- * @param {Level} level Le niveau de sévérité minimum
50
- * des notifications affichées.
51
- * @param {Object} options Les options du formateur.
52
- * @param {WritableStream} [options.writer] Le flux où écrire les résultats.
53
- * @param {number} [options.indent] La taille des indentations (en
54
- * espace).
49
+ * @param {Level} level Le niveau de sévérité minimum des
50
+ * notifications affichées.
51
+ * @param {Object} options Les options du formateur.
52
+ * @param {Writable} [options.writer] Le flux où écrire les résultats.
53
+ * @param {number} [options.indent] La taille des indentations (en
54
+ * espace).
55
55
  */
56
56
  constructor(level, options) {
57
57
  super(level);
@@ -8,7 +8,7 @@ import process from "node:process";
8
8
  import Formatter from "./formatter.js";
9
9
 
10
10
  /**
11
- * @typedef {NodeJS.WritableStream} WritableStream
11
+ * @typedef {import("node:stream").Writable} Writable
12
12
  * @typedef {import("../../type/index.js").Level} Level
13
13
  * @typedef {import("../../type/index.js").Notice} Notice
14
14
  */
@@ -21,7 +21,7 @@ export default class UnixFormatter extends Formatter {
21
21
  /**
22
22
  * Le flux où écrire les résultats.
23
23
  *
24
- * @type {WritableStream}
24
+ * @type {Writable}
25
25
  */
26
26
  #writer;
27
27
 
@@ -35,10 +35,10 @@ export default class UnixFormatter extends Formatter {
35
35
  /**
36
36
  * Crée un formateur.
37
37
  *
38
- * @param {Level} level Le niveau de sévérité minimum
39
- * des notifications affichées.
40
- * @param {Object} options Les options du formateur.
41
- * @param {WritableStream} [options.writer] Le flux où écrire les résultats.
38
+ * @param {Level} level Le niveau de sévérité minimum des
39
+ * notifications affichées.
40
+ * @param {Object} options Les options du formateur.
41
+ * @param {Writable} [options.writer] Le flux où écrire les résultats.
42
42
  */
43
43
  constructor(level, options) {
44
44
  super(level);
package/src/core/index.js CHANGED
@@ -64,8 +64,8 @@ const Results = class {
64
64
  this.#data[file] = [];
65
65
  }
66
66
  for (const notice of notices) {
67
- // Vérifier aussi le fichier de la notification car il peut être
68
- // différent du fichier d'origine (qui est peut être un répertoire
67
+ // Vérifier aussi le fichier de la notification, car il peut être
68
+ // différent du fichier d'origine (qui est peut-être un répertoire
69
69
  // ou une archive).
70
70
  if (undefined === this.#data[notice.file]) {
71
71
  this.#data[notice.file] = [];
@@ -110,12 +110,12 @@ export default async function metalint(files, checkers, root) {
110
110
  for (const checker of checkers) {
111
111
  const glob = new Glob(checker.patterns, { root });
112
112
  if (glob.test(file)) {
113
- const key = [glob];
113
+ let key = checker.patterns.join();
114
114
  const values = [checker.linters];
115
115
  for (const override of checker.overrides) {
116
116
  const subglob = new Glob(override.patterns, { root });
117
117
  if (subglob.test(file)) {
118
- key.push(subglob);
118
+ key += "|" + override.patterns.join();
119
119
  values.push(override.linters);
120
120
  }
121
121
  }
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * @template T
11
11
  * @param {T|T[]} value L'élément.
12
- * @returns {T[]} Un avec seulement l'élément d'entré ou l'élément.
12
+ * @returns {T[]} Un tableau avec seulement l'élément d'entrée ou l'élément.
13
13
  */
14
14
  export const wrap = function (value) {
15
15
  return Array.isArray(value) ? value : [value];
@@ -180,7 +180,7 @@ export default class Glob {
180
180
  /**
181
181
  * Teste si un fichier / répertoire respecte les patrons.
182
182
  *
183
- * @param {string} file Le chemin du fichier / répertoire qui sera vérifié.
183
+ * @param {string} file Le chemin du fichier / répertoire qui sera vérifié.
184
184
  * @returns {string} <code>"DEEP_NEGATIVE"</code> pour un répertoire ne
185
185
  * respectant pas un patron qui exclue aussi ses
186
186
  * fichiers ; <code>"NEGATIVE"</code> si le fichier /
@@ -7,8 +7,8 @@
7
7
  // Ne pas utiliser la version promise de fs car la fonction createReadStream()
8
8
  // n'y est pas. https://github.com/nodejs/node/issues/38627
9
9
  import { createReadStream } from "node:fs";
10
- // Désactiver deux règles ESLint pour cette import car elles ne supportent pas
11
- // la propriété "exports" du package.json.
10
+ // Désactiver deux règles ESLint pour cet import, car elles ne supportent pas la
11
+ // propriété "exports" du package.json.
12
12
  // https://github.com/import-js/eslint-plugin-import/issues/1810
13
13
  // https://github.com/eslint-community/eslint-plugin-n/issues/21
14
14
  // eslint-disable-next-line import/no-unresolved, n/file-extension-in-import
@@ -6,10 +6,18 @@
6
6
 
7
7
  import fs from "node:fs/promises";
8
8
  import { ESLint } from "eslint";
9
+ // Désactiver deux règles ESLint pour cet import, car elles ne supportent pas la
10
+ // propriété "exports" du package.json.
11
+ // https://github.com/import-js/eslint-plugin-import/issues/1810
12
+ // https://github.com/eslint-community/eslint-plugin-n/issues/21
13
+ // eslint-disable-next-line import/no-unresolved, n/file-extension-in-import
14
+ import pkg from "eslint/use-at-your-own-risk";
9
15
  import Levels from "../levels.js";
10
16
  import Severities from "../severities.js";
11
17
  import Wrapper from "./wrapper.js";
12
18
 
19
+ const { FlatESLint } = pkg;
20
+
13
21
  /**
14
22
  * @typedef {import("../../type/index.d.ts").Level} Level
15
23
  * @typedef {import("../../type/index.d.ts").PartialNotice} PartialNotice
@@ -46,13 +54,24 @@ export default class ESLintWrapper extends Wrapper {
46
54
  */
47
55
  constructor(context, options) {
48
56
  super(context);
49
- this.#eslint = new ESLint({
50
- globInputPaths: false,
51
- ignore: false,
52
- baseConfig: options,
53
- useEslintrc: false,
54
- fix: this.fix,
55
- });
57
+ const { configType, ...baseConfig } = options;
58
+ if ("flat" === configType) {
59
+ this.#eslint = new FlatESLint({
60
+ globInputPaths: false,
61
+ ignore: false,
62
+ baseConfig,
63
+ fix: this.fix,
64
+ overrideConfigFile: true,
65
+ });
66
+ } else {
67
+ this.#eslint = new ESLint({
68
+ globInputPaths: false,
69
+ ignore: false,
70
+ baseConfig,
71
+ useEslintrc: false,
72
+ fix: this.fix,
73
+ });
74
+ }
56
75
  }
57
76
 
58
77
  /**
@@ -46,10 +46,7 @@ export default class NpmPackageJSONLintWrapper extends Wrapper {
46
46
  */
47
47
  constructor(context, options) {
48
48
  super(context);
49
- this.#options = {
50
- rules: {},
51
- ...options,
52
- };
49
+ this.#options = options;
53
50
  }
54
51
 
55
52
  /**
@@ -15,7 +15,7 @@ import Wrapper from "./wrapper.js";
15
15
  */
16
16
 
17
17
  /**
18
- * L'enrobage du linter <strong>Stytelint</strong>.
18
+ * L'enrobage du linter <strong>Stylelint</strong>.
19
19
  *
20
20
  * @see https://www.npmjs.com/package/stylelint
21
21
  */
@@ -29,7 +29,7 @@ export default class StylelintWrapper extends Wrapper {
29
29
  #options;
30
30
 
31
31
  /**
32
- * Crée un enrobage pour le linter <strong>Stytelint</strong>.
32
+ * Crée un enrobage pour le linter <strong>Stylelint</strong>.
33
33
  *
34
34
  * @param {Object} context Le contexte de l'enrobage.
35
35
  * @param {Level} context.level Le niveau de sévérité minimum
@@ -46,9 +46,7 @@ export default class StylelintWrapper extends Wrapper {
46
46
  constructor(context, options) {
47
47
  super(context);
48
48
  this.#options = {
49
- // Définir la propriété "rules" car celle-ci est obligatoire (même
50
- // si aucune règle est spécifiée).
51
- config: { rules: {}, ...options },
49
+ config: options,
52
50
  fix: this.fix,
53
51
  // Laisser à Metalint la gestion des fichiers à ignorer.
54
52
  disableDefaultIgnores: true,
@@ -71,7 +71,7 @@ export default class YAMLLintWrapper extends Wrapper {
71
71
  locations: [
72
72
  {
73
73
  // Augmenter de un le numéro de la ligne et de la
74
- // colonne car YAML Lint commence les numérotations
74
+ // colonne, car YAML Lint commence les numérotations
75
75
  // à zéro.
76
76
  line: err.mark.line + 1,
77
77
  column: err.mark.column + 1,
@@ -40,7 +40,6 @@ export function flatten(hierarchy: NormalizedConfig, argv: {
40
40
  level: Level;
41
41
  }): FlattenedConfig;
42
42
  export default flatten;
43
- export type WritableStream = NodeJS.WritableStream;
44
43
  export type TypeofFormatter = import("../formatter/formatter.js").default;
45
44
  export type FlattenedConfig = import("../../type/index.d.ts").FlattenedConfig;
46
45
  export type FlattenedConfigChecker = import("../../type/index.d.ts").FlattenedConfigChecker;
@@ -39,7 +39,6 @@ export function normalize(partial: any, { dir }: {
39
39
  dir: string;
40
40
  }): Promise<NormalizedConfig>;
41
41
  export default normalize;
42
- export type WritableStream = NodeJS.WritableStream;
43
42
  export type Level = import("../../type/index.d.ts").Level;
44
43
  export type NormalizedConfig = import("../../type/index.d.ts").NormalizedConfig;
45
44
  export type NormalizedConfigChecker = import("../../type/index.d.ts").NormalizedConfigChecker;
@@ -8,22 +8,21 @@ export default class CheckstyleFormatter extends Formatter {
8
8
  /**
9
9
  * Crée un formateur.
10
10
  *
11
- * @param {Level} level Le niveau de sévérité minimum
12
- * des notifications affichées.
13
- * @param {Object} options Les options du formateur.
14
- * @param {WritableStream} [options.writer] Le flux où écrire les résultats.
15
- * @param {number} [options.indent] La taille des indentations (en
16
- * espace) ou <code>-1</code> (par
17
- * défaut) pour ne pas mettre de
18
- * retour à la ligne.
11
+ * @param {Level} level Le niveau de sévérité minimum des
12
+ * notifications affichées.
13
+ * @param {Object} options Les options du formateur.
14
+ * @param {Writable} [options.writer] Le flux où écrire les résultats.
15
+ * @param {number} [options.indent] La taille des indentations (en espace)
16
+ * ou <code>-1</code> (par défaut) pour
17
+ * ne pas mettre de retour à la ligne.
19
18
  */
20
19
  constructor(level: Level, options: {
21
- writer?: WritableStream;
20
+ writer?: Writable;
22
21
  indent?: number;
23
22
  });
24
23
  #private;
25
24
  }
26
- export type WritableStream = NodeJS.WritableStream;
25
+ export type Writable = import("node:stream").Writable;
27
26
  export type Level = import("../../type/index.js").Level;
28
27
  export type Notice = import("../../type/index.js").Notice;
29
28
  import Formatter from "./formatter.js";
@@ -5,29 +5,26 @@ export default class ConsoleFormatter extends Formatter {
5
5
  /**
6
6
  * Crée un formateur.
7
7
  *
8
- * @param {Level} level Le niveau de sévérité
9
- * minimum des
10
- * notifications affichées.
11
- * @param {Object} options Les options du
12
- * formateur.
13
- * @param {WritableStream} [options.writer] Le flux écrire les
14
- * résultats.
15
- * @param {boolean} [options.showZeroNotice] La marque indiquant s'il
16
- * faut afficher les
17
- * fichiers sans
18
- * notification.
19
- * @param {boolean} [options.showNoChecked] Le marque indiquant s'il
20
- * faut afficher les
21
- * fichiers non-analysés.
8
+ * @param {Level} level Le niveau de sévérité minimum
9
+ * des notifications affichées.
10
+ * @param {Object} options Les options du formateur.
11
+ * @param {Writable} [options.writer] Le flux où écrire les
12
+ * résultats.
13
+ * @param {boolean} [options.showZeroNotice] La marque indiquant s'il faut
14
+ * afficher les fichiers sans
15
+ * notification.
16
+ * @param {boolean} [options.showNoChecked] Le marque indiquant s'il faut
17
+ * afficher les fichiers
18
+ * non-analysés.
22
19
  */
23
20
  constructor(level: Level, options: {
24
- writer?: WritableStream;
21
+ writer?: Writable;
25
22
  showZeroNotice?: boolean;
26
23
  showNoChecked?: boolean;
27
24
  });
28
25
  #private;
29
26
  }
30
- export type WritableStream = NodeJS.WritableStream;
27
+ export type Writable = import("node:stream").Writable;
31
28
  export type Level = import("../../type/index.js").Level;
32
29
  export type Location = import("../../type/index.js").Location;
33
30
  export type Notice = import("../../type/index.js").Notice;
@@ -7,17 +7,17 @@ export default class CSVFormatter extends Formatter {
7
7
  /**
8
8
  * Crée un formateur.
9
9
  *
10
- * @param {Level} level Le niveau de sévérité minimum
11
- * des notifications affichées.
12
- * @param {Object} options Les options du formateur.
13
- * @param {WritableStream} [options.writer] Le flux où écrire les résultats.
10
+ * @param {Level} level Le niveau de sévérité minimum des
11
+ * notifications affichées.
12
+ * @param {Object} options Les options du formateur.
13
+ * @param {Writable} [options.writer] Le flux où écrire les résultats.
14
14
  */
15
15
  constructor(level: Level, options: {
16
- writer?: WritableStream;
16
+ writer?: Writable;
17
17
  });
18
18
  #private;
19
19
  }
20
- export type WritableStream = NodeJS.WritableStream;
20
+ export type Writable = import("node:stream").Writable;
21
21
  export type Level = import("../../type/index.js").Level;
22
22
  export type Notice = import("../../type/index.js").Notice;
23
23
  import Formatter from "./formatter.js";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @typedef {NodeJS.WritableStream} WritableStream
2
+ * @typedef {import("node:stream").Writable} Writable
3
3
  * @typedef {import("../../type/index.js").Level} Level
4
4
  * @typedef {import("../../type/index.js").Notice} Notice
5
5
  */
@@ -12,17 +12,17 @@ export default class GitHubFormatter extends Formatter {
12
12
  /**
13
13
  * Crée un formateur.
14
14
  *
15
- * @param {Level} level Le niveau de sévérité minimum
16
- * des notifications affichées.
17
- * @param {Object} options Les options du formateur.
18
- * @param {WritableStream} [options.writer] Le flux où écrire les résultats.
15
+ * @param {Level} level Le niveau de sévérité minimum des
16
+ * notifications affichées.
17
+ * @param {Object} options Les options du formateur.
18
+ * @param {Writable} [options.writer] Le flux où écrire les résultats.
19
19
  */
20
20
  constructor(level: Level, options: {
21
- writer?: WritableStream;
21
+ writer?: Writable;
22
22
  });
23
23
  #private;
24
24
  }
25
- export type WritableStream = NodeJS.WritableStream;
25
+ export type Writable = import("node:stream").Writable;
26
26
  export type Level = import("../../type/index.js").Level;
27
27
  export type Notice = import("../../type/index.js").Notice;
28
28
  import Formatter from "./formatter.js";
@@ -1,10 +1,10 @@
1
1
  /**
2
- * @typedef {NodeJS.WritableStream} WritableStream
2
+ * @typedef {import("node:stream").Writable} Writable
3
3
  * @typedef {import("../../type/index.js").Level} Level
4
4
  * @typedef {import("../../type/index.js").Notice} Notice
5
5
  */
6
6
  /**
7
- * Le formateur qui écrit les résultats brut (au format JSON). La seul
7
+ * Le formateur qui écrit les résultats bruts (au format JSON). La seule
8
8
  * altération des résultats est le remplacement des <code>undefined</code> par
9
9
  * des <code>null</code>.
10
10
  *
@@ -14,20 +14,20 @@ export default class JSONFormatter extends Formatter {
14
14
  /**
15
15
  * Crée un formateur.
16
16
  *
17
- * @param {Level} level Le niveau de sévérité minimum
18
- * des notifications affichées.
19
- * @param {Object} options Les options du formateur.
20
- * @param {WritableStream} [options.writer] Le flux où écrire les résultats.
21
- * @param {number} [options.indent] La taille des indentations (en
22
- * espace).
17
+ * @param {Level} level Le niveau de sévérité minimum des
18
+ * notifications affichées.
19
+ * @param {Object} options Les options du formateur.
20
+ * @param {Writable} [options.writer] Le flux où écrire les résultats.
21
+ * @param {number} [options.indent] La taille des indentations (en
22
+ * espace).
23
23
  */
24
24
  constructor(level: Level, options: {
25
- writer?: WritableStream;
25
+ writer?: Writable;
26
26
  indent?: number;
27
27
  });
28
28
  #private;
29
29
  }
30
- export type WritableStream = NodeJS.WritableStream;
30
+ export type Writable = import("node:stream").Writable;
31
31
  export type Level = import("../../type/index.js").Level;
32
32
  export type Notice = import("../../type/index.js").Notice;
33
33
  import Formatter from "./formatter.js";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @typedef {NodeJS.WritableStream} WritableStream
2
+ * @typedef {import("node:stream").Writable} Writable
3
3
  * @typedef {import("../../type/index.js").Level} Level
4
4
  * @typedef {import("../../type/index.js").Notice} Notice
5
5
  */
@@ -11,17 +11,17 @@ export default class UnixFormatter extends Formatter {
11
11
  /**
12
12
  * Crée un formateur.
13
13
  *
14
- * @param {Level} level Le niveau de sévérité minimum
15
- * des notifications affichées.
16
- * @param {Object} options Les options du formateur.
17
- * @param {WritableStream} [options.writer] Le flux où écrire les résultats.
14
+ * @param {Level} level Le niveau de sévérité minimum des
15
+ * notifications affichées.
16
+ * @param {Object} options Les options du formateur.
17
+ * @param {Writable} [options.writer] Le flux où écrire les résultats.
18
18
  */
19
19
  constructor(level: Level, options: {
20
- writer?: WritableStream;
20
+ writer?: Writable;
21
21
  });
22
22
  #private;
23
23
  }
24
- export type WritableStream = NodeJS.WritableStream;
24
+ export type Writable = import("node:stream").Writable;
25
25
  export type Level = import("../../type/index.js").Level;
26
26
  export type Notice = import("../../type/index.js").Notice;
27
27
  import Formatter from "./formatter.js";
@@ -3,13 +3,13 @@
3
3
  * @typedef {import("../../type/index.d.ts").PartialNotice} PartialNotice
4
4
  */
5
5
  /**
6
- * L'enrobage du linter <strong>Stytelint</strong>.
6
+ * L'enrobage du linter <strong>Stylelint</strong>.
7
7
  *
8
8
  * @see https://www.npmjs.com/package/stylelint
9
9
  */
10
10
  export default class StylelintWrapper extends Wrapper {
11
11
  /**
12
- * Crée un enrobage pour le linter <strong>Stytelint</strong>.
12
+ * Crée un enrobage pour le linter <strong>Stylelint</strong>.
13
13
  *
14
14
  * @param {Object} context Le contexte de l'enrobage.
15
15
  * @param {Level} context.level Le niveau de sévérité minimum