source: frontend/node_modules/eslint-webpack-plugin/dist/worker.js

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

Fix frontend appearance

  • Property mode set to 100644
File size: 1.1 KB
Line 
1"use strict";
2
3/** @typedef {import('eslint').ESLint} ESLint */
4
5/** @typedef {import('eslint').ESLint.Options} ESLintOptions */
6Object.assign(module.exports, {
7 lintFiles,
8 setup
9});
10/** @type {{ new (arg0: import("eslint").ESLint.Options): import("eslint").ESLint; outputFixes: (arg0: import("eslint").ESLint.LintResult[]) => any; }} */
11
12let ESLint;
13/** @type {ESLint} */
14
15let eslint;
16/** @type {boolean} */
17
18let fix;
19/**
20 * @typedef {object} setupOptions
21 * @property {string=} eslintPath - import path of eslint
22 * @property {ESLintOptions=} eslintOptions - linter options
23 *
24 * @param {setupOptions} arg0 - setup worker
25 */
26
27function setup({
28 eslintPath,
29 eslintOptions = {}
30}) {
31 fix = !!(eslintOptions && eslintOptions.fix);
32 ({
33 ESLint
34 } = require(eslintPath || 'eslint'));
35 eslint = new ESLint(eslintOptions);
36}
37/**
38 * @param {string | string[]} files
39 */
40
41
42async function lintFiles(files) {
43 const result = await eslint.lintFiles(files); // if enabled, use eslint autofixing where possible
44
45 if (fix) {
46 await ESLint.outputFixes(result);
47 }
48
49 return result;
50}
Note: See TracBrowser for help on using the repository browser.