skyux-stylelint 12.20.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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # skyux-stylelint (Experimental)
2
+
3
+ Stylelint rules for SKY UX projects.
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "skyux-stylelint",
3
+ "version": "12.20.0",
4
+ "author": "Blackbaud, Inc.",
5
+ "description": "Stylelint plugin for SKY UX projects",
6
+ "type": "module",
7
+ "main": "./src/index.js",
8
+ "keywords": [
9
+ "blackbaud",
10
+ "skyux"
11
+ ],
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/blackbaud/skyux.git"
16
+ },
17
+ "bugs": {
18
+ "url": "https://github.com/blackbaud/skyux/issues"
19
+ },
20
+ "homepage": "https://github.com/blackbaud/skyux#readme",
21
+ "ng-add": {
22
+ "save": "devDependencies"
23
+ },
24
+ "dependencies": {
25
+ "tslib": "^2.8.1"
26
+ },
27
+ "peerDependencies": {
28
+ "stylelint": "^16.20.0"
29
+ },
30
+ "sideEffects": false,
31
+ "types": "./src/index.d.ts",
32
+ "module": "./src/index.js"
33
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const _default: import("node_modules/stylelint/types/stylelint/index.js").Plugin[];
2
+ export default _default;
package/src/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import noSkySelectors from './rules/no-sky-selectors.js';
2
+ export default [noSkySelectors];
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/sdk/skyux-stylelint/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,6BAA6B,CAAC;AAEzD,eAAe,CAAC,cAAc,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import stylelint from 'stylelint';
2
+ export declare const ruleName: string;
3
+ declare const _default: stylelint.Plugin;
4
+ export default _default;
@@ -0,0 +1,37 @@
1
+ import stylelint from 'stylelint';
2
+ import { getRuleMeta } from '../utility/meta.js';
3
+ import { withNamespace } from '../utility/namespace.js';
4
+ const ruleId = 'no-sky-selectors';
5
+ export const ruleName = withNamespace(ruleId);
6
+ const messages = stylelint.utils.ruleMessages(ruleName, {
7
+ rejected: () => 'Do not reference SKY UX classes, IDs, or components in stylesheets',
8
+ });
9
+ const ruleBase = (options) => {
10
+ return (root, result) => {
11
+ const validOptions = stylelint.utils.validateOptions(result, ruleName, {
12
+ actual: options,
13
+ possible: [true],
14
+ });
15
+ if (!validOptions) {
16
+ return;
17
+ }
18
+ root.walkRules((ruleNode) => {
19
+ const { selector } = ruleNode;
20
+ // Disallow classes, IDs, or components starting with sky-, skyux-, or skypages-
21
+ if (/(^|[.#\s])sky(pages|ux)?-/.test(selector)) {
22
+ stylelint.utils.report({
23
+ result,
24
+ ruleName,
25
+ message: messages.rejected(),
26
+ node: ruleNode,
27
+ });
28
+ }
29
+ });
30
+ };
31
+ };
32
+ const rule = ruleBase;
33
+ rule.messages = messages;
34
+ rule.meta = getRuleMeta({ ruleId });
35
+ rule.ruleName = ruleName;
36
+ export default stylelint.createPlugin(ruleName, rule);
37
+ //# sourceMappingURL=no-sky-selectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-sky-selectors.js","sourceRoot":"","sources":["../../../../../../libs/sdk/skyux-stylelint/src/rules/no-sky-selectors.ts"],"names":[],"mappings":"AAAA,OAAO,SAA6B,MAAM,WAAW,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,MAAM,GAAG,kBAAkB,CAAC;AAClC,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;AAE9C,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE;IACtD,QAAQ,EAAE,GAAG,EAAE,CACb,oEAAoE;CACvE,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAa,CAAC,OAAO,EAAE,EAAE;IACrC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;QACtB,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE;YACrE,MAAM,EAAE,OAAO;YACf,QAAQ,EAAE,CAAC,IAAI,CAAC;SACjB,CAAC,CAAC;QAEH,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC1B,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC;YAE9B,gFAAgF;YAChF,IAAI,2BAA2B,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/C,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;oBACrB,MAAM;oBACN,QAAQ;oBACR,OAAO,EAAE,QAAQ,CAAC,QAAQ,EAAE;oBAC5B,IAAI,EAAE,QAAQ;iBACf,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,IAAI,GAAG,QAAgB,CAAC;AAE9B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;AACpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAEzB,eAAe,SAAS,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,260 @@
1
+ import { describe } from 'vitest';
2
+ import { testRule } from '../testing/test-rule.js';
3
+ import plugin, { ruleName } from './no-sky-selectors.js';
4
+ describe(ruleName, () => {
5
+ testRule({
6
+ plugins: [plugin],
7
+ ruleName,
8
+ config: true,
9
+ accept: [
10
+ {
11
+ code: '.my-class { color: red; }',
12
+ description: 'non-sky class names are allowed',
13
+ },
14
+ {
15
+ code: '.my-sky-blue { color: blue; }',
16
+ description: 'custom classes with "sky" in the middle are allowed',
17
+ },
18
+ {
19
+ code: '.component-sky { color: red; }',
20
+ description: 'classes ending with "sky" are allowed',
21
+ },
22
+ {
23
+ code: '.skycomponent { color: red; }',
24
+ description: 'classes with "sky" not followed by dash are allowed',
25
+ },
26
+ {
27
+ code: 'div { color: red; }',
28
+ description: 'regular element selectors are allowed',
29
+ },
30
+ {
31
+ code: '[data-sky-element] { color: red; }',
32
+ description: 'attribute selectors are allowed',
33
+ },
34
+ {
35
+ code: '.my-class .other-class { margin: 10px; }',
36
+ description: 'complex selectors without sky- patterns are allowed',
37
+ },
38
+ {
39
+ code: '/* .sky-component would be invalid */',
40
+ description: 'comments containing sky- are allowed',
41
+ },
42
+ {
43
+ code: '@media (min-width: 768px) { .my-class { color: red; } }',
44
+ description: 'media queries with non-sky classes are allowed',
45
+ },
46
+ {
47
+ code: '.blue-sky-theme { background: blue; }',
48
+ description: 'classes with sky not at word boundary are allowed',
49
+ },
50
+ {
51
+ code: '.myskyux-custom { color: blue; }',
52
+ description: 'classes with skyux not at word boundary are allowed',
53
+ },
54
+ {
55
+ code: '.myskypages-custom { color: green; }',
56
+ description: 'classes with skypages not at word boundary are allowed',
57
+ },
58
+ ],
59
+ reject: [
60
+ {
61
+ code: '.sky-component { color: red; }',
62
+ description: 'basic .sky- class selector should be rejected',
63
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
64
+ line: 1,
65
+ column: 1,
66
+ },
67
+ {
68
+ code: '.skyux-button { margin: 10px; }',
69
+ description: '.skyux- class selector should be rejected',
70
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
71
+ line: 1,
72
+ column: 1,
73
+ },
74
+ {
75
+ code: '.skypages-layout { padding: 5px; }',
76
+ description: '.skypages- class selector should be rejected',
77
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
78
+ line: 1,
79
+ column: 1,
80
+ },
81
+ {
82
+ code: '#sky-component { color: red; }',
83
+ description: '#sky- ID selector should be rejected',
84
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
85
+ line: 1,
86
+ column: 1,
87
+ },
88
+ {
89
+ code: '#skyux-button { margin: 10px; }',
90
+ description: '#skyux- ID selector should be rejected',
91
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
92
+ line: 1,
93
+ column: 1,
94
+ },
95
+ {
96
+ code: '#skypages-layout { padding: 5px; }',
97
+ description: '#skypages- ID selector should be rejected',
98
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
99
+ line: 1,
100
+ column: 1,
101
+ },
102
+ {
103
+ code: 'sky-component { color: red; }',
104
+ description: 'sky- element selector should be rejected',
105
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
106
+ line: 1,
107
+ column: 1,
108
+ },
109
+ {
110
+ code: 'skyux-button { margin: 10px; }',
111
+ description: 'skyux- element selector should be rejected',
112
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
113
+ line: 1,
114
+ column: 1,
115
+ },
116
+ {
117
+ code: 'skypages-layout { padding: 5px; }',
118
+ description: 'skypages- element selector should be rejected',
119
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
120
+ line: 1,
121
+ column: 1,
122
+ },
123
+ {
124
+ code: '.my-class .sky-button { margin: 10px; }',
125
+ description: 'complex selector with .sky- class should be rejected',
126
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
127
+ line: 1,
128
+ column: 1,
129
+ },
130
+ {
131
+ code: '.sky-component.sky-active { color: blue; }',
132
+ description: 'multiple .sky- classes in one selector should be rejected',
133
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
134
+ line: 1,
135
+ column: 1,
136
+ },
137
+ {
138
+ code: '.sky-button:hover { background: blue; }',
139
+ description: 'pseudo-class with .sky- class should be rejected',
140
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
141
+ line: 1,
142
+ column: 1,
143
+ },
144
+ {
145
+ code: '.sky-button::before { content: ""; }',
146
+ description: 'pseudo-element with .sky- class should be rejected',
147
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
148
+ line: 1,
149
+ column: 1,
150
+ },
151
+ {
152
+ code: 'div .sky-component span { font-weight: bold; }',
153
+ description: 'descendant selector with .sky- class should be rejected',
154
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
155
+ line: 1,
156
+ column: 1,
157
+ },
158
+ {
159
+ code: '.sky-component > .child { padding: 5px; }',
160
+ description: 'child combinator with .sky- class should be rejected',
161
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
162
+ line: 1,
163
+ column: 1,
164
+ },
165
+ {
166
+ code: 'div sky-element span { font-weight: bold; }',
167
+ description: 'descendant selector with sky- element should be rejected',
168
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
169
+ line: 1,
170
+ column: 1,
171
+ },
172
+ {
173
+ code: '#container .skyux-form { background: white; }',
174
+ description: 'ID and .skyux- class combination should be rejected',
175
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
176
+ line: 1,
177
+ column: 1,
178
+ },
179
+ {
180
+ code: '@media (min-width: 768px) { .sky-component { color: red; } }',
181
+ description: '.sky- class inside media query should be rejected',
182
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
183
+ line: 1,
184
+ column: 29,
185
+ },
186
+ ],
187
+ });
188
+ testRule({
189
+ plugins: [plugin],
190
+ ruleName,
191
+ config: null,
192
+ accept: [
193
+ {
194
+ code: '.sky-component { color: red; }',
195
+ description: 'should not validate when rule is disabled',
196
+ },
197
+ {
198
+ code: 'sky-element { margin: 10px; }',
199
+ description: 'should not validate sky- elements when rule is disabled',
200
+ },
201
+ {
202
+ code: '#skyux-id { padding: 5px; }',
203
+ description: 'should not validate skyux- IDs when rule is disabled',
204
+ },
205
+ ],
206
+ });
207
+ testRule({
208
+ plugins: [plugin],
209
+ ruleName,
210
+ config: 'some-invalid-value',
211
+ reject: [
212
+ {
213
+ code: '.sky-component { color: red; }',
214
+ description: 'should not validate when config invalid',
215
+ message: `Invalid option value "some-invalid-value" for rule "${ruleName}"`,
216
+ },
217
+ ],
218
+ });
219
+ // Test multiple violations in one file
220
+ testRule({
221
+ plugins: [plugin],
222
+ ruleName,
223
+ config: true,
224
+ reject: [
225
+ {
226
+ code: `
227
+ .sky-component { color: red; }
228
+ .my-class { margin: 10px; }
229
+ .skyux-button { padding: 5px; }
230
+ #skypages-header {}
231
+ sky-element { display: block; }
232
+ `,
233
+ description: 'multiple sky violations in different rules',
234
+ warnings: [
235
+ {
236
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
237
+ line: 2,
238
+ column: 11,
239
+ },
240
+ {
241
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
242
+ line: 4,
243
+ column: 11,
244
+ },
245
+ {
246
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
247
+ line: 5,
248
+ column: 11,
249
+ },
250
+ {
251
+ message: 'Do not reference SKY UX classes, IDs, or components in stylesheets',
252
+ line: 6,
253
+ column: 11,
254
+ },
255
+ ],
256
+ },
257
+ ],
258
+ });
259
+ });
260
+ //# sourceMappingURL=no-sky-selectors.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-sky-selectors.test.js","sourceRoot":"","sources":["../../../../../../libs/sdk/skyux-stylelint/src/rules/no-sky-selectors.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEzD,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,QAAQ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;gBACE,IAAI,EAAE,6BAA6B;gBACnC,WAAW,EAAE,sDAAsD;aACpE;SACF;KACF,CAAC,CAAC;IAEH,QAAQ,CAAC;QACP,OAAO,EAAE,CAAC,MAAM,CAAC;QACjB,QAAQ;QACR,MAAM,EAAE,oBAAoB;QAC5B,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,gCAAgC;gBACtC,WAAW,EAAE,yCAAyC;gBACtD,OAAO,EAAE,uDAAuD,QAAQ,GAAG;aAC5E;SACF;KACF,CAAC,CAAC;IAEH,uCAAuC;IACvC,QAAQ,CAAC;QACP,OAAO,EAAE,CAAC,MAAM,CAAC;QACjB,QAAQ;QACR,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE;YACN;gBACE,IAAI,EAAE;;;;;;SAML;gBACD,WAAW,EAAE,4CAA4C;gBACzD,QAAQ,EAAE;oBACR;wBACE,OAAO,EACL,oEAAoE;wBACtE,IAAI,EAAE,CAAC;wBACP,MAAM,EAAE,EAAE;qBACX;oBACD;wBACE,OAAO,EACL,oEAAoE;wBACtE,IAAI,EAAE,CAAC;wBACP,MAAM,EAAE,EAAE;qBACX;oBACD;wBACE,OAAO,EACL,oEAAoE;wBACtE,IAAI,EAAE,CAAC;wBACP,MAAM,EAAE,EAAE;qBACX;oBACD;wBACE,OAAO,EACL,oEAAoE;wBACtE,IAAI,EAAE,CAAC;wBACP,MAAM,EAAE,EAAE;qBACX;iBACF;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { TestSchema } from './types.js';
2
+ export declare function testRule(schema: TestSchema): void;
@@ -0,0 +1,150 @@
1
+ /* eslint-disable complexity */
2
+ /**
3
+ * Adapted from stylelint-test-rule-node to work with vitest.
4
+ * @see https://github.com/stylelint/stylelint-test-rule-node/tree/main
5
+ */
6
+ import { inspect } from 'node:util';
7
+ import stylelint from 'stylelint';
8
+ import { describe, expect, it } from 'vitest';
9
+ const { lint } = stylelint;
10
+ export function testRule(schema) {
11
+ const { ruleName, config, plugins, customSyntax, codeFilename, fix, accept = [], reject = [], } = schema;
12
+ describe(`${ruleName}`, () => {
13
+ const stylelintConfig = {
14
+ plugins,
15
+ rules: { [ruleName]: config },
16
+ };
17
+ setupTestCases({
18
+ name: 'accept',
19
+ cases: accept,
20
+ schema,
21
+ comparisons: (testCase) => async () => {
22
+ const { code } = testCase;
23
+ const stylelintOptions = {
24
+ code,
25
+ config: stylelintConfig,
26
+ customSyntax,
27
+ codeFilename: testCase.codeFilename || codeFilename,
28
+ };
29
+ const { results } = await lint(stylelintOptions);
30
+ const [result] = results;
31
+ expect(result).toBeTruthy();
32
+ const { warnings, parseErrors, invalidOptionWarnings } = result;
33
+ expect(warnings).toEqual([]);
34
+ expect(parseErrors).toEqual([]);
35
+ expect(invalidOptionWarnings).toEqual([]);
36
+ if (!fix) {
37
+ return;
38
+ }
39
+ // Check that --fix doesn't change code
40
+ const outputAfterFix = await lint({ ...stylelintOptions, fix: true });
41
+ const fixedCode = getOutputCss(outputAfterFix);
42
+ expect(fixedCode).toEqual(code);
43
+ },
44
+ });
45
+ setupTestCases({
46
+ name: 'reject',
47
+ cases: reject,
48
+ schema,
49
+ comparisons: (testCase) => async () => {
50
+ const { code, fixed, unfixable, warnings } = testCase;
51
+ const stylelintOptions = {
52
+ code,
53
+ config: stylelintConfig,
54
+ customSyntax,
55
+ codeFilename: testCase.codeFilename || codeFilename,
56
+ computeEditInfo: schema.computeEditInfo,
57
+ };
58
+ const { results } = await lint(stylelintOptions);
59
+ const [result] = results;
60
+ expect(result).toBeTruthy();
61
+ const { warnings: resultWarnings, parseErrors, invalidOptionWarnings, } = result;
62
+ expect(parseErrors).toEqual([]);
63
+ const actualWarnings = [...invalidOptionWarnings, ...resultWarnings];
64
+ const expectedWarnings = warnings ?? [testCase];
65
+ expect(actualWarnings.length).toEqual(expectedWarnings.length);
66
+ for (const [i, expected] of expectedWarnings.entries()) {
67
+ const actualWarning = actualWarnings[i];
68
+ expect(actualWarning).toBeTruthy();
69
+ expect(expected.message).toBeTruthy();
70
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
71
+ expect(actualWarning.text.startsWith(expected.message)).toEqual(true);
72
+ if ('line' in actualWarning && 'line' in expected) {
73
+ expect(actualWarning.line).toEqual(expected.line);
74
+ }
75
+ if ('column' in actualWarning && 'column' in expected) {
76
+ expect(actualWarning.column).toEqual(expected.column);
77
+ }
78
+ if ('endLine' in actualWarning && 'endLine' in expected) {
79
+ expect(actualWarning.endLine).toEqual(expected.endLine);
80
+ }
81
+ if ('endColumn' in actualWarning && 'endColumn' in expected) {
82
+ expect(actualWarning.endColumn).toEqual(expected.endColumn);
83
+ }
84
+ if ('fix' in actualWarning && 'fix' in expected) {
85
+ expect(actualWarning.fix).toEqual(expected.fix);
86
+ }
87
+ }
88
+ if (!fix) {
89
+ return;
90
+ }
91
+ expect(typeof fixed === 'string' || unfixable).toBeTruthy();
92
+ const outputAfterFix = await lint({ ...stylelintOptions, fix: true });
93
+ const fixedCode = getOutputCss(outputAfterFix);
94
+ if (!unfixable) {
95
+ expect(fixedCode).toEqual(fixed);
96
+ expect(fixedCode).not.toEqual(code);
97
+ }
98
+ else {
99
+ // can't fix
100
+ if (fixed) {
101
+ expect(fixedCode).toEqual(fixed);
102
+ }
103
+ expect(fixedCode).toEqual(code);
104
+ }
105
+ // Checks whether only errors other than those fixed are reported
106
+ const outputAfterLintOnFixedCode = await lint({
107
+ ...stylelintOptions,
108
+ code: fixedCode,
109
+ fix: unfixable,
110
+ });
111
+ const [fixedResult] = outputAfterLintOnFixedCode.results;
112
+ expect(fixedResult).toBeTruthy();
113
+ expect(fixedResult.warnings).toEqual(outputAfterFix.results[0]?.warnings);
114
+ expect(fixedResult.parseErrors).toEqual([]);
115
+ },
116
+ });
117
+ });
118
+ }
119
+ function setupTestCases(args) {
120
+ const { cases, comparisons, name, schema } = args;
121
+ if (cases.length === 0)
122
+ return;
123
+ const testGroup = schema.only
124
+ ? describe.only
125
+ : schema.skip
126
+ ? describe.skip
127
+ : describe;
128
+ testGroup(`${name}`, () => {
129
+ cases.forEach((testCase) => {
130
+ if (testCase) {
131
+ const spec = testCase.only ? it.only : testCase.skip ? it.skip : it;
132
+ describe(`${inspect(schema.config)}`, () => {
133
+ describe(`${inspect(testCase.code)}`, () => {
134
+ spec(testCase.description || 'no description', comparisons(testCase));
135
+ });
136
+ });
137
+ }
138
+ });
139
+ });
140
+ }
141
+ function getOutputCss({ results }) {
142
+ expect(results[0]).toBeTruthy();
143
+ const { _postcssResult: result } = results[0];
144
+ expect(result).toBeTruthy();
145
+ expect(result?.root).toBeTruthy();
146
+ expect(result?.opts).toBeTruthy();
147
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
148
+ return result.root.toString(result.opts.syntax);
149
+ }
150
+ //# sourceMappingURL=test-rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-rule.js","sourceRoot":"","sources":["../../../../../../libs/sdk/skyux-stylelint/src/testing/test-rule.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,SAA2B,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAS9C,MAAM,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;AAE3B,MAAM,UAAU,QAAQ,CAAC,MAAkB;IACzC,MAAM,EACJ,QAAQ,EACR,MAAM,EACN,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,GAAG,EACH,MAAM,GAAG,EAAE,EACX,MAAM,GAAG,EAAE,GACZ,GAAG,MAAM,CAAC;IAEX,QAAQ,CAAC,GAAG,QAAQ,EAAE,EAAE,GAAG,EAAE;QAC3B,MAAM,eAAe,GAAG;YACtB,OAAO;YACP,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE;SAC9B,CAAC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O,MAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,155 @@
1
+ /**
2
+ * A test case.
3
+ */
4
+ export type TestCase = {
5
+ /**
6
+ * Code of the test case.
7
+ */
8
+ code: string;
9
+ /**
10
+ * A filename for this `code` property.
11
+ */
12
+ codeFilename?: string;
13
+ /**
14
+ * Description of the test case.
15
+ */
16
+ description?: string | undefined;
17
+ /**
18
+ * Whether to run only the test case. Default: `false`.
19
+ *
20
+ * @see https://nodejs.org/api/test.html#only-tests
21
+ */
22
+ only?: boolean | undefined;
23
+ /**
24
+ * Whether to skip the test case. Default: `false`.
25
+ *
26
+ * @see https://nodejs.org/api/test.html#skipping-tests
27
+ */
28
+ skip?: boolean | undefined;
29
+ };
30
+ /**
31
+ * An accept test case.
32
+ */
33
+ export type AcceptTestCase = TestCase;
34
+ /**
35
+ * A warning.
36
+ */
37
+ export type Warning = {
38
+ /**
39
+ * Expected message from the test case. Usually exported from the plugin.
40
+ * Optional if `warnings` is used.
41
+ */
42
+ message?: string | undefined;
43
+ /**
44
+ * Expected line number of the warning.
45
+ */
46
+ line?: number | undefined;
47
+ /**
48
+ * Expected column number of the warning.
49
+ */
50
+ column?: number | undefined;
51
+ /**
52
+ * Expected end line number of the warning.
53
+ */
54
+ endLine?: number | undefined;
55
+ /**
56
+ * Expected end column number of the warning.
57
+ */
58
+ endColumn?: number | undefined;
59
+ /**
60
+ * Expected `EditInfo` of the warning.
61
+ *
62
+ * @experimental
63
+ */
64
+ fix?: {
65
+ range: [number, number];
66
+ text: string;
67
+ };
68
+ };
69
+ /**
70
+ * Use the `warnings` property, rather than `message`, `line`, and `column`,
71
+ * if the test case is expected to produce more than one warning.
72
+ */
73
+ export type RejectTestCase = TestCase & Warning & {
74
+ /**
75
+ * Expected fixed code of the test case. Optional if `fix` isn't `true`.
76
+ */
77
+ fixed?: string | undefined;
78
+ /**
79
+ * Don't check the `fixed` code. Default: `false`.
80
+ */
81
+ unfixable?: boolean | undefined;
82
+ /**
83
+ * Warning objects containing expected `message`, `line` and `column` etc.
84
+ * Optional if `message` is used.
85
+ */
86
+ warnings?: Warning[] | undefined;
87
+ };
88
+ /**
89
+ * A test schema.
90
+ */
91
+ export type TestSchema = {
92
+ /**
93
+ * Name of the rule being tested. Usually exported from the plugin.
94
+ */
95
+ ruleName: string;
96
+ /**
97
+ * Config to pass to the rule.
98
+ */
99
+ config: true | null | unknown;
100
+ /**
101
+ * Accept test cases.
102
+ */
103
+ accept?: AcceptTestCase[] | undefined;
104
+ /**
105
+ * Reject test cases.
106
+ */
107
+ reject?: RejectTestCase[] | undefined;
108
+ /**
109
+ * Turn on autofix. Default: `false`.
110
+ */
111
+ fix?: boolean | undefined;
112
+ /**
113
+ * Turn on computing `EditInfo`. Default: `false`.
114
+ *
115
+ * @experimental
116
+ */
117
+ computeEditInfo?: boolean;
118
+ /**
119
+ * Maps to Stylelint's `plugins` configuration property.
120
+ *
121
+ * Path to the file that exports the plugin object, relative to the root.
122
+ * Usually it's the same path as a `main` property in plugin's `package.json`.
123
+ *
124
+ * If you're testing a plugin pack, it's the path to the file that exports the array of plugin objects.
125
+ *
126
+ * Optional, if `plugins` option was passed to advanced configuration with `getTestRule()`.
127
+ *
128
+ * @see https://stylelint.io/user-guide/configure#plugins
129
+ */
130
+ plugins?: import('stylelint').Config['plugins'] | undefined;
131
+ /**
132
+ * Maps to Stylelint's `customSyntax` option.
133
+ *
134
+ * @see https://stylelint.io/user-guide/usage/options#customsyntax
135
+ */
136
+ customSyntax?: string | undefined;
137
+ /**
138
+ * Maps to Stylelint's `codeFilename` option.
139
+ *
140
+ * @see https://stylelint.io/user-guide/usage/options#codefilename
141
+ */
142
+ codeFilename?: string | undefined;
143
+ /**
144
+ * Whether to run only the test case. Default: `false`.
145
+ *
146
+ * @see https://nodejs.org/api/test.html#only-tests
147
+ */
148
+ only?: boolean | undefined;
149
+ /**
150
+ * Whether to skip the test case. Default: `false`.
151
+ *
152
+ * @see https://nodejs.org/api/test.html#skipping-tests
153
+ */
154
+ skip?: boolean | undefined;
155
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../libs/sdk/skyux-stylelint/src/testing/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import stylelint from 'stylelint';
2
+ export declare function getRuleMeta(args: {
3
+ fixable?: boolean;
4
+ ruleId: string;
5
+ }): stylelint.RuleMeta;
@@ -0,0 +1,8 @@
1
+ export function getRuleMeta(args) {
2
+ const { fixable, ruleId } = args;
3
+ return {
4
+ fixable,
5
+ url: `https://github.com/blackbaud/skyux/blob/main/libs/cdk/skyux-stylelint/docs/rules/${ruleId}.md`,
6
+ };
7
+ }
8
+ //# sourceMappingURL=meta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../../../../libs/sdk/skyux-stylelint/src/utility/meta.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW,CAAC,IAG3B;IACC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAEjC,OAAO;QACL,OAAO;QACP,GAAG,EAAE,oFAAoF,MAAM,KAAK;KACxE,CAAC;AACjC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function withNamespace(value: string): string;
@@ -0,0 +1,4 @@
1
+ export function withNamespace(value) {
2
+ return `skyux-stylelint/${value}`;
3
+ }
4
+ //# sourceMappingURL=namespace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../../../../../libs/sdk/skyux-stylelint/src/utility/namespace.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,mBAAmB,KAAK,EAAE,CAAC;AACpC,CAAC"}