Slide 12
Slide 12 text
ςετίʔυྫ
ςετͷίʔυ
1 "use strict";
2
3 const { ESLint } = require("eslint");
4 const path = require("path");
5
6 /**
7 * Run ESlint and return the result per files
8 * @param type lint type, which is in lib directory
9 * @returns {Object} …
10 */
11 const runLintWithFixtures = async (type, configFile = `lib/${type}.js`) => {
12 const eslint = new ESLint({
13 overrideConfigFile: path.resolve(process.cwd(), configFile),
14 ignore: false,
15 useEslintrc: false,
16 extensions: [".js", ".jsx", ".ts", ".tsx"]
17 });
18 const targetDir = path.resolve(__dirname, "..", "fixtures", type);
19 const lintResult = await eslint.lintFiles([targetDir]);
20 // console.log(JSON.stringify(lintResult, null, 2));
21 return lintResult.reduce((results, { filePath, messages }) => { … }, {});
22 };
23
24 module.exports = runLintWithFixtures;
ςετ༻ͷ+4ϑΝΠϧʹରͯ͠&4-JOUΛ࣮ߦ