Skip to content

Commit

Permalink
tools: add -F flag for fixing lint issues
Browse files Browse the repository at this point in the history
Add `-F` flag to `jslint.js` which enables the automatic fixing of
issues that are fixable.

PR-URL: nodejs#6483
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
  • Loading branch information
Trott committed May 2, 2016
1 parent 8ebec08 commit db3db07
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tools/jslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ const CLIEngine = require('./eslint').CLIEngine;
const glob = require('./eslint/node_modules/glob');

const cwd = process.cwd();
const cli = new CLIEngine({
const cliOptions = {
rulePaths: rulesDirs
});
};

// Check if we should fix errors that are fixable
if (process.argv.indexOf('-F') !== -1)
cliOptions.fix = true;

const cli = new CLIEngine(cliOptions);

if (cluster.isMaster) {
var numCPUs = 1;
Expand Down Expand Up @@ -240,6 +246,11 @@ if (cluster.isMaster) {
if (files instanceof Array) {
// Lint some files
const report = cli.executeOnFiles(files);

// If we were asked to fix the fixable issues, do so.
if (cliOptions.fix)
CLIEngine.outputFixes(report);

if (config.sendAll) {
// Return both success and error results

Expand Down

0 comments on commit db3db07

Please sign in to comment.