source: frontend/node_modules/@rushstack/eslint-patch/lib-esm/eslint-bulk-suppressions/cli/runEslint.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.5 KB
Line 
1// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2// See LICENSE in the project root for license information.
3import { getEslintPathAndVersion } from './utils/get-eslint-cli';
4export async function runEslintAsync(files, mode) {
5 const cwd = process.cwd();
6 const [eslintPath, eslintVersion] = getEslintPathAndVersion(cwd);
7 const { ESLint } = require(eslintPath);
8 let eslint;
9 const majorVersion = parseInt(eslintVersion, 10);
10 if (majorVersion < 9) {
11 eslint = new ESLint({ cwd, useEslintrc: true });
12 }
13 else {
14 eslint = new ESLint({ cwd });
15 }
16 let results;
17 try {
18 results = await eslint.lintFiles(files);
19 }
20 catch (e) {
21 throw new Error(`@rushstack/eslint-bulk execution error: ${e.message}`);
22 }
23 const { write, prune } = await import('../bulk-suppressions-patch');
24 switch (mode) {
25 case 'suppress': {
26 await write();
27 break;
28 }
29 case 'prune': {
30 await prune();
31 break;
32 }
33 }
34 if (results.length > 0) {
35 const stylishFormatter = await eslint.loadFormatter();
36 // eslint-disable-next-line @typescript-eslint/no-explicit-any
37 const formattedResults = await Promise.resolve(stylishFormatter.format(results));
38 console.log(formattedResults);
39 }
40 console.log('@rushstack/eslint-bulk: Successfully pruned unused suppressions in all .eslint-bulk-suppressions.json ' +
41 `files under directory ${cwd}`);
42}
43//# sourceMappingURL=runEslint.js.map
Note: See TracBrowser for help on using the repository browser.