2022-07-25 18:49:55 +03:00
|
|
|
const { ESLint } = require("eslint");
|
|
|
|
const packagePath = process.cwd();
|
|
|
|
|
|
|
|
(async function main() {
|
|
|
|
const optionsPath = `${packagePath}/.eslintrc.js`;
|
|
|
|
|
|
|
|
// 1. Create an instance.
|
|
|
|
const eslint = new ESLint({
|
|
|
|
cwd: packagePath,
|
|
|
|
baseConfig: require('../config/eslintrc.js')
|
|
|
|
});
|
|
|
|
|
|
|
|
// 2. Lint files.
|
2022-08-02 00:13:30 +03:00
|
|
|
const results = await eslint.lintFiles(["src/**/*.ts"]);
|
2022-07-25 18:49:55 +03:00
|
|
|
|
|
|
|
// 3. Format the results.
|
|
|
|
const formatter = await eslint.loadFormatter("stylish");
|
|
|
|
const resultText = formatter.format(results);
|
|
|
|
|
|
|
|
// 4. Output it.
|
|
|
|
console.log(resultText);
|
|
|
|
})().catch((error) => {
|
|
|
|
process.exitCode = 1;
|
|
|
|
console.error(error);
|
|
|
|
});
|