From 742419b21760639176452ac0bf7d4abd7e2225f5 Mon Sep 17 00:00:00 2001 From: Romain Menke Date: Thu, 28 Dec 2023 18:42:40 +0100 Subject: [PATCH] cleanup --- src/index.mjs | 5 +++++ src/lib/get-custom-properties-from-imports.mjs | 4 ++-- src/lib/get-custom-properties-from-root.mjs | 4 ++-- src/lib/validate-result.mjs | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/index.mjs b/src/index.mjs index 7b5894e..8b803ba 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -5,6 +5,10 @@ import validateResult from './lib/validate-result.mjs'; import messages from './lib/messages.mjs'; import ruleName from './lib/rule-name.mjs'; +const meta = { + url: 'https://github.com/csstools/stylelint-value-no-unknown-custom-properties/blob/main/README.md', +}; + const ruleFunction = (method, opts) => { // sources to import custom selectors from const importFrom = [].concat(Object(opts).importFrom || []); @@ -39,6 +43,7 @@ const ruleFunction = (method, opts) => { ruleFunction.ruleName = ruleName; ruleFunction.messages = messages; +ruleFunction.meta = meta; export default stylelint.createPlugin(ruleName, ruleFunction); diff --git a/src/lib/get-custom-properties-from-imports.mjs b/src/lib/get-custom-properties-from-imports.mjs index 1c1127d..a3e3540 100644 --- a/src/lib/get-custom-properties-from-imports.mjs +++ b/src/lib/get-custom-properties-from-imports.mjs @@ -1,5 +1,5 @@ -import fs from 'fs/promises'; -import path from 'path'; +import fs from 'node:fs/promises'; +import path from 'node:path'; import postcss from 'postcss'; import getCustomPropertiesFromRoot from './get-custom-properties-from-root.mjs'; diff --git a/src/lib/get-custom-properties-from-root.mjs b/src/lib/get-custom-properties-from-root.mjs index 60b14a1..c460115 100644 --- a/src/lib/get-custom-properties-from-root.mjs +++ b/src/lib/get-custom-properties-from-root.mjs @@ -1,5 +1,5 @@ -import { promises as fs } from 'fs'; -import path from 'path'; +import fs from 'node:fs/promises'; +import path from 'node:path'; import postcss from 'postcss'; import { resolveId } from './resolve-id.mjs'; diff --git a/src/lib/validate-result.mjs b/src/lib/validate-result.mjs index e493084..df665b1 100644 --- a/src/lib/validate-result.mjs +++ b/src/lib/validate-result.mjs @@ -11,7 +11,7 @@ export default (result, customProperties) => { }; // match custom property inclusions -const customPropertyReferenceRegExp = /(^|[^\w-])var\([\W\w]+\)/; +const customPropertyReferenceRegExp = /(^|[^\w-])var\([\W\w]+\)/i; // whether a declaration references a custom property const hasCustomPropertyReference = decl => customPropertyReferenceRegExp.test(decl.value);