@taiga-ui/stylelint-config 0.520.0 → 0.522.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.
@@ -1,53 +0,0 @@
1
- const stylelint = require('stylelint');
2
-
3
- const {
4
- createPlugin,
5
- utils: {report, ruleMessages, validateOptions},
6
- } = stylelint;
7
-
8
- const ruleName = '@taiga-ui/no-webkit-box-orient-block-axis';
9
- const messages = ruleMessages(ruleName, {
10
- expected:
11
- 'Expected "-webkit-box-orient: block-axis" to be "-webkit-box-orient: vertical"',
12
- });
13
-
14
- const meta = {
15
- fixable: true,
16
- };
17
-
18
- /** @type {import('stylelint').Rule} */
19
- const ruleFunction = (primary) => (root, result) => {
20
- const validOptions = validateOptions(result, ruleName, {
21
- actual: primary,
22
- possible: [true],
23
- });
24
-
25
- if (!validOptions) {
26
- return;
27
- }
28
-
29
- root.walkDecls('-webkit-box-orient', (decl) => {
30
- if (decl.value.trim().toLowerCase() !== 'block-axis') {
31
- return;
32
- }
33
-
34
- report({
35
- fix: () => {
36
- decl.value = 'vertical';
37
- },
38
- message: messages.expected,
39
- node: decl,
40
- result,
41
- ruleName,
42
- });
43
- });
44
- };
45
-
46
- ruleFunction.ruleName = ruleName;
47
- ruleFunction.messages = messages;
48
- ruleFunction.meta = meta;
49
-
50
- module.exports = createPlugin(ruleName, ruleFunction);
51
- module.exports.ruleName = ruleName;
52
- module.exports.messages = messages;
53
- module.exports.meta = meta;
@@ -1,134 +0,0 @@
1
- const path = require('node:path');
2
- const stylelint = require('stylelint');
3
-
4
- const {
5
- createPlugin,
6
- utils: {report, ruleMessages, validateOptions},
7
- } = stylelint;
8
-
9
- const ruleName = '@taiga-ui/relative-less-import-extension';
10
- const messages = ruleMessages(ruleName, {
11
- expected: (actual, expected) => `Expected "${actual}" to be "${expected}"`,
12
- });
13
-
14
- const meta = {
15
- fixable: true,
16
- };
17
-
18
- function getExpectedExtension(root) {
19
- const file = root.source && root.source.input && root.source.input.file;
20
-
21
- if (!file) {
22
- return '.less';
23
- }
24
-
25
- const ext = path.extname(file).toLowerCase();
26
-
27
- if (ext === '.scss' || ext === '.css' || ext === '.less') {
28
- return ext;
29
- }
30
-
31
- return '.less';
32
- }
33
-
34
- function hasKnownStyleExtension(value) {
35
- return /\.(?:less|scss|css)(?:\?.*)?$/i.test(value);
36
- }
37
-
38
- function isExternalImport(value) {
39
- return (
40
- value.startsWith('@') ||
41
- value.startsWith('~') ||
42
- value.startsWith('/') ||
43
- value.startsWith('//') ||
44
- /^https?:/i.test(value) ||
45
- /^data:/i.test(value)
46
- );
47
- }
48
-
49
- function isUrlImport(params) {
50
- return /^url\(/i.test(params.trim());
51
- }
52
-
53
- function isLocalImportPath(value) {
54
- if (!value) {
55
- return false;
56
- }
57
-
58
- if (isExternalImport(value)) {
59
- return false;
60
- }
61
-
62
- return true;
63
- }
64
-
65
- function splitQueryAndHash(value) {
66
- const match = value.match(/^([^?#]+)([?#].*)?$/);
67
-
68
- return {
69
- pathname: match ? match[1] : value,
70
- suffix: match ? match[2] || '' : '',
71
- };
72
- }
73
-
74
- /** @type {import('stylelint').Rule} */
75
- const ruleFunction = (primary) => (root, result) => {
76
- const validOptions = validateOptions(result, ruleName, {
77
- actual: primary,
78
- possible: [true],
79
- });
80
-
81
- if (!validOptions) {
82
- return;
83
- }
84
-
85
- const expectedExtension = getExpectedExtension(root);
86
-
87
- root.walkAtRules('import', (atRule) => {
88
- const params = atRule.params.trim();
89
-
90
- if (isUrlImport(params)) {
91
- return;
92
- }
93
-
94
- const match = params.match(/^(['"])([^'"]+)\1(.*)$/);
95
-
96
- if (!match) {
97
- return;
98
- }
99
-
100
- const [, quote, rawImportPath, tail] = match;
101
-
102
- if (!isLocalImportPath(rawImportPath)) {
103
- return;
104
- }
105
-
106
- const {pathname, suffix} = splitQueryAndHash(rawImportPath);
107
-
108
- if (hasKnownStyleExtension(pathname)) {
109
- return;
110
- }
111
-
112
- const fixedPath = `${pathname}${expectedExtension}${suffix}`;
113
- const fixedParams = `${quote}${fixedPath}${quote}${tail}`;
114
-
115
- report({
116
- fix: () => {
117
- atRule.params = fixedParams;
118
- },
119
- message: messages.expected(rawImportPath, fixedPath),
120
- node: atRule,
121
- result,
122
- ruleName,
123
- });
124
- });
125
- };
126
-
127
- ruleFunction.ruleName = ruleName;
128
- ruleFunction.messages = messages;
129
- ruleFunction.meta = meta;
130
-
131
- module.exports = createPlugin(ruleName, ruleFunction);
132
- module.exports.ruleName = ruleName;
133
- module.exports.messages = messages;
134
- module.exports.meta = meta;
package/taiga-specific.js DELETED
@@ -1,13 +0,0 @@
1
- module.exports = {
2
- $schema:
3
- 'https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/stylelintrc.json',
4
- rules: {
5
- 'custom-property-pattern': [
6
- '^(tui|t|docsearch)-.([a-z][a-z0-9]*)(-[a-z0-9]+)*$',
7
- {
8
- message: 'Expected custom property name to be kebab-case',
9
- severity: 'error',
10
- },
11
- ],
12
- },
13
- };