From 5dceff5187d350818e9bcd6de8640ffd51ce7bb3 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 22 Nov 2024 11:14:53 -0500 Subject: [PATCH] Fix validation issues --- src/rules/no-invalid-at-rules.js | 2 +- src/rules/no-unknown-at-rules.js | 61 -------------------------------- 2 files changed, 1 insertion(+), 62 deletions(-) delete mode 100644 src/rules/no-unknown-at-rules.js diff --git a/src/rules/no-invalid-at-rules.js b/src/rules/no-invalid-at-rules.js index 13baca4..e291270 100644 --- a/src/rules/no-invalid-at-rules.js +++ b/src/rules/no-invalid-at-rules.js @@ -47,7 +47,7 @@ export default { type: "problem", docs: { - description: "Disallow invalid at-rules.", + description: "Disallow invalid at-rules", recommended: true, }, diff --git a/src/rules/no-unknown-at-rules.js b/src/rules/no-unknown-at-rules.js deleted file mode 100644 index 931e2f8..0000000 --- a/src/rules/no-unknown-at-rules.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @fileoverview Rule to prevent the use of unknown at-rules in CSS. - * @author Nicholas C. Zakas - */ - -//----------------------------------------------------------------------------- -// Imports -//----------------------------------------------------------------------------- - -import data from "css-tree/definition-syntax-data"; - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -const knownAtRules = new Set(Object.keys(data.atrules)); - -//----------------------------------------------------------------------------- -// Rule Definition -//----------------------------------------------------------------------------- - -export default { - meta: { - type: "problem", - - docs: { - description: "Disallow unknown at-rules", - recommended: true, - }, - - messages: { - unknownAtRule: "Unknown at-rule '{{name}}' found.", - }, - }, - - create(context) { - return { - Atrule(node) { - if (!knownAtRules.has(node.name)) { - const loc = node.loc; - - context.report({ - loc: { - start: loc.start, - end: { - line: loc.start.line, - - // add 1 to account for the @ symbol - column: loc.start.column + node.name.length + 1, - }, - }, - messageId: "unknownAtRule", - data: { - name: node.name, - }, - }); - } - }, - }; - }, -};