From 37df5cdf4e79d81448706c6e7d85d1fdaff48a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Tue, 21 Jan 2020 13:51:03 +0100 Subject: [PATCH] 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 --- .eslintignore | 1 + Gruntfile.js | 2 +- dist/.eslintrc.json | 44 +++++++++++++++++++++++++++----------------- package.json | 2 +- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/.eslintignore b/.eslintignore index 3ee82bba3..2d52f5cda 100644 --- a/.eslintignore +++ b/.eslintignore @@ -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 diff --git a/Gruntfile.js b/Gruntfile.js index b91fa1bed..af76ce337 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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" ] diff --git a/dist/.eslintrc.json b/dist/.eslintrc.json index 45ba0c520..ff02f72bc 100644 --- a/dist/.eslintrc.json +++ b/dist/.eslintrc.json @@ -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" + } + } + ] } diff --git a/package.json b/package.json index 2de617df7..905e6a15e 100644 --- a/package.json +++ b/package.json @@ -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",