@culur/config-stylelint 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +35 -12
  2. package/README.md +122 -122
  3. package/dist/index.cjs +2 -2
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.js +2 -2
  6. package/dist/index.js.map +1 -1
  7. package/package.json +10 -10
  8. package/src/__tests__/dedent.ts +5 -5
  9. package/src/__tests__/describe-lint-and-fix.ts +61 -0
  10. package/src/__tests__/describe-rule-or-config.ts +73 -0
  11. package/src/__tests__/index.ts +8 -5
  12. package/src/__tests__/mock.ts +36 -36
  13. package/src/__tests__/spy-on-utils-packages.ts +14 -0
  14. package/src/__tests__/syntax.ts +11 -11
  15. package/src/configs/css.test.ts +9 -10
  16. package/src/configs/css.ts +16 -16
  17. package/src/configs/scss.test.ts +8 -9
  18. package/src/configs/scss.ts +11 -11
  19. package/src/configs/shared.test.ts +8 -9
  20. package/src/configs/shared.ts +5 -5
  21. package/src/configs/vue.test.ts +19 -18
  22. package/src/configs/vue.ts +10 -10
  23. package/src/factory.test.ts +16 -15
  24. package/src/factory.ts +23 -23
  25. package/src/index.test.ts +9 -9
  26. package/src/index.ts +3 -3
  27. package/src/rules/at-rule-no-unknown.test.ts +46 -43
  28. package/src/rules/at-rule-no-unknown.ts +33 -33
  29. package/src/rules/declaration-block-no-redundant-longhand-properties.test.ts +41 -38
  30. package/src/rules/declaration-block-no-redundant-longhand-properties.ts +11 -11
  31. package/src/rules/dollar-variable-pattern.test.ts +26 -27
  32. package/src/rules/dollar-variable-pattern.ts +18 -18
  33. package/src/rules/function-no-unknown.test.ts +43 -39
  34. package/src/rules/function-no-unknown.ts +35 -35
  35. package/src/rules/order.test.ts +47 -46
  36. package/src/rules/order.ts +108 -108
  37. package/src/utils/index.ts +1 -1
  38. package/src/utils/utils.test.ts +46 -46
  39. package/src/utils/utils.ts +44 -44
  40. package/src/__tests__/test-lint-and-fix.ts +0 -55
  41. package/src/__tests__/test-rule-or-config-value.ts +0 -68
@@ -0,0 +1,73 @@
1
+ import type { Awaitable } from 'vitest';
2
+ import { afterEach, describe, it, vi } from 'vitest';
3
+ import type { Config, ConfigRuleSettings } from 'stylelint';
4
+ import type { UtilsPackages } from './mock';
5
+ import { hasValues, spyOnUtilsPackages } from './spy-on-utils-packages';
6
+ import type {
7
+ ConfigRulePrimaryOption,
8
+ ConfigRuleSecondaryOptions,
9
+ } from '~/utils';
10
+
11
+ type Fn<
12
+ TTestCase extends UtilsPackages & object,
13
+ TRuleOrConfig extends
14
+ | ConfigRuleSettings<ConfigRulePrimaryOption, ConfigRuleSecondaryOptions>
15
+ | Config,
16
+ > = (
17
+ ruleOrConfig: TRuleOrConfig,
18
+ options: UtilsPackages & TTestCase,
19
+ ) => Promise<void> | void;
20
+
21
+ export function describeRuleOrConfigFactory<
22
+ TBaseRuleOrConfig extends
23
+ | ConfigRuleSettings<ConfigRulePrimaryOption, ConfigRuleSecondaryOptions>
24
+ | Config,
25
+ >(describeName: string) {
26
+ function describeRuleOrConfig<
27
+ TRuleOrConfig extends TBaseRuleOrConfig,
28
+ TTestCase extends UtilsPackages & object,
29
+ >(
30
+ utilsPackages: typeof import('@culur/utils-packages'),
31
+ getRuleOrConfig: (() => Awaitable<TRuleOrConfig>) | TRuleOrConfig,
32
+ ...args:
33
+ | [testCases: TTestCase[], fn: Fn<TTestCase, TRuleOrConfig>]
34
+ | [fn: Fn<TTestCase, TRuleOrConfig>]
35
+ ) {
36
+ const [testCases, fn] =
37
+ args.length === 2 //
38
+ ? [...args]
39
+ : [[{} as UtilsPackages & TTestCase], ...args];
40
+
41
+ const itName =
42
+ hasValues
43
+ .filter(field => testCases.some(t => typeof t[field] === 'boolean'))
44
+ .map(field => `${field} = $${field}`)
45
+ .join(', ') || 'default';
46
+
47
+ describe(describeName, () => {
48
+ afterEach(() => {
49
+ vi.restoreAllMocks();
50
+ });
51
+
52
+ it.each(testCases)(itName, async testCase => {
53
+ spyOnUtilsPackages(utilsPackages, testCase);
54
+
55
+ const ruleOrConfig =
56
+ typeof getRuleOrConfig === 'function'
57
+ ? await getRuleOrConfig()
58
+ : getRuleOrConfig;
59
+
60
+ fn(ruleOrConfig, testCase);
61
+ });
62
+ });
63
+ }
64
+
65
+ return describeRuleOrConfig;
66
+ }
67
+ export const describeConfig = describeRuleOrConfigFactory<Config>('config');
68
+ export const describeRule = describeRuleOrConfigFactory<
69
+ ConfigRuleSettings<
70
+ ConfigRulePrimaryOption, //
71
+ ConfigRuleSecondaryOptions
72
+ >
73
+ >('rule');
@@ -1,5 +1,8 @@
1
- export * from './dedent';
2
- export * from './mock';
3
- export * from './syntax';
4
- export * from './test-rule-or-config-value';
5
- export * from './test-lint-and-fix';
1
+ export * from './dedent';
2
+ export * from './describe-lint-and-fix';
3
+ export * from './describe-rule-or-config';
4
+ // export * from './mock';
5
+ export * from './spy-on-utils-packages';
6
+ export * from './syntax';
7
+ // export * from './test-lint-and-fix';
8
+ // export * from './test-rule-or-config-value';
@@ -1,36 +1,36 @@
1
- import { vi } from 'vitest';
2
-
3
- export type UtilsPackages = Partial<{
4
- hasTailwind: boolean;
5
- hasSass: boolean;
6
- hasVue: boolean;
7
- }>;
8
-
9
- export const defineMockUtilsPackages = (testCases: UtilsPackages[]) => {
10
- const shouldMockUtilsPackages = testCases.some(
11
- t =>
12
- typeof t.hasTailwind === 'boolean' ||
13
- typeof t.hasSass === 'boolean' ||
14
- typeof t.hasVue === 'boolean',
15
- );
16
-
17
- if (shouldMockUtilsPackages) {
18
- vi.mock('@culur/utils-packages');
19
- }
20
-
21
- return async ({ hasTailwind, hasSass, hasVue }: UtilsPackages) => {
22
- if (shouldMockUtilsPackages) {
23
- const utilsPackages = await import('@culur/utils-packages');
24
-
25
- if (typeof hasTailwind === 'boolean') {
26
- utilsPackages.hasTailwind = vi.fn().mockReturnValue(hasTailwind);
27
- }
28
- if (typeof hasSass === 'boolean') {
29
- utilsPackages.hasSass = vi.fn().mockReturnValue(hasSass);
30
- }
31
- if (typeof hasVue === 'boolean') {
32
- utilsPackages.hasVue = vi.fn().mockReturnValue(hasVue);
33
- }
34
- }
35
- };
36
- };
1
+ import { vi } from 'vitest';
2
+
3
+ export type UtilsPackages = Partial<{
4
+ hasTailwind: boolean;
5
+ hasSass: boolean;
6
+ hasVue: boolean;
7
+ }>;
8
+
9
+ export const defineMockUtilsPackages = (testCases: UtilsPackages[]) => {
10
+ const shouldMockUtilsPackages = testCases.some(
11
+ t =>
12
+ typeof t.hasTailwind === 'boolean' ||
13
+ typeof t.hasSass === 'boolean' ||
14
+ typeof t.hasVue === 'boolean',
15
+ );
16
+
17
+ if (shouldMockUtilsPackages) {
18
+ vi.mock('@culur/utils-packages');
19
+ }
20
+
21
+ return async ({ hasTailwind, hasSass, hasVue }: UtilsPackages) => {
22
+ if (shouldMockUtilsPackages) {
23
+ const utilsPackages = await import('@culur/utils-packages');
24
+
25
+ if (typeof hasTailwind === 'boolean') {
26
+ utilsPackages.hasTailwind = vi.fn().mockReturnValue(hasTailwind);
27
+ }
28
+ if (typeof hasSass === 'boolean') {
29
+ utilsPackages.hasSass = vi.fn().mockReturnValue(hasSass);
30
+ }
31
+ if (typeof hasVue === 'boolean') {
32
+ utilsPackages.hasVue = vi.fn().mockReturnValue(hasVue);
33
+ }
34
+ }
35
+ };
36
+ };
@@ -0,0 +1,14 @@
1
+ import { vi } from 'vitest';
2
+ import type { UtilsPackages } from './mock';
3
+
4
+ export const hasValues = ['hasTailwind', 'hasSass', 'hasVue'] as const;
5
+
6
+ export function spyOnUtilsPackages(
7
+ utilsPackages: typeof import('@culur/utils-packages'),
8
+ options: UtilsPackages,
9
+ ) {
10
+ for (const hasValue of hasValues) {
11
+ const value = options[hasValue] ?? false;
12
+ vi.spyOn(utilsPackages, hasValue).mockReturnValue(value);
13
+ }
14
+ }
@@ -1,11 +1,11 @@
1
- import type { Config } from 'stylelint';
2
- import postcssScss from 'postcss-scss';
3
-
4
- type OverrideSyntax = Config['overrides'] extends (infer T)[] | undefined
5
- ? T
6
- : never;
7
-
8
- export const syntaxScss: OverrideSyntax = {
9
- files: ['*.scss', '**/*.scss'],
10
- customSyntax: postcssScss,
11
- };
1
+ import type { Config } from 'stylelint';
2
+ import postcssScss from 'postcss-scss';
3
+
4
+ type OverrideSyntax = Config['overrides'] extends (infer T)[] | undefined
5
+ ? T
6
+ : never;
7
+
8
+ export const syntaxScss: OverrideSyntax = {
9
+ files: ['*.scss', '**/*.scss'],
10
+ customSyntax: postcssScss,
11
+ };
@@ -1,10 +1,9 @@
1
- import { assert, describe } from 'vitest';
2
- import { configCss } from './css';
3
- import { testConfigValue } from '~/__tests__';
4
-
5
- describe('css config', () => {
6
- testConfigValue(configCss, config => {
7
- assert(Array.isArray(config.extends));
8
- assert(Array.isArray(config.plugins));
9
- });
10
- });
1
+ import { assert } from 'vitest';
2
+ import * as utilsPackages from '@culur/utils-packages';
3
+ import { configCss } from './css';
4
+ import { describeConfig } from '~/__tests__';
5
+
6
+ describeConfig(utilsPackages, configCss, config => {
7
+ assert(Array.isArray(config.extends));
8
+ assert(Array.isArray(config.plugins));
9
+ });
@@ -1,16 +1,16 @@
1
- import type { Config } from 'stylelint';
2
- import { atRuleNoUnknownCSS } from '~/rules/at-rule-no-unknown';
3
- import { declarationBlockNoRedundantLonghandProperties } from '~/rules/declaration-block-no-redundant-longhand-properties';
4
- import { functionNoUnknown } from '~/rules/function-no-unknown';
5
- import { order } from '~/rules/order';
6
-
7
- export const configCss = (): Config => ({
8
- extends: ['stylelint-config-standard', 'stylelint-config-clean-order'],
9
- plugins: ['stylelint-order', 'stylelint-selector-bem-pattern'],
10
- rules: {
11
- ...atRuleNoUnknownCSS(),
12
- ...declarationBlockNoRedundantLonghandProperties,
13
- ...functionNoUnknown(),
14
- ...order(),
15
- },
16
- });
1
+ import type { Config } from 'stylelint';
2
+ import { atRuleNoUnknownCSS } from '~/rules/at-rule-no-unknown';
3
+ import { declarationBlockNoRedundantLonghandProperties } from '~/rules/declaration-block-no-redundant-longhand-properties';
4
+ import { functionNoUnknown } from '~/rules/function-no-unknown';
5
+ import { order } from '~/rules/order';
6
+
7
+ export const configCss = (): Config => ({
8
+ extends: ['stylelint-config-standard', 'stylelint-config-clean-order'],
9
+ plugins: ['stylelint-order', 'stylelint-selector-bem-pattern'],
10
+ rules: {
11
+ ...atRuleNoUnknownCSS(),
12
+ ...declarationBlockNoRedundantLonghandProperties,
13
+ ...functionNoUnknown(),
14
+ ...order(),
15
+ },
16
+ });
@@ -1,9 +1,8 @@
1
- import { assert, describe } from 'vitest';
2
- import { configScss } from './scss';
3
- import { testConfigValue } from '~/__tests__';
4
-
5
- describe('scss config', () => {
6
- testConfigValue(configScss, config => {
7
- assert(Array.isArray(config.extends));
8
- });
9
- });
1
+ import * as utilsPackages from '@culur/utils-packages';
2
+ import { assert } from 'vitest';
3
+ import { configScss } from './scss';
4
+ import { describeConfig } from '~/__tests__';
5
+
6
+ describeConfig(utilsPackages, configScss, config => {
7
+ assert(Array.isArray(config.extends));
8
+ });
@@ -1,11 +1,11 @@
1
- import type { Config } from 'stylelint';
2
- import { atRuleNoUnknownSCSS } from '~/rules/at-rule-no-unknown';
3
- import { dollarVariablePatternSCSS } from '~/rules/dollar-variable-pattern';
4
-
5
- export const configScss = (): Config => ({
6
- extends: ['stylelint-config-standard-scss'],
7
- rules: {
8
- ...atRuleNoUnknownSCSS(),
9
- ...dollarVariablePatternSCSS,
10
- },
11
- });
1
+ import type { Config } from 'stylelint';
2
+ import { atRuleNoUnknownSCSS } from '~/rules/at-rule-no-unknown';
3
+ import { dollarVariablePatternSCSS } from '~/rules/dollar-variable-pattern';
4
+
5
+ export const configScss = (): Config => ({
6
+ extends: ['stylelint-config-standard-scss'],
7
+ rules: {
8
+ ...atRuleNoUnknownSCSS(),
9
+ ...dollarVariablePatternSCSS,
10
+ },
11
+ });
@@ -1,9 +1,8 @@
1
- import { assert, describe } from 'vitest';
2
- import { configShared } from './shared';
3
- import { testConfigValue } from '~/__tests__';
4
-
5
- describe('shared config', () => {
6
- testConfigValue(configShared, config => {
7
- assert(Array.isArray(config.extends));
8
- });
9
- });
1
+ import { assert } from 'vitest';
2
+ import * as utilsPackages from '@culur/utils-packages';
3
+ import { configShared } from './shared';
4
+ import { describeConfig } from '~/__tests__';
5
+
6
+ describeConfig(utilsPackages, configShared, config => {
7
+ assert(Array.isArray(config.extends));
8
+ });
@@ -1,5 +1,5 @@
1
- import type { Config } from 'stylelint';
2
-
3
- export const configShared = (): Config => ({
4
- extends: ['stylelint-config-html'],
5
- });
1
+ import type { Config } from 'stylelint';
2
+
3
+ export const configShared = (): Config => ({
4
+ extends: ['stylelint-config-html'],
5
+ });
@@ -1,18 +1,19 @@
1
- import { assert, describe } from 'vitest';
2
- import { configVue } from './vue';
3
- import { testConfigValue } from '~/__tests__';
4
-
5
- describe('vue config', () => {
6
- testConfigValue(
7
- [{ hasSass: true }, { hasSass: false }],
8
- configVue,
9
- (config, options) => {
10
- assert(Array.isArray(config.extends));
11
- config.extends.includes(
12
- options.hasSass
13
- ? 'stylelint-config-standard-vue/scss'
14
- : 'stylelint-config-standard-vue',
15
- );
16
- },
17
- );
18
- });
1
+ import { assert } from 'vitest';
2
+ import * as utilsPackages from '@culur/utils-packages';
3
+ import { configVue } from './vue';
4
+ import { describeConfig } from '~/__tests__';
5
+
6
+ describeConfig(
7
+ utilsPackages,
8
+ configVue,
9
+ [{ hasSass: true }, { hasSass: false }],
10
+ (config, testCase) => {
11
+ assert(Array.isArray(config.extends));
12
+ assert(Array.isArray(config.extends));
13
+ config.extends.includes(
14
+ testCase.hasSass
15
+ ? 'stylelint-config-standard-vue/scss'
16
+ : 'stylelint-config-standard-vue',
17
+ );
18
+ },
19
+ );
@@ -1,10 +1,10 @@
1
- import { hasSass } from '@culur/utils-packages';
2
- import type { Config } from 'stylelint';
3
-
4
- export const configVue = (): Config => ({
5
- extends: [
6
- hasSass()
7
- ? 'stylelint-config-standard-vue/scss'
8
- : 'stylelint-config-standard-vue',
9
- ],
10
- });
1
+ import { hasSass } from '@culur/utils-packages';
2
+ import type { Config } from 'stylelint';
3
+
4
+ export const configVue = (): Config => ({
5
+ extends: [
6
+ hasSass()
7
+ ? 'stylelint-config-standard-vue/scss'
8
+ : 'stylelint-config-standard-vue',
9
+ ],
10
+ });
@@ -1,15 +1,16 @@
1
- import { css, testLintAndFix } from './__tests__';
2
- import defineConfig from './factory';
3
-
4
- testLintAndFix(defineConfig, [
5
- {
6
- code: css`
7
- a {
8
- color: red;
9
- }
10
- `,
11
- hasSass: true,
12
- hasVue: true,
13
- isError: false,
14
- },
15
- ]);
1
+ import * as utilsPackages from '@culur/utils-packages';
2
+ import { css, describeLintAndFix } from './__tests__';
3
+ import defineConfig from './factory';
4
+
5
+ describeLintAndFix(utilsPackages, defineConfig, [
6
+ {
7
+ code: css`
8
+ a {
9
+ color: red;
10
+ }
11
+ `,
12
+ hasSass: true,
13
+ hasVue: true,
14
+ isError: false,
15
+ },
16
+ ]);
package/src/factory.ts CHANGED
@@ -1,23 +1,23 @@
1
- import type { Packages } from '@culur/utils-packages';
2
- import { hasSass, hasVue, updateDefaultPackages } from '@culur/utils-packages';
3
- import type { Config } from 'stylelint';
4
- import { configCss } from './configs/css';
5
- import { configScss } from './configs/scss';
6
- import { configShared } from './configs/shared';
7
- import { configVue } from './configs/vue';
8
- import { mergeConfigs } from './utils';
9
-
10
- export default function defineConfig(
11
- options?: Partial<Packages>,
12
- config?: Config,
13
- ): Config {
14
- updateDefaultPackages(options);
15
-
16
- return mergeConfigs(
17
- configShared(),
18
- configCss(),
19
- hasSass() && configScss(),
20
- hasVue() && configVue(),
21
- config,
22
- );
23
- }
1
+ import type { Packages } from '@culur/utils-packages';
2
+ import { hasSass, hasVue, updateDefaultPackages } from '@culur/utils-packages';
3
+ import type { Config } from 'stylelint';
4
+ import { configCss } from './configs/css';
5
+ import { configScss } from './configs/scss';
6
+ import { configShared } from './configs/shared';
7
+ import { configVue } from './configs/vue';
8
+ import { mergeConfigs } from './utils';
9
+
10
+ export default function defineConfig(
11
+ options?: Partial<Packages>,
12
+ config?: Config,
13
+ ): Config {
14
+ updateDefaultPackages(options);
15
+
16
+ return mergeConfigs(
17
+ configShared(),
18
+ configCss(),
19
+ hasSass() && configScss(),
20
+ hasVue() && configVue(),
21
+ config,
22
+ );
23
+ }
package/src/index.test.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { describe, expectTypeOf, it } from 'vitest';
2
- import type { Config } from 'stylelint';
3
- import defineConfig from '.';
4
-
5
- describe('index', () => {
6
- it('root config', () => {
7
- expectTypeOf(defineConfig).toEqualTypeOf<Config>();
8
- });
9
- });
1
+ import { describe, expectTypeOf, it } from 'vitest';
2
+ import type { Config } from 'stylelint';
3
+ import defineConfig from '.';
4
+
5
+ describe('index', () => {
6
+ it('root config', () => {
7
+ expectTypeOf(defineConfig).toEqualTypeOf<Config>();
8
+ });
9
+ });
package/src/index.ts CHANGED
@@ -1,3 +1,3 @@
1
- import defineConfig from './factory';
2
-
3
- export default defineConfig();
1
+ import defineConfig from './factory';
2
+
3
+ export default defineConfig();
@@ -1,43 +1,46 @@
1
- import { assert, expect } from 'vitest';
2
- import { syntaxScss, testLintAndFix } from '~/__tests__';
3
- import { testRuleValue } from '~/__tests__/test-rule-or-config-value';
4
-
5
- testRuleValue(
6
- [
7
- { hasTailwind: false, length: 0 },
8
- { hasTailwind: true, length: 7 },
9
- ],
10
- async () => {
11
- const module = await import('./at-rule-no-unknown');
12
- return module.atRuleNoUnknownRule();
13
- },
14
- (rule, options) => {
15
- assert(Array.isArray(rule));
16
- assert(typeof rule[1] === 'object');
17
- expect(rule[1].ignoreAtRules).toHaveLength(options.length);
18
- },
19
- );
20
-
21
- testLintAndFix(async () => {
22
- const module = await import('./at-rule-no-unknown');
23
- return {
24
- rules: module.atRuleNoUnknownCSS(),
25
- };
26
- }, [
27
- { hasTailwind: false, code: '@unknown {}', isError: true },
28
- { hasTailwind: false, code: '@media {}', isError: false },
29
- { hasTailwind: true, code: '@tailwind {}', isError: false },
30
- ]);
31
-
32
- testLintAndFix(async () => {
33
- const module = await import('./at-rule-no-unknown');
34
- return {
35
- plugins: ['stylelint-scss'],
36
- rules: module.atRuleNoUnknownSCSS(),
37
- overrides: [syntaxScss],
38
- };
39
- }, [
40
- { ext: 'scss', hasTailwind: false, code: '@unknown {}', isError: true },
41
- { ext: 'scss', hasTailwind: false, code: '@media {}', isError: false },
42
- { ext: 'scss', hasTailwind: true, code: '@tailwind {}', isError: false },
43
- ]);
1
+ import * as utilsPackages from '@culur/utils-packages';
2
+ import { assert, expect } from 'vitest';
3
+ import {
4
+ atRuleNoUnknownCSS,
5
+ atRuleNoUnknownRule,
6
+ atRuleNoUnknownSCSS,
7
+ } from './at-rule-no-unknown';
8
+ import { describeLintAndFix, describeRule, syntaxScss } from '~/__tests__';
9
+
10
+ describeRule(
11
+ utilsPackages,
12
+ atRuleNoUnknownRule,
13
+ [
14
+ { hasTailwind: false, length: 0 },
15
+ { hasTailwind: true, length: 7 },
16
+ ],
17
+ (rule, testCase) => {
18
+ assert(Array.isArray(rule));
19
+ assert(typeof rule[1] === 'object');
20
+ expect(rule[1].ignoreAtRules).toHaveLength(testCase.length);
21
+ },
22
+ );
23
+
24
+ describeLintAndFix(
25
+ utilsPackages, //
26
+ () => ({ rules: atRuleNoUnknownCSS() }),
27
+ [
28
+ { hasTailwind: false, code: '@unknown {}', isError: true },
29
+ { hasTailwind: false, code: '@media {}', isError: false },
30
+ { hasTailwind: true, code: '@tailwind {}', isError: false },
31
+ ],
32
+ );
33
+
34
+ describeLintAndFix(
35
+ utilsPackages,
36
+ () => ({
37
+ plugins: ['stylelint-scss'],
38
+ rules: atRuleNoUnknownSCSS(),
39
+ overrides: [syntaxScss],
40
+ }),
41
+ [
42
+ { ext: 'scss', hasTailwind: false, code: '@unknown {}', isError: true },
43
+ { ext: 'scss', hasTailwind: false, code: '@media {}', isError: false },
44
+ { ext: 'scss', hasTailwind: true, code: '@tailwind {}', isError: false },
45
+ ],
46
+ );
@@ -1,33 +1,33 @@
1
- import { hasTailwind } from '@culur/utils-packages';
2
- import { defineRule, defineRules } from '~/utils';
3
-
4
- // https://tailwindcss.com/docs/functions-and-directives
5
- const directives = [
6
- 'tailwind',
7
- 'layer',
8
- 'apply',
9
- 'config',
10
-
11
- // https://v2.tailwindcss.com/docs/functions-and-directives
12
- // backwards compatible for v2
13
- 'variants',
14
- 'responsive',
15
- 'screen',
16
- ];
17
-
18
- export const atRuleNoUnknownRule = () =>
19
- defineRule<boolean, { ignoreAtRules: (string | RegExp)[] }>([
20
- true,
21
- { ignoreAtRules: hasTailwind() ? directives : [] },
22
- ]);
23
-
24
- export const atRuleNoUnknownCSS = () =>
25
- defineRules({
26
- 'at-rule-no-unknown': atRuleNoUnknownRule(),
27
- });
28
-
29
- export const atRuleNoUnknownSCSS = () =>
30
- defineRules({
31
- 'at-rule-no-unknown': null,
32
- 'scss/at-rule-no-unknown': atRuleNoUnknownRule(),
33
- });
1
+ import { hasTailwind } from '@culur/utils-packages';
2
+ import { defineRule, defineRules } from '~/utils';
3
+
4
+ // https://tailwindcss.com/docs/functions-and-directives
5
+ const directives = [
6
+ 'tailwind',
7
+ 'layer',
8
+ 'apply',
9
+ 'config',
10
+
11
+ // https://v2.tailwindcss.com/docs/functions-and-directives
12
+ // backwards compatible for v2
13
+ 'variants',
14
+ 'responsive',
15
+ 'screen',
16
+ ];
17
+
18
+ export const atRuleNoUnknownRule = () =>
19
+ defineRule<boolean, { ignoreAtRules: (string | RegExp)[] }>([
20
+ true,
21
+ { ignoreAtRules: hasTailwind() ? directives : [] },
22
+ ]);
23
+
24
+ export const atRuleNoUnknownCSS = () =>
25
+ defineRules({
26
+ 'at-rule-no-unknown': atRuleNoUnknownRule(),
27
+ });
28
+
29
+ export const atRuleNoUnknownSCSS = () =>
30
+ defineRules({
31
+ 'at-rule-no-unknown': null,
32
+ 'scss/at-rule-no-unknown': atRuleNoUnknownRule(),
33
+ });