mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Build: Switch from jscs+jshint to eslint
This commit is contained in:
parent
019c8f1f41
commit
f80ae67c53
12
.eslintignore
Normal file
12
.eslintignore
Normal file
@ -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
.eslintrc
Normal file
145
.eslintrc
Normal file
@ -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
.jscsrc
10
.jscsrc
@ -1,10 +0,0 @@
|
||||
{
|
||||
"preset": "jquery",
|
||||
|
||||
// remove after https://github.com/jscs-dev/node-jscs/issues/1685
|
||||
// and https://github.com/jscs-dev/node-jscs/issues/1686
|
||||
"requireCapitalizedComments": null,
|
||||
|
||||
"excludeFiles": [ "external",
|
||||
"test/node_smoke_tests/lib/ensure_iterability.js", "node_modules" ]
|
||||
}
|
14
.jshintrc
14
.jshintrc
@ -1,14 +0,0 @@
|
||||
{
|
||||
"boss": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"immed": true,
|
||||
"noarg": true,
|
||||
"quotmark": "double",
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
|
||||
"node": true
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
.jshintignore
|
||||
.jshintrc
|
||||
.eslintignore
|
||||
.eslintrc
|
||||
|
||||
/.editorconfig
|
||||
/.gitattributes
|
||||
|
49
Gruntfile.js
49
Gruntfile.js
@ -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 );
|
||||
@ -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
|
||||
}
|
||||
},
|
||||
dist: {
|
||||
src: "dist/jquery.js",
|
||||
options: srcHintOptions
|
||||
}
|
||||
},
|
||||
jscs: {
|
||||
src: "src",
|
||||
gruntfile: "Gruntfile.js",
|
||||
eslint: {
|
||||
options: {
|
||||
|
||||
// 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"
|
||||
// See https://github.com/sindresorhus/grunt-eslint/issues/119
|
||||
quiet: true
|
||||
},
|
||||
all: ".",
|
||||
dev: [ "src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js" ]
|
||||
},
|
||||
testswarm: {
|
||||
tests: [
|
||||
@ -164,7 +143,7 @@ module.exports = function( grunt ) {
|
||||
]
|
||||
},
|
||||
watch: {
|
||||
files: [ "<%= jshint.all.src %>" ],
|
||||
files: [ "<%= eslint.dev %>" ],
|
||||
tasks: [ "dev" ]
|
||||
},
|
||||
uglify: {
|
||||
@ -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
|
||||
@ -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
build/.eslintrc
Normal file
7
build/.eslintrc
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": "../.eslintrc",
|
||||
"root": true
|
||||
}
|
@ -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",
|
||||
|
15
src/.eslintrc
Normal file
15
src/.eslintrc
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"env": {
|
||||
"browser"
|
||||
},
|
||||
"extends": "../.eslintrc",
|
||||
"root": true,
|
||||
"globals": {
|
||||
"window": true,
|
||||
"JSON": false,
|
||||
"jQuery": true,
|
||||
"define": true,
|
||||
"module": true,
|
||||
"noGlobal": true
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
{
|
||||
"boss": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"immed": true,
|
||||
"noarg": true,
|
||||
"quotmark": "double",
|
||||
"strict": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
|
||||
"sub": true,
|
||||
|
||||
// Support: IE <=9 only, Android <=4.0 only
|
||||
// The above browsers are failing a lot of tests in the ES5
|
||||
// test suite at http://test262.ecmascript.org.
|
||||
"es3": true,
|
||||
|
||||
"globals": {
|
||||
"window": true,
|
||||
"JSON": false,
|
||||
|
||||
"jQuery": true,
|
||||
"define": true,
|
||||
"module": true,
|
||||
"noGlobal": true
|
||||
}
|
||||
}
|
55
test/.eslintrc
Normal file
55
test/.eslintrc
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true
|
||||
},
|
||||
"extends": "../.eslintrc",
|
||||
"root": true,
|
||||
"globals": {
|
||||
"require": false,
|
||||
"define": false,
|
||||
"DOMParser": false,
|
||||
"JSON": false,
|
||||
"Promise": false,
|
||||
"Symbol": false,
|
||||
"QUnit": false,
|
||||
"ajaxTest": false,
|
||||
"testIframe": false,
|
||||
"testIframeWithCallback": false,
|
||||
"iframeCallback": true,
|
||||
"createDashboardXML": false,
|
||||
"createXMLFragment": false,
|
||||
"moduleTeardown": false,
|
||||
"testFoo": false,
|
||||
"url": false,
|
||||
"t": false,
|
||||
"q": false,
|
||||
"jQuery": true,
|
||||
"sinon": true,
|
||||
"amdDefined": true,
|
||||
"fireNative": true,
|
||||
"Globals": true,
|
||||
"hasPHP": true,
|
||||
"isLocal": true,
|
||||
"supportjQuery": true,
|
||||
"originaljQuery": true,
|
||||
"$": true,
|
||||
"original$": true,
|
||||
"baseURL": true,
|
||||
"externalHost": true
|
||||
},
|
||||
"rules": {
|
||||
// See https://github.com/eslint/eslint/issues/6125
|
||||
"no-unused-vars": "off",
|
||||
|
||||
// Too much errors
|
||||
"max-len": "off",
|
||||
"brace-style": "off",
|
||||
"key-spacing": "off",
|
||||
"camelcase": "off",
|
||||
"dot-notaion": "off",
|
||||
|
||||
// Not a lot really too much, but waiting for autofix for these rules
|
||||
"lines-around-comment": "off",
|
||||
"dot-notation": "off"
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
{
|
||||
"boss": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"immed": true,
|
||||
"noarg": true,
|
||||
"quotmark": "double",
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
|
||||
"es3": true,
|
||||
|
||||
"evil": true,
|
||||
"sub": true,
|
||||
|
||||
"browser": true,
|
||||
"devel": true,
|
||||
"wsh": true,
|
||||
|
||||
"globals": {
|
||||
"require": false,
|
||||
"define": false,
|
||||
"DOMParser": false,
|
||||
"JSON": false,
|
||||
"Promise": false,
|
||||
"Symbol": false,
|
||||
"QUnit": false,
|
||||
"ajaxTest": false,
|
||||
"testIframe": false,
|
||||
"testIframeWithCallback": false,
|
||||
"iframeCallback": true,
|
||||
"createDashboardXML": false,
|
||||
"createXMLFragment": false,
|
||||
"moduleTeardown": false,
|
||||
"testFoo": false,
|
||||
"url": false,
|
||||
"t": false,
|
||||
"q": false,
|
||||
|
||||
"jQuery": true,
|
||||
"sinon": true,
|
||||
"amdDefined": true,
|
||||
"fireNative": true,
|
||||
"Globals": true,
|
||||
"hasPHP": true,
|
||||
"isLocal": true,
|
||||
"supportjQuery": true,
|
||||
"originaljQuery": true,
|
||||
"$": true,
|
||||
"original$": true,
|
||||
"baseURL": true,
|
||||
"externalHost": true
|
||||
}
|
||||
}
|
7
test/node_smoke_tests/.eslintrc
Normal file
7
test/node_smoke_tests/.eslintrc
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": "../.eslintrc",
|
||||
"root": true
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"boss": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"immed": true,
|
||||
"noarg": true,
|
||||
"quotmark": "double",
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
|
||||
"node": true
|
||||
}
|
Loading…
Reference in New Issue
Block a user