Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 08e0884

Browse filesBrowse files
TrottFishrock123
authored andcommitted
tools: add -F flag for fixing lint issues
Add `-F` flag to `jslint.js` which enables the automatic fixing of issues that are fixable. PR-URL: #6483 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
1 parent 7c30f15 commit 08e0884
Copy full SHA for 08e0884

File tree

Expand file treeCollapse file tree

1 file changed

+13
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-2
lines changed
Open diff view settings
Collapse file

‎tools/jslint.js‎

Copy file name to clipboardExpand all lines: tools/jslint.js
+13-2Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ const CLIEngine = require('./eslint').CLIEngine;
1313
const glob = require('./eslint/node_modules/glob');
1414

1515
const cwd = process.cwd();
16-
const cli = new CLIEngine({
16+
const cliOptions = {
1717
rulePaths: rulesDirs
18-
});
18+
};
19+
20+
// Check if we should fix errors that are fixable
21+
if (process.argv.indexOf('-F') !== -1)
22+
cliOptions.fix = true;
23+
24+
const cli = new CLIEngine(cliOptions);
1925

2026
if (cluster.isMaster) {
2127
var numCPUs = 1;
@@ -240,6 +246,11 @@ if (cluster.isMaster) {
240246
if (files instanceof Array) {
241247
// Lint some files
242248
const report = cli.executeOnFiles(files);
249+
250+
// If we were asked to fix the fixable issues, do so.
251+
if (cliOptions.fix)
252+
CLIEngine.outputFixes(report);
253+
243254
if (config.sendAll) {
244255
// Return both success and error results
245256

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.