Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
romainmenke committed Dec 28, 2023
1 parent 72edf46 commit 742419b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 || []);
Expand Down Expand Up @@ -39,6 +43,7 @@ const ruleFunction = (method, opts) => {

ruleFunction.ruleName = ruleName;
ruleFunction.messages = messages;
ruleFunction.meta = meta;

export default stylelint.createPlugin(ruleName, ruleFunction);

Expand Down
4 changes: 2 additions & 2 deletions src/lib/get-custom-properties-from-imports.mjs
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
4 changes: 2 additions & 2 deletions src/lib/get-custom-properties-from-root.mjs
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion src/lib/validate-result.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 742419b

Please sign in to comment.