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/README.md CHANGED
@@ -103,7 +103,7 @@ source) :
103
103
  <td>package.json</td>
104
104
  <td>
105
105
  <a title="depcheck"
106
- href="https://www.npmjs.com/package/depcheck">Depcheck</a>
106
+ href="https://www.npmjs.com/package/depcheck">Depcheck</a>,
107
107
  <a title="npm-check-updates"
108
108
  href="https://www.npmjs.com/package/npm-check-updates"
109
109
  >npm-check-updates</a>,
@@ -267,7 +267,7 @@ jobs:
267
267
 
268
268
  [img-npm]: https://img.shields.io/npm/dm/metalint?label=npm&logo=npm&logoColor=whitesmoke
269
269
  [img-build]: https://img.shields.io/github/actions/workflow/status/regseb/metalint/ci.yml?branch=main&logo=github&logoColor=whitesmoke
270
- [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
270
+ [img-coverage]: https://img.shields.io/endpoint?label=coverage&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fregseb%2Fmetalint%2Fmain
271
271
  [img-semver]: https://img.shields.io/badge/semver-2.0.0-blue?logo=semver&logoColor=whitesmoke
272
272
  [link-npm]: https://www.npmjs.com/package/metalint
273
273
  [link-build]: https://github.com/regseb/metalint/actions/workflows/ci.yml?query=branch%3Amain
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metalint",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Un linter pour les gouverner tous.",
5
5
  "keywords": [
6
6
  "checker",
@@ -34,6 +34,9 @@
34
34
  "types": "./types/wrapper/wrapper.d.ts",
35
35
  "default": "./src/core/wrapper/wrapper.js"
36
36
  },
37
+ "./types/config": {
38
+ "types": "./src/types/config.d.ts"
39
+ },
37
40
  "./package.json": "./package.json"
38
41
  },
39
42
  "main": "./src/core/index.js",
@@ -59,51 +62,53 @@
59
62
  "devDependencies": {
60
63
  "@coffeelint/cli": "5.2.11",
61
64
  "@prantlf/jsonlint": "14.0.3",
62
- "@prettier/plugin-xml": "3.2.2",
63
- "@stryker-mutator/core": "8.0.0",
64
- "@stryker-mutator/mocha-runner": "8.0.0",
65
- "@types/eslint": "8.56.1",
65
+ "@prettier/plugin-xml": "3.4.1",
66
+ "@stryker-mutator/core": "8.2.6",
67
+ "@stryker-mutator/mocha-runner": "8.2.6",
68
+ "@types/eslint": "8.56.7",
66
69
  "@types/htmlhint": "1.1.5",
67
70
  "@types/jshint": "2.12.4",
68
71
  "@types/mocha": "10.0.6",
69
- "@types/sinon": "17.0.2",
72
+ "@types/sinon": "17.0.3",
70
73
  "@types/yargs": "17.0.32",
71
- "addons-linter": "6.19.0",
74
+ "@typescript-eslint/eslint-plugin": "7.5.0",
75
+ "@typescript-eslint/parser": "7.5.0",
76
+ "addons-linter": "6.25.0",
72
77
  "ajv": "8.12.0",
73
78
  "csslint": "1.0.5",
74
79
  "depcheck": "1.4.7",
75
80
  "doiuse": "6.0.2",
76
- "eslint": "8.56.0",
81
+ "eslint": "8.57.0",
77
82
  "eslint-plugin-array-func": "4.0.0",
78
83
  "eslint-plugin-eslint-comments": "3.2.0",
79
84
  "eslint-plugin-import": "2.29.1",
80
- "eslint-plugin-jsdoc": "48.0.2",
81
- "eslint-plugin-mocha": "10.2.0",
82
- "eslint-plugin-n": "16.6.1",
85
+ "eslint-plugin-jsdoc": "48.2.2",
86
+ "eslint-plugin-mocha": "10.4.1",
87
+ "eslint-plugin-n": "16.6.2",
83
88
  "eslint-plugin-no-unsanitized": "4.0.2",
84
89
  "eslint-plugin-promise": "6.1.1",
85
- "eslint-plugin-regexp": "2.1.2",
86
- "eslint-plugin-unicorn": "50.0.1",
90
+ "eslint-plugin-regexp": "2.4.0",
91
+ "eslint-plugin-unicorn": "51.0.1",
87
92
  "htmlhint": "1.1.4",
88
93
  "htmllint": "0.8.0",
89
94
  "jshint": "2.13.6",
90
95
  "jsonlint-mod": "1.7.6",
91
96
  "jszip": "3.10.1",
92
- "markdownlint": "0.32.1",
93
- "markuplint": "3.15.0",
94
- "mocha": "10.2.0",
95
- "npm-check-updates": "16.14.12",
97
+ "markdownlint": "0.34.0",
98
+ "markuplint": "4.5.0",
99
+ "mocha": "10.4.0",
100
+ "npm-check-updates": "16.14.18",
96
101
  "npm-package-json-lint": "7.1.0",
97
- "prettier": "3.1.1",
102
+ "prettier": "3.2.5",
98
103
  "publint": "0.2.7",
99
- "purgecss": "5.0.0",
104
+ "purgecss": "6.0.0",
100
105
  "sinon": "17.0.1",
101
- "sort-package-json": "2.6.0",
106
+ "sort-package-json": "2.10.0",
102
107
  "standard": "17.1.0",
103
- "stylelint": "16.1.0",
104
- "svglint": "2.6.0",
105
- "typedoc": "0.25.6",
106
- "typescript": "5.3.3",
108
+ "stylelint": "16.3.1",
109
+ "svglint": "2.7.1",
110
+ "typedoc": "0.25.12",
111
+ "typescript": "5.4.3",
107
112
  "yaml-lint": "1.7.0"
108
113
  },
109
114
  "engines": {
package/src/bin/argv.js CHANGED
@@ -15,8 +15,8 @@ import { FORMATTERS } from "../core/formatter/formatter.js";
15
15
  import Levels from "../core/levels.js";
16
16
 
17
17
  /**
18
- * @typedef {import("../core/formatter/formatter.js").default} TypeofFormatter
19
- * @typedef {import("../type/index.d.ts").Level} Level
18
+ * @typedef {import("../types/level.d.ts").Level} Level
19
+ * @typedef {import("../types/typeofformatter.d.ts").default} TypeofFormatter
20
20
  */
21
21
 
22
22
  /**
@@ -31,11 +31,13 @@ import Levels from "../core/levels.js";
31
31
  * @property {TypeofFormatter|undefined} formatter L'option
32
32
  * <code>--formatter</code> de
33
33
  * la ligne de commande.
34
- * @property {Level} level L'option <code>--level</code>
35
- * de la ligne de commande.
34
+ * @property {Level} level L'option
35
+ * <code>--level</code> de la
36
+ * ligne de commande.
36
37
  * @property {boolean} help L'option <code>--help</code>
37
38
  * de la ligne de commande.
38
39
  */
40
+
39
41
  /**
40
42
  * Extrait, vérifie et normalise les paramètres et les options de la ligne de
41
43
  * commande.
@@ -8,18 +8,18 @@ import Levels from "../levels.js";
8
8
  import { merge } from "../utils/object.js";
9
9
 
10
10
  /**
11
- * @typedef {import("../formatter/formatter.js").default} TypeofFormatter
12
- * @typedef {import("../../type/index.d.ts").FlattenedConfig} FlattenedConfig
13
- * @typedef {import("../../type/index.d.ts").FlattenedConfigChecker} FlattenedConfigChecker
14
- * @typedef {import("../../type/index.d.ts").FlattenedConfigLinter} FlattenedConfigLinter
15
- * @typedef {import("../../type/index.d.ts").FlattenedConfigOverride} FlattenedConfigOverride
16
- * @typedef {import("../../type/index.d.ts").FlattenedConfigReporter} FlattenedConfigReporter
17
- * @typedef {import("../../type/index.d.ts").Level} Level
18
- * @typedef {import("../../type/index.d.ts").NormalizedConfig} NormalizedConfig
19
- * @typedef {import("../../type/index.d.ts").NormalizedConfigChecker} NormalizedConfigChecker
20
- * @typedef {import("../../type/index.d.ts").NormalizedConfigLinter} NormalizedConfigLinter
21
- * @typedef {import("../../type/index.d.ts").NormalizedConfigOverride} NormalizedConfigOverride
22
- * @typedef {import("../../type/index.d.ts").NormalizedConfigReporter} NormalizedConfigReporter
11
+ * @typedef {import("../../types/configuration/flattened.d.ts").FlattenedConfig} FlattenedConfig
12
+ * @typedef {import("../../types/configuration/flattened.d.ts").FlattenedConfigChecker} FlattenedConfigChecker
13
+ * @typedef {import("../../types/configuration/flattened.d.ts").FlattenedConfigLinter} FlattenedConfigLinter
14
+ * @typedef {import("../../types/configuration/flattened.d.ts").FlattenedConfigOverride} FlattenedConfigOverride
15
+ * @typedef {import("../../types/configuration/flattened.d.ts").FlattenedConfigReporter} FlattenedConfigReporter
16
+ * @typedef {import("../../types/configuration/normalized.d.ts").NormalizedConfig} NormalizedConfig
17
+ * @typedef {import("../../types/configuration/normalized.d.ts").NormalizedConfigChecker} NormalizedConfigChecker
18
+ * @typedef {import("../../types/configuration/normalized.d.ts").NormalizedConfigLinter} NormalizedConfigLinter
19
+ * @typedef {import("../../types/configuration/normalized.d.ts").NormalizedConfigOverride} NormalizedConfigOverride
20
+ * @typedef {import("../../types/configuration/normalized.d.ts").NormalizedConfigReporter} NormalizedConfigReporter
21
+ * @typedef {import("../../types/level.d.ts").default} Level
22
+ * @typedef {import("../../types/typeofformatter.js").default} TypeofFormatter
23
23
  */
24
24
 
25
25
  /**
@@ -42,9 +42,9 @@ export const flattenPatterns = function (hierarchies, { patterns }) {
42
42
  * @param {boolean|undefined} hierarchy La valeur d'une des propriétés
43
43
  * <code>"fix"</code>.
44
44
  * @param {Object} context Le contexte de la fusion.
45
- * @param {boolean|undefined} context.fix La valeur de la propriété
45
+ * @param {boolean} context.fix La valeur de la propriété
46
46
  * <code>"fix"</code> parente.
47
- * @returns {boolean|undefined} La valeur fusionnée.
47
+ * @returns {boolean} La valeur fusionnée.
48
48
  */
49
49
  export const flattenFix = function (hierarchy, { fix }) {
50
50
  return hierarchy ?? fix;
@@ -67,13 +67,14 @@ export const flattenLevel = function (hierarchy, { level }) {
67
67
  /**
68
68
  * Fusionne une propriété <code>"options"</code>.
69
69
  *
70
- * @param {Record<string, any>[]} hierarchies La valeur d'une des propriétés
71
- * <code>"options"</code>.
72
- * @param {Object} context Le contexte de la fusion.
73
- * @param {Record<string, any>} context.options La valeur de la propriété
74
- * <code>"options"</code>
75
- * parente.
76
- * @returns {Record<string, any>} La valeur fusionnée.
70
+ * @param {Record<string, unknown>[]} hierarchies La valeur d'une des
71
+ * propriétés
72
+ * <code>"options"</code>.
73
+ * @param {Object} context Le contexte de la fusion.
74
+ * @param {Record<string, unknown>} context.options La valeur de la propriété
75
+ * <code>"options"</code>
76
+ * parente.
77
+ * @returns {Record<string, unknown>} La valeur fusionnée.
77
78
  */
78
79
  export const flattenOptions = function (hierarchies, { options }) {
79
80
  return [options, ...hierarchies].reduce(merge);
@@ -87,8 +88,7 @@ export const flattenOptions = function (hierarchies, { options }) {
87
88
  * <code>"reporters"</code>.
88
89
  * @param {Object} context Le contexte de la fusion.
89
90
  * @param {Level} context.level La valeur de la propriété
90
- * <code>"level"</code>
91
- * parente.
91
+ * <code>"level"</code> parente.
92
92
  * @returns {FlattenedConfigReporter} La valeur fusionnée.
93
93
  */
94
94
  export const flattenReporter = function (hierarchy, { level }) {
@@ -107,7 +107,7 @@ export const flattenReporter = function (hierarchy, { level }) {
107
107
  * <code>"reporters"</code>.
108
108
  * @param {Object} context Le contexte de la
109
109
  * fusion.
110
- * @param {TypeofFormatter} context.formatter La valeur de la
110
+ * @param {TypeofFormatter|undefined} context.formatter La valeur de la
111
111
  * propriété
112
112
  * <code>"formatter"</code>
113
113
  * parente.
@@ -134,18 +134,18 @@ export const flattenReporters = function (hierarchies, { formatter, level }) {
134
134
  /**
135
135
  * Fusionne un élément d'une propriété <code>"linters"</code>.
136
136
  *
137
- * @param {NormalizedConfigLinter} hierarchy La valeur de l'élément d'une
138
- * des propriétés
139
- * <code>"linters"</code>.
140
- * @param {Object} context Le contexte de la fusion.
141
- * @param {boolean|undefined} context.fix La valeur de la propriété
142
- * <code>"fix"</code> parente.
143
- * @param {Level} context.level La valeur de la propriété
144
- * <code>"level"</code>
145
- * parente.
146
- * @param {Record<string, any>} context.options La valeur de la propriété
147
- * <code>"options"</code>
148
- * parente.
137
+ * @param {NormalizedConfigLinter} hierarchy La valeur de l'élément d'une
138
+ * des propriétés
139
+ * <code>"linters"</code>.
140
+ * @param {Object} context Le contexte de la fusion.
141
+ * @param {boolean} context.fix La valeur de la propriété
142
+ * <code>"fix"</code> parente.
143
+ * @param {Level} context.level La valeur de la propriété
144
+ * <code>"level"</code>
145
+ * parente.
146
+ * @param {Record<string, unknown>} context.options La valeur de la propriété
147
+ * <code>"options"</code>
148
+ * parente.
149
149
  * @returns {FlattenedConfigLinter} La valeur fusionnée.
150
150
  */
151
151
  export const flattenLinter = function (hierarchy, { fix, level, options }) {
@@ -164,7 +164,7 @@ export const flattenLinter = function (hierarchy, { fix, level, options }) {
164
164
  * propriétés
165
165
  * <code>"linters"</code>.
166
166
  * @param {Object} context Le contexte de la fusion.
167
- * @param {boolean|undefined} context.fix La valeur de la propriété
167
+ * @param {boolean} context.fix La valeur de la propriété
168
168
  * <code>"fix"</code> parente.
169
169
  * @param {Level} context.level La valeur de la propriété
170
170
  * <code>"level"</code> parente.
@@ -200,15 +200,14 @@ export const flattenLinters = function (hierarchies, { fix, level }) {
200
200
  /**
201
201
  * Fusionne un élément d'une propriété <code>"overrides"</code>.
202
202
  *
203
- * @param {NormalizedConfigOverride} hierarchy La valeur de l'élément
204
- * d'une des propriétés
203
+ * @param {NormalizedConfigOverride} hierarchy La valeur de l'élément d'une
204
+ * des propriétés
205
205
  * <code>"overrides"</code>.
206
206
  * @param {Object} context Le contexte de la fusion.
207
- * @param {boolean|undefined} context.fix La valeur de la propriété
207
+ * @param {boolean} context.fix La valeur de la propriété
208
208
  * <code>"fix"</code> parente.
209
209
  * @param {Level} context.level La valeur de la propriété
210
- * <code>"level"</code>
211
- * parente.
210
+ * <code>"level"</code> parente.
212
211
  * @returns {FlattenedConfigOverride} La valeur fusionnée.
213
212
  */
214
213
  export const flattenOverride = function (hierarchy, { fix, level }) {
@@ -228,7 +227,7 @@ export const flattenOverride = function (hierarchy, { fix, level }) {
228
227
  * propriété
229
228
  * <code>"checkers"</code>.
230
229
  * @param {Object} context Le contexte de la fusion.
231
- * @param {boolean|undefined} context.fix La valeur de la propriété
230
+ * @param {boolean} context.fix La valeur de la propriété
232
231
  * <code>"fix"</code> parente.
233
232
  * @param {Level} context.level La valeur de la propriété
234
233
  * <code>"level"</code> parente.
@@ -255,18 +254,20 @@ export const flattenChecker = function (hierarchy, { fix, level }) {
255
254
  /**
256
255
  * Fusionne la configuration.
257
256
  *
258
- * @param {NormalizedConfig} hierarchy L'objet JSON normalisé
259
- * contenant la configuration.
260
- * @param {Object} argv Certaines options de la
261
- * ligne de commande.
262
- * @param {boolean|undefined} argv.fix L'option <code>--fix</code>
263
- * de la ligne de commande.
264
- * @param {TypeofFormatter|undefined} argv.formatter L'option
265
- * <code>--formatter</code> de
266
- * la ligne de commande.
267
- * @param {Level|undefined} argv.level L'options
268
- * <code>--level</code> de la
269
- * ligne de commande.
257
+ * @param {NormalizedConfig} hierarchy L'objet JSON normalisé
258
+ * contenant la
259
+ * configuration.
260
+ * @param {Object} argv Certaines options de la
261
+ * ligne de commande.
262
+ * @param {boolean|undefined} [argv.fix] L'option
263
+ * <code>--fix</code> de la
264
+ * ligne de commande.
265
+ * @param {TypeofFormatter|undefined} [argv.formatter] L'option
266
+ * <code>--formatter</code>
267
+ * de la ligne de commande.
268
+ * @param {Level|undefined} [argv.level] L'options
269
+ * <code>--level</code> de
270
+ * la ligne de commande.
270
271
  * @returns {FlattenedConfig} L'objet JSON fusionné.
271
272
  */
272
273
  export const flatten = function (hierarchy, argv) {
@@ -11,24 +11,26 @@ import Levels from "../levels.js";
11
11
  import Wrapper, { WRAPPERS } from "../wrapper/wrapper.js";
12
12
 
13
13
  /**
14
- * @typedef {import("../../type/index.d.ts").Level} Level
15
- * @typedef {import("../../type/index.d.ts").NormalizedConfig} NormalizedConfig
16
- * @typedef {import("../../type/index.d.ts").NormalizedConfigChecker} NormalizedConfigChecker
17
- * @typedef {import("../../type/index.d.ts").NormalizedConfigLinter} NormalizedConfigLinter
18
- * @typedef {import("../../type/index.d.ts").NormalizedConfigOverride} NormalizedConfigOverride
19
- * @typedef {import("../../type/index.d.ts").NormalizedConfigReporter} NormalizedConfigReporter
14
+ * @typedef {import("../../types/configuration/normalized.d.ts").NormalizedConfig} NormalizedConfig
15
+ * @typedef {import("../../types/configuration/normalized.d.ts").NormalizedConfigChecker} NormalizedConfigChecker
16
+ * @typedef {import("../../types/configuration/normalized.d.ts").NormalizedConfigLinter} NormalizedConfigLinter
17
+ * @typedef {import("../../types/configuration/normalized.d.ts").NormalizedConfigOverride} NormalizedConfigOverride
18
+ * @typedef {import("../../types/configuration/normalized.d.ts").NormalizedConfigReporter} NormalizedConfigReporter
19
+ * @typedef {import("../../types/level.d.ts").default} Level
20
+ * @typedef {import("../../types/typeofformatter.d.ts").default} TypeofFormatter
21
+ * @typedef {import("../../types/typeofwrapper.d.ts").default} TypeofWrapper
20
22
  */
21
23
 
22
24
  /**
23
25
  * Lit un fichier JavaScript exportant un objet JSON.
24
26
  *
25
27
  * @param {string} file L'adresse du fichier qui sera lu.
26
- * @returns {Promise<Record<string, any>>} L'objet JSON récupéré.
28
+ * @returns {Promise<Record<string, unknown>>} L'objet JSON récupéré.
27
29
  */
28
30
  const read = async function (file) {
29
31
  try {
30
32
  // eslint-disable-next-line no-unsanitized/method
31
- const module = await import(pathToFileURL(file));
33
+ const module = await import(pathToFileURL(file).href);
32
34
  return module.default;
33
35
  } catch (err) {
34
36
  throw new Error(`Cannot import '${file}'.`, { cause: err });
@@ -138,7 +140,7 @@ export const normalizeLevel = function (partial) {
138
140
  * Normalise une propriété <code>"formatter"</code>.
139
141
  *
140
142
  * @param {*} partial La valeur d'une propriété <code>"formatter"</code>.
141
- * @returns {Promise<typeof Formatter>} La valeur normalisée.
143
+ * @returns {Promise<TypeofFormatter>} La valeur normalisée.
142
144
  * @throws {Error} Si le <code>"formatter"</code> est invalide.
143
145
  * @throws {TypeError} Si le <code>"formatter"</code> n'a pas le bon type.
144
146
  */
@@ -178,7 +180,7 @@ export const normalizeFormatter = async function (partial) {
178
180
  * @param {Object} context Le context de la propriété.
179
181
  * @param {string} context.dir Le répertoire où se trouve le fichier
180
182
  * <code>metalint.config.js</code>.
181
- * @returns {Promise<Record<string, any>>} La valeur normalisée.
183
+ * @returns {Promise<Record<string, unknown>>} La valeur normalisée.
182
184
  * @throws {TypeError} Si l'<code>"options"</code> n'a pas le bon type.
183
185
  */
184
186
  export const normalizeOption = async function (partial, { dir }) {
@@ -202,7 +204,7 @@ export const normalizeOption = async function (partial, { dir }) {
202
204
  * @param {Object} context Le context de la propriété.
203
205
  * @param {string} context.dir Le répertoire où se trouve le fichier
204
206
  * <code>metalint.config.js</code>.
205
- * @returns {Promise<Record<string, any>[]>} La valeur normalisée.
207
+ * @returns {Promise<Record<string, unknown>[]>} La valeur normalisée.
206
208
  * @throws {TypeError} Si l'<code>"options"</code> n'a pas le bon type.
207
209
  */
208
210
  export const normalizeOptions = async function (partials, { dir }) {
@@ -279,7 +281,7 @@ export const normalizeReporters = async function (partials, { dir }) {
279
281
  * Normalise une propriété <code>"wrapper"</code>.
280
282
  *
281
283
  * @param {*} partial La valeur d'une propriété <code>"wrapper"</code>.
282
- * @returns {Promise<typeof Wrapper>} La valeur normalisée.
284
+ * @returns {Promise<TypeofWrapper>} La valeur normalisée.
283
285
  * @throws {TypeError} Si le <code>"reporters"</code> n'a pas le bon type.
284
286
  */
285
287
  export const normalizeWrapper = async function (partial) {
@@ -358,7 +360,7 @@ export const normalizeLinter = async function (partial, { dir }) {
358
360
  export const normalizeLinters = async function (partials, { dir }) {
359
361
  let normalizeds;
360
362
  if (undefined === partials) {
361
- normalizeds = [];
363
+ normalizeds = /** @type {NormalizedConfigLinter[]} */ ([]);
362
364
  } else if (Array.isArray(partials)) {
363
365
  normalizeds = await Promise.all(
364
366
  partials.map((p) => normalizeLinter(p, { dir })),
@@ -411,7 +413,7 @@ export const normalizeOverride = async function (partial, { dir }) {
411
413
  export const normalizeOverrides = async function (partials, { dir }) {
412
414
  let normalizeds;
413
415
  if (undefined === partials) {
414
- normalizeds = [];
416
+ normalizeds = /** @type {NormalizedConfigOverride[]} */ ([]);
415
417
  } else if (Array.isArray(partials)) {
416
418
  normalizeds = await Promise.all(
417
419
  partials.map((p) => normalizeOverride(p, { dir })),
@@ -465,7 +467,7 @@ export const normalizeChecker = async function (partial, { dir }) {
465
467
  export const normalizeCheckers = async function (partials, { dir }) {
466
468
  let normalizeds;
467
469
  if (undefined === partials) {
468
- normalizeds = [];
470
+ normalizeds = /** @type {NormalizedConfigChecker[]} */ ([]);
469
471
  } else if (Array.isArray(partials)) {
470
472
  normalizeds = await Promise.all(
471
473
  partials.map((p) => normalizeChecker(p, { dir })),
@@ -495,7 +497,7 @@ export const normalize = async function (partial, { dir }) {
495
497
  if ("object" === typeof partial) {
496
498
  normalized = {
497
499
  patterns: normalizePatterns(partial.patterns, { auto: [] }),
498
- fix: normalizeFix(partial.fix),
500
+ fix: normalizeFix(partial.fix) ?? false,
499
501
  level: normalizeLevel(partial.level),
500
502
  reporters: await normalizeReporters(partial.reporters, { dir }),
501
503
  checkers: await normalizeCheckers(partial.checkers, { dir }),
@@ -7,7 +7,7 @@
7
7
  import { flattenFix, flattenLevel, flattenOptions } from "./flatten.js";
8
8
 
9
9
  /**
10
- * @typedef {import("../../type/index.d.ts").FlattenedConfigLinter} FlattenedConfigLinter
10
+ * @typedef {import("../../types/configuration/flattened.js").FlattenedConfigLinter} FlattenedConfigLinter
11
11
  */
12
12
 
13
13
  /**
@@ -10,8 +10,8 @@ import Formatter from "./formatter.js";
10
10
 
11
11
  /**
12
12
  * @typedef {import("node:stream").Writable} Writable
13
- * @typedef {import("../../type/index.js").Level} Level
14
- * @typedef {import("../../type/index.js").Notice} Notice
13
+ * @typedef {import("../../types/level.d.ts").default} Level
14
+ * @typedef {import("../../types/notice.d.ts").default} Notice
15
15
  */
16
16
 
17
17
  /**
@@ -12,10 +12,10 @@ import Formatter from "./formatter.js";
12
12
 
13
13
  /**
14
14
  * @typedef {import("node:stream").Writable} Writable
15
- * @typedef {import("../../type/index.js").Level} Level
16
- * @typedef {import("../../type/index.js").Location} Location
17
- * @typedef {import("../../type/index.js").Notice} Notice
18
- * @typedef {import("../../type/index.js").Severity} Severity
15
+ * @typedef {import("../../types/level.d.ts").default} Level
16
+ * @typedef {import("../../types/location.d.ts").default} Location
17
+ * @typedef {import("../../types/notice.d.ts").default} Notice
18
+ * @typedef {import("../../types/severity.d.ts").default} Severity
19
19
  */
20
20
 
21
21
  /**
@@ -97,7 +97,7 @@ const printCodeSource = function (locations, content, writer) {
97
97
  if (characters.length === i) {
98
98
  characters[i] = {
99
99
  line: location.line,
100
- columns: [],
100
+ columns: /** @type {number[]} */ ([]),
101
101
  };
102
102
  if (undefined !== location.column) {
103
103
  characters[i].columns.push(location.column);
@@ -9,8 +9,8 @@ import Formatter from "./formatter.js";
9
9
 
10
10
  /**
11
11
  * @typedef {import("node:stream").Writable} Writable
12
- * @typedef {import("../../type/index.js").Level} Level
13
- * @typedef {import("../../type/index.js").Notice} Notice
12
+ * @typedef {import("../../types/level.d.ts").default} Level
13
+ * @typedef {import("../../types/notice.d.ts").default} Notice
14
14
  */
15
15
 
16
16
  /**
@@ -8,8 +8,8 @@ import fs from "node:fs/promises";
8
8
  import { fileURLToPath } from "node:url";
9
9
 
10
10
  /**
11
- * @typedef {import("../../type/index.js").Level} Level
12
- * @typedef {import("../../type/index.js").Notice} Notice
11
+ * @typedef {import("../../types/level.d.ts").default} Level
12
+ * @typedef {import("../../types/notice.d.ts").default} Notice
13
13
  */
14
14
 
15
15
  /**
@@ -10,8 +10,8 @@ import Formatter from "./formatter.js";
10
10
 
11
11
  /**
12
12
  * @typedef {import("node:stream").Writable} Writable
13
- * @typedef {import("../../type/index.js").Level} Level
14
- * @typedef {import("../../type/index.js").Notice} Notice
13
+ * @typedef {import("../../types/level.d.ts").default} Level
14
+ * @typedef {import("../../types/notice.d.ts").default} Notice
15
15
  */
16
16
 
17
17
  /**
@@ -9,8 +9,8 @@ import Formatter from "./formatter.js";
9
9
 
10
10
  /**
11
11
  * @typedef {import("node:stream").Writable} Writable
12
- * @typedef {import("../../type/index.js").Level} Level
13
- * @typedef {import("../../type/index.js").Notice} Notice
12
+ * @typedef {import("../../types/level.d.ts").default} Level
13
+ * @typedef {import("../../types/notice.d.ts").default} Notice
14
14
  */
15
15
 
16
16
  /**
@@ -9,8 +9,8 @@ import Formatter from "./formatter.js";
9
9
 
10
10
  /**
11
11
  * @typedef {import("node:stream").Writable} Writable
12
- * @typedef {import("../../type/index.js").Level} Level
13
- * @typedef {import("../../type/index.js").Notice} Notice
12
+ * @typedef {import("../../types/level.d.ts").default} Level
13
+ * @typedef {import("../../types/notice.d.ts").default} Notice
14
14
  */
15
15
 
16
16
  /**