Build: Lint the minified jQuery file as well

While we have absolutely no style-related expectations to our minified file,
we do care that it's valid ES 5.1. This is now verified.

Also, update grunt-eslint as a newer ESLint version is required to be able
to use "extends" inside of the "overrides" section.

Fixes gh-3075
Closes gh-4594
Ref gh-4598
This commit is contained in:
Michał Gołębiowski-Owczarek 2020-01-21 13:51:03 +01:00
parent 46c284b12b
commit 37df5cdf4e
4 changed files with 30 additions and 19 deletions

View File

@ -3,6 +3,7 @@ node_modules
*.min.js
dist/**
!dist/jquery.js
!dist/jquery.min.js
test/data/jquery-1.9.1.js
test/data/badcall.js
test/data/badjson.js

View File

@ -107,7 +107,7 @@ module.exports = function( grunt ) {
// We have to explicitly declare "src" property otherwise "newer"
// task wouldn't work properly :/
dist: {
src: "dist/jquery.js"
src: [ "dist/jquery.js", "dist/jquery.min.js" ]
},
dev: {
src: [ "src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js" ]

44
dist/.eslintrc.json vendored
View File

@ -1,23 +1,33 @@
{
"root": true,
"extends": "../.eslintrc-browser.json",
"parserOptions": {
"ecmaVersion": 5,
"sourceType": "script"
},
"rules": {
// That is okay for the built version
"no-multiple-empty-lines": "off",
"overrides": [
{
"files": "jquery.js",
"extends": "../.eslintrc-browser.json",
// Sizzle is not compatible with jQuery code style
"no-nested-ternary": "off",
"no-unused-expressions": "off",
"no-unused-vars": "off",
"lines-around-comment": "off",
"space-in-parens": "off",
"camelcase": "off",
"computed-property-spacing": "off",
"max-len": "off",
"dot-notation": "off",
"semi-spacing": "off",
"brace-style": "off"
}
"rules": {
// That is okay for the built version
"no-multiple-empty-lines": "off",
// Sizzle is not compatible with jQuery code style
"no-nested-ternary": "off",
"no-unused-expressions": "off",
"no-unused-vars": "off",
"lines-around-comment": "off",
"space-in-parens": "off",
"camelcase": "off",
"computed-property-spacing": "off",
"max-len": "off",
"dot-notation": "off",
"semi-spacing": "off",
"brace-style": "off"
}
}
]
}

View File

@ -36,7 +36,7 @@
"grunt-compare-size": "0.4.2",
"grunt-contrib-uglify": "3.4.0",
"grunt-contrib-watch": "1.1.0",
"grunt-eslint": "21.0.0",
"grunt-eslint": "22.0.0",
"grunt-git-authors": "3.2.0",
"grunt-jsonlint": "1.1.0",
"grunt-karma": "3.0.1",