From a6b7ebfcaaad44dd6f9f706f509090d46b23f1f5 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Sat, 28 Jan 2023 02:15:08 +0100 Subject: [PATCH] [dev] Disallow tag usage in CSS (#2336) --- .stylelintrc.json | 4 +++- package-lock.json | 13 +++++++++++++ package.json | 1 + src/styles/reboot.css | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.stylelintrc.json b/.stylelintrc.json index 61d981f38..0735c84bf 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -9,6 +9,7 @@ "stylelint-declaration-block-no-ignored-properties", "stylelint-high-performance-animation", "stylelint-group-selectors", + "stylelint-selector-tag-no-without-class", "./dev/wholePixel.js" ], "rules": { @@ -39,6 +40,7 @@ { "ignorePseudoClasses": ["global"] } - ] + ], + "plugin/selector-tag-no-without-class": ["/^(?!body|html)([^_-]*)$/", { "severity": "warning" }] } } diff --git a/package-lock.json b/package-lock.json index e4dc0f03a..6a1ae505a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -86,6 +86,7 @@ "stylelint-declaration-block-no-ignored-properties": "^2.6.0", "stylelint-group-selectors": "^1.0.9", "stylelint-high-performance-animation": "^1.6.0", + "stylelint-selector-tag-no-without-class": "^2.0.5", "telegraph-node": "^1.0.4", "typescript": "^4.9.3", "webpack": "^5.75.0", @@ -14916,6 +14917,18 @@ "stylelint": "^14.5.1" } }, + "node_modules/stylelint-selector-tag-no-without-class": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/stylelint-selector-tag-no-without-class/-/stylelint-selector-tag-no-without-class-2.0.5.tgz", + "integrity": "sha512-Cj8wipvI7Ofq+2Z+uq3Z9FPPp1w8VIoXf2xlOgTtExrmbg//hqkCjMpOI8QCgj/eVdrgK41RrO+THjXL/Ghhdw==", + "dev": true, + "dependencies": { + "lodash": "^4.17.5" + }, + "peerDependencies": { + "stylelint": ">= 9.x < 15" + } + }, "node_modules/stylelint/node_modules/balanced-match": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-2.0.0.tgz", diff --git a/package.json b/package.json index 3fb15252c..fa1fdbea5 100644 --- a/package.json +++ b/package.json @@ -106,6 +106,7 @@ "stylelint-declaration-block-no-ignored-properties": "^2.6.0", "stylelint-group-selectors": "^1.0.9", "stylelint-high-performance-animation": "^1.6.0", + "stylelint-selector-tag-no-without-class": "^2.0.5", "telegraph-node": "^1.0.4", "typescript": "^4.9.3", "webpack": "^5.75.0", diff --git a/src/styles/reboot.css b/src/styles/reboot.css index d5ac441c2..11306cac7 100644 --- a/src/styles/reboot.css +++ b/src/styles/reboot.css @@ -1,3 +1,4 @@ +/* stylelint-disable plugin/selector-tag-no-without-class */ *, *::before, *::after {