From e45738e3c9a918da6bdb003043ce1bef0a07b50f Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 12 May 2022 17:51:50 +0200 Subject: [PATCH] Introduce eslint-plugin-jquery (#19690) Introduce the plugin that allows us to gradually forbid jQuery code. I've enabled all rules that already pass. Next step will be to go through each rule and fix the issues by using native DOM equivalents, which I think can be done in separate PRs, but if prefered I could also start here. --- .eslintrc | 50 +++++++++++++++++++++++++++++++++++++++++++++++ package-lock.json | 17 ++++++++++++++++ package.json | 1 + 3 files changed, 68 insertions(+) diff --git a/.eslintrc b/.eslintrc index 3d9f003aff..ff62d9cc93 100644 --- a/.eslintrc +++ b/.eslintrc @@ -13,6 +13,7 @@ plugins: - eslint-plugin-import - eslint-plugin-vue - eslint-plugin-html + - eslint-plugin-jquery extends: - plugin:vue/recommended @@ -140,6 +141,55 @@ rules: import/unambiguous: [0] indent: [2, 2, {SwitchCase: 1}] init-declarations: [0] + jquery/no-ajax-events: [2] + jquery/no-ajax: [0] + jquery/no-animate: [2] + jquery/no-attr: [0] + jquery/no-bind: [2] + jquery/no-class: [0] + jquery/no-clone: [2] + jquery/no-closest: [0] + jquery/no-css: [0] + jquery/no-data: [0] + jquery/no-deferred: [2] + jquery/no-delegate: [2] + jquery/no-each: [0] + jquery/no-extend: [2] + jquery/no-fade: [0] + jquery/no-filter: [0] + jquery/no-find: [0] + jquery/no-global-eval: [2] + jquery/no-grep: [2] + jquery/no-has: [2] + jquery/no-hide: [0] + jquery/no-html: [0] + jquery/no-in-array: [2] + jquery/no-is-array: [2] + jquery/no-is-function: [2] + jquery/no-is: [0] + jquery/no-load: [2] + jquery/no-map: [0] + jquery/no-merge: [2] + jquery/no-param: [2] + jquery/no-parent: [0] + jquery/no-parents: [0] + jquery/no-parse-html: [2] + jquery/no-prop: [0] + jquery/no-proxy: [2] + jquery/no-ready: [0] + jquery/no-serialize: [2] + jquery/no-show: [0] + jquery/no-size: [2] + jquery/no-sizzle: [0] + jquery/no-slide: [0] + jquery/no-submit: [0] + jquery/no-text: [0] + jquery/no-toggle: [0] + jquery/no-trigger: [0] + jquery/no-trim: [2] + jquery/no-val: [0] + jquery/no-when: [2] + jquery/no-wrap: [2] key-spacing: [2] keyword-spacing: [2] line-comment-position: [0] diff --git a/package-lock.json b/package-lock.json index 72559681f1..64e2b70cb1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,6 +48,7 @@ "eslint": "8.15.0", "eslint-plugin-html": "6.2.0", "eslint-plugin-import": "2.26.0", + "eslint-plugin-jquery": "1.5.1", "eslint-plugin-unicorn": "42.0.0", "eslint-plugin-vue": "8.7.1", "jest": "28.1.0", @@ -4352,6 +4353,15 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, + "node_modules/eslint-plugin-jquery": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-jquery/-/eslint-plugin-jquery-1.5.1.tgz", + "integrity": "sha512-L7v1eaK5t80C0lvUXPFP9MKnBOqPSKhCOYyzy4LZ0+iK+TJwN8S9gAkzzP1AOhypRIwA88HF6phQ9C7jnOpW8w==", + "dev": true, + "peerDependencies": { + "eslint": ">=5.4.0" + } + }, "node_modules/eslint-plugin-unicorn": { "version": "42.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-42.0.0.tgz", @@ -13443,6 +13453,13 @@ } } }, + "eslint-plugin-jquery": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-jquery/-/eslint-plugin-jquery-1.5.1.tgz", + "integrity": "sha512-L7v1eaK5t80C0lvUXPFP9MKnBOqPSKhCOYyzy4LZ0+iK+TJwN8S9gAkzzP1AOhypRIwA88HF6phQ9C7jnOpW8w==", + "dev": true, + "requires": {} + }, "eslint-plugin-unicorn": { "version": "42.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-42.0.0.tgz", diff --git a/package.json b/package.json index 21368a8389..7d75ce54cc 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "eslint": "8.15.0", "eslint-plugin-html": "6.2.0", "eslint-plugin-import": "2.26.0", + "eslint-plugin-jquery": "1.5.1", "eslint-plugin-unicorn": "42.0.0", "eslint-plugin-vue": "8.7.1", "jest": "28.1.0",