metalint 0.14.1 → 0.15.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.
- package/LICENSE +1 -1
- package/README.md +38 -7
- package/package.json +37 -34
- package/src/bin/index.js +10 -105
- package/src/core/configuration/flatten.js +12 -11
- package/src/core/formatter/console.js +5 -5
- package/src/core/formatter/formatter.js +5 -18
- package/src/core/index.js +128 -118
- package/src/core/results.js +86 -0
- package/src/core/wrapper/addons-linter.js +3 -6
- package/src/core/wrapper/ajv.js +122 -0
- package/src/core/wrapper/csslint.js +1 -6
- package/src/core/wrapper/depcheck.js +148 -0
- package/src/core/wrapper/doiuse.js +2 -3
- package/src/core/wrapper/eslint.js +2 -3
- package/src/core/wrapper/htmlhint.js +1 -6
- package/src/core/wrapper/htmllint.js +1 -6
- package/src/core/wrapper/jshint.js +1 -6
- package/src/core/wrapper/publint.js +136 -0
- package/src/core/wrapper/standard.js +7 -1
- package/src/core/wrapper/stylelint.js +1 -6
- package/src/core/wrapper/svglint.js +92 -0
- package/src/core/wrapper/wrapper.js +5 -18
- package/types/configuration/flatten.d.ts +2 -2
- package/types/index.d.ts +20 -14
- package/types/results.d.ts +7 -0
- package/types/wrapper/ajv.d.ts +36 -0
- package/types/wrapper/depcheck.d.ts +36 -0
- package/types/wrapper/publint.d.ts +33 -0
- package/types/wrapper/svglint.d.ts +36 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Metalint
|
|
2
2
|
|
|
3
|
-
<!-- Utiliser du HTML
|
|
3
|
+
<!-- Utiliser du HTML (avec l'attribut "align" obsolète) pour faire flotter
|
|
4
|
+
l'image à droite. -->
|
|
4
5
|
<!-- markdownlint-disable-next-line no-inline-html-->
|
|
5
6
|
<img src="asset/logo.svg" align="right" alt="">
|
|
6
7
|
|
|
@@ -72,6 +73,7 @@ source) :
|
|
|
72
73
|
<tr>
|
|
73
74
|
<td>JSON</td>
|
|
74
75
|
<td>
|
|
76
|
+
<a title="ajv" href="https://www.npmjs.com/package/ajv">Ajv</a>,
|
|
75
77
|
<a title="@prantlf/jsonlint"
|
|
76
78
|
href="https://www.npmjs.com/package/@prantlf/jsonlint">@prantlf/JSON
|
|
77
79
|
Lint</a>,
|
|
@@ -100,18 +102,16 @@ source) :
|
|
|
100
102
|
<tr>
|
|
101
103
|
<td>package.json</td>
|
|
102
104
|
<td>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
<a title="depcheck"
|
|
106
|
+
href="https://www.npmjs.com/package/depcheck">Depcheck</a>
|
|
105
107
|
<a title="npm-check-updates"
|
|
106
108
|
href="https://www.npmjs.com/package/npm-check-updates"
|
|
107
109
|
>npm-check-updates</a>,
|
|
108
|
-
<!-- markdownlint-enable no-bare-urls -->
|
|
109
|
-
<!-- markdownlint-disable no-bare-urls -->
|
|
110
|
-
<!-- https://github.com/DavidAnson/markdownlint/issues/961 -->
|
|
111
110
|
<a title="npm-package-json-lint"
|
|
112
111
|
href="https://www.npmjs.com/package/npm-package-json-lint"
|
|
113
112
|
>npm-package-json-lint</a>,
|
|
114
|
-
|
|
113
|
+
<a title="publint"
|
|
114
|
+
href="https://www.npmjs.com/package/publint">publint</a>,
|
|
115
115
|
<a title="sort-package-json"
|
|
116
116
|
href="https://www.npmjs.com/package/sort-package-json">Sort
|
|
117
117
|
Package.json</a>
|
|
@@ -133,6 +133,15 @@ source) :
|
|
|
133
133
|
href="https://www.npmjs.com/package/stylelint">Stylelint</a>
|
|
134
134
|
</td>
|
|
135
135
|
</tr>
|
|
136
|
+
<tr>
|
|
137
|
+
<td>SVG</td>
|
|
138
|
+
<td>
|
|
139
|
+
<a title="prettier"
|
|
140
|
+
href="https://www.npmjs.com/package/prettier">Prettier</a>,
|
|
141
|
+
<a title="svglint"
|
|
142
|
+
href="https://www.npmjs.com/package/svglint">SVGLint</a>
|
|
143
|
+
</td>
|
|
144
|
+
</tr>
|
|
136
145
|
<tr>
|
|
137
146
|
<td>WebExtension</td>
|
|
138
147
|
<td>
|
|
@@ -221,6 +230,8 @@ export default {
|
|
|
221
230
|
|
|
222
231
|
## Intégration
|
|
223
232
|
|
|
233
|
+
### npm
|
|
234
|
+
|
|
224
235
|
Après avoir installé Metalint et les linters dans votre projet npm, vous pouvez
|
|
225
236
|
ajouter le script suivant dans votre `package.json` :
|
|
226
237
|
|
|
@@ -234,6 +245,26 @@ ajouter le script suivant dans votre `package.json` :
|
|
|
234
245
|
|
|
235
246
|
Metalint est maintenant utilisable avec la commande : `npm run lint`
|
|
236
247
|
|
|
248
|
+
### GitHub Actions
|
|
249
|
+
|
|
250
|
+
Pour lancer Metalint dans vos GitHub Actions, vous pouvez utiliser le formateur
|
|
251
|
+
`github` pour rapporter les problèmes dans les pull requests.
|
|
252
|
+
|
|
253
|
+
```YAML
|
|
254
|
+
jobs:
|
|
255
|
+
lint:
|
|
256
|
+
runs-on: ubuntu-latest
|
|
257
|
+
steps:
|
|
258
|
+
- uses: actions/setup-node@v4
|
|
259
|
+
- uses: actions/checkout@v4
|
|
260
|
+
with:
|
|
261
|
+
persist-credentials: false
|
|
262
|
+
- name: Install dependencies
|
|
263
|
+
run: npm ci
|
|
264
|
+
- name: Lint files
|
|
265
|
+
run: npm run lint -- --formatter github
|
|
266
|
+
```
|
|
267
|
+
|
|
237
268
|
[img-npm]: https://img.shields.io/npm/dm/metalint?label=npm&logo=npm&logoColor=whitesmoke
|
|
238
269
|
[img-build]: https://img.shields.io/github/actions/workflow/status/regseb/metalint/ci.yml?branch=main&logo=github&logoColor=whitesmoke
|
|
239
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metalint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Un linter pour les gouverner tous.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"checker",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
26
|
"types": "./types/index.d.ts",
|
|
27
|
-
"default": "./src/
|
|
27
|
+
"default": "./src/core/index.js"
|
|
28
28
|
},
|
|
29
29
|
"./api/formatter": {
|
|
30
30
|
"types": "./types/formatter/formatter.d.ts",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"lint:types": "tsc --project .tsconfig_lint.json",
|
|
48
48
|
"test": "npm run test:unit",
|
|
49
49
|
"test:unit": "mocha --config test/unit/mocharc.json",
|
|
50
|
-
"test:coverage": "stryker run
|
|
50
|
+
"test:coverage": "stryker run",
|
|
51
51
|
"jsdocs": "typedoc --tsconfig .tsconfig_jsdocs.json",
|
|
52
52
|
"prepare": "tsc --project .tsconfig_types.json",
|
|
53
53
|
"clean": "node .script/clean.js"
|
|
@@ -59,51 +59,54 @@
|
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@coffeelint/cli": "5.2.11",
|
|
61
61
|
"@prantlf/jsonlint": "14.0.3",
|
|
62
|
-
"@prettier/plugin-xml": "3.2.
|
|
63
|
-
"@stryker-mutator/core": "
|
|
64
|
-
"@stryker-mutator/mocha-runner": "
|
|
65
|
-
"@types/eslint": "8.
|
|
66
|
-
"@types/htmlhint": "1.1.
|
|
67
|
-
"@types/jshint": "2.12.
|
|
68
|
-
"@types/mocha": "10.0.
|
|
69
|
-
"@types/
|
|
70
|
-
"@types/
|
|
71
|
-
"
|
|
72
|
-
"
|
|
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",
|
|
66
|
+
"@types/htmlhint": "1.1.5",
|
|
67
|
+
"@types/jshint": "2.12.4",
|
|
68
|
+
"@types/mocha": "10.0.6",
|
|
69
|
+
"@types/sinon": "17.0.2",
|
|
70
|
+
"@types/yargs": "17.0.32",
|
|
71
|
+
"addons-linter": "6.19.0",
|
|
72
|
+
"ajv": "8.12.0",
|
|
73
73
|
"csslint": "1.0.5",
|
|
74
|
+
"depcheck": "1.4.7",
|
|
74
75
|
"doiuse": "6.0.2",
|
|
75
|
-
"eslint": "8.
|
|
76
|
-
"eslint-plugin-array-func": "
|
|
76
|
+
"eslint": "8.56.0",
|
|
77
|
+
"eslint-plugin-array-func": "4.0.0",
|
|
77
78
|
"eslint-plugin-eslint-comments": "3.2.0",
|
|
78
|
-
"eslint-plugin-import": "2.
|
|
79
|
-
"eslint-plugin-jsdoc": "
|
|
80
|
-
"eslint-plugin-mocha": "10.
|
|
81
|
-
"eslint-plugin-n": "16.
|
|
79
|
+
"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",
|
|
82
83
|
"eslint-plugin-no-unsanitized": "4.0.2",
|
|
83
84
|
"eslint-plugin-promise": "6.1.1",
|
|
84
|
-
"eslint-plugin-regexp": "1.
|
|
85
|
-
"eslint-plugin-unicorn": "
|
|
85
|
+
"eslint-plugin-regexp": "2.1.2",
|
|
86
|
+
"eslint-plugin-unicorn": "50.0.1",
|
|
86
87
|
"htmlhint": "1.1.4",
|
|
87
88
|
"htmllint": "0.8.0",
|
|
88
89
|
"jshint": "2.13.6",
|
|
89
90
|
"jsonlint-mod": "1.7.6",
|
|
90
|
-
"
|
|
91
|
-
"
|
|
91
|
+
"jszip": "3.10.1",
|
|
92
|
+
"markdownlint": "0.32.1",
|
|
93
|
+
"markuplint": "3.15.0",
|
|
92
94
|
"mocha": "10.2.0",
|
|
93
|
-
"
|
|
94
|
-
"npm-
|
|
95
|
-
"
|
|
96
|
-
"
|
|
95
|
+
"npm-check-updates": "16.14.12",
|
|
96
|
+
"npm-package-json-lint": "7.1.0",
|
|
97
|
+
"prettier": "3.1.1",
|
|
98
|
+
"publint": "0.2.7",
|
|
97
99
|
"purgecss": "5.0.0",
|
|
98
|
-
"sinon": "
|
|
99
|
-
"sort-package-json": "2.
|
|
100
|
+
"sinon": "17.0.1",
|
|
101
|
+
"sort-package-json": "2.6.0",
|
|
100
102
|
"standard": "17.1.0",
|
|
101
|
-
"stylelint": "
|
|
102
|
-
"
|
|
103
|
-
"
|
|
103
|
+
"stylelint": "16.1.0",
|
|
104
|
+
"svglint": "2.6.0",
|
|
105
|
+
"typedoc": "0.25.6",
|
|
106
|
+
"typescript": "5.3.3",
|
|
104
107
|
"yaml-lint": "1.7.0"
|
|
105
108
|
},
|
|
106
109
|
"engines": {
|
|
107
|
-
"node": ">=20.
|
|
110
|
+
"node": ">=20.6.0"
|
|
108
111
|
}
|
|
109
112
|
}
|
package/src/bin/index.js
CHANGED
|
@@ -1,86 +1,12 @@
|
|
|
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é
|
|
4
|
-
// "files" (du package.json) commençant par "./".
|
|
5
|
-
// https://github.com/eslint-community/eslint-plugin-n/issues/99
|
|
6
|
-
// eslint-disable-next-line n/no-unpublished-bin
|
|
7
3
|
import fs from "node:fs/promises";
|
|
8
|
-
import path from "node:path";
|
|
9
4
|
import process from "node:process";
|
|
10
|
-
import { fileURLToPath
|
|
11
|
-
import
|
|
12
|
-
import normalize from "../core/configuration/normalize.js";
|
|
13
|
-
import metalint from "../core/index.js";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import Metalint from "../core/index.js";
|
|
14
7
|
import Severities from "../core/severities.js";
|
|
15
|
-
import { exists } from "../core/utils/file.js";
|
|
16
|
-
import Glob from "../core/utils/glob.js";
|
|
17
8
|
import { parse } from "./argv.js";
|
|
18
9
|
|
|
19
|
-
/**
|
|
20
|
-
* @typedef {import("../core/formatter/formatter.js")} Formatter
|
|
21
|
-
* @typedef {import("../type/index.d.ts").FlattenedConfigChecker} FlattenedConfigChecker
|
|
22
|
-
* @typedef {import("../type/index.d.ts").FlattenedConfigReporter} FlattenedConfigReporter
|
|
23
|
-
* @typedef {import("../type/index.d.ts").Severity} Severity
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
if (undefined === import.meta.resolve) {
|
|
27
|
-
/**
|
|
28
|
-
* Résous un chemin relatif à partir du module.
|
|
29
|
-
*
|
|
30
|
-
* @param {string} specifier Le chemin relatif vers un fichier ou un
|
|
31
|
-
* répertoire.
|
|
32
|
-
* @returns {string} L'URL absolue vers le fichier ou le répertoire.
|
|
33
|
-
* @see https://nodejs.org/api/esm.html#importmetaresolvespecifier-parent
|
|
34
|
-
*/
|
|
35
|
-
import.meta.resolve = (specifier) => {
|
|
36
|
-
return new URL(specifier, import.meta.url).href;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Vérifie (en appelant des linters) une liste de fichiers.
|
|
42
|
-
*
|
|
43
|
-
* @param {string[]} files La liste des fichiers.
|
|
44
|
-
* @param {FlattenedConfigChecker[]} checkers La liste des vérifications
|
|
45
|
-
* faites sur les fichiers.
|
|
46
|
-
* @param {string} root L'adresse du répertoire où se
|
|
47
|
-
* trouve le répertoire
|
|
48
|
-
* <code>.metalint/</code>.
|
|
49
|
-
* @param {FlattenedConfigReporter[]} reporters La liste des rapporteurs
|
|
50
|
-
* utilisés pour afficher les
|
|
51
|
-
* résultats.
|
|
52
|
-
* @returns {Promise<Severity|undefined>} La sévérité la plus élevée des
|
|
53
|
-
* résultats.
|
|
54
|
-
*/
|
|
55
|
-
const check = async function (files, checkers, root, reporters) {
|
|
56
|
-
let severity;
|
|
57
|
-
|
|
58
|
-
const formatters = reporters.map((reporter) => {
|
|
59
|
-
// eslint-disable-next-line new-cap
|
|
60
|
-
return new reporter.formatter(reporter.level, reporter.options);
|
|
61
|
-
});
|
|
62
|
-
const results = await metalint(files, checkers, root);
|
|
63
|
-
for (const [file, notices] of Object.entries(results)) {
|
|
64
|
-
// Déterminer la sévérité la plus élevée des résultats.
|
|
65
|
-
if (undefined !== notices) {
|
|
66
|
-
for (const notice of notices) {
|
|
67
|
-
if (undefined === severity || severity > notice.severity) {
|
|
68
|
-
severity = notice.severity;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Afficher les notifications avec chaque rapporteur.
|
|
74
|
-
for (const formatter of formatters) {
|
|
75
|
-
await formatter.notify(file, notices);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Attendre tous les rapporteurs.
|
|
80
|
-
await Promise.all(formatters.map((f) => f.finalize()));
|
|
81
|
-
return severity;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
10
|
const argv = await parse();
|
|
85
11
|
if (argv.help) {
|
|
86
12
|
process.stdout.write(
|
|
@@ -89,37 +15,16 @@ if (argv.help) {
|
|
|
89
15
|
process.exit(0);
|
|
90
16
|
}
|
|
91
17
|
|
|
92
|
-
let root = process.cwd();
|
|
93
|
-
// Rechercher le fichier de configuration dans le répertoire courant, puis dans
|
|
94
|
-
// les parents, grands-parents...
|
|
95
|
-
while (!(await exists(path.join(root, argv.config)))) {
|
|
96
|
-
// Si on est remonté à la racine.
|
|
97
|
-
if (path.join(root, "..") === root) {
|
|
98
|
-
process.stderr.write("metalint: no such config file.\n");
|
|
99
|
-
process.exit(10);
|
|
100
|
-
}
|
|
101
|
-
root = path.join(root, "..");
|
|
102
|
-
}
|
|
103
|
-
|
|
104
18
|
try {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
argv,
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
const glob = new Glob(patterns, { root });
|
|
117
|
-
const files = [];
|
|
118
|
-
for (const base of argv._) {
|
|
119
|
-
files.push(...(await glob.walk(base)));
|
|
120
|
-
}
|
|
19
|
+
const metalint = await Metalint.fromFileSystem({
|
|
20
|
+
config: argv.config,
|
|
21
|
+
fix: argv.fix,
|
|
22
|
+
formatter: argv.formatter,
|
|
23
|
+
level: argv.level,
|
|
24
|
+
});
|
|
25
|
+
const results = await metalint.lintFiles(argv._);
|
|
26
|
+
const severity = await metalint.report(results);
|
|
121
27
|
|
|
122
|
-
const severity = await check(files, checkers, root, reporters);
|
|
123
28
|
let code;
|
|
124
29
|
switch (severity) {
|
|
125
30
|
case Severities.FATAL:
|
|
@@ -255,16 +255,18 @@ export const flattenChecker = function (hierarchy, { fix, level }) {
|
|
|
255
255
|
/**
|
|
256
256
|
* Fusionne la configuration.
|
|
257
257
|
*
|
|
258
|
-
* @param {NormalizedConfig}
|
|
259
|
-
*
|
|
260
|
-
* @param {Object}
|
|
261
|
-
*
|
|
262
|
-
* @param {boolean|undefined}
|
|
263
|
-
*
|
|
264
|
-
* @param {TypeofFormatter}
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
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.
|
|
268
270
|
* @returns {FlattenedConfig} L'objet JSON fusionné.
|
|
269
271
|
*/
|
|
270
272
|
export const flatten = function (hierarchy, argv) {
|
|
@@ -272,7 +274,6 @@ export const flatten = function (hierarchy, argv) {
|
|
|
272
274
|
const level = flattenLevel(argv.level ?? Levels.INFO, {
|
|
273
275
|
level: hierarchy.level,
|
|
274
276
|
});
|
|
275
|
-
// TODO Vérifier que checkers n'est pas vide.
|
|
276
277
|
return {
|
|
277
278
|
patterns: hierarchy.patterns,
|
|
278
279
|
reporters: flattenReporters(hierarchy.reporters, {
|
|
@@ -112,14 +112,14 @@ const printCodeSource = function (locations, content, writer) {
|
|
|
112
112
|
printCodeSourceLine(line - 1, content, false, writer);
|
|
113
113
|
printCodeSourceLine(line, content, true, writer);
|
|
114
114
|
if (0 !== columns.length) {
|
|
115
|
-
let
|
|
115
|
+
let dashes = "-".repeat(6 + columns.at(-1));
|
|
116
116
|
for (const column of columns) {
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
dashes =
|
|
118
|
+
dashes.slice(0, 6 + column) +
|
|
119
119
|
"^" +
|
|
120
|
-
|
|
120
|
+
dashes.slice(6 + column + 1);
|
|
121
121
|
}
|
|
122
|
-
print(writer,
|
|
122
|
+
print(writer, dashes + "\n");
|
|
123
123
|
}
|
|
124
124
|
printCodeSourceLine(line + 1, content, false, writer);
|
|
125
125
|
printCodeSourceLine(line + 2, content, false, writer);
|
|
@@ -12,20 +12,6 @@ import { fileURLToPath } from "node:url";
|
|
|
12
12
|
* @typedef {import("../../type/index.js").Notice} Notice
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
if (undefined === import.meta.resolve) {
|
|
16
|
-
/**
|
|
17
|
-
* Résous un chemin relatif à partir du module.
|
|
18
|
-
*
|
|
19
|
-
* @param {string} specifier Le chemin relatif vers un fichier ou un
|
|
20
|
-
* répertoire.
|
|
21
|
-
* @returns {string} L'URL absolue vers le fichier ou le répertoire.
|
|
22
|
-
* @see https://nodejs.org/api/esm.html#importmetaresolvespecifier-parent
|
|
23
|
-
*/
|
|
24
|
-
import.meta.resolve = (specifier) => {
|
|
25
|
-
return new URL(specifier, import.meta.url).href;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
15
|
/**
|
|
30
16
|
* La liste des fichiers JavaScript des formateurs.
|
|
31
17
|
*
|
|
@@ -39,10 +25,11 @@ const scripts = await fs.readdir(fileURLToPath(import.meta.resolve("./")));
|
|
|
39
25
|
* @constant {string[]} FORMATTERS
|
|
40
26
|
*/
|
|
41
27
|
export const FORMATTERS = scripts
|
|
42
|
-
//
|
|
43
|
-
.
|
|
44
|
-
|
|
45
|
-
|
|
28
|
+
// Garder seulement les fichiers JavaScript et enlever le fichier
|
|
29
|
+
// "formatter.js" qui n'est pas un vrai formateur.
|
|
30
|
+
.filter((f) => f.endsWith(".js") && "formatter.js" !== f)
|
|
31
|
+
// Enlever l'extension des fichiers.
|
|
32
|
+
.map((f) => f.slice(0, -3));
|
|
46
33
|
|
|
47
34
|
/**
|
|
48
35
|
* Le formateur parent.
|