From aa9be6f181613c695e80ddf97b0518b1ac674198 Mon Sep 17 00:00:00 2001 From: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> Date: Mon, 6 Nov 2023 16:15:26 +0900 Subject: [PATCH] Remove `import-lazy` and change `stylelint.rules` Promise-based (#7279) This commit makes the following changes, including a breaking: - Remove the `import-lazy` dependency - Make the `stylelint.rules` object Promise-based (breaking) Thanks to these changes, the test suite is executed for ESM rules (`lib/rules/*/index.mjs`), instead of CJS ones (`*.cjs`). --- .changeset/slow-planes-begin.md | 5 + docs/developer-guide/plugins.md | 9 +- docs/developer-guide/rules.md | 1 + docs/migration-guide/to-16.md | 13 +- ...plugin-conditionally-check-color-named.cjs | 6 +- lib/__tests__/normalizeRuleSettings.test.mjs | 28 +- .../standalone-deprecations.test.mjs | 20 +- ...dalone-quiet-deprecation-warnings.test.mjs | 12 +- lib/augmentConfig.cjs | 2 +- lib/augmentConfig.mjs | 2 +- lib/lintPostcssResult.cjs | 4 +- lib/lintPostcssResult.mjs | 4 +- lib/normalizeAllRuleSettings.cjs | 6 +- lib/normalizeAllRuleSettings.mjs | 6 +- lib/rules/__tests__/index.test.mjs | 97 ++- lib/rules/index.cjs | 641 +++++++++++------- lib/rules/index.mjs | 640 ++++++++++------- lib/standalone.cjs | 4 +- lib/utils/__tests__/checkAgainstRule.test.mjs | 32 +- lib/utils/checkAgainstRule.cjs | 4 +- lib/utils/checkAgainstRule.mjs | 4 +- lib/utils/getStylelintRule.cjs | 16 +- lib/utils/getStylelintRule.mjs | 16 +- package-lock.json | 2 +- package.json | 1 - patches/import-lazy+4.0.0.patch | 14 - types/stylelint/index.d.ts | 131 +++- 27 files changed, 1069 insertions(+), 651 deletions(-) create mode 100644 .changeset/slow-planes-begin.md delete mode 100644 patches/import-lazy+4.0.0.patch diff --git a/.changeset/slow-planes-begin.md b/.changeset/slow-planes-begin.md new file mode 100644 index 0000000000..3ffcc290f8 --- /dev/null +++ b/.changeset/slow-planes-begin.md @@ -0,0 +1,5 @@ +--- +"stylelint": major +--- + +Changed: Node.js API so that the `stylelint.rules` object has `Promise` functions diff --git a/docs/developer-guide/plugins.md b/docs/developer-guide/plugins.md index c5deed701d..39961abb68 100644 --- a/docs/developer-guide/plugins.md +++ b/docs/developer-guide/plugins.md @@ -297,15 +297,16 @@ Here's an example of a plugin that runs `declaration-no-important` only if there ```js module.exports = stylelint.createPlugin(ruleName, (expectation) => { - const runDeclarationNoImportant = - stylelint.rules["declaration-no-important"](expectation); + const runDeclarationNoImportant = stylelint.rules[ + "declaration-no-important" + ].then((rule) => rule(expectation)); return (root, result) => { - if (root.toString().indexOf("@@check-declaration-no-important") === -1) { + if (!root.toString().includes("@@check-declaration-no-important")) { return; } - runDeclarationNoImportant(root, result); + return runDeclarationNoImportant.then((rule) => rule(root, result)); }; }); ``` diff --git a/docs/developer-guide/rules.md b/docs/developer-guide/rules.md index ff33bb27d7..b4a3a77961 100644 --- a/docs/developer-guide/rules.md +++ b/docs/developer-guide/rules.md @@ -260,6 +260,7 @@ The final step is to add references to the new rule in the following places: - [The rules `index.mjs` file](../../lib/rules/index.mjs) - [The list of rules](../user-guide/rules.md) +- [The type definition of rules](../../types/stylelint/index.d.ts) ## Add an option to a rule diff --git a/docs/migration-guide/to-16.md b/docs/migration-guide/to-16.md index f5af9ed9c8..cc045e8a05 100644 --- a/docs/migration-guide/to-16.md +++ b/docs/migration-guide/to-16.md @@ -52,8 +52,17 @@ If you use `stylelint.lint()` to lint files, the `code` property will always be We've changed the `stylelint.formatters` object in the Node.js API so that every formatter is a `Promise` function. ```diff js --stylelint.formatters.json(results); -+stylelint.formatters.json.then(formatter => formatter(results)); +-const formatter = stylelint.formatters.json; ++const formatter = await stylelint.formatters.json; +``` + +## Changed Node.js API returned `rules` object + +We've changed the `stylelint.rules` object in the Node.js API so that every rule is a `Promise` function. + +```diff js +-const rule = stylelint.rules['block-no-empty']; ++const rule = await stylelint.rules['block-no-empty']; ``` ## Changed CLI to print problems to stderr diff --git a/lib/__tests__/fixtures/plugin-conditionally-check-color-named.cjs b/lib/__tests__/fixtures/plugin-conditionally-check-color-named.cjs index 7ca543e69f..9f9dd8b756 100644 --- a/lib/__tests__/fixtures/plugin-conditionally-check-color-named.cjs +++ b/lib/__tests__/fixtures/plugin-conditionally-check-color-named.cjs @@ -5,11 +5,13 @@ const stylelint = require('../../index.cjs'); const ruleName = 'plugin/conditionally-check-color-named'; module.exports = stylelint.createPlugin(ruleName, (expectation, options, context) => { - const colorNamedRule = stylelint.rules['color-named'](expectation, options, context); + const colorNamedRule = stylelint.rules['color-named'].then((rule) => + rule(expectation, options, context), + ); return (root, result) => { if (!root.toString().includes('@@check-color-named')) return; - colorNamedRule(root, result); + return colorNamedRule.then((rule) => rule(root, result)); }; }); diff --git a/lib/__tests__/normalizeRuleSettings.test.mjs b/lib/__tests__/normalizeRuleSettings.test.mjs index 189356833e..cc765e8371 100644 --- a/lib/__tests__/normalizeRuleSettings.test.mjs +++ b/lib/__tests__/normalizeRuleSettings.test.mjs @@ -33,8 +33,9 @@ describe('rules whose primary option IS NOT an array', () => { expect(actual).toEqual(expected); }); - it('arrayed number with secondary options returns same', () => { - const actual = normalizeRuleSettings([2, { severity: 'warning' }], rules['block-no-empty']); + it('arrayed number with secondary options returns same', async () => { + const rule = await rules['block-no-empty']; + const actual = normalizeRuleSettings([2, { severity: 'warning' }], rule); const expected = [2, { severity: 'warning' }]; expect(actual).toEqual(expected); @@ -75,8 +76,9 @@ describe('rules whose primary option IS NOT an array', () => { expect(actual).toEqual(expected); }); - it('arrayed boolean with secondary options returns same', () => { - const actual = normalizeRuleSettings([true, { severity: 'warning' }], rules['block-no-empty']); + it('arrayed boolean with secondary options returns same', async () => { + const rule = await rules['block-no-empty']; + const actual = normalizeRuleSettings([true, { severity: 'warning' }], rule); const expected = [true, { severity: 'warning' }]; expect(actual).toEqual(expected); @@ -92,25 +94,25 @@ describe('rules whose primary option CAN BE an array', () => { expect(normalizeRuleSettings([null], mockRule)).toBeNull(); }); - it('solo primary option array is nested within an array', () => { - const actual = normalizeRuleSettings(['calc', 'rgba'], rules['function-allowed-list']); + it('solo primary option array is nested within an array', async () => { + const rule = await rules['function-allowed-list']; + const actual = normalizeRuleSettings(['calc', 'rgba'], rule); const expected = [['calc', 'rgba']]; expect(actual).toEqual(expected); }); - it('primary option array in an array', () => { - const actual = normalizeRuleSettings([['calc', 'rgba']], rules['function-allowed-list']); + it('primary option array in an array', async () => { + const rule = await rules['function-allowed-list']; + const actual = normalizeRuleSettings([['calc', 'rgba']], rule); const expected = [['calc', 'rgba']]; expect(actual).toEqual(expected); }); - it('nested primary option array returns same', () => { - const actual = normalizeRuleSettings( - [['calc', 'rgba'], { severity: 'warning' }], - rules['function-allowed-list'], - ); + it('nested primary option array returns same', async () => { + const rule = await rules['function-allowed-list']; + const actual = normalizeRuleSettings([['calc', 'rgba'], { severity: 'warning' }], rule); const expected = [['calc', 'rgba'], { severity: 'warning' }]; expect(actual).toEqual(expected); diff --git a/lib/__tests__/standalone-deprecations.test.mjs b/lib/__tests__/standalone-deprecations.test.mjs index 2c34349aaa..bcdf2f4393 100644 --- a/lib/__tests__/standalone-deprecations.test.mjs +++ b/lib/__tests__/standalone-deprecations.test.mjs @@ -1,26 +1,20 @@ -import { createRequire } from 'node:module'; import readJSONFile from '../testUtils/readJSONFile.mjs'; import standalone from '../standalone.mjs'; import { jest } from '@jest/globals'; -jest.mock('../rules/block-no-empty/index.cjs'); - -const require = createRequire(import.meta.url); -const blockNoEmpty = require('../rules/block-no-empty/index.cjs'); +jest.unstable_mockModule('../rules/block-no-empty/index.mjs', () => ({ + default() { + return (root, result) => { + result.warn('Some deprecation', { stylelintType: 'deprecation' }); + }; + }, +})); const configBlockNoEmpty = readJSONFile( new URL('./fixtures/config-block-no-empty.json', import.meta.url), ); -blockNoEmpty.mockImplementation(() => { - return (root, result) => { - result.warn('Some deprecation', { - stylelintType: 'deprecation', - }); - }; -}); - describe('standalone with deprecations', () => { it('works', async () => { const { output, results } = await standalone({ diff --git a/lib/__tests__/standalone-quiet-deprecation-warnings.test.mjs b/lib/__tests__/standalone-quiet-deprecation-warnings.test.mjs index c1b01bc542..25c49103c4 100644 --- a/lib/__tests__/standalone-quiet-deprecation-warnings.test.mjs +++ b/lib/__tests__/standalone-quiet-deprecation-warnings.test.mjs @@ -1,14 +1,8 @@ -import { createRequire } from 'node:module'; import { jest } from '@jest/globals'; import report from '../utils/report.mjs'; import standalone from '../standalone.mjs'; -jest.mock('../rules/block-no-empty/index.cjs'); - -const require = createRequire(import.meta.url); -const deprecatedRule = require('../rules/block-no-empty/index.cjs'); - -deprecatedRule.mockImplementation(() => { +const deprecatedRule = () => { return (root, result) => { report({ ruleName: 'block-no-empty', @@ -17,10 +11,12 @@ deprecatedRule.mockImplementation(() => { result, }); }; -}); +}; deprecatedRule.meta = { deprecated: true }; +jest.unstable_mockModule('../rules/block-no-empty/index.mjs', () => ({ default: deprecatedRule })); + it('standalone does not silence deprecation warnings by default', async () => { const config = { rules: { diff --git a/lib/augmentConfig.cjs b/lib/augmentConfig.cjs index 1530bb9d88..7df6437e72 100644 --- a/lib/augmentConfig.cjs +++ b/lib/augmentConfig.cjs @@ -132,7 +132,7 @@ async function augmentConfigFull(stylelint, filePath, cosmiconfigResult) { ); } - augmentedConfig = normalizeAllRuleSettings(augmentedConfig); + augmentedConfig = await normalizeAllRuleSettings(augmentedConfig); return { config: augmentedConfig, diff --git a/lib/augmentConfig.mjs b/lib/augmentConfig.mjs index 564a1f2fda..87d53fbf6f 100644 --- a/lib/augmentConfig.mjs +++ b/lib/augmentConfig.mjs @@ -129,7 +129,7 @@ export async function augmentConfigFull(stylelint, filePath, cosmiconfigResult) ); } - augmentedConfig = normalizeAllRuleSettings(augmentedConfig); + augmentedConfig = await normalizeAllRuleSettings(augmentedConfig); return { config: augmentedConfig, diff --git a/lib/lintPostcssResult.cjs b/lib/lintPostcssResult.cjs index 20413f06d5..50a42bc9b7 100644 --- a/lib/lintPostcssResult.cjs +++ b/lib/lintPostcssResult.cjs @@ -19,7 +19,7 @@ const index = require('./rules/index.cjs'); * @param {StylelintConfig} config * @returns {Promise} */ -function lintPostcssResult(stylelintOptions, postcssResult, config) { +async function lintPostcssResult(stylelintOptions, postcssResult, config) { postcssResult.stylelint.ruleSeverities = {}; postcssResult.stylelint.customMessages = {}; postcssResult.stylelint.ruleMetadata = {}; @@ -66,7 +66,7 @@ function lintPostcssResult(stylelintOptions, postcssResult, config) { : []; for (const ruleName of ruleNames) { - const ruleFunction = getStylelintRule(ruleName, config); + const ruleFunction = await getStylelintRule(ruleName, config); if (ruleFunction === undefined) { performRules.push( diff --git a/lib/lintPostcssResult.mjs b/lib/lintPostcssResult.mjs index ab98227dbf..367d75687e 100644 --- a/lib/lintPostcssResult.mjs +++ b/lib/lintPostcssResult.mjs @@ -16,7 +16,7 @@ import rules from './rules/index.mjs'; * @param {StylelintConfig} config * @returns {Promise} */ -export default function lintPostcssResult(stylelintOptions, postcssResult, config) { +export default async function lintPostcssResult(stylelintOptions, postcssResult, config) { postcssResult.stylelint.ruleSeverities = {}; postcssResult.stylelint.customMessages = {}; postcssResult.stylelint.ruleMetadata = {}; @@ -63,7 +63,7 @@ export default function lintPostcssResult(stylelintOptions, postcssResult, confi : []; for (const ruleName of ruleNames) { - const ruleFunction = getStylelintRule(ruleName, config); + const ruleFunction = await getStylelintRule(ruleName, config); if (ruleFunction === undefined) { performRules.push( diff --git a/lib/normalizeAllRuleSettings.cjs b/lib/normalizeAllRuleSettings.cjs index a0c131bbea..3ce0ff3dfe 100644 --- a/lib/normalizeAllRuleSettings.cjs +++ b/lib/normalizeAllRuleSettings.cjs @@ -9,16 +9,16 @@ const normalizeRuleSettings = require('./normalizeRuleSettings.cjs'); /** * @param {StylelintConfig} config - * @return {StylelintConfig} + * @return {Promise} */ -function normalizeAllRuleSettings(config) { +async function normalizeAllRuleSettings(config) { if (!config.rules) return config; /** @type {StylelintConfig['rules']} */ const normalizedRules = {}; for (const [ruleName, rawRuleSettings] of Object.entries(config.rules)) { - const rule = getStylelintRule(ruleName, config); + const rule = await getStylelintRule(ruleName, config); if (rule) { normalizedRules[ruleName] = normalizeRuleSettings(rawRuleSettings, rule); diff --git a/lib/normalizeAllRuleSettings.mjs b/lib/normalizeAllRuleSettings.mjs index 3e4231501c..f8313c0913 100644 --- a/lib/normalizeAllRuleSettings.mjs +++ b/lib/normalizeAllRuleSettings.mjs @@ -5,16 +5,16 @@ import normalizeRuleSettings from './normalizeRuleSettings.mjs'; /** * @param {StylelintConfig} config - * @return {StylelintConfig} + * @return {Promise} */ -export default function normalizeAllRuleSettings(config) { +export default async function normalizeAllRuleSettings(config) { if (!config.rules) return config; /** @type {StylelintConfig['rules']} */ const normalizedRules = {}; for (const [ruleName, rawRuleSettings] of Object.entries(config.rules)) { - const rule = getStylelintRule(ruleName, config); + const rule = await getStylelintRule(ruleName, config); if (rule) { normalizedRules[ruleName] = normalizeRuleSettings(rawRuleSettings, rule); diff --git a/lib/rules/__tests__/index.test.mjs b/lib/rules/__tests__/index.test.mjs index a0dc0d3591..72d6b3f2d2 100644 --- a/lib/rules/__tests__/index.test.mjs +++ b/lib/rules/__tests__/index.test.mjs @@ -1,119 +1,116 @@ -import { existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs'; +import { mkdirSync, rmSync, writeFileSync } from 'node:fs'; import { createRequire } from 'node:module'; import { execSync } from 'node:child_process'; import { fileURLToPath } from 'node:url'; -import path from 'node:path'; +import { join } from 'node:path'; import { readFile } from 'node:fs/promises'; import rules from '../index.mjs'; const require = createRequire(import.meta.url); -const __dirname = fileURLToPath(new URL('.', import.meta.url)); -const ruleEntries = Object.entries(rules); +const ruleNames = Object.keys(rules); let rulesListDoc; beforeAll(async () => { rulesListDoc = await readFile( - path.join(__dirname, '..', '..', '..', 'docs', 'user-guide', 'rules.md'), + new URL('../../../docs/user-guide/rules.md', import.meta.url), 'utf8', ); }); describe('all rules', () => { - test.each(ruleEntries)('"%s" should have metadata', (name, rule) => { - expect(rule.meta).toBeTruthy(); - expect(rule.meta.url).toBe(`https://stylelint.io/user-guide/rules/${name}`); + test.each(ruleNames)('"%s" should have metadata', async (name) => { + const rule = await rules[name]; + + expect(rule).toHaveProperty('meta.url', `https://stylelint.io/user-guide/rules/${name}`); expect([true, undefined]).toContain(rule.meta.fixable); }); - test.each(ruleEntries)('"%s" should have a link to a rule doc in the rules page', (name) => { + test.each(ruleNames)('"%s" should have a link to a rule doc in the rules page', (name) => { expect(rulesListDoc).toContain(`[\`${name}\`](../../lib/`); }); }); describe('fixable rules', () => { - const fixableRules = ruleEntries.filter(([, rule]) => rule.meta.fixable); + test.each(ruleNames)('"%s" should describe fixable in the documents', async (name) => { + const rule = await rules[name]; - test.each(fixableRules)('"%s" should describe fixable in the rules doc', async (name) => { - const doc = await readFile(path.join(__dirname, '..', name, 'README.md'), 'utf8'); + if (!rule.meta.fixable) return; - expect(doc).toMatch('`fix` option'); - }); + const ruleDoc = await readFile(new URL(`../${name}/README.md`, import.meta.url), 'utf8'); - test.each(fixableRules)('"%s" should describe fixable in the rules doc', (name) => { + expect(ruleDoc).toMatch('`fix` option'); expect(rulesListDoc).toMatch(new RegExp(`^.+\`${name}\`.+\\|.+\\|\\s+🔧\\s+\\|$`, 'm')); }); }); -// eslint-disable-next-line jest/no-disabled-tests --- Leaving for future cases of deprecated rules. -describe.skip('deprecated rules', () => { - const deprecatedRules = ruleEntries.filter(([, rule]) => rule.meta.deprecated); +describe('deprecated rules', () => { + test.each(ruleNames)('"%s" should describe deprecation in the document', async (name) => { + const rule = await rules[name]; + + if (!rule.meta.deprecated) return; - test.each(deprecatedRules)('"%s" should describe deprecation in the rules doc', async (name) => { - const doc = await readFile(path.join(__dirname, '..', name, 'README.md'), 'utf8'); + const ruleDoc = await readFile(new URL(`../${name}/README.md`, import.meta.url), 'utf8'); - expect(doc).toMatch('> **Warning**'); + expect(ruleDoc).toMatch('> **Warning**'); }); }); describe('custom message option', () => { - test.each(ruleEntries)( - '"%s" should describe a custom message option in its doc', - async (ruleName) => { - let jsFile = path.join(__dirname, '..', ruleName, 'index.mjs'); - - // TODO: Remove after the migration to ESM. - if (!existsSync(jsFile)) { - jsFile = path.join(__dirname, '..', ruleName, 'index.js'); - } - - const jsCode = await readFile(jsFile, 'utf8'); + test.each(ruleNames)( + '"%s" should describe a custom message option in the document', + async (name) => { + const jsCode = await readFile(new URL(`../${name}/index.mjs`, import.meta.url), 'utf8'); // NOTE: If all rules support a custom message option, we should remove this `if` statement. if (!jsCode.includes('\tmessageArgs: [')) return; - const doc = await readFile(jsFile.replace(/index\.m?js$/, 'README.md'), 'utf8'); + const doc = await readFile(new URL(`../${name}/README.md`, import.meta.url), 'utf8'); expect(doc).toContain('`message` secondary option'); }, ); }); -describe('standard config', () => { - // eslint-disable-next-line jest/no-disabled-tests -- To prevent a failure when adding a new rule to the sharable config. See #7045. - describe.skip('due to chicken and egg problem #7045', () => { - const tmpDir = path.join(__dirname, 'tmp'); +// eslint-disable-next-line jest/no-disabled-tests -- To prevent a failure when adding a new rule to the sharable config. See #7045. +describe.skip('standard config', () => { + let tmpDir; + let standardRules; + + beforeAll(() => { + tmpDir = fileURLToPath(new URL('./tmp', import.meta.url)); // NOTE: The use of Promised-based APIs may cause flaky test on CI. rmSync(tmpDir, { recursive: true, force: true }); mkdirSync(tmpDir, { recursive: true }); - writeFileSync(path.join(tmpDir, 'package.json'), '{}'); + writeFileSync(join(tmpDir, 'package.json'), '{}'); execSync( 'npm install --silent --no-package-lock --no-audit --omit=peer stylelint-config-standard', { cwd: tmpDir }, ); const configRules = (name) => { - const config = require(path.join(tmpDir, 'node_modules', name)); + const config = require(join(tmpDir, 'node_modules', name)); return Object.keys(config.rules); }; - const standardRules = configRules('stylelint-config-standard'); - - standardRules.push(...configRules('stylelint-config-recommended')); + standardRules = [ + ...configRules('stylelint-config-standard'), + ...configRules('stylelint-config-recommended'), + ]; + }); - afterAll(() => { - rmSync(tmpDir, { recursive: true, force: true }); - }); + afterAll(() => { + rmSync(tmpDir, { recursive: true, force: true }); + }); - test('the rules are not empty', () => { - expect(standardRules).not.toHaveLength(0); - }); + test('the rules are present in the rules doc', () => { + expect(standardRules).not.toHaveLength(0); - test.each(standardRules)('the rule "%s" are present in the rules doc', (name) => { + for (const name of standardRules) { expect(rulesListDoc).toMatch(new RegExp(`^.+\`${name}\`.+\\|\\s+✅\\s+\\|.+\\|$`, 'm')); - }); + } }); }); diff --git a/lib/rules/index.cjs b/lib/rules/index.cjs index 40b274738d..8fd8323ac7 100644 --- a/lib/rules/index.cjs +++ b/lib/rules/index.cjs @@ -2,260 +2,397 @@ // please instead edit the ESM counterpart and rebuild with Rollup (npm run build). 'use strict'; -const node_module = require('node:module'); -const importLazy = require('import-lazy'); +const _interopNamespaceDefaultOnly = e => Object.freeze({ __proto__: null, default: e }); -var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; -// @ts-expect-error -- TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. -const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('lib/rules/index.cjs', document.baseURI).href))); - -/** @type {import('stylelint')['rules']} */ +/** @type {import('stylelint').BuiltInRules} */ const rules = { - 'alpha-value-notation': importLazy(() => require$1('./alpha-value-notation/index.cjs'))(), - 'annotation-no-unknown': importLazy(() => require$1('./annotation-no-unknown/index.cjs'))(), - 'at-rule-allowed-list': importLazy(() => require$1('./at-rule-allowed-list/index.cjs'))(), - 'at-rule-disallowed-list': importLazy(() => require$1('./at-rule-disallowed-list/index.cjs'))(), - 'at-rule-empty-line-before': importLazy(() => require$1('./at-rule-empty-line-before/index.cjs'))(), - 'at-rule-no-unknown': importLazy(() => require$1('./at-rule-no-unknown/index.cjs'))(), - 'at-rule-no-vendor-prefix': importLazy(() => require$1('./at-rule-no-vendor-prefix/index.cjs'))(), - 'at-rule-property-required-list': importLazy(() => - require$1('./at-rule-property-required-list/index.cjs'), - )(), - 'block-no-empty': importLazy(() => require$1('./block-no-empty/index.cjs'))(), - 'color-function-notation': importLazy(() => require$1('./color-function-notation/index.cjs'))(), - 'color-hex-alpha': importLazy(() => require$1('./color-hex-alpha/index.cjs'))(), - 'color-hex-length': importLazy(() => require$1('./color-hex-length/index.cjs'))(), - 'color-named': importLazy(() => require$1('./color-named/index.cjs'))(), - 'color-no-hex': importLazy(() => require$1('./color-no-hex/index.cjs'))(), - 'color-no-invalid-hex': importLazy(() => require$1('./color-no-invalid-hex/index.cjs'))(), - 'comment-empty-line-before': importLazy(() => require$1('./comment-empty-line-before/index.cjs'))(), - 'comment-no-empty': importLazy(() => require$1('./comment-no-empty/index.cjs'))(), - 'comment-pattern': importLazy(() => require$1('./comment-pattern/index.cjs'))(), - 'comment-whitespace-inside': importLazy(() => require$1('./comment-whitespace-inside/index.cjs'))(), - 'comment-word-disallowed-list': importLazy(() => - require$1('./comment-word-disallowed-list/index.cjs'), - )(), - 'custom-media-pattern': importLazy(() => require$1('./custom-media-pattern/index.cjs'))(), - 'custom-property-empty-line-before': importLazy(() => - require$1('./custom-property-empty-line-before/index.cjs'), - )(), - 'custom-property-no-missing-var-function': importLazy(() => - require$1('./custom-property-no-missing-var-function/index.cjs'), - )(), - 'custom-property-pattern': importLazy(() => require$1('./custom-property-pattern/index.cjs'))(), - 'declaration-block-no-duplicate-custom-properties': importLazy(() => - require$1('./declaration-block-no-duplicate-custom-properties/index.cjs'), - )(), - 'declaration-block-no-duplicate-properties': importLazy(() => - require$1('./declaration-block-no-duplicate-properties/index.cjs'), - )(), - 'declaration-block-no-redundant-longhand-properties': importLazy(() => - require$1('./declaration-block-no-redundant-longhand-properties/index.cjs'), - )(), - 'declaration-block-no-shorthand-property-overrides': importLazy(() => - require$1('./declaration-block-no-shorthand-property-overrides/index.cjs'), - )(), - 'declaration-block-single-line-max-declarations': importLazy(() => - require$1('./declaration-block-single-line-max-declarations/index.cjs'), - )(), - 'declaration-empty-line-before': importLazy(() => - require$1('./declaration-empty-line-before/index.cjs'), - )(), - 'declaration-no-important': importLazy(() => require$1('./declaration-no-important/index.cjs'))(), - 'declaration-property-max-values': importLazy(() => - require$1('./declaration-property-max-values/index.cjs'), - )(), - 'declaration-property-unit-allowed-list': importLazy(() => - require$1('./declaration-property-unit-allowed-list/index.cjs'), - )(), - 'declaration-property-unit-disallowed-list': importLazy(() => - require$1('./declaration-property-unit-disallowed-list/index.cjs'), - )(), - 'declaration-property-value-allowed-list': importLazy(() => - require$1('./declaration-property-value-allowed-list/index.cjs'), - )(), - 'declaration-property-value-disallowed-list': importLazy(() => - require$1('./declaration-property-value-disallowed-list/index.cjs'), - )(), - 'declaration-property-value-no-unknown': importLazy(() => - require$1('./declaration-property-value-no-unknown/index.cjs'), - )(), - 'font-family-no-missing-generic-family-keyword': importLazy(() => - require$1('./font-family-no-missing-generic-family-keyword/index.cjs'), - )(), - 'font-family-name-quotes': importLazy(() => require$1('./font-family-name-quotes/index.cjs'))(), - 'font-family-no-duplicate-names': importLazy(() => - require$1('./font-family-no-duplicate-names/index.cjs'), - )(), - 'font-weight-notation': importLazy(() => require$1('./font-weight-notation/index.cjs'))(), - 'function-allowed-list': importLazy(() => require$1('./function-allowed-list/index.cjs'))(), - 'function-calc-no-unspaced-operator': importLazy(() => - require$1('./function-calc-no-unspaced-operator/index.cjs'), - )(), - - 'function-disallowed-list': importLazy(() => require$1('./function-disallowed-list/index.cjs'))(), - 'function-linear-gradient-no-nonstandard-direction': importLazy(() => - require$1('./function-linear-gradient-no-nonstandard-direction/index.cjs'), - )(), - - 'function-name-case': importLazy(() => require$1('./function-name-case/index.cjs'))(), - 'function-no-unknown': importLazy(() => require$1('./function-no-unknown/index.cjs'))(), - - 'function-url-no-scheme-relative': importLazy(() => - require$1('./function-url-no-scheme-relative/index.cjs'), - )(), - 'function-url-quotes': importLazy(() => require$1('./function-url-quotes/index.cjs'))(), - 'function-url-scheme-allowed-list': importLazy(() => - require$1('./function-url-scheme-allowed-list/index.cjs'), - )(), - 'function-url-scheme-disallowed-list': importLazy(() => - require$1('./function-url-scheme-disallowed-list/index.cjs'), - )(), - - 'hue-degree-notation': importLazy(() => require$1('./hue-degree-notation/index.cjs'))(), - 'import-notation': importLazy(() => require$1('./import-notation/index.cjs'))(), - 'keyframe-block-no-duplicate-selectors': importLazy(() => - require$1('./keyframe-block-no-duplicate-selectors/index.cjs'), - )(), - 'keyframe-declaration-no-important': importLazy(() => - require$1('./keyframe-declaration-no-important/index.cjs'), - )(), - 'keyframe-selector-notation': importLazy(() => - require$1('./keyframe-selector-notation/index.cjs'), - )(), - 'keyframes-name-pattern': importLazy(() => require$1('./keyframes-name-pattern/index.cjs'))(), - 'length-zero-no-unit': importLazy(() => require$1('./length-zero-no-unit/index.cjs'))(), - 'max-nesting-depth': importLazy(() => require$1('./max-nesting-depth/index.cjs'))(), - 'media-feature-name-allowed-list': importLazy(() => - require$1('./media-feature-name-allowed-list/index.cjs'), - )(), - 'media-feature-name-disallowed-list': importLazy(() => - require$1('./media-feature-name-disallowed-list/index.cjs'), - )(), - 'media-feature-name-no-unknown': importLazy(() => - require$1('./media-feature-name-no-unknown/index.cjs'), - )(), - 'media-feature-name-no-vendor-prefix': importLazy(() => - require$1('./media-feature-name-no-vendor-prefix/index.cjs'), - )(), - 'media-feature-name-unit-allowed-list': importLazy(() => - require$1('./media-feature-name-unit-allowed-list/index.cjs'), - )(), - 'media-feature-name-value-allowed-list': importLazy(() => - require$1('./media-feature-name-value-allowed-list/index.cjs'), - )(), - 'media-feature-name-value-no-unknown': importLazy(() => - require$1('./media-feature-name-value-no-unknown/index.cjs'), - )(), - 'media-feature-range-notation': importLazy(() => - require$1('./media-feature-range-notation/index.cjs'), - )(), - - 'media-query-no-invalid': importLazy(() => require$1('./media-query-no-invalid/index.cjs'))(), - 'named-grid-areas-no-invalid': importLazy(() => - require$1('./named-grid-areas-no-invalid/index.cjs'), - )(), - 'no-descending-specificity': importLazy(() => require$1('./no-descending-specificity/index.cjs'))(), - 'no-duplicate-at-import-rules': importLazy(() => - require$1('./no-duplicate-at-import-rules/index.cjs'), - )(), - 'no-duplicate-selectors': importLazy(() => require$1('./no-duplicate-selectors/index.cjs'))(), - 'no-empty-source': importLazy(() => require$1('./no-empty-source/index.cjs'))(), - 'no-invalid-double-slash-comments': importLazy(() => - require$1('./no-invalid-double-slash-comments/index.cjs'), - )(), - 'no-invalid-position-at-import-rule': importLazy(() => - require$1('./no-invalid-position-at-import-rule/index.cjs'), - )(), - 'no-irregular-whitespace': importLazy(() => require$1('./no-irregular-whitespace/index.cjs'))(), - 'no-unknown-animations': importLazy(() => require$1('./no-unknown-animations/index.cjs'))(), - 'no-unknown-custom-properties': importLazy(() => - require$1('./no-unknown-custom-properties/index.cjs'), - )(), - 'number-max-precision': importLazy(() => require$1('./number-max-precision/index.cjs'))(), - 'property-allowed-list': importLazy(() => require$1('./property-allowed-list/index.cjs'))(), - 'property-disallowed-list': importLazy(() => require$1('./property-disallowed-list/index.cjs'))(), - 'property-no-unknown': importLazy(() => require$1('./property-no-unknown/index.cjs'))(), - 'property-no-vendor-prefix': importLazy(() => require$1('./property-no-vendor-prefix/index.cjs'))(), - 'rule-empty-line-before': importLazy(() => require$1('./rule-empty-line-before/index.cjs'))(), - 'rule-selector-property-disallowed-list': importLazy(() => - require$1('./rule-selector-property-disallowed-list/index.cjs'), - )(), - 'selector-anb-no-unmatchable': importLazy(() => - require$1('./selector-anb-no-unmatchable/index.cjs'), - )(), - 'selector-attribute-name-disallowed-list': importLazy(() => - require$1('./selector-attribute-name-disallowed-list/index.cjs'), - )(), - 'selector-attribute-operator-allowed-list': importLazy(() => - require$1('./selector-attribute-operator-allowed-list/index.cjs'), - )(), - 'selector-attribute-operator-disallowed-list': importLazy(() => - require$1('./selector-attribute-operator-disallowed-list/index.cjs'), - )(), - 'selector-attribute-quotes': importLazy(() => require$1('./selector-attribute-quotes/index.cjs'))(), - 'selector-class-pattern': importLazy(() => require$1('./selector-class-pattern/index.cjs'))(), - 'selector-combinator-allowed-list': importLazy(() => - require$1('./selector-combinator-allowed-list/index.cjs'), - )(), - 'selector-combinator-disallowed-list': importLazy(() => - require$1('./selector-combinator-disallowed-list/index.cjs'), - )(), - - 'selector-disallowed-list': importLazy(() => require$1('./selector-disallowed-list/index.cjs'))(), - 'selector-id-pattern': importLazy(() => require$1('./selector-id-pattern/index.cjs'))(), - - 'selector-max-attribute': importLazy(() => require$1('./selector-max-attribute/index.cjs'))(), - 'selector-max-class': importLazy(() => require$1('./selector-max-class/index.cjs'))(), - 'selector-max-combinators': importLazy(() => require$1('./selector-max-combinators/index.cjs'))(), - 'selector-max-compound-selectors': importLazy(() => - require$1('./selector-max-compound-selectors/index.cjs'), - )(), - - 'selector-max-id': importLazy(() => require$1('./selector-max-id/index.cjs'))(), - 'selector-max-pseudo-class': importLazy(() => require$1('./selector-max-pseudo-class/index.cjs'))(), - 'selector-max-specificity': importLazy(() => require$1('./selector-max-specificity/index.cjs'))(), - 'selector-max-type': importLazy(() => require$1('./selector-max-type/index.cjs'))(), - 'selector-max-universal': importLazy(() => require$1('./selector-max-universal/index.cjs'))(), - 'selector-nested-pattern': importLazy(() => require$1('./selector-nested-pattern/index.cjs'))(), - 'selector-no-qualifying-type': importLazy(() => - require$1('./selector-no-qualifying-type/index.cjs'), - )(), - 'selector-no-vendor-prefix': importLazy(() => require$1('./selector-no-vendor-prefix/index.cjs'))(), - 'selector-not-notation': importLazy(() => require$1('./selector-not-notation/index.cjs'))(), - 'selector-pseudo-class-allowed-list': importLazy(() => - require$1('./selector-pseudo-class-allowed-list/index.cjs'), - )(), - 'selector-pseudo-class-disallowed-list': importLazy(() => - require$1('./selector-pseudo-class-disallowed-list/index.cjs'), - )(), - 'selector-pseudo-class-no-unknown': importLazy(() => - require$1('./selector-pseudo-class-no-unknown/index.cjs'), - )(), - 'selector-pseudo-element-allowed-list': importLazy(() => - require$1('./selector-pseudo-element-allowed-list/index.cjs'), - )(), - 'selector-pseudo-element-colon-notation': importLazy(() => - require$1('./selector-pseudo-element-colon-notation/index.cjs'), - )(), - 'selector-pseudo-element-disallowed-list': importLazy(() => - require$1('./selector-pseudo-element-disallowed-list/index.cjs'), - )(), - 'selector-pseudo-element-no-unknown': importLazy(() => - require$1('./selector-pseudo-element-no-unknown/index.cjs'), - )(), - 'selector-type-case': importLazy(() => require$1('./selector-type-case/index.cjs'))(), - 'selector-type-no-unknown': importLazy(() => require$1('./selector-type-no-unknown/index.cjs'))(), - 'shorthand-property-no-redundant-values': importLazy(() => - require$1('./shorthand-property-no-redundant-values/index.cjs'), - )(), - 'string-no-newline': importLazy(() => require$1('./string-no-newline/index.cjs'))(), - 'time-min-milliseconds': importLazy(() => require$1('./time-min-milliseconds/index.cjs'))(), - 'unit-allowed-list': importLazy(() => require$1('./unit-allowed-list/index.cjs'))(), - 'unit-disallowed-list': importLazy(() => require$1('./unit-disallowed-list/index.cjs'))(), - 'unit-no-unknown': importLazy(() => require$1('./unit-no-unknown/index.cjs'))(), - 'value-keyword-case': importLazy(() => require$1('./value-keyword-case/index.cjs'))(), - 'value-no-vendor-prefix': importLazy(() => require$1('./value-no-vendor-prefix/index.cjs'))(), + get 'alpha-value-notation'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./alpha-value-notation/index.cjs'))).then((m) => m.default); + }, + get 'annotation-no-unknown'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./annotation-no-unknown/index.cjs'))).then((m) => m.default); + }, + get 'at-rule-allowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./at-rule-allowed-list/index.cjs'))).then((m) => m.default); + }, + get 'at-rule-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./at-rule-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'at-rule-empty-line-before'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./at-rule-empty-line-before/index.cjs'))).then((m) => m.default); + }, + get 'at-rule-no-unknown'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./at-rule-no-unknown/index.cjs'))).then((m) => m.default); + }, + get 'at-rule-no-vendor-prefix'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./at-rule-no-vendor-prefix/index.cjs'))).then((m) => m.default); + }, + get 'at-rule-property-required-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./at-rule-property-required-list/index.cjs'))).then((m) => m.default); + }, + get 'block-no-empty'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./block-no-empty/index.cjs'))).then((m) => m.default); + }, + get 'color-function-notation'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./color-function-notation/index.cjs'))).then((m) => m.default); + }, + get 'color-hex-alpha'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./color-hex-alpha/index.cjs'))).then((m) => m.default); + }, + get 'color-hex-length'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./color-hex-length/index.cjs'))).then((m) => m.default); + }, + get 'color-named'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./color-named/index.cjs'))).then((m) => m.default); + }, + get 'color-no-hex'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./color-no-hex/index.cjs'))).then((m) => m.default); + }, + get 'color-no-invalid-hex'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./color-no-invalid-hex/index.cjs'))).then((m) => m.default); + }, + get 'comment-empty-line-before'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./comment-empty-line-before/index.cjs'))).then((m) => m.default); + }, + get 'comment-no-empty'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./comment-no-empty/index.cjs'))).then((m) => m.default); + }, + get 'comment-pattern'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./comment-pattern/index.cjs'))).then((m) => m.default); + }, + get 'comment-whitespace-inside'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./comment-whitespace-inside/index.cjs'))).then((m) => m.default); + }, + get 'comment-word-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./comment-word-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'custom-media-pattern'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./custom-media-pattern/index.cjs'))).then((m) => m.default); + }, + get 'custom-property-empty-line-before'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./custom-property-empty-line-before/index.cjs'))).then((m) => m.default); + }, + get 'custom-property-no-missing-var-function'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./custom-property-no-missing-var-function/index.cjs'))).then((m) => m.default); + }, + get 'custom-property-pattern'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./custom-property-pattern/index.cjs'))).then((m) => m.default); + }, + get 'declaration-block-no-duplicate-custom-properties'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./declaration-block-no-duplicate-custom-properties/index.cjs'))).then( + (m) => m.default, + ); + }, + get 'declaration-block-no-duplicate-properties'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./declaration-block-no-duplicate-properties/index.cjs'))).then((m) => m.default); + }, + get 'declaration-block-no-redundant-longhand-properties'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./declaration-block-no-redundant-longhand-properties/index.cjs'))).then( + (m) => m.default, + ); + }, + get 'declaration-block-no-shorthand-property-overrides'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./declaration-block-no-shorthand-property-overrides/index.cjs'))).then( + (m) => m.default, + ); + }, + get 'declaration-block-single-line-max-declarations'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./declaration-block-single-line-max-declarations/index.cjs'))).then( + (m) => m.default, + ); + }, + get 'declaration-empty-line-before'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./declaration-empty-line-before/index.cjs'))).then((m) => m.default); + }, + get 'declaration-no-important'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./declaration-no-important/index.cjs'))).then((m) => m.default); + }, + get 'declaration-property-max-values'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./declaration-property-max-values/index.cjs'))).then((m) => m.default); + }, + get 'declaration-property-unit-allowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./declaration-property-unit-allowed-list/index.cjs'))).then((m) => m.default); + }, + get 'declaration-property-unit-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./declaration-property-unit-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'declaration-property-value-allowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./declaration-property-value-allowed-list/index.cjs'))).then((m) => m.default); + }, + get 'declaration-property-value-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./declaration-property-value-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'declaration-property-value-no-unknown'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./declaration-property-value-no-unknown/index.cjs'))).then((m) => m.default); + }, + get 'font-family-name-quotes'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./font-family-name-quotes/index.cjs'))).then((m) => m.default); + }, + get 'font-family-no-duplicate-names'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./font-family-no-duplicate-names/index.cjs'))).then((m) => m.default); + }, + get 'font-family-no-missing-generic-family-keyword'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./font-family-no-missing-generic-family-keyword/index.cjs'))).then( + (m) => m.default, + ); + }, + get 'font-weight-notation'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./font-weight-notation/index.cjs'))).then((m) => m.default); + }, + get 'function-allowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./function-allowed-list/index.cjs'))).then((m) => m.default); + }, + get 'function-calc-no-unspaced-operator'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./function-calc-no-unspaced-operator/index.cjs'))).then((m) => m.default); + }, + get 'function-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./function-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'function-linear-gradient-no-nonstandard-direction'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./function-linear-gradient-no-nonstandard-direction/index.cjs'))).then( + (m) => m.default, + ); + }, + get 'function-name-case'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./function-name-case/index.cjs'))).then((m) => m.default); + }, + get 'function-no-unknown'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./function-no-unknown/index.cjs'))).then((m) => m.default); + }, + get 'function-url-no-scheme-relative'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./function-url-no-scheme-relative/index.cjs'))).then((m) => m.default); + }, + get 'function-url-quotes'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./function-url-quotes/index.cjs'))).then((m) => m.default); + }, + get 'function-url-scheme-allowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./function-url-scheme-allowed-list/index.cjs'))).then((m) => m.default); + }, + get 'function-url-scheme-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./function-url-scheme-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'hue-degree-notation'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./hue-degree-notation/index.cjs'))).then((m) => m.default); + }, + get 'import-notation'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./import-notation/index.cjs'))).then((m) => m.default); + }, + get 'keyframe-block-no-duplicate-selectors'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./keyframe-block-no-duplicate-selectors/index.cjs'))).then((m) => m.default); + }, + get 'keyframe-declaration-no-important'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./keyframe-declaration-no-important/index.cjs'))).then((m) => m.default); + }, + get 'keyframe-selector-notation'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./keyframe-selector-notation/index.cjs'))).then((m) => m.default); + }, + get 'keyframes-name-pattern'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./keyframes-name-pattern/index.cjs'))).then((m) => m.default); + }, + get 'length-zero-no-unit'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./length-zero-no-unit/index.cjs'))).then((m) => m.default); + }, + get 'max-nesting-depth'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./max-nesting-depth/index.cjs'))).then((m) => m.default); + }, + get 'media-feature-name-allowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./media-feature-name-allowed-list/index.cjs'))).then((m) => m.default); + }, + get 'media-feature-name-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./media-feature-name-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'media-feature-name-no-unknown'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./media-feature-name-no-unknown/index.cjs'))).then((m) => m.default); + }, + get 'media-feature-name-no-vendor-prefix'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./media-feature-name-no-vendor-prefix/index.cjs'))).then((m) => m.default); + }, + get 'media-feature-name-unit-allowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./media-feature-name-unit-allowed-list/index.cjs'))).then((m) => m.default); + }, + get 'media-feature-name-value-allowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./media-feature-name-value-allowed-list/index.cjs'))).then((m) => m.default); + }, + get 'media-feature-name-value-no-unknown'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./media-feature-name-value-no-unknown/index.cjs'))).then((m) => m.default); + }, + get 'media-feature-range-notation'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./media-feature-range-notation/index.cjs'))).then((m) => m.default); + }, + get 'media-query-no-invalid'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./media-query-no-invalid/index.cjs'))).then((m) => m.default); + }, + get 'named-grid-areas-no-invalid'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./named-grid-areas-no-invalid/index.cjs'))).then((m) => m.default); + }, + get 'no-descending-specificity'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./no-descending-specificity/index.cjs'))).then((m) => m.default); + }, + get 'no-duplicate-at-import-rules'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./no-duplicate-at-import-rules/index.cjs'))).then((m) => m.default); + }, + get 'no-duplicate-selectors'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./no-duplicate-selectors/index.cjs'))).then((m) => m.default); + }, + get 'no-empty-source'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./no-empty-source/index.cjs'))).then((m) => m.default); + }, + get 'no-invalid-double-slash-comments'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./no-invalid-double-slash-comments/index.cjs'))).then((m) => m.default); + }, + get 'no-invalid-position-at-import-rule'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./no-invalid-position-at-import-rule/index.cjs'))).then((m) => m.default); + }, + get 'no-irregular-whitespace'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./no-irregular-whitespace/index.cjs'))).then((m) => m.default); + }, + get 'no-unknown-animations'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./no-unknown-animations/index.cjs'))).then((m) => m.default); + }, + get 'no-unknown-custom-properties'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./no-unknown-custom-properties/index.cjs'))).then((m) => m.default); + }, + get 'number-max-precision'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./number-max-precision/index.cjs'))).then((m) => m.default); + }, + get 'property-allowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./property-allowed-list/index.cjs'))).then((m) => m.default); + }, + get 'property-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./property-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'property-no-unknown'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./property-no-unknown/index.cjs'))).then((m) => m.default); + }, + get 'property-no-vendor-prefix'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./property-no-vendor-prefix/index.cjs'))).then((m) => m.default); + }, + get 'rule-empty-line-before'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./rule-empty-line-before/index.cjs'))).then((m) => m.default); + }, + get 'rule-selector-property-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./rule-selector-property-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'selector-anb-no-unmatchable'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-anb-no-unmatchable/index.cjs'))).then((m) => m.default); + }, + get 'selector-attribute-name-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-attribute-name-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'selector-attribute-operator-allowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-attribute-operator-allowed-list/index.cjs'))).then((m) => m.default); + }, + get 'selector-attribute-operator-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-attribute-operator-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'selector-attribute-quotes'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-attribute-quotes/index.cjs'))).then((m) => m.default); + }, + get 'selector-class-pattern'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-class-pattern/index.cjs'))).then((m) => m.default); + }, + get 'selector-combinator-allowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-combinator-allowed-list/index.cjs'))).then((m) => m.default); + }, + get 'selector-combinator-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-combinator-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'selector-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'selector-id-pattern'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-id-pattern/index.cjs'))).then((m) => m.default); + }, + get 'selector-max-attribute'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-max-attribute/index.cjs'))).then((m) => m.default); + }, + get 'selector-max-class'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-max-class/index.cjs'))).then((m) => m.default); + }, + get 'selector-max-combinators'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-max-combinators/index.cjs'))).then((m) => m.default); + }, + get 'selector-max-compound-selectors'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-max-compound-selectors/index.cjs'))).then((m) => m.default); + }, + get 'selector-max-id'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-max-id/index.cjs'))).then((m) => m.default); + }, + get 'selector-max-pseudo-class'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-max-pseudo-class/index.cjs'))).then((m) => m.default); + }, + get 'selector-max-specificity'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-max-specificity/index.cjs'))).then((m) => m.default); + }, + get 'selector-max-type'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-max-type/index.cjs'))).then((m) => m.default); + }, + get 'selector-max-universal'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-max-universal/index.cjs'))).then((m) => m.default); + }, + get 'selector-nested-pattern'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-nested-pattern/index.cjs'))).then((m) => m.default); + }, + get 'selector-no-qualifying-type'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-no-qualifying-type/index.cjs'))).then((m) => m.default); + }, + get 'selector-no-vendor-prefix'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-no-vendor-prefix/index.cjs'))).then((m) => m.default); + }, + get 'selector-not-notation'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-not-notation/index.cjs'))).then((m) => m.default); + }, + get 'selector-pseudo-class-allowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-pseudo-class-allowed-list/index.cjs'))).then((m) => m.default); + }, + get 'selector-pseudo-class-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-pseudo-class-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'selector-pseudo-class-no-unknown'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-pseudo-class-no-unknown/index.cjs'))).then((m) => m.default); + }, + get 'selector-pseudo-element-allowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-pseudo-element-allowed-list/index.cjs'))).then((m) => m.default); + }, + get 'selector-pseudo-element-colon-notation'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-pseudo-element-colon-notation/index.cjs'))).then((m) => m.default); + }, + get 'selector-pseudo-element-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-pseudo-element-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'selector-pseudo-element-no-unknown'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-pseudo-element-no-unknown/index.cjs'))).then((m) => m.default); + }, + get 'selector-type-case'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-type-case/index.cjs'))).then((m) => m.default); + }, + get 'selector-type-no-unknown'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./selector-type-no-unknown/index.cjs'))).then((m) => m.default); + }, + get 'shorthand-property-no-redundant-values'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./shorthand-property-no-redundant-values/index.cjs'))).then((m) => m.default); + }, + get 'string-no-newline'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./string-no-newline/index.cjs'))).then((m) => m.default); + }, + get 'time-min-milliseconds'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./time-min-milliseconds/index.cjs'))).then((m) => m.default); + }, + get 'unit-allowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./unit-allowed-list/index.cjs'))).then((m) => m.default); + }, + get 'unit-disallowed-list'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./unit-disallowed-list/index.cjs'))).then((m) => m.default); + }, + get 'unit-no-unknown'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./unit-no-unknown/index.cjs'))).then((m) => m.default); + }, + get 'value-keyword-case'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./value-keyword-case/index.cjs'))).then((m) => m.default); + }, + get 'value-no-vendor-prefix'() { + return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./value-no-vendor-prefix/index.cjs'))).then((m) => m.default); + }, }; module.exports = rules; diff --git a/lib/rules/index.mjs b/lib/rules/index.mjs index 3ef1dcb456..ca2d4ed0d3 100644 --- a/lib/rules/index.mjs +++ b/lib/rules/index.mjs @@ -1,256 +1,392 @@ -import { createRequire } from 'node:module'; -// @ts-expect-error -- TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. -const require = createRequire(import.meta.url); - -import importLazy from 'import-lazy'; - -/** @type {import('stylelint')['rules']} */ +/** @type {import('stylelint').BuiltInRules} */ const rules = { - 'alpha-value-notation': importLazy(() => require('./alpha-value-notation/index.cjs'))(), - 'annotation-no-unknown': importLazy(() => require('./annotation-no-unknown/index.cjs'))(), - 'at-rule-allowed-list': importLazy(() => require('./at-rule-allowed-list/index.cjs'))(), - 'at-rule-disallowed-list': importLazy(() => require('./at-rule-disallowed-list/index.cjs'))(), - 'at-rule-empty-line-before': importLazy(() => require('./at-rule-empty-line-before/index.cjs'))(), - 'at-rule-no-unknown': importLazy(() => require('./at-rule-no-unknown/index.cjs'))(), - 'at-rule-no-vendor-prefix': importLazy(() => require('./at-rule-no-vendor-prefix/index.cjs'))(), - 'at-rule-property-required-list': importLazy(() => - require('./at-rule-property-required-list/index.cjs'), - )(), - 'block-no-empty': importLazy(() => require('./block-no-empty/index.cjs'))(), - 'color-function-notation': importLazy(() => require('./color-function-notation/index.cjs'))(), - 'color-hex-alpha': importLazy(() => require('./color-hex-alpha/index.cjs'))(), - 'color-hex-length': importLazy(() => require('./color-hex-length/index.cjs'))(), - 'color-named': importLazy(() => require('./color-named/index.cjs'))(), - 'color-no-hex': importLazy(() => require('./color-no-hex/index.cjs'))(), - 'color-no-invalid-hex': importLazy(() => require('./color-no-invalid-hex/index.cjs'))(), - 'comment-empty-line-before': importLazy(() => require('./comment-empty-line-before/index.cjs'))(), - 'comment-no-empty': importLazy(() => require('./comment-no-empty/index.cjs'))(), - 'comment-pattern': importLazy(() => require('./comment-pattern/index.cjs'))(), - 'comment-whitespace-inside': importLazy(() => require('./comment-whitespace-inside/index.cjs'))(), - 'comment-word-disallowed-list': importLazy(() => - require('./comment-word-disallowed-list/index.cjs'), - )(), - 'custom-media-pattern': importLazy(() => require('./custom-media-pattern/index.cjs'))(), - 'custom-property-empty-line-before': importLazy(() => - require('./custom-property-empty-line-before/index.cjs'), - )(), - 'custom-property-no-missing-var-function': importLazy(() => - require('./custom-property-no-missing-var-function/index.cjs'), - )(), - 'custom-property-pattern': importLazy(() => require('./custom-property-pattern/index.cjs'))(), - 'declaration-block-no-duplicate-custom-properties': importLazy(() => - require('./declaration-block-no-duplicate-custom-properties/index.cjs'), - )(), - 'declaration-block-no-duplicate-properties': importLazy(() => - require('./declaration-block-no-duplicate-properties/index.cjs'), - )(), - 'declaration-block-no-redundant-longhand-properties': importLazy(() => - require('./declaration-block-no-redundant-longhand-properties/index.cjs'), - )(), - 'declaration-block-no-shorthand-property-overrides': importLazy(() => - require('./declaration-block-no-shorthand-property-overrides/index.cjs'), - )(), - 'declaration-block-single-line-max-declarations': importLazy(() => - require('./declaration-block-single-line-max-declarations/index.cjs'), - )(), - 'declaration-empty-line-before': importLazy(() => - require('./declaration-empty-line-before/index.cjs'), - )(), - 'declaration-no-important': importLazy(() => require('./declaration-no-important/index.cjs'))(), - 'declaration-property-max-values': importLazy(() => - require('./declaration-property-max-values/index.cjs'), - )(), - 'declaration-property-unit-allowed-list': importLazy(() => - require('./declaration-property-unit-allowed-list/index.cjs'), - )(), - 'declaration-property-unit-disallowed-list': importLazy(() => - require('./declaration-property-unit-disallowed-list/index.cjs'), - )(), - 'declaration-property-value-allowed-list': importLazy(() => - require('./declaration-property-value-allowed-list/index.cjs'), - )(), - 'declaration-property-value-disallowed-list': importLazy(() => - require('./declaration-property-value-disallowed-list/index.cjs'), - )(), - 'declaration-property-value-no-unknown': importLazy(() => - require('./declaration-property-value-no-unknown/index.cjs'), - )(), - 'font-family-no-missing-generic-family-keyword': importLazy(() => - require('./font-family-no-missing-generic-family-keyword/index.cjs'), - )(), - 'font-family-name-quotes': importLazy(() => require('./font-family-name-quotes/index.cjs'))(), - 'font-family-no-duplicate-names': importLazy(() => - require('./font-family-no-duplicate-names/index.cjs'), - )(), - 'font-weight-notation': importLazy(() => require('./font-weight-notation/index.cjs'))(), - 'function-allowed-list': importLazy(() => require('./function-allowed-list/index.cjs'))(), - 'function-calc-no-unspaced-operator': importLazy(() => - require('./function-calc-no-unspaced-operator/index.cjs'), - )(), - - 'function-disallowed-list': importLazy(() => require('./function-disallowed-list/index.cjs'))(), - 'function-linear-gradient-no-nonstandard-direction': importLazy(() => - require('./function-linear-gradient-no-nonstandard-direction/index.cjs'), - )(), - - 'function-name-case': importLazy(() => require('./function-name-case/index.cjs'))(), - 'function-no-unknown': importLazy(() => require('./function-no-unknown/index.cjs'))(), - - 'function-url-no-scheme-relative': importLazy(() => - require('./function-url-no-scheme-relative/index.cjs'), - )(), - 'function-url-quotes': importLazy(() => require('./function-url-quotes/index.cjs'))(), - 'function-url-scheme-allowed-list': importLazy(() => - require('./function-url-scheme-allowed-list/index.cjs'), - )(), - 'function-url-scheme-disallowed-list': importLazy(() => - require('./function-url-scheme-disallowed-list/index.cjs'), - )(), - - 'hue-degree-notation': importLazy(() => require('./hue-degree-notation/index.cjs'))(), - 'import-notation': importLazy(() => require('./import-notation/index.cjs'))(), - 'keyframe-block-no-duplicate-selectors': importLazy(() => - require('./keyframe-block-no-duplicate-selectors/index.cjs'), - )(), - 'keyframe-declaration-no-important': importLazy(() => - require('./keyframe-declaration-no-important/index.cjs'), - )(), - 'keyframe-selector-notation': importLazy(() => - require('./keyframe-selector-notation/index.cjs'), - )(), - 'keyframes-name-pattern': importLazy(() => require('./keyframes-name-pattern/index.cjs'))(), - 'length-zero-no-unit': importLazy(() => require('./length-zero-no-unit/index.cjs'))(), - 'max-nesting-depth': importLazy(() => require('./max-nesting-depth/index.cjs'))(), - 'media-feature-name-allowed-list': importLazy(() => - require('./media-feature-name-allowed-list/index.cjs'), - )(), - 'media-feature-name-disallowed-list': importLazy(() => - require('./media-feature-name-disallowed-list/index.cjs'), - )(), - 'media-feature-name-no-unknown': importLazy(() => - require('./media-feature-name-no-unknown/index.cjs'), - )(), - 'media-feature-name-no-vendor-prefix': importLazy(() => - require('./media-feature-name-no-vendor-prefix/index.cjs'), - )(), - 'media-feature-name-unit-allowed-list': importLazy(() => - require('./media-feature-name-unit-allowed-list/index.cjs'), - )(), - 'media-feature-name-value-allowed-list': importLazy(() => - require('./media-feature-name-value-allowed-list/index.cjs'), - )(), - 'media-feature-name-value-no-unknown': importLazy(() => - require('./media-feature-name-value-no-unknown/index.cjs'), - )(), - 'media-feature-range-notation': importLazy(() => - require('./media-feature-range-notation/index.cjs'), - )(), - - 'media-query-no-invalid': importLazy(() => require('./media-query-no-invalid/index.cjs'))(), - 'named-grid-areas-no-invalid': importLazy(() => - require('./named-grid-areas-no-invalid/index.cjs'), - )(), - 'no-descending-specificity': importLazy(() => require('./no-descending-specificity/index.cjs'))(), - 'no-duplicate-at-import-rules': importLazy(() => - require('./no-duplicate-at-import-rules/index.cjs'), - )(), - 'no-duplicate-selectors': importLazy(() => require('./no-duplicate-selectors/index.cjs'))(), - 'no-empty-source': importLazy(() => require('./no-empty-source/index.cjs'))(), - 'no-invalid-double-slash-comments': importLazy(() => - require('./no-invalid-double-slash-comments/index.cjs'), - )(), - 'no-invalid-position-at-import-rule': importLazy(() => - require('./no-invalid-position-at-import-rule/index.cjs'), - )(), - 'no-irregular-whitespace': importLazy(() => require('./no-irregular-whitespace/index.cjs'))(), - 'no-unknown-animations': importLazy(() => require('./no-unknown-animations/index.cjs'))(), - 'no-unknown-custom-properties': importLazy(() => - require('./no-unknown-custom-properties/index.cjs'), - )(), - 'number-max-precision': importLazy(() => require('./number-max-precision/index.cjs'))(), - 'property-allowed-list': importLazy(() => require('./property-allowed-list/index.cjs'))(), - 'property-disallowed-list': importLazy(() => require('./property-disallowed-list/index.cjs'))(), - 'property-no-unknown': importLazy(() => require('./property-no-unknown/index.cjs'))(), - 'property-no-vendor-prefix': importLazy(() => require('./property-no-vendor-prefix/index.cjs'))(), - 'rule-empty-line-before': importLazy(() => require('./rule-empty-line-before/index.cjs'))(), - 'rule-selector-property-disallowed-list': importLazy(() => - require('./rule-selector-property-disallowed-list/index.cjs'), - )(), - 'selector-anb-no-unmatchable': importLazy(() => - require('./selector-anb-no-unmatchable/index.cjs'), - )(), - 'selector-attribute-name-disallowed-list': importLazy(() => - require('./selector-attribute-name-disallowed-list/index.cjs'), - )(), - 'selector-attribute-operator-allowed-list': importLazy(() => - require('./selector-attribute-operator-allowed-list/index.cjs'), - )(), - 'selector-attribute-operator-disallowed-list': importLazy(() => - require('./selector-attribute-operator-disallowed-list/index.cjs'), - )(), - 'selector-attribute-quotes': importLazy(() => require('./selector-attribute-quotes/index.cjs'))(), - 'selector-class-pattern': importLazy(() => require('./selector-class-pattern/index.cjs'))(), - 'selector-combinator-allowed-list': importLazy(() => - require('./selector-combinator-allowed-list/index.cjs'), - )(), - 'selector-combinator-disallowed-list': importLazy(() => - require('./selector-combinator-disallowed-list/index.cjs'), - )(), - - 'selector-disallowed-list': importLazy(() => require('./selector-disallowed-list/index.cjs'))(), - 'selector-id-pattern': importLazy(() => require('./selector-id-pattern/index.cjs'))(), - - 'selector-max-attribute': importLazy(() => require('./selector-max-attribute/index.cjs'))(), - 'selector-max-class': importLazy(() => require('./selector-max-class/index.cjs'))(), - 'selector-max-combinators': importLazy(() => require('./selector-max-combinators/index.cjs'))(), - 'selector-max-compound-selectors': importLazy(() => - require('./selector-max-compound-selectors/index.cjs'), - )(), - - 'selector-max-id': importLazy(() => require('./selector-max-id/index.cjs'))(), - 'selector-max-pseudo-class': importLazy(() => require('./selector-max-pseudo-class/index.cjs'))(), - 'selector-max-specificity': importLazy(() => require('./selector-max-specificity/index.cjs'))(), - 'selector-max-type': importLazy(() => require('./selector-max-type/index.cjs'))(), - 'selector-max-universal': importLazy(() => require('./selector-max-universal/index.cjs'))(), - 'selector-nested-pattern': importLazy(() => require('./selector-nested-pattern/index.cjs'))(), - 'selector-no-qualifying-type': importLazy(() => - require('./selector-no-qualifying-type/index.cjs'), - )(), - 'selector-no-vendor-prefix': importLazy(() => require('./selector-no-vendor-prefix/index.cjs'))(), - 'selector-not-notation': importLazy(() => require('./selector-not-notation/index.cjs'))(), - 'selector-pseudo-class-allowed-list': importLazy(() => - require('./selector-pseudo-class-allowed-list/index.cjs'), - )(), - 'selector-pseudo-class-disallowed-list': importLazy(() => - require('./selector-pseudo-class-disallowed-list/index.cjs'), - )(), - 'selector-pseudo-class-no-unknown': importLazy(() => - require('./selector-pseudo-class-no-unknown/index.cjs'), - )(), - 'selector-pseudo-element-allowed-list': importLazy(() => - require('./selector-pseudo-element-allowed-list/index.cjs'), - )(), - 'selector-pseudo-element-colon-notation': importLazy(() => - require('./selector-pseudo-element-colon-notation/index.cjs'), - )(), - 'selector-pseudo-element-disallowed-list': importLazy(() => - require('./selector-pseudo-element-disallowed-list/index.cjs'), - )(), - 'selector-pseudo-element-no-unknown': importLazy(() => - require('./selector-pseudo-element-no-unknown/index.cjs'), - )(), - 'selector-type-case': importLazy(() => require('./selector-type-case/index.cjs'))(), - 'selector-type-no-unknown': importLazy(() => require('./selector-type-no-unknown/index.cjs'))(), - 'shorthand-property-no-redundant-values': importLazy(() => - require('./shorthand-property-no-redundant-values/index.cjs'), - )(), - 'string-no-newline': importLazy(() => require('./string-no-newline/index.cjs'))(), - 'time-min-milliseconds': importLazy(() => require('./time-min-milliseconds/index.cjs'))(), - 'unit-allowed-list': importLazy(() => require('./unit-allowed-list/index.cjs'))(), - 'unit-disallowed-list': importLazy(() => require('./unit-disallowed-list/index.cjs'))(), - 'unit-no-unknown': importLazy(() => require('./unit-no-unknown/index.cjs'))(), - 'value-keyword-case': importLazy(() => require('./value-keyword-case/index.cjs'))(), - 'value-no-vendor-prefix': importLazy(() => require('./value-no-vendor-prefix/index.cjs'))(), + get 'alpha-value-notation'() { + return import('./alpha-value-notation/index.mjs').then((m) => m.default); + }, + get 'annotation-no-unknown'() { + return import('./annotation-no-unknown/index.mjs').then((m) => m.default); + }, + get 'at-rule-allowed-list'() { + return import('./at-rule-allowed-list/index.mjs').then((m) => m.default); + }, + get 'at-rule-disallowed-list'() { + return import('./at-rule-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'at-rule-empty-line-before'() { + return import('./at-rule-empty-line-before/index.mjs').then((m) => m.default); + }, + get 'at-rule-no-unknown'() { + return import('./at-rule-no-unknown/index.mjs').then((m) => m.default); + }, + get 'at-rule-no-vendor-prefix'() { + return import('./at-rule-no-vendor-prefix/index.mjs').then((m) => m.default); + }, + get 'at-rule-property-required-list'() { + return import('./at-rule-property-required-list/index.mjs').then((m) => m.default); + }, + get 'block-no-empty'() { + return import('./block-no-empty/index.mjs').then((m) => m.default); + }, + get 'color-function-notation'() { + return import('./color-function-notation/index.mjs').then((m) => m.default); + }, + get 'color-hex-alpha'() { + return import('./color-hex-alpha/index.mjs').then((m) => m.default); + }, + get 'color-hex-length'() { + return import('./color-hex-length/index.mjs').then((m) => m.default); + }, + get 'color-named'() { + return import('./color-named/index.mjs').then((m) => m.default); + }, + get 'color-no-hex'() { + return import('./color-no-hex/index.mjs').then((m) => m.default); + }, + get 'color-no-invalid-hex'() { + return import('./color-no-invalid-hex/index.mjs').then((m) => m.default); + }, + get 'comment-empty-line-before'() { + return import('./comment-empty-line-before/index.mjs').then((m) => m.default); + }, + get 'comment-no-empty'() { + return import('./comment-no-empty/index.mjs').then((m) => m.default); + }, + get 'comment-pattern'() { + return import('./comment-pattern/index.mjs').then((m) => m.default); + }, + get 'comment-whitespace-inside'() { + return import('./comment-whitespace-inside/index.mjs').then((m) => m.default); + }, + get 'comment-word-disallowed-list'() { + return import('./comment-word-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'custom-media-pattern'() { + return import('./custom-media-pattern/index.mjs').then((m) => m.default); + }, + get 'custom-property-empty-line-before'() { + return import('./custom-property-empty-line-before/index.mjs').then((m) => m.default); + }, + get 'custom-property-no-missing-var-function'() { + return import('./custom-property-no-missing-var-function/index.mjs').then((m) => m.default); + }, + get 'custom-property-pattern'() { + return import('./custom-property-pattern/index.mjs').then((m) => m.default); + }, + get 'declaration-block-no-duplicate-custom-properties'() { + return import('./declaration-block-no-duplicate-custom-properties/index.mjs').then( + (m) => m.default, + ); + }, + get 'declaration-block-no-duplicate-properties'() { + return import('./declaration-block-no-duplicate-properties/index.mjs').then((m) => m.default); + }, + get 'declaration-block-no-redundant-longhand-properties'() { + return import('./declaration-block-no-redundant-longhand-properties/index.mjs').then( + (m) => m.default, + ); + }, + get 'declaration-block-no-shorthand-property-overrides'() { + return import('./declaration-block-no-shorthand-property-overrides/index.mjs').then( + (m) => m.default, + ); + }, + get 'declaration-block-single-line-max-declarations'() { + return import('./declaration-block-single-line-max-declarations/index.mjs').then( + (m) => m.default, + ); + }, + get 'declaration-empty-line-before'() { + return import('./declaration-empty-line-before/index.mjs').then((m) => m.default); + }, + get 'declaration-no-important'() { + return import('./declaration-no-important/index.mjs').then((m) => m.default); + }, + get 'declaration-property-max-values'() { + return import('./declaration-property-max-values/index.mjs').then((m) => m.default); + }, + get 'declaration-property-unit-allowed-list'() { + return import('./declaration-property-unit-allowed-list/index.mjs').then((m) => m.default); + }, + get 'declaration-property-unit-disallowed-list'() { + return import('./declaration-property-unit-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'declaration-property-value-allowed-list'() { + return import('./declaration-property-value-allowed-list/index.mjs').then((m) => m.default); + }, + get 'declaration-property-value-disallowed-list'() { + return import('./declaration-property-value-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'declaration-property-value-no-unknown'() { + return import('./declaration-property-value-no-unknown/index.mjs').then((m) => m.default); + }, + get 'font-family-name-quotes'() { + return import('./font-family-name-quotes/index.mjs').then((m) => m.default); + }, + get 'font-family-no-duplicate-names'() { + return import('./font-family-no-duplicate-names/index.mjs').then((m) => m.default); + }, + get 'font-family-no-missing-generic-family-keyword'() { + return import('./font-family-no-missing-generic-family-keyword/index.mjs').then( + (m) => m.default, + ); + }, + get 'font-weight-notation'() { + return import('./font-weight-notation/index.mjs').then((m) => m.default); + }, + get 'function-allowed-list'() { + return import('./function-allowed-list/index.mjs').then((m) => m.default); + }, + get 'function-calc-no-unspaced-operator'() { + return import('./function-calc-no-unspaced-operator/index.mjs').then((m) => m.default); + }, + get 'function-disallowed-list'() { + return import('./function-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'function-linear-gradient-no-nonstandard-direction'() { + return import('./function-linear-gradient-no-nonstandard-direction/index.mjs').then( + (m) => m.default, + ); + }, + get 'function-name-case'() { + return import('./function-name-case/index.mjs').then((m) => m.default); + }, + get 'function-no-unknown'() { + return import('./function-no-unknown/index.mjs').then((m) => m.default); + }, + get 'function-url-no-scheme-relative'() { + return import('./function-url-no-scheme-relative/index.mjs').then((m) => m.default); + }, + get 'function-url-quotes'() { + return import('./function-url-quotes/index.mjs').then((m) => m.default); + }, + get 'function-url-scheme-allowed-list'() { + return import('./function-url-scheme-allowed-list/index.mjs').then((m) => m.default); + }, + get 'function-url-scheme-disallowed-list'() { + return import('./function-url-scheme-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'hue-degree-notation'() { + return import('./hue-degree-notation/index.mjs').then((m) => m.default); + }, + get 'import-notation'() { + return import('./import-notation/index.mjs').then((m) => m.default); + }, + get 'keyframe-block-no-duplicate-selectors'() { + return import('./keyframe-block-no-duplicate-selectors/index.mjs').then((m) => m.default); + }, + get 'keyframe-declaration-no-important'() { + return import('./keyframe-declaration-no-important/index.mjs').then((m) => m.default); + }, + get 'keyframe-selector-notation'() { + return import('./keyframe-selector-notation/index.mjs').then((m) => m.default); + }, + get 'keyframes-name-pattern'() { + return import('./keyframes-name-pattern/index.mjs').then((m) => m.default); + }, + get 'length-zero-no-unit'() { + return import('./length-zero-no-unit/index.mjs').then((m) => m.default); + }, + get 'max-nesting-depth'() { + return import('./max-nesting-depth/index.mjs').then((m) => m.default); + }, + get 'media-feature-name-allowed-list'() { + return import('./media-feature-name-allowed-list/index.mjs').then((m) => m.default); + }, + get 'media-feature-name-disallowed-list'() { + return import('./media-feature-name-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'media-feature-name-no-unknown'() { + return import('./media-feature-name-no-unknown/index.mjs').then((m) => m.default); + }, + get 'media-feature-name-no-vendor-prefix'() { + return import('./media-feature-name-no-vendor-prefix/index.mjs').then((m) => m.default); + }, + get 'media-feature-name-unit-allowed-list'() { + return import('./media-feature-name-unit-allowed-list/index.mjs').then((m) => m.default); + }, + get 'media-feature-name-value-allowed-list'() { + return import('./media-feature-name-value-allowed-list/index.mjs').then((m) => m.default); + }, + get 'media-feature-name-value-no-unknown'() { + return import('./media-feature-name-value-no-unknown/index.mjs').then((m) => m.default); + }, + get 'media-feature-range-notation'() { + return import('./media-feature-range-notation/index.mjs').then((m) => m.default); + }, + get 'media-query-no-invalid'() { + return import('./media-query-no-invalid/index.mjs').then((m) => m.default); + }, + get 'named-grid-areas-no-invalid'() { + return import('./named-grid-areas-no-invalid/index.mjs').then((m) => m.default); + }, + get 'no-descending-specificity'() { + return import('./no-descending-specificity/index.mjs').then((m) => m.default); + }, + get 'no-duplicate-at-import-rules'() { + return import('./no-duplicate-at-import-rules/index.mjs').then((m) => m.default); + }, + get 'no-duplicate-selectors'() { + return import('./no-duplicate-selectors/index.mjs').then((m) => m.default); + }, + get 'no-empty-source'() { + return import('./no-empty-source/index.mjs').then((m) => m.default); + }, + get 'no-invalid-double-slash-comments'() { + return import('./no-invalid-double-slash-comments/index.mjs').then((m) => m.default); + }, + get 'no-invalid-position-at-import-rule'() { + return import('./no-invalid-position-at-import-rule/index.mjs').then((m) => m.default); + }, + get 'no-irregular-whitespace'() { + return import('./no-irregular-whitespace/index.mjs').then((m) => m.default); + }, + get 'no-unknown-animations'() { + return import('./no-unknown-animations/index.mjs').then((m) => m.default); + }, + get 'no-unknown-custom-properties'() { + return import('./no-unknown-custom-properties/index.mjs').then((m) => m.default); + }, + get 'number-max-precision'() { + return import('./number-max-precision/index.mjs').then((m) => m.default); + }, + get 'property-allowed-list'() { + return import('./property-allowed-list/index.mjs').then((m) => m.default); + }, + get 'property-disallowed-list'() { + return import('./property-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'property-no-unknown'() { + return import('./property-no-unknown/index.mjs').then((m) => m.default); + }, + get 'property-no-vendor-prefix'() { + return import('./property-no-vendor-prefix/index.mjs').then((m) => m.default); + }, + get 'rule-empty-line-before'() { + return import('./rule-empty-line-before/index.mjs').then((m) => m.default); + }, + get 'rule-selector-property-disallowed-list'() { + return import('./rule-selector-property-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'selector-anb-no-unmatchable'() { + return import('./selector-anb-no-unmatchable/index.mjs').then((m) => m.default); + }, + get 'selector-attribute-name-disallowed-list'() { + return import('./selector-attribute-name-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'selector-attribute-operator-allowed-list'() { + return import('./selector-attribute-operator-allowed-list/index.mjs').then((m) => m.default); + }, + get 'selector-attribute-operator-disallowed-list'() { + return import('./selector-attribute-operator-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'selector-attribute-quotes'() { + return import('./selector-attribute-quotes/index.mjs').then((m) => m.default); + }, + get 'selector-class-pattern'() { + return import('./selector-class-pattern/index.mjs').then((m) => m.default); + }, + get 'selector-combinator-allowed-list'() { + return import('./selector-combinator-allowed-list/index.mjs').then((m) => m.default); + }, + get 'selector-combinator-disallowed-list'() { + return import('./selector-combinator-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'selector-disallowed-list'() { + return import('./selector-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'selector-id-pattern'() { + return import('./selector-id-pattern/index.mjs').then((m) => m.default); + }, + get 'selector-max-attribute'() { + return import('./selector-max-attribute/index.mjs').then((m) => m.default); + }, + get 'selector-max-class'() { + return import('./selector-max-class/index.mjs').then((m) => m.default); + }, + get 'selector-max-combinators'() { + return import('./selector-max-combinators/index.mjs').then((m) => m.default); + }, + get 'selector-max-compound-selectors'() { + return import('./selector-max-compound-selectors/index.mjs').then((m) => m.default); + }, + get 'selector-max-id'() { + return import('./selector-max-id/index.mjs').then((m) => m.default); + }, + get 'selector-max-pseudo-class'() { + return import('./selector-max-pseudo-class/index.mjs').then((m) => m.default); + }, + get 'selector-max-specificity'() { + return import('./selector-max-specificity/index.mjs').then((m) => m.default); + }, + get 'selector-max-type'() { + return import('./selector-max-type/index.mjs').then((m) => m.default); + }, + get 'selector-max-universal'() { + return import('./selector-max-universal/index.mjs').then((m) => m.default); + }, + get 'selector-nested-pattern'() { + return import('./selector-nested-pattern/index.mjs').then((m) => m.default); + }, + get 'selector-no-qualifying-type'() { + return import('./selector-no-qualifying-type/index.mjs').then((m) => m.default); + }, + get 'selector-no-vendor-prefix'() { + return import('./selector-no-vendor-prefix/index.mjs').then((m) => m.default); + }, + get 'selector-not-notation'() { + return import('./selector-not-notation/index.mjs').then((m) => m.default); + }, + get 'selector-pseudo-class-allowed-list'() { + return import('./selector-pseudo-class-allowed-list/index.mjs').then((m) => m.default); + }, + get 'selector-pseudo-class-disallowed-list'() { + return import('./selector-pseudo-class-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'selector-pseudo-class-no-unknown'() { + return import('./selector-pseudo-class-no-unknown/index.mjs').then((m) => m.default); + }, + get 'selector-pseudo-element-allowed-list'() { + return import('./selector-pseudo-element-allowed-list/index.mjs').then((m) => m.default); + }, + get 'selector-pseudo-element-colon-notation'() { + return import('./selector-pseudo-element-colon-notation/index.mjs').then((m) => m.default); + }, + get 'selector-pseudo-element-disallowed-list'() { + return import('./selector-pseudo-element-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'selector-pseudo-element-no-unknown'() { + return import('./selector-pseudo-element-no-unknown/index.mjs').then((m) => m.default); + }, + get 'selector-type-case'() { + return import('./selector-type-case/index.mjs').then((m) => m.default); + }, + get 'selector-type-no-unknown'() { + return import('./selector-type-no-unknown/index.mjs').then((m) => m.default); + }, + get 'shorthand-property-no-redundant-values'() { + return import('./shorthand-property-no-redundant-values/index.mjs').then((m) => m.default); + }, + get 'string-no-newline'() { + return import('./string-no-newline/index.mjs').then((m) => m.default); + }, + get 'time-min-milliseconds'() { + return import('./time-min-milliseconds/index.mjs').then((m) => m.default); + }, + get 'unit-allowed-list'() { + return import('./unit-allowed-list/index.mjs').then((m) => m.default); + }, + get 'unit-disallowed-list'() { + return import('./unit-disallowed-list/index.mjs').then((m) => m.default); + }, + get 'unit-no-unknown'() { + return import('./unit-no-unknown/index.mjs').then((m) => m.default); + }, + get 'value-keyword-case'() { + return import('./value-keyword-case/index.mjs').then((m) => m.default); + }, + get 'value-no-vendor-prefix'() { + return import('./value-no-vendor-prefix/index.mjs').then((m) => m.default); + }, }; export default rules; diff --git a/lib/standalone.cjs b/lib/standalone.cjs index ab0508f30d..7d1c88a471 100644 --- a/lib/standalone.cjs +++ b/lib/standalone.cjs @@ -3,7 +3,7 @@ 'use strict'; const node_path = require('node:path'); -const node_fs = require('node:fs'); +const fs = require('node:fs'); const process = require('node:process'); const createDebug = require('debug'); const fastGlob = require('fast-glob'); @@ -160,7 +160,7 @@ async function standalone({ const globCWD = (globbyOptions && globbyOptions.cwd) || cwd; const absolutePath = !node_path.isAbsolute(entry) ? node_path.join(globCWD, entry) : node_path.normalize(entry); - if (node_fs.existsSync(absolutePath)) { + if (fs.existsSync(absolutePath)) { // This path points to a file. Return an escaped path to avoid globbing return fastGlob.escapePath(normalizePath(entry)); } diff --git a/lib/utils/__tests__/checkAgainstRule.test.mjs b/lib/utils/__tests__/checkAgainstRule.test.mjs index f3f0c23298..ee620a5340 100644 --- a/lib/utils/__tests__/checkAgainstRule.test.mjs +++ b/lib/utils/__tests__/checkAgainstRule.test.mjs @@ -29,12 +29,12 @@ const mockResult = { }; describe('checkAgainstRule', () => { - it('does nothing with no errors', () => { + it('does nothing with no errors', async () => { const root = postcss.parse('a { color: black }'); const warnings = []; - checkAgainstRule( + await checkAgainstRule( { ruleName: 'color-named', ruleSettings: 'always-where-possible', @@ -46,12 +46,12 @@ describe('checkAgainstRule', () => { expect(warnings).toHaveLength(0); }); - it('handles non-array rule settings', () => { + it('handles non-array rule settings', async () => { const root = postcss.parse('a { color: black }'); const warnings = []; - checkAgainstRule( + await checkAgainstRule( { ruleName: 'color-named', ruleSettings: 'never', @@ -66,12 +66,12 @@ describe('checkAgainstRule', () => { expect(warnings[0].column).toBe(12); }); - it('handles array rule settings', () => { + it('handles array rule settings', async () => { const root = postcss.parse('@import horse.css\n@media {}\n@import dog.css;'); const warnings = []; - checkAgainstRule( + await checkAgainstRule( { ruleName: 'at-rule-empty-line-before', ruleSettings: ['always', { ignoreAtRules: ['media'] }], @@ -86,13 +86,13 @@ describe('checkAgainstRule', () => { expect(warnings[0].column).toBe(1); }); - it('outputs fixed code when provided a context object', () => { + it('outputs fixed code when provided a context object', async () => { const root = postcss.parse('a { top: 0px; }'); const context = { fix: true }; const warnings = []; - checkAgainstRule( + await checkAgainstRule( { ruleName: 'length-zero-no-unit', ruleSettings: true, @@ -106,12 +106,12 @@ describe('checkAgainstRule', () => { expect(root.toString()).toBe('a { top: 0; }'); }); - it('checks against custom rule (passing)', () => { + it('checks against custom rule (passing)', async () => { const root = postcss.parse('.not-empty {}'); const warnings = []; - checkAgainstRule( + await checkAgainstRule( { ruleName: mockRuleName, result: mockResult, @@ -124,12 +124,12 @@ describe('checkAgainstRule', () => { expect(warnings).toHaveLength(0); }); - it('checks against custom rule (failing)', () => { + it('checks against custom rule (failing)', async () => { const root = postcss.parse(''); const warnings = []; - checkAgainstRule( + await checkAgainstRule( { ruleName: mockRuleName, result: mockResult, @@ -145,13 +145,13 @@ describe('checkAgainstRule', () => { expect(warnings[0].column).toBe(1); }); - test('throws when checking against custom rule without result object', () => { - expect(() => { + test('throws when checking against custom rule without result object', async () => { + await expect(async () => { const root = postcss.parse(''); const warnings = []; - checkAgainstRule( + await checkAgainstRule( { ruleName: mockRuleName, ruleSettings: true, @@ -159,6 +159,6 @@ describe('checkAgainstRule', () => { }, (warning) => warnings.push(warning), ); - }).toThrow(`Rule "${mockRuleName}" does not exist`); + }).rejects.toThrow(`Rule "${mockRuleName}" does not exist`); }); }); diff --git a/lib/utils/checkAgainstRule.cjs b/lib/utils/checkAgainstRule.cjs index 85e0bdc701..862f0c77f2 100644 --- a/lib/utils/checkAgainstRule.cjs +++ b/lib/utils/checkAgainstRule.cjs @@ -10,7 +10,7 @@ const normalizeRuleSettings = require('../normalizeRuleSettings.cjs'); /** * @type {import('stylelint').Utils['checkAgainstRule']} */ -function checkAgainstRule(options, callback) { +async function checkAgainstRule(options, callback) { if (!validateTypes.isPlainObject(options)) throw new Error('Expected an options object'); if (!callback) throw new Error('Expected a callback function'); @@ -19,7 +19,7 @@ function checkAgainstRule(options, callback) { if (!ruleName) throw new Error('Expected a "ruleName" option'); - const rule = getStylelintRule(ruleName, result && result.stylelint.config); + const rule = await getStylelintRule(ruleName, result?.stylelint?.config); if (!rule) throw new Error(`Rule "${ruleName}" does not exist`); diff --git a/lib/utils/checkAgainstRule.mjs b/lib/utils/checkAgainstRule.mjs index 96d899e30c..c82c6c8273 100644 --- a/lib/utils/checkAgainstRule.mjs +++ b/lib/utils/checkAgainstRule.mjs @@ -7,7 +7,7 @@ import normalizeRuleSettings from '../normalizeRuleSettings.mjs'; /** * @type {import('stylelint').Utils['checkAgainstRule']} */ -export default function checkAgainstRule(options, callback) { +export default async function checkAgainstRule(options, callback) { if (!isPlainObject(options)) throw new Error('Expected an options object'); if (!callback) throw new Error('Expected a callback function'); @@ -16,7 +16,7 @@ export default function checkAgainstRule(options, callback) { if (!ruleName) throw new Error('Expected a "ruleName" option'); - const rule = getStylelintRule(ruleName, result && result.stylelint.config); + const rule = await getStylelintRule(ruleName, result?.stylelint?.config); if (!rule) throw new Error(`Rule "${ruleName}" does not exist`); diff --git a/lib/utils/getStylelintRule.cjs b/lib/utils/getStylelintRule.cjs index 1b576f0ced..2f829d03ef 100644 --- a/lib/utils/getStylelintRule.cjs +++ b/lib/utils/getStylelintRule.cjs @@ -7,10 +7,22 @@ const index = require('../rules/index.cjs'); /** * @param {string} ruleName * @param {import('stylelint').Config | undefined} [config] - * @returns {import('stylelint').Rule | undefined} + * @returns {Promise} */ function getStylelintRule(ruleName, config) { - return index[ruleName] || (config && config.pluginFunctions && config.pluginFunctions[ruleName]); + if (isBuiltInRule(ruleName)) { + return index[ruleName]; + } + + return Promise.resolve(config?.pluginFunctions?.[ruleName]); +} + +/** + * @param {string} ruleName + * @returns {ruleName is keyof rules} + */ +function isBuiltInRule(ruleName) { + return ruleName in index; } module.exports = getStylelintRule; diff --git a/lib/utils/getStylelintRule.mjs b/lib/utils/getStylelintRule.mjs index 4dd1ae928e..87383c4ec3 100644 --- a/lib/utils/getStylelintRule.mjs +++ b/lib/utils/getStylelintRule.mjs @@ -3,8 +3,20 @@ import rules from '../rules/index.mjs'; /** * @param {string} ruleName * @param {import('stylelint').Config | undefined} [config] - * @returns {import('stylelint').Rule | undefined} + * @returns {Promise} */ export default function getStylelintRule(ruleName, config) { - return rules[ruleName] || (config && config.pluginFunctions && config.pluginFunctions[ruleName]); + if (isBuiltInRule(ruleName)) { + return rules[ruleName]; + } + + return Promise.resolve(config?.pluginFunctions?.[ruleName]); +} + +/** + * @param {string} ruleName + * @returns {ruleName is keyof rules} + */ +function isBuiltInRule(ruleName) { + return ruleName in rules; } diff --git a/package-lock.json b/package-lock.json index 11cfcc616f..7373a9f095 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,6 @@ "globjoin": "^0.1.4", "html-tags": "^3.3.1", "ignore": "^5.2.4", - "import-lazy": "^4.0.0", "imurmurhash": "^0.1.4", "is-plain-object": "^5.0.0", "known-css-properties": "^0.29.0", @@ -7196,6 +7195,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-4.0.0.tgz", "integrity": "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==", + "dev": true, "engines": { "node": ">=8" } diff --git a/package.json b/package.json index 4982ff8f1b..4bddd64415 100644 --- a/package.json +++ b/package.json @@ -161,7 +161,6 @@ "globjoin": "^0.1.4", "html-tags": "^3.3.1", "ignore": "^5.2.4", - "import-lazy": "^4.0.0", "imurmurhash": "^0.1.4", "is-plain-object": "^5.0.0", "known-css-properties": "^0.29.0", diff --git a/patches/import-lazy+4.0.0.patch b/patches/import-lazy+4.0.0.patch deleted file mode 100644 index 0a2724f0ac..0000000000 --- a/patches/import-lazy+4.0.0.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/node_modules/import-lazy/index.d.ts b/node_modules/import-lazy/index.d.ts -index b842b41..4fc7073 100644 ---- a/node_modules/import-lazy/index.d.ts -+++ b/node_modules/import-lazy/index.d.ts -@@ -20,7 +20,7 @@ console.log(stuff.PHI); // => 1.618033 - ``` - */ - declare function importLazy( -- importFn: (moduleId: string) => T --): (moduleId: string) => T; -+ importFn: (moduleId?: string) => T -+): (moduleId?: string) => T; - - export = importLazy; diff --git a/types/stylelint/index.d.ts b/types/stylelint/index.d.ts index af2d05de30..ce8d8623fb 100644 --- a/types/stylelint/index.d.ts +++ b/types/stylelint/index.d.ts @@ -243,6 +243,135 @@ declare namespace stylelint { meta?: RuleMeta; }; + /** @internal */ + type BuiltInRules = { + readonly 'alpha-value-notation': Promise; + readonly 'annotation-no-unknown': Promise; + readonly 'at-rule-allowed-list': Promise; + readonly 'at-rule-disallowed-list': Promise; + readonly 'at-rule-empty-line-before': Promise; + readonly 'at-rule-no-unknown': Promise; + readonly 'at-rule-no-vendor-prefix': Promise; + readonly 'at-rule-property-required-list': Promise; + readonly 'block-no-empty': Promise; + readonly 'color-function-notation': Promise; + readonly 'color-hex-alpha': Promise; + readonly 'color-hex-length': Promise; + readonly 'color-named': Promise; + readonly 'color-no-hex': Promise; + readonly 'color-no-invalid-hex': Promise; + readonly 'comment-empty-line-before': Promise; + readonly 'comment-no-empty': Promise; + readonly 'comment-pattern': Promise; + readonly 'comment-whitespace-inside': Promise; + readonly 'comment-word-disallowed-list': Promise; + readonly 'custom-media-pattern': Promise; + readonly 'custom-property-empty-line-before': Promise; + readonly 'custom-property-no-missing-var-function': Promise; + readonly 'custom-property-pattern': Promise; + readonly 'declaration-block-no-duplicate-custom-properties': Promise; + readonly 'declaration-block-no-duplicate-properties': Promise; + readonly 'declaration-block-no-redundant-longhand-properties': Promise; + readonly 'declaration-block-no-shorthand-property-overrides': Promise; + readonly 'declaration-block-single-line-max-declarations': Promise; + readonly 'declaration-empty-line-before': Promise; + readonly 'declaration-no-important': Promise; + readonly 'declaration-property-max-values': Promise; + readonly 'declaration-property-unit-allowed-list': Promise; + readonly 'declaration-property-unit-disallowed-list': Promise; + readonly 'declaration-property-value-allowed-list': Promise; + readonly 'declaration-property-value-disallowed-list': Promise; + readonly 'declaration-property-value-no-unknown': Promise; + readonly 'font-family-name-quotes': Promise; + readonly 'font-family-no-duplicate-names': Promise; + readonly 'font-family-no-missing-generic-family-keyword': Promise; + readonly 'font-weight-notation': Promise; + readonly 'function-allowed-list': Promise; + readonly 'function-calc-no-unspaced-operator': Promise; + readonly 'function-disallowed-list': Promise; + readonly 'function-linear-gradient-no-nonstandard-direction': Promise; + readonly 'function-name-case': Promise; + readonly 'function-no-unknown': Promise; + readonly 'function-url-no-scheme-relative': Promise; + readonly 'function-url-quotes': Promise; + readonly 'function-url-scheme-allowed-list': Promise; + readonly 'function-url-scheme-disallowed-list': Promise; + readonly 'hue-degree-notation': Promise; + readonly 'import-notation': Promise; + readonly 'keyframe-block-no-duplicate-selectors': Promise; + readonly 'keyframe-declaration-no-important': Promise; + readonly 'keyframe-selector-notation': Promise; + readonly 'keyframes-name-pattern': Promise; + readonly 'length-zero-no-unit': Promise; + readonly 'max-nesting-depth': Promise; + readonly 'media-feature-name-allowed-list': Promise; + readonly 'media-feature-name-disallowed-list': Promise; + readonly 'media-feature-name-no-unknown': Promise; + readonly 'media-feature-name-no-vendor-prefix': Promise; + readonly 'media-feature-name-unit-allowed-list': Promise; + readonly 'media-feature-name-value-allowed-list': Promise; + readonly 'media-feature-name-value-no-unknown': Promise; + readonly 'media-feature-range-notation': Promise; + readonly 'media-query-no-invalid': Promise; + readonly 'named-grid-areas-no-invalid': Promise; + readonly 'no-descending-specificity': Promise; + readonly 'no-duplicate-at-import-rules': Promise; + readonly 'no-duplicate-selectors': Promise; + readonly 'no-empty-source': Promise; + readonly 'no-invalid-double-slash-comments': Promise; + readonly 'no-invalid-position-at-import-rule': Promise; + readonly 'no-irregular-whitespace': Promise; + readonly 'no-unknown-animations': Promise; + readonly 'no-unknown-custom-properties': Promise; + readonly 'number-max-precision': Promise; + readonly 'property-allowed-list': Promise; + readonly 'property-disallowed-list': Promise; + readonly 'property-no-unknown': Promise; + readonly 'property-no-vendor-prefix': Promise; + readonly 'rule-empty-line-before': Promise; + readonly 'rule-selector-property-disallowed-list': Promise; + readonly 'selector-anb-no-unmatchable': Promise; + readonly 'selector-attribute-name-disallowed-list': Promise; + readonly 'selector-attribute-operator-allowed-list': Promise; + readonly 'selector-attribute-operator-disallowed-list': Promise; + readonly 'selector-attribute-quotes': Promise; + readonly 'selector-class-pattern': Promise; + readonly 'selector-combinator-allowed-list': Promise; + readonly 'selector-combinator-disallowed-list': Promise; + readonly 'selector-disallowed-list': Promise; + readonly 'selector-id-pattern': Promise; + readonly 'selector-max-attribute': Promise; + readonly 'selector-max-class': Promise; + readonly 'selector-max-combinators': Promise; + readonly 'selector-max-compound-selectors': Promise; + readonly 'selector-max-id': Promise; + readonly 'selector-max-pseudo-class': Promise; + readonly 'selector-max-specificity': Promise; + readonly 'selector-max-type': Promise; + readonly 'selector-max-universal': Promise; + readonly 'selector-nested-pattern': Promise; + readonly 'selector-no-qualifying-type': Promise; + readonly 'selector-no-vendor-prefix': Promise; + readonly 'selector-not-notation': Promise; + readonly 'selector-pseudo-class-allowed-list': Promise; + readonly 'selector-pseudo-class-disallowed-list': Promise; + readonly 'selector-pseudo-class-no-unknown': Promise; + readonly 'selector-pseudo-element-allowed-list': Promise; + readonly 'selector-pseudo-element-colon-notation': Promise; + readonly 'selector-pseudo-element-disallowed-list': Promise; + readonly 'selector-pseudo-element-no-unknown': Promise; + readonly 'selector-type-case': Promise; + readonly 'selector-type-no-unknown': Promise; + readonly 'shorthand-property-no-redundant-values': Promise; + readonly 'string-no-newline': Promise; + readonly 'time-min-milliseconds': Promise; + readonly 'unit-allowed-list': Promise; + readonly 'unit-disallowed-list': Promise; + readonly 'unit-no-unknown': Promise; + readonly 'value-keyword-case': Promise; + readonly 'value-no-vendor-prefix': Promise; + }; + /** @internal */ type GetPostcssOptions = { code?: string; @@ -645,7 +774,7 @@ type PublicApi = PostCSS.PluginCreator & { /** * Available rules. */ - rules: { [k: string]: stylelint.Rule }; + rules: stylelint.BuiltInRules; /** * Result report formatters by name.