metalint 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +2 -2
  2. package/package.json +29 -24
  3. package/src/bin/argv.js +6 -4
  4. package/src/core/configuration/flatten.js +56 -55
  5. package/src/core/configuration/normalize.js +18 -16
  6. package/src/core/configuration/override.js +1 -1
  7. package/src/core/formatter/checkstyle.js +2 -2
  8. package/src/core/formatter/console.js +5 -5
  9. package/src/core/formatter/csv.js +2 -2
  10. package/src/core/formatter/formatter.js +2 -2
  11. package/src/core/formatter/github.js +2 -2
  12. package/src/core/formatter/json.js +2 -2
  13. package/src/core/formatter/unix.js +2 -2
  14. package/src/core/index.js +102 -29
  15. package/src/core/results.js +21 -1
  16. package/src/core/wrapper/addons-linter.js +16 -14
  17. package/src/core/wrapper/ajv.js +16 -15
  18. package/src/core/wrapper/coffeelint__cli.js +16 -14
  19. package/src/core/wrapper/csslint.js +16 -14
  20. package/src/core/wrapper/depcheck.js +15 -14
  21. package/src/core/wrapper/doiuse.js +17 -14
  22. package/src/core/wrapper/eslint.js +15 -14
  23. package/src/core/wrapper/htmlhint.js +15 -14
  24. package/src/core/wrapper/htmllint.js +16 -14
  25. package/src/core/wrapper/jshint.js +15 -14
  26. package/src/core/wrapper/jsonlint-mod.js +15 -13
  27. package/src/core/wrapper/markdownlint.js +15 -14
  28. package/src/core/wrapper/markuplint.js +19 -14
  29. package/src/core/wrapper/npm-check-updates.js +15 -14
  30. package/src/core/wrapper/npm-package-json-lint.js +15 -14
  31. package/src/core/wrapper/prantlf__jsonlint.js +15 -14
  32. package/src/core/wrapper/prettier.js +15 -14
  33. package/src/core/wrapper/publint.js +16 -15
  34. package/src/core/wrapper/purgecss.js +15 -14
  35. package/src/core/wrapper/sort-package-json.js +15 -14
  36. package/src/core/wrapper/standard.js +15 -13
  37. package/src/core/wrapper/stylelint.js +15 -14
  38. package/src/core/wrapper/svglint.js +16 -14
  39. package/src/core/wrapper/wrapper.js +2 -2
  40. package/src/core/wrapper/yaml-lint.js +15 -14
  41. package/src/types/config.d.ts +6 -0
  42. package/src/types/configuration/flattened.d.ts +38 -0
  43. package/src/types/configuration/normalized.d.ts +44 -0
  44. package/src/types/configuration/partial.d.ts +54 -0
  45. package/src/types/level.d.ts +9 -0
  46. package/src/types/location.d.ts +12 -0
  47. package/src/types/notice.d.ts +26 -0
  48. package/src/types/severity.d.ts +9 -0
  49. package/src/types/typeofformatter.d.ts +13 -0
  50. package/src/types/typeofwrapper.d.ts +20 -0
  51. package/types/configuration/flatten.d.ts +26 -26
  52. package/types/configuration/normalize.d.ts +12 -12
  53. package/types/configuration/override.d.ts +1 -1
  54. package/types/formatter/checkstyle.d.ts +2 -2
  55. package/types/formatter/console.d.ts +4 -4
  56. package/types/formatter/csv.d.ts +2 -2
  57. package/types/formatter/formatter.d.ts +2 -2
  58. package/types/formatter/github.d.ts +4 -4
  59. package/types/formatter/json.d.ts +4 -4
  60. package/types/formatter/unix.d.ts +4 -4
  61. package/types/index.d.ts +67 -7
  62. package/types/results.d.ts +24 -4
  63. package/types/wrapper/addons-linter.d.ts +17 -16
  64. package/types/wrapper/ajv.d.ts +17 -16
  65. package/types/wrapper/coffeelint__cli.d.ts +17 -16
  66. package/types/wrapper/csslint.d.ts +17 -16
  67. package/types/wrapper/depcheck.d.ts +17 -16
  68. package/types/wrapper/doiuse.d.ts +19 -16
  69. package/types/wrapper/eslint.d.ts +17 -16
  70. package/types/wrapper/htmlhint.d.ts +17 -16
  71. package/types/wrapper/htmllint.d.ts +17 -16
  72. package/types/wrapper/jshint.d.ts +17 -16
  73. package/types/wrapper/jsonlint-mod.d.ts +17 -16
  74. package/types/wrapper/markdownlint.d.ts +17 -16
  75. package/types/wrapper/markuplint.d.ts +17 -16
  76. package/types/wrapper/npm-check-updates.d.ts +17 -16
  77. package/types/wrapper/npm-package-json-lint.d.ts +17 -16
  78. package/types/wrapper/prantlf__jsonlint.d.ts +17 -16
  79. package/types/wrapper/prettier.d.ts +17 -16
  80. package/types/wrapper/publint.d.ts +16 -15
  81. package/types/wrapper/purgecss.d.ts +17 -16
  82. package/types/wrapper/sort-package-json.d.ts +17 -16
  83. package/types/wrapper/standard.d.ts +17 -16
  84. package/types/wrapper/stylelint.d.ts +17 -16
  85. package/types/wrapper/svglint.d.ts +17 -16
  86. package/types/wrapper/wrapper.d.ts +2 -2
  87. package/types/wrapper/yaml-lint.d.ts +17 -16
  88. package/src/type/index.d.ts +0 -149
package/src/core/index.js CHANGED
@@ -15,17 +15,72 @@ import { exists } from "./utils/file.js";
15
15
  import Glob from "./utils/glob.js";
16
16
 
17
17
  /**
18
- * @typedef {import("../type/index.d.ts").FlattenedConfigChecker} FlattenedConfigChecker
19
- * @typedef {import("../type/index.d.ts").Notice} Notice
18
+ * @typedef {import("../types/configuration/flattened.d.ts").FlattenedConfig} FlattenedConfig
19
+ * @typedef {import("../types/configuration/flattened.d.ts").FlattenedConfigChecker} FlattenedConfigChecker
20
+ * @typedef {import("../types/level.d.ts").default} Level
21
+ * @typedef {import("../types/notice.d.ts").default} Notice
22
+ * @typedef {import("../types/severity.d.ts").default} Severity
23
+ * @typedef {import("../types/typeofformatter.d.ts").default} TypeofFormatter
24
+ * @typedef {import("./formatter/formatter.js").default} Formatter
25
+ * @typedef {import("./wrapper/wrapper.js").default} Wrapper
20
26
  */
21
27
 
22
28
  export default class Metalint {
29
+ /**
30
+ * Le répertoire racine.
31
+ *
32
+ * @type {string}
33
+ */
23
34
  #root;
35
+
36
+ /**
37
+ * Les motifs généraux des fichiers.
38
+ *
39
+ * @type {Glob}
40
+ */
24
41
  #glob;
42
+
43
+ /**
44
+ * Les checkers (avec leurs linters).
45
+ */
25
46
  #checkers;
47
+
48
+ /**
49
+ * Les formatters.
50
+ *
51
+ * @type {Formatter[]}
52
+ */
26
53
  #formatters;
54
+
55
+ /**
56
+ * Le cache des wrappers.
57
+ *
58
+ * @type {Map<string, Wrapper[]>}
59
+ */
27
60
  #cache = new Map();
28
61
 
62
+ /**
63
+ * Crée une instance de Metalint à partir d'une configuration sur le système
64
+ * de fichiers.
65
+ *
66
+ * @param {Object} [options] Les éventuelles options pour
67
+ * créer une instance de
68
+ * Metalint.
69
+ * @param {string} [options.config] L'éventuel chemin vers le
70
+ * fichier de configuration de
71
+ * Metalint.
72
+ * @param {boolean} [options.fix] L'éventuelle marque
73
+ * indiquant si les linters
74
+ * doivent corriger les
75
+ * fichiers.
76
+ * @param {TypeofFormatter} [options.formatter] L'éventuel formatteur à
77
+ * utiliser.
78
+ * @param {Level} [options.level] L'éventuel niveau minimum
79
+ * des notifications à
80
+ * rapporter.
81
+ * @returns {Promise<Metalint>} Une promesse contenant l'instance de
82
+ * Metalint.
83
+ */
29
84
  static async fromFileSystem(options = {}) {
30
85
  const config = options.config ?? ".metalint/metalint.config.js";
31
86
 
@@ -42,7 +97,7 @@ export default class Metalint {
42
97
 
43
98
  // eslint-disable-next-line no-unsanitized/method
44
99
  const { default: configuration } = await import(
45
- pathToFileURL(path.join(root, config))
100
+ pathToFileURL(path.join(root, config)).href
46
101
  );
47
102
  const { patterns, reporters, checkers } = flatten(
48
103
  await normalize(configuration, {
@@ -54,12 +109,19 @@ export default class Metalint {
54
109
  level: options.level,
55
110
  },
56
111
  );
57
- return new Metalint({ root, patterns, reporters, checkers });
112
+ return new Metalint({ patterns, reporters, checkers }, { root });
58
113
  }
59
114
 
60
- constructor(config) {
61
- this.#root = config.root;
62
- this.#glob = new Glob(config.patterns, { root: config.root });
115
+ /**
116
+ * Crée une instance de Metalint.
117
+ *
118
+ * @param {FlattenedConfig} config La configuration de Metalint.
119
+ * @param {Object} context Le contexte.
120
+ * @param {string} context.root Le répertoire racine.
121
+ */
122
+ constructor(config, { root }) {
123
+ this.#root = root;
124
+ this.#glob = new Glob(config.patterns, { root: this.#root });
63
125
 
64
126
  this.#formatters = config.reporters.map((reporter) => {
65
127
  // eslint-disable-next-line new-cap
@@ -67,11 +129,11 @@ export default class Metalint {
67
129
  });
68
130
 
69
131
  this.#checkers = config.checkers.map((checker) => ({
70
- ...checker,
71
132
  glob: new Glob(checker.patterns, { root: this.#root }),
133
+ linters: checker.linters,
72
134
  overrides: checker.overrides.map((override) => ({
73
- ...override,
74
135
  glob: new Glob(override.patterns, { root: this.#root }),
136
+ linters: override.linters,
75
137
  })),
76
138
  }));
77
139
  }
@@ -88,42 +150,41 @@ export default class Metalint {
88
150
  * fichier.
89
151
  */
90
152
  async lintFiles(bases) {
91
- const files = [];
153
+ const files = /** @type {string[]} */ ([]);
92
154
  for (const base of bases) {
93
155
  files.push(...(await this.#glob.walk(base)));
94
156
  }
95
157
  const results = new Results(files);
96
158
  for (const file of files) {
97
- for (const checker of this.#checkers) {
159
+ for (const [i, checker] of Object.entries(this.#checkers)) {
98
160
  if (checker.glob.test(file)) {
99
- let key = checker.patterns.join();
161
+ let key = i.toString();
100
162
  const values = [checker.linters];
101
- for (const override of checker.overrides) {
163
+ for (const [j, override] of Object.entries(
164
+ checker.overrides,
165
+ )) {
102
166
  if (override.glob.test(file)) {
103
- key += "|" + override.patterns.join();
167
+ key += `.${j}`;
104
168
  values.push(override.linters);
105
169
  }
106
170
  }
107
171
 
108
- let wrappers = [];
172
+ let wrappers;
109
173
  if (this.#cache.has(key)) {
110
174
  wrappers = this.#cache.get(key);
111
175
  } else {
112
- const linters = values.reduce(mergeLinters);
113
- for (const linter of linters) {
114
- wrappers.push(
115
- // eslint-disable-next-line new-cap
116
- new linter.wrapper(
117
- {
118
- fix: linter.fix,
119
- level: linter.level,
120
- root: this.#root,
121
- files,
122
- },
123
- linter.options,
124
- ),
176
+ wrappers = values.reduce(mergeLinters).map((linter) => {
177
+ // eslint-disable-next-line new-cap
178
+ return new linter.wrapper(
179
+ {
180
+ fix: linter.fix,
181
+ level: linter.level,
182
+ root: this.#root,
183
+ files,
184
+ },
185
+ linter.options,
125
186
  );
126
- }
187
+ });
127
188
  this.#cache.set(key, wrappers);
128
189
  }
129
190
  for (const wrapper of wrappers) {
@@ -136,6 +197,18 @@ export default class Metalint {
136
197
  return results.toObject();
137
198
  }
138
199
 
200
+ /**
201
+ * Rapporte des résultats dans les formats choisis.
202
+ *
203
+ * @param {Record<string, Notice[]|undefined>} results La liste des
204
+ * notifications
205
+ * regroupées par
206
+ * fichier.
207
+ * @returns {Promise<Severity|undefined>} La sévérité la plus élevée des
208
+ * notifications ; ou
209
+ * <code>undefined</code> si les
210
+ * résultats ont aucune notification.
211
+ */
139
212
  async report(results) {
140
213
  let severity;
141
214
 
@@ -7,7 +7,8 @@
7
7
  import Severities from "./severities.js";
8
8
 
9
9
  /**
10
- * @typedef {import("../type/index.d.ts").Notice} Notice
10
+ * @typedef {import("../types/notice.d.ts").Notice} Notice
11
+ * @typedef {import("../types/notice.d.ts").PartialNotice} PartialNotice
11
12
  */
12
13
 
13
14
  /**
@@ -42,6 +43,9 @@ const compare = function (notice1, notice2) {
42
43
  return notice1.locations.length - notice2.locations.length;
43
44
  };
44
45
 
46
+ /**
47
+ * Les résultats d'une analyse.
48
+ */
45
49
  export default class Results {
46
50
  /**
47
51
  * Les données des résultats.
@@ -50,10 +54,21 @@ export default class Results {
50
54
  */
51
55
  #data;
52
56
 
57
+ /**
58
+ * Crée des résultats pour des fichiers.
59
+ *
60
+ * @param {string[]} files Les noms des fichiers.
61
+ */
53
62
  constructor(files) {
54
63
  this.#data = Object.fromEntries(files.map((f) => [f, undefined]));
55
64
  }
56
65
 
66
+ /**
67
+ * Ajoute des notifications d'un fichier dans les résultats.
68
+ *
69
+ * @param {string} file Le nom du fichier.
70
+ * @param {PartialNotice[]} notices Les notifications.
71
+ */
57
72
  add(file, notices) {
58
73
  // Ajouter un tableau vide dans les données pour indiquer que le fichier
59
74
  // a été analysé par au moins un linter.
@@ -76,6 +91,11 @@ export default class Results {
76
91
  }
77
92
  }
78
93
 
94
+ /**
95
+ * Retourne les résultats en objet.
96
+ *
97
+ * @returns {Record<string, Notice[]|undefined>} Les résultats.
98
+ */
79
99
  toObject() {
80
100
  // Trier les notifications.
81
101
  Object.values(this.#data)
@@ -5,14 +5,15 @@
5
5
  */
6
6
 
7
7
  import path from "node:path/posix";
8
+ // @ts-expect-error -- Add-ons Linter ne fournit pas de types.
8
9
  import linter from "addons-linter";
9
10
  import Levels from "../levels.js";
10
11
  import Severities from "../severities.js";
11
12
  import Wrapper from "./wrapper.js";
12
13
 
13
14
  /**
14
- * @typedef {import("../../type/index.d.ts").Level} Level
15
- * @typedef {import("../../type/index.d.ts").PartialNotice} PartialNotice
15
+ * @typedef {import("../../types/notice.d.ts").PartialNotice} PartialNotice
16
+ * @typedef {import("../../types/level.d.ts").default} Level
16
17
  */
17
18
 
18
19
  /**
@@ -24,7 +25,7 @@ export default class AddonsLinterWrapper extends Wrapper {
24
25
  /**
25
26
  * Les options du linter.
26
27
  *
27
- * @type {Record<string, any>}
28
+ * @type {Record<string, unknown>}
28
29
  * @see https://github.com/mozilla/addons-linter#linter-api-usage
29
30
  */
30
31
  #options;
@@ -32,17 +33,18 @@ export default class AddonsLinterWrapper extends Wrapper {
32
33
  /**
33
34
  * Crée un enrobage pour le linter <strong>Add-ons Linter</strong>.
34
35
  *
35
- * @param {Object} context Le contexte de l'enrobage.
36
- * @param {Level} context.level Le niveau de sévérité minimum
37
- * des notifications retournées.
38
- * @param {boolean} context.fix La marque indiquant s'il faut
39
- * corriger le fichier.
40
- * @param {string} context.root L'adresse du répertoire où se
41
- * trouve le répertoire
42
- * <code>.metalint/</code>.
43
- * @param {string[]} context.files La liste de tous les fichiers
44
- * analysés.
45
- * @param {Record<string, any>} options Les options du linter.
36
+ * @param {Object} context Le contexte de l'enrobage.
37
+ * @param {Level} context.level Le niveau de sévérité
38
+ * minimum des notifications
39
+ * retournées.
40
+ * @param {boolean} context.fix La marque indiquant s'il
41
+ * faut corriger le fichier.
42
+ * @param {string} context.root L'adresse du répertoire
43
+ * se trouve le répertoire
44
+ * <code>.metalint/</code>.
45
+ * @param {string[]} context.files La liste de tous les
46
+ * fichiers analysés.
47
+ * @param {Record<string, unknown>} options Les options du linter.
46
48
  */
47
49
  constructor(context, options) {
48
50
  super(context);
@@ -11,8 +11,8 @@ import Severities from "../severities.js";
11
11
  import Wrapper from "./wrapper.js";
12
12
 
13
13
  /**
14
- * @typedef {import("../../type/index.d.ts").Level} Level
15
- * @typedef {import("../../type/index.d.ts").PartialNotice} PartialNotice
14
+ * @typedef {import("../../types/notice.d.ts").PartialNotice} PartialNotice
15
+ * @typedef {import("../../types/level.d.ts").default} Level
16
16
  */
17
17
 
18
18
  /**
@@ -24,7 +24,7 @@ export default class AjvWrapper extends Wrapper {
24
24
  /**
25
25
  * Les options du linter.
26
26
  *
27
- * @type {Record<string, any>}
27
+ * @type {Record<string, unknown>}
28
28
  * @see https://ajv.js.org/options.html#ajv-options
29
29
  */
30
30
  #options;
@@ -40,24 +40,25 @@ export default class AjvWrapper extends Wrapper {
40
40
  /**
41
41
  * Le schéma du fichier JSON.
42
42
  *
43
- * @type {Record<string, any>}
43
+ * @type {Record<string, unknown>}
44
44
  */
45
45
  #schema;
46
46
 
47
47
  /**
48
48
  * Crée un enrobage pour le linter <strong>Ajv</strong>.
49
49
  *
50
- * @param {Object} context Le contexte de l'enrobage.
51
- * @param {Level} context.level Le niveau de sévérité minimum
52
- * des notifications retournées.
53
- * @param {boolean} context.fix La marque indiquant s'il faut
54
- * corriger le fichier.
55
- * @param {string} context.root L'adresse du répertoire où se
56
- * trouve le répertoire
57
- * <code>.metalint/</code>.
58
- * @param {string[]} context.files La liste de tous les fichiers
59
- * analysés.
60
- * @param {Record<string, any>} options Les options du linter.
50
+ * @param {Object} context Le contexte de l'enrobage.
51
+ * @param {Level} context.level Le niveau de sévérité
52
+ * minimum des notifications
53
+ * retournées.
54
+ * @param {boolean} context.fix La marque indiquant s'il
55
+ * faut corriger le fichier.
56
+ * @param {string} context.root L'adresse du répertoire
57
+ * se trouve le répertoire
58
+ * <code>.metalint/</code>.
59
+ * @param {string[]} context.files La liste de tous les
60
+ * fichiers analysés.
61
+ * @param {Record<string, unknown>} options Les options du linter.
61
62
  */
62
63
  constructor(context, options) {
63
64
  super(context);
@@ -5,14 +5,15 @@
5
5
  */
6
6
 
7
7
  import fs from "node:fs/promises";
8
+ // @ts-expect-error -- CoffeeLint ne fournit pas de types.
8
9
  import coffeelint from "@coffeelint/cli";
9
10
  import Levels from "../levels.js";
10
11
  import Severities from "../severities.js";
11
12
  import Wrapper from "./wrapper.js";
12
13
 
13
14
  /**
14
- * @typedef {import("../../type/index.js").Level} Level
15
- * @typedef {import("../../type/index.js").PartialNotice} PartialNotice
15
+ * @typedef {import("../../types/notice.d.ts").PartialNotice} PartialNotice
16
+ * @typedef {import("../../types/level.d.ts").default} Level
16
17
  */
17
18
 
18
19
  /**
@@ -24,7 +25,7 @@ export default class CoffeeLintCliWrapper extends Wrapper {
24
25
  /**
25
26
  * Les options du linter.
26
27
  *
27
- * @type {Record<string, any>}
28
+ * @type {Record<string, unknown>}
28
29
  * @see https://coffeelint.github.io/#options
29
30
  */
30
31
  #options;
@@ -32,17 +33,18 @@ export default class CoffeeLintCliWrapper extends Wrapper {
32
33
  /**
33
34
  * Crée un enrobage pour le linter <strong>CoffeeLint</strong>.
34
35
  *
35
- * @param {Object} context Le contexte de l'enrobage.
36
- * @param {Level} context.level Le niveau de sévérité minimum
37
- * des notifications retournées.
38
- * @param {boolean} context.fix La marque indiquant s'il faut
39
- * corriger le fichier.
40
- * @param {string} context.root L'adresse du répertoire où se
41
- * trouve le répertoire
42
- * <code>.metalint/</code>.
43
- * @param {string[]} context.files La liste de tous les fichiers
44
- * analysés.
45
- * @param {Record<string, any>} options Les options du linter.
36
+ * @param {Object} context Le contexte de l'enrobage.
37
+ * @param {Level} context.level Le niveau de sévérité
38
+ * minimum des notifications
39
+ * retournées.
40
+ * @param {boolean} context.fix La marque indiquant s'il
41
+ * faut corriger le fichier.
42
+ * @param {string} context.root L'adresse du répertoire
43
+ * se trouve le répertoire
44
+ * <code>.metalint/</code>.
45
+ * @param {string[]} context.files La liste de tous les
46
+ * fichiers analysés.
47
+ * @param {Record<string, unknown>} options Les options du linter.
46
48
  */
47
49
  constructor(context, options) {
48
50
  super(context);
@@ -5,14 +5,15 @@
5
5
  */
6
6
 
7
7
  import fs from "node:fs/promises";
8
+ // @ts-expect-error -- CSSLint ne fournit pas de types.
8
9
  import { CSSLint } from "csslint";
9
10
  import Levels from "../levels.js";
10
11
  import Severities from "../severities.js";
11
12
  import Wrapper from "./wrapper.js";
12
13
 
13
14
  /**
14
- * @typedef {import("../../type/index.d.ts").Level} Level
15
- * @typedef {import("../../type/index.d.ts").PartialNotice} PartialNotice
15
+ * @typedef {import("../../types/notice.d.ts").PartialNotice} PartialNotice
16
+ * @typedef {import("../../types/level.d.ts").default} Level
16
17
  */
17
18
 
18
19
  /**
@@ -24,7 +25,7 @@ export default class CSSLintWrapper extends Wrapper {
24
25
  /**
25
26
  * Les options du linter.
26
27
  *
27
- * @type {Record<string, any>}
28
+ * @type {Record<string, unknown>}
28
29
  * @see https://github.com/CSSLint/csslint/wiki/Rules
29
30
  */
30
31
  #options;
@@ -32,17 +33,18 @@ export default class CSSLintWrapper extends Wrapper {
32
33
  /**
33
34
  * Crée un enrobage pour le linter <strong>CSSLint</strong>.
34
35
  *
35
- * @param {Object} context Le contexte de l'enrobage.
36
- * @param {Level} context.level Le niveau de sévérité minimum
37
- * des notifications retournées.
38
- * @param {boolean} context.fix La marque indiquant s'il faut
39
- * corriger le fichier.
40
- * @param {string} context.root L'adresse du répertoire où se
41
- * trouve le répertoire
42
- * <code>.metalint/</code>.
43
- * @param {string[]} context.files La liste de tous les fichiers
44
- * analysés.
45
- * @param {Record<string, any>} options Les options du linter.
36
+ * @param {Object} context Le contexte de l'enrobage.
37
+ * @param {Level} context.level Le niveau de sévérit
38
+ * minimum des notifications
39
+ * retournées.
40
+ * @param {boolean} context.fix La marque indiquant s'il
41
+ * faut corriger le fichier.
42
+ * @param {string} context.root L'adresse du répertoire
43
+ * se trouve le répertoire
44
+ * <code>.metalint/</code>.
45
+ * @param {string[]} context.files La liste de tous les
46
+ * fichiers analysés.
47
+ * @param {Record<string, unknown>} options Les options du linter.
46
48
  */
47
49
  constructor(context, options) {
48
50
  super(context);
@@ -11,8 +11,8 @@ import Severities from "../severities.js";
11
11
  import Wrapper from "./wrapper.js";
12
12
 
13
13
  /**
14
- * @typedef {import("../../type/index.d.ts").Level} Level
15
- * @typedef {import("../../type/index.d.ts").PartialNotice} PartialNotice
14
+ * @typedef {import("../../types/notice.d.ts").PartialNotice} PartialNotice
15
+ * @typedef {import("../../types/level.d.ts").default} Level
16
16
  */
17
17
 
18
18
  /**
@@ -24,24 +24,25 @@ export default class DepcheckWrapper extends Wrapper {
24
24
  /**
25
25
  * Les options du linter.
26
26
  *
27
- * @type {Record<string, any>}
27
+ * @type {Record<string, unknown>}
28
28
  */
29
29
  #options;
30
30
 
31
31
  /**
32
32
  * Crée un enrobage pour le linter <strong>Depcheck</strong>.
33
33
  *
34
- * @param {Object} context Le contexte de l'enrobage.
35
- * @param {Level} context.level Le niveau de sévérité minimum
36
- * des notifications retournées.
37
- * @param {boolean} context.fix La marque indiquant s'il faut
38
- * corriger le fichier.
39
- * @param {string} context.root L'adresse du répertoire où se
40
- * trouve le répertoire
41
- * <code>.metalint/</code>.
42
- * @param {string[]} context.files La liste de tous les fichiers
43
- * analysés.
44
- * @param {Record<string, any>} options Les options du linter.
34
+ * @param {Object} context Le contexte de l'enrobage.
35
+ * @param {Level} context.level Le niveau de sévérité
36
+ * minimum des notifications
37
+ * retournées.
38
+ * @param {boolean} context.fix La marque indiquant s'il
39
+ * faut corriger le fichier.
40
+ * @param {string} context.root L'adresse du répertoire
41
+ * se trouve le répertoire
42
+ * <code>.metalint/</code>.
43
+ * @param {string[]} context.files La liste de tous les
44
+ * fichiers analysés.
45
+ * @param {Record<string, unknown>} options Les options du linter.
45
46
  */
46
47
  constructor(context, options) {
47
48
  super(context);
@@ -7,6 +7,7 @@
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
+ // @ts-expect-error -- doiuse ne fournit pas de types.
10
11
  // Désactiver la règle suivante pour cet import, car elle ne supporte pas la
11
12
  // propriété "exports" du package.json.
12
13
  // https://github.com/import-js/eslint-plugin-import/issues/1810
@@ -16,8 +17,9 @@ import Levels from "../levels.js";
16
17
  import Wrapper from "./wrapper.js";
17
18
 
18
19
  /**
19
- * @typedef {import("../../type/index.d.ts").Level} Level
20
- * @typedef {import("../../type/index.d.ts").PartialNotice} PartialNotice
20
+ * @typedef {import("node:stream").Writable} Writable
21
+ * @typedef {import("../../types/notice.d.ts").PartialNotice} PartialNotice
22
+ * @typedef {import("../../types/level.d.ts").default} Level
21
23
  */
22
24
 
23
25
  /**
@@ -29,24 +31,25 @@ export default class DoIUseWrapper extends Wrapper {
29
31
  /**
30
32
  * L'instance de DoIUse.
31
33
  *
32
- * @type {Object}
34
+ * @type {Writable}
33
35
  */
34
36
  #doiuse;
35
37
 
36
38
  /**
37
39
  * Crée un enrobage pour le linter <strong>doiuse</strong>.
38
40
  *
39
- * @param {Object} context Le contexte de l'enrobage.
40
- * @param {Level} context.level Le niveau de sévérité minimum
41
- * des notifications retournées.
42
- * @param {boolean} context.fix La marque indiquant s'il faut
43
- * corriger le fichier.
44
- * @param {string} context.root L'adresse du répertoire où se
45
- * trouve le répertoire
46
- * <code>.metalint/</code>.
47
- * @param {string[]} context.files La liste de tous les fichiers
48
- * analysés.
49
- * @param {Record<string, any>} options Les options du linter.
41
+ * @param {Object} context Le contexte de l'enrobage.
42
+ * @param {Level} context.level Le niveau de sévérité
43
+ * minimum des notifications
44
+ * retournées.
45
+ * @param {boolean} context.fix La marque indiquant s'il
46
+ * faut corriger le fichier.
47
+ * @param {string} context.root L'adresse du répertoire
48
+ * se trouve le répertoire
49
+ * <code>.metalint/</code>.
50
+ * @param {string[]} context.files La liste de tous les
51
+ * fichiers analysés.
52
+ * @param {Record<string, unknown>} options Les options du linter.
50
53
  */
51
54
  constructor(context, options) {
52
55
  super(context);
@@ -18,8 +18,8 @@ import Wrapper from "./wrapper.js";
18
18
  const { FlatESLint } = pkg;
19
19
 
20
20
  /**
21
- * @typedef {import("../../type/index.d.ts").Level} Level
22
- * @typedef {import("../../type/index.d.ts").PartialNotice} PartialNotice
21
+ * @typedef {import("../../types/notice.d.ts").PartialNotice} PartialNotice
22
+ * @typedef {import("../../types/level.d.ts").default} Level
23
23
  */
24
24
 
25
25
  /**
@@ -31,7 +31,7 @@ export default class ESLintWrapper extends Wrapper {
31
31
  /**
32
32
  * L'instance de ESLint.
33
33
  *
34
- * @type {typeof ESLint}
34
+ * @type {ESLint}
35
35
  * @see https://eslint.org/docs/latest/integrate/nodejs-api
36
36
  */
37
37
  #eslint;
@@ -39,17 +39,18 @@ export default class ESLintWrapper extends Wrapper {
39
39
  /**
40
40
  * Crée un enrobage pour le linter <strong>ESLint</strong>.
41
41
  *
42
- * @param {Object} context Le contexte de l'enrobage.
43
- * @param {Level} context.level Le niveau de sévérité minimum
44
- * des notifications retournées.
45
- * @param {boolean} context.fix La marque indiquant s'il faut
46
- * corriger le fichier.
47
- * @param {string} context.root L'adresse du répertoire où se
48
- * trouve le répertoire
49
- * <code>.metalint/</code>.
50
- * @param {string[]} context.files La liste de tous les fichiers
51
- * analysés.
52
- * @param {Record<string, any>} options Les options du linter.
42
+ * @param {Object} context Le contexte de l'enrobage.
43
+ * @param {Level} context.level Le niveau de sévérité
44
+ * minimum des notifications
45
+ * retournées.
46
+ * @param {boolean} context.fix La marque indiquant s'il
47
+ * faut corriger le fichier.
48
+ * @param {string} context.root L'adresse du répertoire
49
+ * se trouve le répertoire
50
+ * <code>.metalint/</code>.
51
+ * @param {string[]} context.files La liste de tous les
52
+ * fichiers analysés.
53
+ * @param {Record<string, unknown>} options Les options du linter.
53
54
  */
54
55
  constructor(context, options) {
55
56
  super(context);