Skip to content

Commit 7707f60

Browse files
committedJun 30, 2019
Upgrade to ESLint v6 and require Node.js 8
Fixes #162
1 parent a18f9ee commit 7707f60

File tree

3 files changed

+19
-22
lines changed

3 files changed

+19
-22
lines changed
 

‎.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: node_js
22
node_js:
3+
- '12'
34
- '10'
45
- '8'
5-
- '6'

‎package.json

+5-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"url": "sindresorhus.com"
1111
},
1212
"engines": {
13-
"node": ">=6"
13+
"node": ">=8"
1414
},
1515
"scripts": {
1616
"test": "grunt"
@@ -20,22 +20,19 @@
2020
],
2121
"keywords": [
2222
"gruntplugin",
23+
"eslint",
2324
"lint",
2425
"validate",
25-
"report",
26-
"jshint",
27-
"jslint",
28-
"ecmascript",
29-
"esprima"
26+
"report"
3027
],
3128
"dependencies": {
3229
"chalk": "^2.1.0",
33-
"eslint": "^5.16.0"
30+
"eslint": "^6.0.1"
3431
},
3532
"devDependencies": {
3633
"grunt": "^1.0.1",
3734
"grunt-cli": "^1.2.0",
38-
"grunt-shell": "^2.1.0"
35+
"grunt-shell": "^3.0.1"
3936
},
4037
"peerDependencies": {
4138
"grunt": ">=1"

‎tasks/eslint.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const eslint = require('eslint');
44

55
module.exports = grunt => {
66
grunt.registerMultiTask('eslint', 'Validate files with ESLint', function () {
7-
const opts = this.options({
7+
const options = this.options({
88
outputFile: false,
99
quiet: false,
1010
maxWarnings: -1,
@@ -16,47 +16,47 @@ module.exports = grunt => {
1616
return true;
1717
}
1818

19-
const formatter = eslint.CLIEngine.getFormatter(opts.format);
19+
const formatter = eslint.CLIEngine.getFormatter(options.format);
2020

2121
if (!formatter) {
22-
grunt.warn(`Could not find formatter ${opts.format}`);
22+
grunt.warn(`Could not find formatter ${options.format}`);
2323
return false;
2424
}
2525

26-
const engine = new eslint.CLIEngine(opts);
26+
const engine = new eslint.CLIEngine(options);
2727

2828
let report;
2929
try {
3030
report = engine.executeOnFiles(this.filesSrc);
31-
} catch (err) {
32-
grunt.warn(err);
31+
} catch (error) {
32+
grunt.warn(error);
3333
return false;
3434
}
3535

36-
if (opts.fix) {
36+
if (options.fix) {
3737
eslint.CLIEngine.outputFixes(report);
3838
}
3939

4040
let results = report.results;
4141

42-
if (opts.quiet) {
42+
if (options.quiet) {
4343
results = eslint.CLIEngine.getErrorResults(results);
4444
}
4545

4646
const output = formatter(results);
4747

48-
if (opts.outputFile) {
49-
grunt.file.write(opts.outputFile, output);
48+
if (options.outputFile) {
49+
grunt.file.write(options.outputFile, output);
5050
} else if (output) {
5151
console.log(output);
5252
}
5353

54-
const tooManyWarnings = opts.maxWarnings >= 0 && report.warningCount > opts.maxWarnings;
54+
const tooManyWarnings = options.maxWarnings >= 0 && report.warningCount > options.maxWarnings;
5555

5656
if (report.errorCount === 0 && tooManyWarnings) {
57-
grunt.warn(`ESLint found too many warnings (maximum: ${opts.maxWarnings})`);
57+
grunt.warn(`ESLint found too many warnings (maximum: ${options.maxWarnings})`);
5858
}
5959

60-
return opts.failOnError ? report.errorCount === 0 : 0;
60+
return options.failOnError ? report.errorCount === 0 : 0;
6161
});
6262
};

0 commit comments

Comments
 (0)
Please sign in to comment.