Skip to content

Commit

Permalink
Replace jshint with eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuk committed Jun 23, 2022
1 parent 4e4c01a commit 85c2348
Show file tree
Hide file tree
Showing 10 changed files with 1,598 additions and 544 deletions.
41 changes: 41 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = {
"env": {
"browser": true,
"commonjs": true,
"es2021": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": "latest"
},
"ignorePatterns": ["vendor/*.js", "dist/*.js"],
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
],
"curly": "error",
"eqeqeq": "error",
"no-new": "error",
"no-caller": "error",
"guard-for-in": "error",
"no-extend-native": "error",
"strict": [
"error",
"global"
],
}
};
1 change: 0 additions & 1 deletion .jshintignore

This file was deleted.

21 changes: 0 additions & 21 deletions .jshintrc

This file was deleted.

23 changes: 1 addition & 22 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,9 @@
/*jshint node: true */
"use strict";

module.exports = function(grunt) {
var version = require("./package.json").version;

grunt.initConfig({
jshint: {
// see https://github.com/gruntjs/grunt-contrib-jshint/issues/198
// we can't override the options using the jshintrc path
options: grunt.file.readJSON('.jshintrc'),
production: ['./lib/**/*.js'],
test: ['./test/helpers/**/*.js', './test/asserts/**/*.js'],
documentation: {
options: {
// we include js files with jekyll, jshint can't see all
// variables and we can't declare all of them
undef: false,
// 'implied' still give false positives in our case
strict: false
},
files: {
src: ['./documentation/**/*.js']
}
}
},
browserify: {
all: {
files: {
Expand Down Expand Up @@ -59,9 +39,8 @@ module.exports = function(grunt) {
});

grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');

grunt.registerTask("build", ["browserify", "uglify"]);
grunt.registerTask("default", ["jshint", "build"]);
grunt.registerTask("default", ["build"]);
};
2 changes: 1 addition & 1 deletion documentation/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Here are the interesting build commands :
* `npm run test-browser` will the tests in some browsers using SauceLabs, see
below.
* `npm run test` will run the tests in nodejs and in the browser.
* `npm run lint` will use jshint the check the source code.
* `npm run lint` will use eslint the check the source code.

#### Documentation

Expand Down
3 changes: 1 addition & 2 deletions lib/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,15 @@ var out = {
*/
forEach: function(cb) {
var filename, relativePath, file;
/* jshint ignore:start */
// ignore warning about unwanted properties because this.files is a null prototype object
/* eslint-disable-next-line guard-for-in */
for (filename in this.files) {
file = this.files[filename];
relativePath = filename.slice(this.root.length, filename.length);
if (relativePath && filename.slice(0, this.root.length) === this.root) { // the file is in the current root
cb(relativePath, file); // TODO reverse the parameters ? need to be clean AND consistent with the filter search fn...
}
}
/* jshint ignore:end */
},

/**
Expand Down

0 comments on commit 85c2348

Please sign in to comment.