Skip to content

Commit

Permalink
Build: Switch from jscs+jshint to eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
markelog committed Jun 11, 2016
1 parent 019c8f1 commit f80ae67
Show file tree
Hide file tree
Showing 14 changed files with 261 additions and 160 deletions.
12 changes: 12 additions & 0 deletions .eslintignore
@@ -0,0 +1,12 @@
external
test/data/jquery-1.9.1.js
test/data/badcall.js
test/data/badjson.js
test/data/json_obj.js
test/data/readywaitasset.js
test/data/readywaitloader.js
test/data/support/csp.js
test/data/support/getComputedSupport.js
test/node_smoke_tests/lib/ensure_iterability.js
node_modules
dist
145 changes: 145 additions & 0 deletions .eslintrc
@@ -0,0 +1,145 @@
{
"env": {},
"globals": {},
"rules": {
"no-cond-assign": [
"error",
"except-parens"
],
"curly": [
"error",
"all"
],
"object-curly-spacing": [
"error",
"always"
],
"computed-property-spacing": [
"error",
"always"
],
"array-bracket-spacing": [
"error",
"always"
],
"eqeqeq": [
"error",
"smart"
],

// Shows errors where jshint wouldn't (see jshint "expr" rule)
// clarifing this with eslint team
// "no-unused-expressions": "error",
"wrap-iife": [
"error",
"inside"
],
"no-caller": "error",
"quotes": [
"error",
"double",
"avoid-escape"
],
"no-undef": "error",
"no-unused-vars": "error",
"operator-linebreak": [
"error",
"after"
],
"comma-style": [
"error",
"last"
],
"camelcase": [
"error",
{
"properties": "never"
}
],
"dot-notation": [
"error",
{
"allowPattern": "^[a-z]+(_[a-z]+)+$"
}
],
"max-len": [
"error",
{
"code": 100,
"ignoreComments": true
}
],
"no-mixed-spaces-and-tabs": "error",
"no-trailing-spaces": "error",
"no-multi-str": "error",
"comma-dangle": [
"error",
"never"
],
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"space-before-blocks": [
"error",
"always"
],
"space-in-parens": [
"error",
"always"
],
"keyword-spacing": [
2
],
"semi": [
"error",
"always"
],
"semi-spacing": [
"error",
{
// Because of the `for ( ; ...)` requirement
// "before": true,
"after": true
}
],
"space-infix-ops": "error",
"eol-last": "error",
"lines-around-comment": [
"error",
{
"beforeLineComment": true
}
],
"linebreak-style": [
"error",
"unix"
],
"no-with": "error",
"brace-style": "error",
"space-before-function-paren": [
"error",
"never"
],
"no-loop-func": "error",
"no-spaced-func": "error",
"key-spacing": [
"error",
{
"beforeColon": false,
"afterColon": true
}
],
"space-unary-ops": [
"error",
{
"words": false,
"nonwords": false
}
],
"no-multiple-empty-lines": 2
}
}
10 changes: 0 additions & 10 deletions .jscsrc

This file was deleted.

14 changes: 0 additions & 14 deletions .jshintrc

This file was deleted.

4 changes: 2 additions & 2 deletions .npmignore
@@ -1,5 +1,5 @@
.jshintignore
.jshintrc
.eslintignore
.eslintrc

/.editorconfig
/.gitattributes
Expand Down
49 changes: 17 additions & 32 deletions Gruntfile.js
Expand Up @@ -14,7 +14,6 @@ module.exports = function( grunt ) {

var fs = require( "fs" ),
gzip = require( "gzip-js" ),
srcHintOptions = readOptionalJSON( "src/.jshintrc" ),

// Skip jsdom-related tests in Node.js 0.10 & 0.12
runJsdomTests = !/^v0/.test( process.version );
Expand Down Expand Up @@ -103,34 +102,14 @@ module.exports = function( grunt ) {
src: [ "package.json" ]
}
},
jshint: {
all: {
src: [
"src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js"
],
options: {
jshintrc: true
}
eslint: {
options: {

// See https://github.com/sindresorhus/grunt-eslint/issues/119
quiet: true
},
dist: {
src: "dist/jquery.js",
options: srcHintOptions
}
},
jscs: {
src: "src",
gruntfile: "Gruntfile.js",

// Check parts of tests that pass
test: [
"test/data/testrunner.js",
"test/unit/animation.js",
"test/unit/basic.js",
"test/unit/support.js",
"test/unit/tween.js",
"test/unit/wrap.js"
],
build: "build"
all: ".",
dev: [ "src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js" ]
},
testswarm: {
tests: [
Expand Down Expand Up @@ -164,7 +143,7 @@ module.exports = function( grunt ) {
]
},
watch: {
files: [ "<%= jshint.all.src %>" ],
files: [ "<%= eslint.dev %>" ],
tasks: [ "dev" ]
},
uglify: {
Expand Down Expand Up @@ -201,7 +180,7 @@ module.exports = function( grunt ) {
// Integrate jQuery specific tasks
grunt.loadTasks( "build/tasks" );

grunt.registerTask( "lint", [ "jsonlint", "jshint", "jscs" ] );
grunt.registerTask( "lint", [ "jsonlint" ] );

// Don't run Node-related tests in Node.js < 1.0.0 as they require an old
// jsdom version that needs compiling, making it harder for people to compile
Expand All @@ -213,9 +192,15 @@ module.exports = function( grunt ) {
) );

// Short list as a high frequency watch task
grunt.registerTask( "dev", [ "build:*:*", "lint", "uglify", "remove_map_comment", "dist:*" ] );
grunt.registerTask( "dev", [
"build:*:*",
"uglify",
"remove_map_comment",
"dist:*"
]
);

grunt.registerTask( "default", [ "dev", "test_fast", "compare_size" ] );

grunt.registerTask( "precommit_lint", [ "newer:jsonlint", "newer:jshint:all", "newer:jscs" ] );
grunt.registerTask( "precommit_lint", [ "newer:jsonlint" ] );
};
7 changes: 7 additions & 0 deletions build/.eslintrc
@@ -0,0 +1,7 @@
{
"env": {
"node": true
},
"extends": "../.eslintrc",
"root": true
}
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -33,11 +33,10 @@
"grunt-babel": "6.0.0",
"grunt-cli": "1.2.0",
"grunt-compare-size": "0.4.2",
"grunt-contrib-jshint": "1.0.0",
"grunt-contrib-uglify": "1.0.1",
"grunt-contrib-watch": "1.0.0",
"grunt-eslint": "18.1.0",
"grunt-git-authors": "3.2.0",
"grunt-jscs": "2.8.0",
"grunt-jsonlint": "1.0.7",
"grunt-newer": "1.2.0",
"grunt-npmcopy": "0.1.0",
Expand Down
15 changes: 15 additions & 0 deletions src/.eslintrc
@@ -0,0 +1,15 @@
{
"env": {
"browser"
},
"extends": "../.eslintrc",
"root": true,
"globals": {
"window": true,
"JSON": false,
"jQuery": true,
"define": true,
"module": true,
"noGlobal": true
}
}
30 changes: 0 additions & 30 deletions src/.jshintrc

This file was deleted.

0 comments on commit f80ae67

Please sign in to comment.