@primer/stylelint-config 12.9.2 → 13.0.0-rc.0a1e1bd

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- const {createVariableRule} = require('./lib/variable-rules')
1
+ import {createVariableRule} from './lib/variable-rules.js'
2
2
 
3
- module.exports = createVariableRule(
3
+ export default createVariableRule(
4
4
  'primer/typography',
5
5
  {
6
6
  'font-size': {
@@ -1,16 +1,16 @@
1
- const stylelint = require('stylelint')
2
- const utilities = require('./lib/primer-utilities')
1
+ import stylelint from 'stylelint'
2
+ import utilities from './lib/primer-utilities.js'
3
3
 
4
- const ruleName = 'primer/utilities'
4
+ export const ruleName = 'primer/utilities'
5
5
 
6
- const messages = stylelint.utils.ruleMessages(ruleName, {
6
+ export const messages = stylelint.utils.ruleMessages(ruleName, {
7
7
  rejected: (selector, utilityClass) => {
8
8
  return `Consider using the Primer utility '.${utilityClass}' instead of the selector '${selector}' in your html. https://primer.style/css/utilities`
9
9
  },
10
10
  })
11
11
 
12
12
  // eslint-disable-next-line no-unused-vars
13
- module.exports = stylelint.createPlugin(ruleName, (enabled, options = {}, context) => {
13
+ export default stylelint.createPlugin(ruleName, (enabled, options = {}, context) => {
14
14
  if (!enabled) {
15
15
  return noop
16
16
  }
@@ -50,6 +50,3 @@ module.exports = stylelint.createPlugin(ruleName, (enabled, options = {}, contex
50
50
  })
51
51
 
52
52
  function noop() {}
53
-
54
- module.exports.ruleName = ruleName
55
- module.exports.messages = messages
package/property-order.js CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = [
1
+ export default [
2
2
  'all',
3
3
  'position',
4
4
  'top',
package/browsers.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = [
2
- '> 5%',
3
- 'last 2 firefox versions',
4
- 'last 2 chrome versions',
5
- 'last 2 safari versions',
6
- 'last 2 edge versions',
7
- ]
package/index.js DELETED
@@ -1,106 +0,0 @@
1
- const browsers = require('./browsers')
2
- const propertyOrder = require('./property-order')
3
-
4
- module.exports = {
5
- extends: ['stylelint-config-standard'],
6
- customSyntax: require('postcss-scss'),
7
- ignoreFiles: ['**/*.js', '**/*.cjs'],
8
- plugins: [
9
- 'stylelint-no-unsupported-browser-features',
10
- 'stylelint-order',
11
- 'stylelint-scss',
12
- './plugins/borders',
13
- './plugins/box-shadow',
14
- './plugins/colors',
15
- './plugins/no-deprecated-colors',
16
- './plugins/no-experimental-vars',
17
- './plugins/no-override',
18
- './plugins/no-scale-colors',
19
- './plugins/no-undefined-vars',
20
- './plugins/no-unused-vars',
21
- './plugins/responsive-widths',
22
- './plugins/spacing',
23
- './plugins/typography',
24
- './plugins/utilities',
25
- './plugins/new-color-vars-have-fallback',
26
- './plugins/no-display-colors',
27
- ],
28
- rules: {
29
- 'alpha-value-notation': 'number',
30
- 'at-rule-disallowed-list': ['extend'],
31
- 'at-rule-no-unknown': null,
32
- 'block-no-empty': true,
33
- 'color-function-notation': null,
34
- 'color-named': 'never',
35
- 'color-no-invalid-hex': true,
36
- 'comment-no-empty': null,
37
- 'custom-property-pattern': null,
38
- 'declaration-block-no-duplicate-properties': [true, {ignore: ['consecutive-duplicates']}],
39
- 'declaration-block-no-redundant-longhand-properties': null,
40
- 'declaration-block-no-shorthand-property-overrides': true,
41
- 'declaration-property-value-disallowed-list': {
42
- '/^transition/': ['/all/'],
43
- '/^background/': ['http:', 'https:'],
44
- '/^border/': ['none'],
45
- '/.+/': ['initial'],
46
- },
47
- 'function-calc-no-unspaced-operator': true,
48
- 'function-linear-gradient-no-nonstandard-direction': true,
49
- 'function-no-unknown': null,
50
- 'keyframes-name-pattern': null,
51
- 'max-nesting-depth': 3,
52
- 'media-feature-name-no-unknown': null,
53
- 'media-feature-name-no-vendor-prefix': null,
54
- 'no-descending-specificity': null,
55
- 'no-duplicate-selectors': true,
56
- 'no-invalid-position-at-import-rule': [true, {ignoreAtRules: ['use']}],
57
- 'number-max-precision': null,
58
- 'order/properties-order': propertyOrder,
59
- 'plugin/no-unsupported-browser-features': [true, {severity: 'warning', browsers}],
60
- 'primer/borders': true,
61
- 'primer/box-shadow': true,
62
- 'primer/colors': true,
63
- 'primer/no-deprecated-colors': true,
64
- 'primer/no-experimental-vars': [
65
- true,
66
- {
67
- designTokens: '@primer/primitives/tokens-v2-private/docs/docValues.json',
68
- },
69
- ],
70
- 'primer/no-override': true,
71
- 'primer/no-undefined-vars': [
72
- true,
73
- {severity: 'warning', files: 'node_modules/@primer/primitives/dist/scss/colors*/*.scss'},
74
- ],
75
- 'primer/no-unused-vars': [true, {severity: 'warning'}],
76
- 'primer/responsive-widths': true,
77
- 'primer/spacing': true,
78
- 'primer/typography': true,
79
- 'primer/utilities': null,
80
- 'primer/new-color-vars-have-fallback': [true, {severity: 'error'}],
81
- 'scss/at-extend-no-missing-placeholder': true,
82
- 'scss/at-rule-no-unknown': true,
83
- 'scss/declaration-nested-properties-no-divided-groups': true,
84
- 'scss/dollar-variable-no-missing-interpolation': true,
85
- 'scss/function-quote-no-quoted-strings-inside': true,
86
- 'scss/function-unquote-no-unquoted-strings-inside': true,
87
- 'scss/no-duplicate-mixins': true,
88
- 'scss/selector-no-redundant-nesting-selector': true,
89
- 'selector-class-pattern': null,
90
- 'selector-max-compound-selectors': 3,
91
- 'selector-max-id': 0,
92
- 'selector-max-specificity': '0,4,0',
93
- 'selector-max-type': 0,
94
- 'selector-no-qualifying-type': true,
95
- 'selector-pseudo-element-no-unknown': true,
96
- 'string-no-newline': true,
97
- 'unit-no-unknown': true,
98
- 'value-keyword-case': null,
99
- 'selector-not-notation': null,
100
- 'import-notation': ['string'],
101
- 'annotation-no-unknown': null,
102
- 'keyframe-selector-notation': ['percentage-unless-within-keyword-only-block'],
103
- 'media-query-no-invalid': null,
104
- 'media-feature-range-notation': ['prefix'],
105
- },
106
- }
@@ -1,26 +0,0 @@
1
- const {existsSync} = require('fs')
2
- const {join} = require('path')
3
-
4
- module.exports = {
5
- getPrimerModuleDir,
6
- requirePrimerFile,
7
- }
8
-
9
- function getPrimerModuleDir() {
10
- const cwd = process.cwd()
11
- const localPackageJson = join(cwd, 'package.json')
12
- if (existsSync(localPackageJson)) {
13
- // eslint-disable-next-line import/no-dynamic-require
14
- const {name} = require(localPackageJson)
15
- if (name === '@primer/css') {
16
- return cwd
17
- }
18
- }
19
- return '@primer/css'
20
- }
21
-
22
- function requirePrimerFile(path) {
23
- const fullPath = join(getPrimerModuleDir(), path)
24
- // eslint-disable-next-line import/no-dynamic-require
25
- return require(fullPath)
26
- }
@@ -1,39 +0,0 @@
1
- const stylelint = require('stylelint')
2
-
3
- const ruleName = 'primer/new-color-vars-have-fallback'
4
- const messages = stylelint.utils.ruleMessages(ruleName, {
5
- expectedFallback: variable =>
6
- `Expected a fallback value for CSS variable ${variable}. New color variables fallbacks, check primer.style/primitives to find the correct value`,
7
- })
8
-
9
- module.exports = stylelint.createPlugin(ruleName, enabled => {
10
- const variables = require('./lib/new-color-css-vars-map.json')
11
-
12
- if (!enabled) {
13
- return noop
14
- }
15
-
16
- return (root, result) => {
17
- root.walkDecls(node => {
18
- for (const variable of variables) {
19
- if (node.value.includes(`var(${variable})`)) {
20
- // Check if the declaration uses a CSS variable from the JSON
21
- const match = node.value.match(new RegExp(`var\\(${variable},(.*)\\)`))
22
- if (!match || match[1].trim() === '') {
23
- stylelint.utils.report({
24
- ruleName,
25
- result,
26
- node,
27
- message: messages.expectedFallback(variable),
28
- })
29
- }
30
- }
31
- }
32
- })
33
- }
34
- })
35
-
36
- function noop() {}
37
-
38
- module.exports.ruleName = ruleName
39
- module.exports.messages = messages
@@ -1,103 +0,0 @@
1
- const stylelint = require('stylelint')
2
- const matchAll = require('string.prototype.matchall')
3
-
4
- const ruleName = 'primer/no-deprecated-colors'
5
- const messages = stylelint.utils.ruleMessages(ruleName, {
6
- rejected: (varName, replacement, property) => {
7
- if (replacement === null) {
8
- return `Variable ${varName} is deprecated for property ${property}. Please consult the primer color docs for a replacement. https://primer.style/primitives/storybook/?path=/story/migration-tables`
9
- }
10
-
11
- return `Variable ${varName} is deprecated for property ${property}. Please use the replacement ${replacement}.`
12
- },
13
- })
14
-
15
- // Match CSS variable references (e.g var(--color-text-primary))
16
- // eslint-disable-next-line no-useless-escape
17
- const variableReferenceRegex = /var\(([^\),]+)(,.*)?\)/g
18
-
19
- const replacedVars = {}
20
- const newVars = {}
21
-
22
- module.exports = stylelint.createPlugin(ruleName, (enabled, options = {}, context) => {
23
- const {inlineFallback = false} = options
24
-
25
- if (!enabled) {
26
- return noop
27
- }
28
-
29
- const {verbose = false} = options
30
- // eslint-disable-next-line no-console
31
- const log = verbose ? (...args) => console.warn(...args) : noop
32
-
33
- // Keep track of declarations we've already seen
34
- const seen = new WeakMap()
35
-
36
- // eslint-disable-next-line import/no-dynamic-require
37
- const variableChecks = require(options.deprecatedFile || './lib/primitives-v8.json')
38
-
39
- const lintResult = (root, result) => {
40
- // Walk all declarations
41
- root.walk(node => {
42
- if (seen.has(node)) {
43
- return
44
- } else {
45
- seen.set(node, true)
46
- }
47
-
48
- // walk these nodes
49
- if (node.type !== 'decl') {
50
- return
51
- }
52
-
53
- for (const [, variableName] of matchAll(node.value, variableReferenceRegex)) {
54
- if (variableName in variableChecks) {
55
- let replacement = variableChecks[variableName]
56
- if (typeof replacement === 'object') {
57
- if (node.prop) {
58
- for (const prop of replacement) {
59
- // Check if node.prop starts with one of the props array elements
60
- if (prop['props'].some(p => node.prop.startsWith(p))) {
61
- replacement = prop['replacement']
62
- break
63
- }
64
- }
65
- }
66
- if (typeof replacement === 'object') {
67
- replacement = null
68
- }
69
- }
70
-
71
- if (context.fix && replacement !== null) {
72
- replacement = `${replacement}${inlineFallback ? `, var(${variableName})` : ''}`
73
- replacedVars[variableName] = true
74
- newVars[replacement] = true
75
- if (node.type === 'atrule') {
76
- node.params = node.params.replace(variableName, replacement)
77
- } else {
78
- node.value = node.value.replace(variableName, replacement)
79
- }
80
- continue
81
- }
82
-
83
- stylelint.utils.report({
84
- message: messages.rejected(variableName, replacement, node.prop),
85
- node,
86
- ruleName,
87
- result,
88
- })
89
- }
90
- }
91
- })
92
- }
93
-
94
- log(
95
- `${Object.keys(replacedVars).length} deprecated variables replaced with ${Object.keys(newVars).length} variables.`,
96
- )
97
- return lintResult
98
- })
99
-
100
- function noop() {}
101
-
102
- module.exports.ruleName = ruleName
103
- module.exports.messages = messages
@@ -1,47 +0,0 @@
1
- const stylelint = require('stylelint')
2
- const declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex')
3
-
4
- const ruleName = 'primer/no-experimental-vars'
5
- const messages = stylelint.utils.ruleMessages(ruleName, {
6
- rejected: value => {
7
- return `Do not use experimental variable \`var(--${value})\`. Experimental variables are undergoing testing, see https://github.com/github/primer/issues/889 for more details.`
8
- },
9
- })
10
-
11
- // eslint-disable-next-line no-unused-vars
12
- module.exports = stylelint.createPlugin(ruleName, (enabled, options = {}, context) => {
13
- if (!enabled) {
14
- return noop
15
- }
16
-
17
- // eslint-disable-next-line import/no-dynamic-require
18
- const designTokens = require(options.designTokens)
19
-
20
- let experimentalVars = null
21
- for (const tokenType of Object.keys(designTokens)) {
22
- experimentalVars = new Set(designTokens[tokenType].map(t => t['name']))
23
- }
24
-
25
- const lintResult = (root, result) => {
26
- root.walkDecls(decl => {
27
- for (const expVar of experimentalVars) {
28
- if (decl.value.includes(`var(--${expVar})`)) {
29
- stylelint.utils.report({
30
- index: declarationValueIndex(decl),
31
- message: messages.rejected(expVar),
32
- node: decl,
33
- result,
34
- ruleName,
35
- })
36
- }
37
- }
38
- })
39
- }
40
-
41
- return lintResult
42
- })
43
-
44
- function noop() {}
45
-
46
- module.exports.ruleName = ruleName
47
- module.exports.messages = messages
@@ -1,120 +0,0 @@
1
- const stylelint = require('stylelint')
2
- const {requirePrimerFile} = require('./lib/primer')
3
-
4
- const ruleName = 'primer/no-override'
5
- const CLASS_PATTERN = /(\.[-\w]+)/
6
- const CLASS_PATTERN_ALL = new RegExp(CLASS_PATTERN, 'g')
7
- const CLASS_PATTERN_ONLY = /^\.[-\w]+(:{1,2}[-\w]+)?$/
8
-
9
- module.exports = stylelint.createPlugin(ruleName, (enabled, options = {}) => {
10
- if (!enabled) {
11
- return noop
12
- }
13
-
14
- const {bundles = ['utilities'], ignoreSelectors = []} = options
15
-
16
- const isSelectorIgnored =
17
- typeof ignoreSelectors === 'function'
18
- ? ignoreSelectors
19
- : selector => {
20
- return ignoreSelectors.some(pattern => {
21
- return pattern instanceof RegExp ? pattern.test(selector) : selector.includes(pattern)
22
- })
23
- }
24
-
25
- const primerMeta = requirePrimerFile('dist/meta.json')
26
- const availableBundles = Object.keys(primerMeta.bundles)
27
-
28
- // These map selectors to the bundle in which they're defined.
29
- // If there's no entry for a given selector, it means that it's not defined
30
- // in one of the *specified* bundles, since we're iterating over the list of
31
- // bundle names in the options.
32
- const immutableSelectors = new Map()
33
- const immutableClassSelectors = new Map()
34
-
35
- for (const bundle of bundles) {
36
- if (!availableBundles.includes(bundle)) {
37
- continue
38
- }
39
- const stats = requirePrimerFile(`dist/stats/${bundle}.json`)
40
- const selectors = stats.selectors.values
41
- for (const selector of selectors) {
42
- immutableSelectors.set(selector, bundle)
43
- for (const classSelector of getClassSelectors(selector)) {
44
- immutableClassSelectors.set(classSelector, bundle)
45
- }
46
- }
47
- }
48
-
49
- const messages = stylelint.utils.ruleMessages(ruleName, {
50
- rejected: ({rule, selector, bundle}) => {
51
- const definedIn = ` (defined in @primer/css/${bundle})`
52
- const ruleSelector = collapseWhitespace(rule.selector)
53
- const context = selector === rule.selector ? '' : ` in "${ruleSelector}"`
54
- return `"${collapseWhitespace(selector)}" should not be overridden${context}${definedIn}.`
55
- },
56
- })
57
-
58
- return (root, result) => {
59
- if (!Array.isArray(bundles) || bundles.some(bundle => !availableBundles.includes(bundle))) {
60
- const invalidBundles = Array.isArray(bundles)
61
- ? `"${bundles.filter(bundle => !availableBundles.includes(bundle)).join('", "')}"`
62
- : '(not an array)'
63
- result.warn(`The "bundles" option must be an array of valid bundles; got: ${invalidBundles}`, {
64
- stylelintType: 'invalidOption',
65
- stylelintReference: 'https://github.com/primer/stylelint-config#options',
66
- })
67
- }
68
-
69
- const report = subject =>
70
- stylelint.utils.report({
71
- message: messages.rejected(subject),
72
- node: subject.rule,
73
- result,
74
- ruleName,
75
- })
76
-
77
- root.walkRules(rule => {
78
- const {selector} = rule
79
- if (immutableSelectors.has(selector)) {
80
- if (isClassSelector(selector)) {
81
- if (!isSelectorIgnored(selector)) {
82
- return report({
83
- rule,
84
- bundle: immutableSelectors.get(selector),
85
- selector,
86
- })
87
- }
88
- } else {
89
- // console.log(`not a class selector: "${selector}"`)
90
- }
91
- }
92
- for (const classSelector of getClassSelectors(selector)) {
93
- if (immutableClassSelectors.has(classSelector)) {
94
- if (!isSelectorIgnored(classSelector)) {
95
- return report({
96
- rule,
97
- bundle: immutableClassSelectors.get(classSelector),
98
- selector: classSelector,
99
- })
100
- }
101
- }
102
- }
103
- })
104
- }
105
- })
106
-
107
- function getClassSelectors(selector) {
108
- const match = selector.match(CLASS_PATTERN_ALL)
109
- return match ? [...match] : []
110
- }
111
-
112
- function isClassSelector(selector) {
113
- return CLASS_PATTERN_ONLY.test(selector)
114
- }
115
-
116
- function collapseWhitespace(str) {
117
- return str.trim().replace(/\s+/g, ' ')
118
- }
119
-
120
- function noop() {}
@@ -1,54 +0,0 @@
1
- const stylelint = require('stylelint')
2
- const matchAll = require('string.prototype.matchall')
3
-
4
- const ruleName = 'primer/no-scale-colors'
5
- const messages = stylelint.utils.ruleMessages(ruleName, {
6
- rejected: varName =>
7
- `${varName} is a non-functional scale color and cannot be used without being wrapped in the color-variables mixin`,
8
- })
9
-
10
- // Match CSS variable references (e.g var(--color-text-primary))
11
- // eslint-disable-next-line no-useless-escape
12
- const variableReferenceRegex = /var\(([^\),]+)(,.*)?\)/g
13
-
14
- module.exports = stylelint.createPlugin(ruleName, (enabled, options = {}) => {
15
- if (!enabled) {
16
- return noop
17
- }
18
-
19
- const {verbose = false} = options
20
- // eslint-disable-next-line no-console
21
- const log = verbose ? (...args) => console.warn(...args) : noop
22
-
23
- // Keep track of declarations we've already seen
24
- const seen = new WeakMap()
25
-
26
- return (root, result) => {
27
- root.walkRules(rule => {
28
- rule.walkDecls(decl => {
29
- if (seen.has(decl)) {
30
- return
31
- } else {
32
- seen.set(decl, true)
33
- }
34
-
35
- for (const [, variableName] of matchAll(decl.value, variableReferenceRegex)) {
36
- log(`Found variable reference ${variableName}`)
37
- if (variableName.match(/^--color-(scale|auto)-/)) {
38
- stylelint.utils.report({
39
- message: messages.rejected(variableName),
40
- node: decl,
41
- result,
42
- ruleName,
43
- })
44
- }
45
- }
46
- })
47
- })
48
- }
49
- })
50
-
51
- function noop() {}
52
-
53
- module.exports.ruleName = ruleName
54
- module.exports.messages = messages
@@ -1,121 +0,0 @@
1
- const fs = require('fs')
2
- const stylelint = require('stylelint')
3
- const matchAll = require('string.prototype.matchall')
4
- const globby = require('globby')
5
- const TapMap = require('tap-map')
6
-
7
- const ruleName = 'primer/no-undefined-vars'
8
- const messages = stylelint.utils.ruleMessages(ruleName, {
9
- rejected: varName => `${varName} is not defined`,
10
- })
11
-
12
- // Match CSS variable definitions (e.g. --color-text-primary:)
13
- const variableDefinitionRegex = /^\s*(--[\w|-]+):/gm
14
-
15
- // Match CSS variables defined with the color-variables mixin
16
- const colorModeVariableDefinitionRegex = /^[^/\n]*\(["']?([^'"\s,]+)["']?,\s*\(light|dark:/gm
17
-
18
- // Match CSS variable references (e.g var(--color-text-primary))
19
- // eslint-disable-next-line no-useless-escape
20
- const variableReferenceRegex = /var\(([^\),]+)(,.*)?\)/g
21
-
22
- module.exports = stylelint.createPlugin(ruleName, (enabled, options = {}) => {
23
- if (!enabled) {
24
- return noop
25
- }
26
-
27
- const {files = ['**/*.scss', '!node_modules'], verbose = false} = options
28
- // eslint-disable-next-line no-console
29
- const log = verbose ? (...args) => console.warn(...args) : noop
30
- const globalDefinedVariables = getDefinedVariables(files, log)
31
- // Keep track of declarations we've already seen
32
- const seen = new WeakMap()
33
-
34
- return (root, result) => {
35
- const fileDefinedVariables = new Set()
36
-
37
- function checkVariable(variableName, node, allowed) {
38
- if (!allowed.has(variableName)) {
39
- stylelint.utils.report({
40
- message: messages.rejected(variableName),
41
- node,
42
- result,
43
- ruleName,
44
- })
45
- }
46
- }
47
-
48
- root.walkAtRules(rule => {
49
- if (rule.name === 'include' && rule.params.startsWith('color-variables')) {
50
- const innerMatch = [...matchAll(rule.params, variableReferenceRegex)]
51
- if (!innerMatch.length) {
52
- return
53
- }
54
-
55
- for (const [, variableName] of innerMatch) {
56
- checkVariable(variableName, rule, new Set([...globalDefinedVariables, ...fileDefinedVariables]))
57
- }
58
- }
59
- })
60
-
61
- root.walkRules(rule => {
62
- const scopeDefinedVaribles = new Set()
63
-
64
- rule.walkDecls(decl => {
65
- // Add CSS variable declarations within the source text to the list of allowed variables
66
- if (decl.prop.startsWith('--')) {
67
- scopeDefinedVaribles.add(decl.prop)
68
- if (decl.parent.selector === ':root' || decl.parent.selector === ':host') {
69
- fileDefinedVariables.add(decl.prop)
70
- }
71
- }
72
-
73
- if (seen.has(decl)) {
74
- return
75
- } else {
76
- seen.set(decl, true)
77
- }
78
-
79
- for (const [, variableName] of matchAll(decl.value, variableReferenceRegex)) {
80
- checkVariable(
81
- variableName,
82
- decl,
83
- new Set([...globalDefinedVariables, ...fileDefinedVariables, ...scopeDefinedVaribles]),
84
- )
85
- }
86
- })
87
- })
88
- }
89
- })
90
-
91
- const cwd = process.cwd()
92
- const cache = new TapMap()
93
-
94
- function getDefinedVariables(globs, log) {
95
- const cacheKey = JSON.stringify({globs, cwd})
96
- return cache.tap(cacheKey, () => {
97
- const definedVariables = new Set()
98
-
99
- const files = globby.sync(globs)
100
- log(`Scanning ${files.length} SCSS files for CSS variables`)
101
- for (const file of files) {
102
- log(`==========\nLooking for CSS variable definitions in ${file}`)
103
- const css = fs.readFileSync(file, 'utf-8')
104
- for (const [, variableName] of matchAll(css, variableDefinitionRegex)) {
105
- log(`${variableName} defined in ${file}`)
106
- definedVariables.add(variableName)
107
- }
108
- for (const [, variableName] of matchAll(css, colorModeVariableDefinitionRegex)) {
109
- log(`--color-${variableName} defined via color-variables in ${file}`)
110
- definedVariables.add(`--color-${variableName}`)
111
- }
112
- }
113
-
114
- return definedVariables
115
- })
116
- }
117
-
118
- function noop() {}
119
-
120
- module.exports.ruleName = ruleName
121
- module.exports.messages = messages