@culur/config-stylelint 1.1.1 → 1.3.0
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.
- package/.stylelintignore +255 -0
- package/CHANGELOG.md +51 -0
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/{chunk-7MXAEVIH.js → chunk-4CDCPLVG.js} +3 -3
- package/dist/{chunk-7MXAEVIH.js.map → chunk-4CDCPLVG.js.map} +1 -1
- package/dist/chunk-6VM4JLMD.cjs +14 -0
- package/dist/{chunk-VILYU6GB.cjs.map → chunk-6VM4JLMD.cjs.map} +1 -1
- package/dist/chunk-ASB7XXVH.cjs +14 -0
- package/dist/{chunk-25GAG7VZ.cjs.map → chunk-ASB7XXVH.cjs.map} +1 -1
- package/dist/{chunk-BUXFTQGN.js → chunk-D5GIA3J2.js} +3 -3
- package/dist/{chunk-BUXFTQGN.js.map → chunk-D5GIA3J2.js.map} +1 -1
- package/dist/chunk-DBVDBZNI.cjs +14 -0
- package/dist/{chunk-OGKNAGXF.cjs.map → chunk-DBVDBZNI.cjs.map} +1 -1
- package/dist/chunk-DQIMRV7D.cjs +14 -0
- package/dist/{chunk-7HEUVQEH.cjs.map → chunk-DQIMRV7D.cjs.map} +1 -1
- package/dist/chunk-F4PRQYTF.cjs +14 -0
- package/dist/{chunk-Y6Z2IDP7.cjs.map → chunk-F4PRQYTF.cjs.map} +1 -1
- package/dist/{chunk-A7OLAKMM.cjs → chunk-GARXFY3Y.cjs} +4 -4
- package/dist/{chunk-A7OLAKMM.cjs.map → chunk-GARXFY3Y.cjs.map} +1 -1
- package/dist/{chunk-C27K4OM4.js → chunk-GLQEXVMX.js} +3 -3
- package/dist/{chunk-C27K4OM4.js.map → chunk-GLQEXVMX.js.map} +1 -1
- package/dist/{chunk-7GVP73HJ.js → chunk-HEFGHOWK.js} +3 -3
- package/dist/{chunk-7GVP73HJ.js.map → chunk-HEFGHOWK.js.map} +1 -1
- package/dist/chunk-HXDUHBH2.cjs +14 -0
- package/dist/{chunk-3EXGA24H.cjs.map → chunk-HXDUHBH2.cjs.map} +1 -1
- package/dist/{chunk-6TFCLJEL.js → chunk-JLYFDT7L.js} +3 -3
- package/dist/{chunk-6TFCLJEL.js.map → chunk-JLYFDT7L.js.map} +1 -1
- package/dist/chunk-MK6HPYUQ.cjs +14 -0
- package/dist/{chunk-C64I73TJ.cjs.map → chunk-MK6HPYUQ.cjs.map} +1 -1
- package/dist/{chunk-DCLB4SF5.cjs → chunk-Q7QKY37B.cjs} +60 -50
- package/dist/chunk-Q7QKY37B.cjs.map +1 -0
- package/dist/{chunk-OHYFOP6B.js → chunk-QDVVH7TK.js} +3 -3
- package/dist/{chunk-OHYFOP6B.js.map → chunk-QDVVH7TK.js.map} +1 -1
- package/dist/{chunk-DHBMZYEQ.js → chunk-R5QD3X2T.js} +3 -3
- package/dist/{chunk-DHBMZYEQ.js.map → chunk-R5QD3X2T.js.map} +1 -1
- package/dist/{chunk-IYMC4Z7C.js → chunk-TMAQPDZS.js} +3 -3
- package/dist/{chunk-IYMC4Z7C.js.map → chunk-TMAQPDZS.js.map} +1 -1
- package/dist/{chunk-RGZTVH2G.js → chunk-YP6HM3ZU.js} +60 -50
- package/dist/chunk-YP6HM3ZU.js.map +1 -0
- package/dist/factory.cjs +2 -2
- package/dist/factory.js +1 -1
- package/dist/{magic-string.es-BDAUG5D5.js → magic-string.es-UBX3LPHW.js} +4 -4
- package/dist/magic-string.es-UBX3LPHW.js.map +1 -0
- package/dist/{magic-string.es-DBGNV4HZ.cjs → magic-string.es-WYIO6UMX.cjs} +4 -4
- package/dist/magic-string.es-WYIO6UMX.cjs.map +1 -0
- package/dist/shareable-configs/auto.cjs +3 -3
- package/dist/shareable-configs/auto.js +2 -2
- package/dist/shareable-configs/none.cjs +3 -3
- package/dist/shareable-configs/none.js +2 -2
- package/dist/shareable-configs/sass-vue.cjs +3 -3
- package/dist/shareable-configs/sass-vue.js +2 -2
- package/dist/shareable-configs/sass.cjs +3 -3
- package/dist/shareable-configs/sass.js +2 -2
- package/dist/shareable-configs/tailwind-sass-vue.cjs +3 -3
- package/dist/shareable-configs/tailwind-sass-vue.js +2 -2
- package/dist/shareable-configs/tailwind-sass.cjs +3 -3
- package/dist/shareable-configs/tailwind-sass.js +2 -2
- package/dist/shareable-configs/tailwind.cjs +3 -3
- package/dist/shareable-configs/tailwind.js +2 -2
- package/dist/shareable-configs/vue.cjs +3 -3
- package/dist/shareable-configs/vue.js +2 -2
- package/package.json +15 -24
- package/src/__tests__/describe-lint-and-fix.ts +2 -2
- package/src/__tests__/describe-rule-or-config.ts +1 -1
- package/src/__tests__/syntax.ts +1 -1
- package/src/configs/css.ts +1 -0
- package/src/rules/order.ts +40 -62
- package/dist/chunk-25GAG7VZ.cjs +0 -14
- package/dist/chunk-3EXGA24H.cjs +0 -14
- package/dist/chunk-7HEUVQEH.cjs +0 -14
- package/dist/chunk-C64I73TJ.cjs +0 -14
- package/dist/chunk-DCLB4SF5.cjs.map +0 -1
- package/dist/chunk-OGKNAGXF.cjs +0 -14
- package/dist/chunk-RGZTVH2G.js.map +0 -1
- package/dist/chunk-VILYU6GB.cjs +0 -14
- package/dist/chunk-Y6Z2IDP7.cjs +0 -14
- package/dist/magic-string.es-BDAUG5D5.js.map +0 -1
- package/dist/magic-string.es-DBGNV4HZ.cjs.map +0 -1
- package/dist/shareable-configs/shareable-configs.test.cjs +0 -15579
- package/dist/shareable-configs/shareable-configs.test.cjs.map +0 -1
- package/dist/shareable-configs/shareable-configs.test.d.cts +0 -2
- package/dist/shareable-configs/shareable-configs.test.d.ts +0 -2
- package/dist/shareable-configs/shareable-configs.test.js +0 -15577
- package/dist/shareable-configs/shareable-configs.test.js.map +0 -1
- package/src/configs/css.test.ts +0 -8
- package/src/configs/scss.test.ts +0 -7
- package/src/configs/shared.test.ts +0 -7
- package/src/configs/vue.test.ts +0 -17
- package/src/factory.test.ts +0 -30
- package/src/rules/at-rule-no-unknown.test.ts +0 -42
- package/src/rules/declaration-block-no-redundant-longhand-properties.test.ts +0 -36
- package/src/rules/dollar-variable-pattern.test.ts +0 -27
- package/src/rules/function-no-unknown.test.ts +0 -40
- package/src/rules/order.test.ts +0 -44
- package/src/shareable-configs/shareable-configs.test.ts +0 -21
- package/src/utils/utils.test.ts +0 -46
package/src/configs/css.test.ts
DELETED
package/src/configs/scss.test.ts
DELETED
package/src/configs/vue.test.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { assert } from 'vitest';
|
|
2
|
-
import { describeConfig } from '~/__tests__';
|
|
3
|
-
import { configVue } from './vue';
|
|
4
|
-
|
|
5
|
-
describeConfig(
|
|
6
|
-
configVue,
|
|
7
|
-
[{ sass: true }, { sass: false }],
|
|
8
|
-
(config, testCase) => {
|
|
9
|
-
assert(Array.isArray(config.extends));
|
|
10
|
-
assert(Array.isArray(config.extends));
|
|
11
|
-
config.extends.includes(
|
|
12
|
-
testCase.sass
|
|
13
|
-
? 'stylelint-config-standard-vue/scss'
|
|
14
|
-
: 'stylelint-config-standard-vue',
|
|
15
|
-
);
|
|
16
|
-
},
|
|
17
|
-
);
|
package/src/factory.test.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { css, describeLintAndFix } from './__tests__';
|
|
2
|
-
import defineConfig from './factory';
|
|
3
|
-
|
|
4
|
-
describeLintAndFix(
|
|
5
|
-
() => defineConfig({ vue: true, sass: true }),
|
|
6
|
-
[
|
|
7
|
-
{
|
|
8
|
-
code: css`
|
|
9
|
-
a {
|
|
10
|
-
color: red;
|
|
11
|
-
}
|
|
12
|
-
`,
|
|
13
|
-
isError: false,
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
describeLintAndFix(
|
|
19
|
-
() => defineConfig(),
|
|
20
|
-
[
|
|
21
|
-
{
|
|
22
|
-
code: css`
|
|
23
|
-
a {
|
|
24
|
-
color: red;
|
|
25
|
-
}
|
|
26
|
-
`,
|
|
27
|
-
isError: false,
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
);
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { assert, expect } from 'vitest';
|
|
2
|
-
import { describeLintAndFix, describeRule, syntaxScss } from '~/__tests__';
|
|
3
|
-
import {
|
|
4
|
-
atRuleNoUnknownCSS,
|
|
5
|
-
atRuleNoUnknownRule,
|
|
6
|
-
atRuleNoUnknownSCSS,
|
|
7
|
-
} from './at-rule-no-unknown';
|
|
8
|
-
|
|
9
|
-
describeRule(
|
|
10
|
-
atRuleNoUnknownRule,
|
|
11
|
-
[
|
|
12
|
-
{ tailwind: false, length: 0 },
|
|
13
|
-
{ tailwind: true, length: 7 },
|
|
14
|
-
],
|
|
15
|
-
(rule, testCase) => {
|
|
16
|
-
assert(Array.isArray(rule));
|
|
17
|
-
assert(typeof rule[1] === 'object');
|
|
18
|
-
expect(rule[1].ignoreAtRules).toHaveLength(testCase.length);
|
|
19
|
-
},
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
describeLintAndFix(
|
|
23
|
-
o => ({ rules: atRuleNoUnknownCSS(o) }),
|
|
24
|
-
[
|
|
25
|
-
{ tailwind: false, code: '@unknown {}', isError: true },
|
|
26
|
-
{ tailwind: false, code: '@media {}', isError: false },
|
|
27
|
-
{ tailwind: true, code: '@tailwind {}', isError: false },
|
|
28
|
-
],
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
describeLintAndFix(
|
|
32
|
-
o => ({
|
|
33
|
-
plugins: ['stylelint-scss'],
|
|
34
|
-
rules: atRuleNoUnknownSCSS(o),
|
|
35
|
-
overrides: [syntaxScss],
|
|
36
|
-
}),
|
|
37
|
-
[
|
|
38
|
-
{ ext: 'scss', tailwind: false, code: '@unknown {}', isError: true },
|
|
39
|
-
{ ext: 'scss', tailwind: false, code: '@media {}', isError: false },
|
|
40
|
-
{ ext: 'scss', tailwind: true, code: '@tailwind {}', isError: false },
|
|
41
|
-
],
|
|
42
|
-
);
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { assert, expect } from 'vitest';
|
|
2
|
-
import { css, describeLintAndFix, describeRule } from '~/__tests__';
|
|
3
|
-
import {
|
|
4
|
-
declarationBlockNoRedundantLonghandProperties,
|
|
5
|
-
declarationBlockNoRedundantLonghandPropertiesRule,
|
|
6
|
-
} from './declaration-block-no-redundant-longhand-properties';
|
|
7
|
-
|
|
8
|
-
describeRule(
|
|
9
|
-
declarationBlockNoRedundantLonghandPropertiesRule, //
|
|
10
|
-
rule => {
|
|
11
|
-
assert(Array.isArray(rule));
|
|
12
|
-
assert(typeof rule[1] === 'object');
|
|
13
|
-
expect(rule[1].ignoreShorthands).toHaveLength(1);
|
|
14
|
-
},
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
describeLintAndFix(
|
|
18
|
-
{ rules: declarationBlockNoRedundantLonghandProperties }, //
|
|
19
|
-
[
|
|
20
|
-
{
|
|
21
|
-
code: css`
|
|
22
|
-
a {
|
|
23
|
-
margin-top: 1px;
|
|
24
|
-
margin-right: 2px;
|
|
25
|
-
margin-bottom: 3px;
|
|
26
|
-
margin-left: 4px;
|
|
27
|
-
}
|
|
28
|
-
`,
|
|
29
|
-
fixedCode: css`
|
|
30
|
-
a {
|
|
31
|
-
margin: 1px 2px 3px 4px;
|
|
32
|
-
}
|
|
33
|
-
`,
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { assert, expectTypeOf } from 'vitest';
|
|
2
|
-
import { describeLintAndFix, describeRule, scss } from '~/__tests__';
|
|
3
|
-
import {
|
|
4
|
-
dollarVariablePatternRule,
|
|
5
|
-
dollarVariablePatternSCSS,
|
|
6
|
-
} from './dollar-variable-pattern';
|
|
7
|
-
|
|
8
|
-
describeRule(
|
|
9
|
-
dollarVariablePatternRule, //
|
|
10
|
-
rule => {
|
|
11
|
-
assert(Array.isArray(rule));
|
|
12
|
-
assert(typeof rule[1] === 'object');
|
|
13
|
-
expectTypeOf(rule[1].message).toBeString();
|
|
14
|
-
},
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
describeLintAndFix(
|
|
18
|
-
{
|
|
19
|
-
extends: ['stylelint-config-standard-scss'],
|
|
20
|
-
rules: dollarVariablePatternSCSS,
|
|
21
|
-
},
|
|
22
|
-
[
|
|
23
|
-
{ isError: false, code: scss`a { $kebab-case: 123; }` },
|
|
24
|
-
{ isError: true, code: scss`a { $snake_case: 123; }` },
|
|
25
|
-
{ isError: true, code: scss`a { $camelCase: 123; }` },
|
|
26
|
-
],
|
|
27
|
-
);
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { assert, expect } from 'vitest';
|
|
2
|
-
import { describeLintAndFix, describeRule } from '~/__tests__';
|
|
3
|
-
import {
|
|
4
|
-
functionNoUnknown,
|
|
5
|
-
functionNoUnknownRule,
|
|
6
|
-
} from './function-no-unknown';
|
|
7
|
-
|
|
8
|
-
describeRule(
|
|
9
|
-
functionNoUnknownRule,
|
|
10
|
-
[
|
|
11
|
-
{ tailwind: true, sass: false, vue: false, length: 2 },
|
|
12
|
-
{ tailwind: false, sass: true, vue: false, length: 1 },
|
|
13
|
-
{ tailwind: false, sass: false, vue: true, length: 1 },
|
|
14
|
-
],
|
|
15
|
-
(rule, options) => {
|
|
16
|
-
assert(Array.isArray(rule));
|
|
17
|
-
assert(typeof rule[1] === 'object');
|
|
18
|
-
expect(rule[1].ignoreFunctions).toHaveLength(options.length);
|
|
19
|
-
},
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
describeLintAndFix(
|
|
23
|
-
o => ({ rules: functionNoUnknown(o) }),
|
|
24
|
-
[
|
|
25
|
-
{
|
|
26
|
-
isError: true,
|
|
27
|
-
code: 'a { color: unknown(1); }',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
tailwind: true,
|
|
31
|
-
isError: false,
|
|
32
|
-
code: 'a { color: theme(colors.blue.500); }',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
vue: true,
|
|
36
|
-
isError: false,
|
|
37
|
-
code: 'a { color: v-bind(colors); }',
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
);
|
package/src/rules/order.test.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { assert, expect } from 'vitest';
|
|
2
|
-
import { describeLintAndFix, describeRule, scss } from '~/__tests__';
|
|
3
|
-
import { order, orderRule } from './order';
|
|
4
|
-
|
|
5
|
-
describeRule(
|
|
6
|
-
orderRule,
|
|
7
|
-
[
|
|
8
|
-
{ tailwind: false, sass: false, length: 8 },
|
|
9
|
-
{ tailwind: true, sass: false, length: 15 },
|
|
10
|
-
{ tailwind: false, sass: true, length: 16 },
|
|
11
|
-
{ tailwind: true, sass: true, length: 23 },
|
|
12
|
-
],
|
|
13
|
-
(rule, testCase) => {
|
|
14
|
-
assert(Array.isArray(rule));
|
|
15
|
-
|
|
16
|
-
assert(Array.isArray(rule[0]));
|
|
17
|
-
expect(rule[0]).toHaveLength(testCase.length);
|
|
18
|
-
|
|
19
|
-
assert(typeof rule[1] === 'object');
|
|
20
|
-
expect(rule[1]).toStrictEqual({ unspecified: 'bottom' });
|
|
21
|
-
},
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
describeLintAndFix(
|
|
25
|
-
o => ({
|
|
26
|
-
plugins: ['stylelint-order'],
|
|
27
|
-
rules: order(o),
|
|
28
|
-
}),
|
|
29
|
-
[
|
|
30
|
-
{
|
|
31
|
-
tailwind: false,
|
|
32
|
-
sass: false,
|
|
33
|
-
code: scss`
|
|
34
|
-
a {
|
|
35
|
-
$variable: 1px;
|
|
36
|
-
--property: 3px;
|
|
37
|
-
@variable: 2px;
|
|
38
|
-
width: 4px;
|
|
39
|
-
}
|
|
40
|
-
`,
|
|
41
|
-
isError: false,
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { expectTypeOf, it } from 'vitest';
|
|
2
|
-
import type { Config } from 'stylelint';
|
|
3
|
-
import autoConfig from './auto';
|
|
4
|
-
import noneConfig from './none';
|
|
5
|
-
import sassConfig from './sass';
|
|
6
|
-
import sassVueConfig from './sass-vue';
|
|
7
|
-
import tailwindConfig from './tailwind';
|
|
8
|
-
import tailwindSassConfig from './tailwind-sass';
|
|
9
|
-
import tailwindSassVueConfig from './tailwind-sass-vue';
|
|
10
|
-
import vueConfig from './vue';
|
|
11
|
-
|
|
12
|
-
it('shareable configs', () => {
|
|
13
|
-
expectTypeOf(autoConfig).toEqualTypeOf<Config>();
|
|
14
|
-
expectTypeOf(noneConfig).toEqualTypeOf<Config>();
|
|
15
|
-
expectTypeOf(sassVueConfig).toEqualTypeOf<Config>();
|
|
16
|
-
expectTypeOf(sassConfig).toEqualTypeOf<Config>();
|
|
17
|
-
expectTypeOf(tailwindSassVueConfig).toEqualTypeOf<Config>();
|
|
18
|
-
expectTypeOf(tailwindSassConfig).toEqualTypeOf<Config>();
|
|
19
|
-
expectTypeOf(tailwindConfig).toEqualTypeOf<Config>();
|
|
20
|
-
expectTypeOf(vueConfig).toEqualTypeOf<Config>();
|
|
21
|
-
});
|
package/src/utils/utils.test.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { assert, describe, expect, expectTypeOf, it } from 'vitest';
|
|
2
|
-
import { defineRule, defineRules, mergeConfigs } from './utils';
|
|
3
|
-
|
|
4
|
-
describe('rules', () => {
|
|
5
|
-
it('defineRule & rules', () => {
|
|
6
|
-
type PrimaryOption = true;
|
|
7
|
-
interface SecondaryOptions {
|
|
8
|
-
ignore: ['comments'];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const blockNoEmptyRule = defineRule<PrimaryOption, SecondaryOptions>([
|
|
12
|
-
true,
|
|
13
|
-
{ ignore: ['comments'] },
|
|
14
|
-
]);
|
|
15
|
-
const blockNoEmpty = defineRules({ 'block-no-empty': blockNoEmptyRule });
|
|
16
|
-
|
|
17
|
-
assert(Array.isArray(blockNoEmptyRule));
|
|
18
|
-
expectTypeOf(blockNoEmpty).toBeObject();
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
describe('merge configs', () => {
|
|
23
|
-
it('should merge plugins', () => {
|
|
24
|
-
const mergedConfigs = mergeConfigs(
|
|
25
|
-
{ plugins: ['plugin-a'] }, //
|
|
26
|
-
{ plugins: ['plugin-b'] },
|
|
27
|
-
{ plugins: [] },
|
|
28
|
-
{},
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
assert(Array.isArray(mergedConfigs.plugins));
|
|
32
|
-
expect(mergedConfigs.plugins).toHaveLength(2);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should merge overrides', () => {
|
|
36
|
-
const mergedConfigs = mergeConfigs(
|
|
37
|
-
{ overrides: [{ files: 'a.css' }] },
|
|
38
|
-
{ overrides: [{ files: 'b.css' }] },
|
|
39
|
-
{ overrides: [] },
|
|
40
|
-
{},
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
assert(Array.isArray(mergedConfigs.overrides));
|
|
44
|
-
expect(mergedConfigs.overrides).toHaveLength(2);
|
|
45
|
-
});
|
|
46
|
-
});
|