From a4d6f83b5be6b95f288a5ca02eb1f46d8ac0f992 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 12 May 2023 21:15:49 +0200 Subject: [PATCH] Add `eslint-plugin-wc` (#24689) Add [eslint-plugin-wc](https://github.com/43081j/eslint-plugin-wc), another small set of eslint rules covering web components. --- .eslintrc.yaml | 10 ++++++++++ package-lock.json | 29 +++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 40 insertions(+) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index c4e0b9de8c..5fa6d1e682 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -16,6 +16,7 @@ plugins: - eslint-plugin-sonarjs - eslint-plugin-custom-elements - eslint-plugin-regexp + - eslint-plugin-wc env: es2022: true @@ -717,6 +718,15 @@ rules: use-isnan: [2] valid-typeof: [2, {requireStringLiterals: true}] vars-on-top: [0] + wc/attach-shadow-constructor: [2] + wc/guard-super-call: [2] + wc/no-closed-shadow-root: [2] + wc/no-constructor-attributes: [2] + wc/no-constructor-params: [2] + wc/no-invalid-element-name: [0] # covered by custom-elements/valid-tag-name + wc/no-self-class: [2] + wc/no-typos: [2] + wc/require-listener-teardown: [2] wrap-iife: [2, inside] wrap-regex: [0] yield-star-spacing: [2, after] diff --git a/package-lock.json b/package-lock.json index 36539779b8..72e9cdab9f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -68,6 +68,7 @@ "eslint-plugin-sonarjs": "0.19.0", "eslint-plugin-unicorn": "47.0.0", "eslint-plugin-vue": "9.12.0", + "eslint-plugin-wc": "1.5.0", "jsdom": "22.0.0", "markdownlint-cli": "0.34.0", "stylelint": "15.6.1", @@ -4683,6 +4684,19 @@ "eslint": "^6.2.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/eslint-plugin-wc": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-wc/-/eslint-plugin-wc-1.5.0.tgz", + "integrity": "sha512-KFSfiHDol/LeV7U6IX8GdgpGf/s3wG8FTG120Rml/hGNB/DkCuGYQhlf0VgdBdf7gweem8Nlsh5o64HNdj+qPA==", + "dev": true, + "dependencies": { + "is-valid-element-name": "^1.0.0", + "js-levenshtein-esm": "^1.2.0" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, "node_modules/eslint-scope": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", @@ -5994,6 +6008,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-valid-element-name": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-valid-element-name/-/is-valid-element-name-1.0.0.tgz", + "integrity": "sha512-GZITEJY2LkSjQfaIPBha7eyZv+ge0PhBR7KITeCCWvy7VBQrCUdFkvpI+HrAPQjVtVjy1LvlEkqQTHckoszruw==", + "dev": true, + "dependencies": { + "is-potential-custom-element-name": "^1.0.0" + } + }, "node_modules/is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -6086,6 +6109,12 @@ "node": ">=0.8.0" } }, + "node_modules/js-levenshtein-esm": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/js-levenshtein-esm/-/js-levenshtein-esm-1.2.0.tgz", + "integrity": "sha512-fzreKVq1eD7eGcQr7MtRpQH94f8gIfhdrc7yeih38xh684TNMK9v5aAu2wxfIRMk/GpAJRrzcirMAPIaSDaByQ==", + "dev": true + }, "node_modules/js-sdsl": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz", diff --git a/package.json b/package.json index 9054404fbf..e0e0644024 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "eslint-plugin-sonarjs": "0.19.0", "eslint-plugin-unicorn": "47.0.0", "eslint-plugin-vue": "9.12.0", + "eslint-plugin-wc": "1.5.0", "jsdom": "22.0.0", "markdownlint-cli": "0.34.0", "stylelint": "15.6.1",