Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linter updates #332

Merged
merged 1 commit into from
Mar 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/runners/application-files-watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default async function(
(path, event) => reloadApplicationWithMessage(path, event, distPath)
),
eslintRC: watch(`${projectRoot}/.eslintrc.js`, async () => {
buildConfig.jsLinter = new eslint.CLIEngine(await import(`${projectRoot}/.eslintrc.js`));
buildConfig.jsLinter = new eslint.ESLint(await import(`${projectRoot}/.eslintrc.js`));
})
});

Expand Down
18 changes: 10 additions & 8 deletions lib/utils/lint-javascript.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import eslintReporter from 'eslint/lib/cli-engine/formatters/codeframe.js';
import eslintReporter from 'eslint-formatter-codeframe';

export default function(files, jsLinter) {
const report = jsLinter.executeOnFiles(files);
const result = eslintReporter(report.results);
export default async function(files, jsLinter) {
const report = await jsLinter.lintFiles(files);

if (result) {
console.log(result);
}
if (report.length > 0) {
let result = eslintReporter(report);
if (result) {
console.log(result);
}

return result;
return result;
}
}
4 changes: 2 additions & 2 deletions lib/worker-pool/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ parentPort.on(
} else if (action === 'LINT_JS') {
Console.log(workerReference, chalk.yellow('linting JS/TS'));

global.jsLinter = global.jsLinter || new eslint.CLIEngine();
global.jsLinter = global.jsLinter || new eslint.ESLint();

try {
const timer = countTime();

lintJavaScript(fileNames, global.jsLinter);
await lintJavaScript(fileNames, global.jsLinter);

Console.log(
workerReference,
Expand Down
Loading