From 3037922a9bc2e2e2708de589ff0235062970d6cc Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 8 Apr 2023 11:24:42 +0200 Subject: [PATCH] Add eslint-plugin-custom-elements (#23991) Add [eslint-plugin-custom-elements](https://github.com/github/eslint-plugin-custom-elements) and enable all rules that I've found sensible. --- .eslintrc.yaml | 14 ++++++++++++++ package-lock.json | 10 ++++++++++ package.json | 1 + 3 files changed, 25 insertions(+) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 2cde9d2aa5..81b3a10f30 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -13,6 +13,7 @@ plugins: - eslint-plugin-import - eslint-plugin-jquery - eslint-plugin-sonarjs + - eslint-plugin-custom-elements env: es2022: true @@ -62,6 +63,19 @@ rules: consistent-this: [0] constructor-super: [2] curly: [0] + custom-elements/expose-class-on-global: [0] + custom-elements/extends-correct-class: [2] + custom-elements/file-name-matches-element: [0] + custom-elements/no-constructor: [2] + custom-elements/no-customized-built-in-elements: [2] + custom-elements/no-dom-traversal-in-attributechangedcallback: [2] + custom-elements/no-dom-traversal-in-connectedcallback: [2] + custom-elements/no-exports-with-element: [2] + custom-elements/no-method-prefixed-with-on: [2] + custom-elements/no-unchecked-define: [0] + custom-elements/one-element-per-file: [0] + custom-elements/tag-name-matches-class: [2] + custom-elements/valid-tag-name: [2] default-case-last: [2] default-case: [0] default-param-last: [0] diff --git a/package-lock.json b/package-lock.json index 8aa40dce39..fa096811ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,6 +59,7 @@ "@stoplight/spectral-cli": "6.6.0", "@vitejs/plugin-vue": "4.1.0", "eslint": "8.37.0", + "eslint-plugin-custom-elements": "0.0.7", "eslint-plugin-import": "2.27.5", "eslint-plugin-jquery": "1.5.1", "eslint-plugin-sonarjs": "0.19.0", @@ -4475,6 +4476,15 @@ "ms": "^2.1.1" } }, + "node_modules/eslint-plugin-custom-elements": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/eslint-plugin-custom-elements/-/eslint-plugin-custom-elements-0.0.7.tgz", + "integrity": "sha512-s37mXujv/fAsPlvoLbO8jiZDM2gc/dFXIDf7wK52LMrsTsLpE5ITugQCwPM8lmcONjYdswS5kneX9LzJlt7aTA==", + "dev": true, + "peerDependencies": { + "eslint": ">=4.19.0" + } + }, "node_modules/eslint-plugin-import": { "version": "2.27.5", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz", diff --git a/package.json b/package.json index 3ccf0c0840..bc9f8676bb 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "@stoplight/spectral-cli": "6.6.0", "@vitejs/plugin-vue": "4.1.0", "eslint": "8.37.0", + "eslint-plugin-custom-elements": "0.0.7", "eslint-plugin-import": "2.27.5", "eslint-plugin-jquery": "1.5.1", "eslint-plugin-sonarjs": "0.19.0",