@alfalab/stylelint-core-vars 1.5.0 → 1.7.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 CHANGED
@@ -26,7 +26,12 @@ npm install --save-dev stylelint @alfalab/stylelint-core-vars
26
26
  "@alfalab/stylelint-core-vars"
27
27
  ],
28
28
  "rules": {
29
- "stylelint-core-vars/use-vars": true,
29
+ "stylelint-core-vars/use-vars": [
30
+ true,
31
+ {
32
+ "allowNumericValues": true
33
+ }
34
+ ],
30
35
  "stylelint-core-vars/use-mixins": true,
31
36
  "stylelint-core-vars/use-one-of-vars": [
32
37
  true,
@@ -55,3 +60,29 @@ npm install --save-dev stylelint @alfalab/stylelint-core-vars
55
60
  },
56
61
  }
57
62
  ```
63
+
64
+ ## Лицензия
65
+
66
+ ```
67
+ The MIT License (MIT)
68
+
69
+ Copyright (c) 2024 core-ds contributors
70
+
71
+ Permission is hereby granted, free of charge, to any person obtaining a copy
72
+ of this software and associated documentation files (the "Software"), to deal
73
+ in the Software without restriction, including without limitation the rights
74
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
75
+ copies of the Software, and to permit persons to whom the Software is
76
+ furnished to do so, subject to the following conditions:
77
+
78
+ The above copyright notice and this permission notice shall be included in
79
+ all copies or substantial portions of the Software.
80
+
81
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
82
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
83
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
84
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
85
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
86
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
87
+ THE SOFTWARE.
88
+ ```
package/index.js CHANGED
@@ -1,273 +1 @@
1
- const stylelint = require('stylelint');
2
- const { findOldVars } = require('./utils');
3
- const toOneLine = require('./utils').toOneLine;
4
- const findVars = require('./utils').findVars;
5
- const colorsSet = require('./utils').colorsSet;
6
- const findTypographyMixins = require('./utils').findTypographyMixins;
7
- const VARS_AVAILABLE = require('./utils').VARS_AVAILABLE;
8
-
9
- const RULE_USE_VARS = 'stylelint-core-vars/use-vars';
10
- const RULE_USE_ONE_OF_VARS = 'stylelint-core-vars/use-one-of-vars';
11
- const RULE_USE_MIXINS = 'stylelint-core-vars/use-mixins';
12
- const RULE_USE_ONE_OF_MIXINS = 'stylelint-core-vars/use-one-of-mixins';
13
- const RULE_DO_NOT_USE_DARK_COLORS = 'stylelint-core-vars/do-not-use-dark-colors';
14
- const RULE_DO_NOT_USE_OLD_VARS = 'stylelint-core-vars/do-not-use-old-vars';
15
-
16
- const messages = {
17
- [RULE_USE_VARS]: stylelint.utils.ruleMessages(RULE_USE_VARS, {
18
- expected: (variable, value) => {
19
- return `Use variable 'var(${variable})' instead of plain value '${value}'`;
20
- },
21
- }),
22
- [RULE_USE_ONE_OF_VARS]: stylelint.utils.ruleMessages(RULE_USE_ONE_OF_VARS, {
23
- expected: (variables, value) => {
24
- const variablesPart = variables.map((v) => `var(${v})`).join('\n');
25
-
26
- return `Use variables instead of plain value '${value}':\n${variablesPart}\n`;
27
- },
28
- }),
29
- [RULE_DO_NOT_USE_OLD_VARS]: stylelint.utils.ruleMessages(RULE_DO_NOT_USE_OLD_VARS, {
30
- expected: (variables, value, fixable = true) => {
31
- if (!variables.length) return `Ask you designer how to replace old token '${value}'`;
32
-
33
- const startMsg = fixable ? 'Use' : 'Cant find proper token, but you can use';
34
-
35
- if (variables.length === 1) {
36
- return `${startMsg} variable 'var(${variables[0]})' instead of old '${value}'`;
37
- }
38
-
39
- const variablesPart = variables.map((v) => `var(${v})`).join('\n');
40
-
41
- return `${startMsg} one of new variables instead of old '${value}':\n${variablesPart}\n`;
42
- },
43
- }),
44
- [RULE_USE_MIXINS]: stylelint.utils.ruleMessages(RULE_USE_MIXINS, {
45
- expected: (mixin) => {
46
- return `Use mixin '${mixin.name}' instead of plain values`;
47
- },
48
- }),
49
- [RULE_USE_ONE_OF_MIXINS]: stylelint.utils.ruleMessages(RULE_USE_ONE_OF_MIXINS, {
50
- expected: (mixins) => {
51
- const mixinsPart = mixins
52
- .map(({ name, props }) => `${name} (${Object.values(props).join('|')})`)
53
- .join('\n');
54
- return `Use mixins instead of plain values:\n${mixinsPart}\n`;
55
- },
56
- }),
57
- [RULE_DO_NOT_USE_DARK_COLORS]: stylelint.utils.ruleMessages(RULE_DO_NOT_USE_DARK_COLORS, {
58
- expected: () => {
59
- return 'Do not use dark colors directly. Only light and static colors are allowed';
60
- },
61
- }),
62
- };
63
-
64
- const checkVars = (decl, result, context, ruleName, matcher, shouldReport) => {
65
- const { prop, raws } = decl;
66
-
67
- let value = toOneLine(decl.value);
68
- let substitution;
69
-
70
- const previousValues = [];
71
-
72
- while ((substitution = matcher(value, prop))) {
73
- let fixed = false;
74
-
75
- value = value.replace(substitution.value, substitution.fixedValue);
76
-
77
- if (context.fix && substitution.fixable) {
78
- decl.value = value;
79
- fixed = true;
80
- }
81
-
82
- const originalValueIndex = previousValues.reduce(
83
- (acc, sub) => (acc > sub.index + sub.diff ? acc - sub.diff : acc),
84
- substitution.index
85
- );
86
-
87
- if (shouldReport(substitution.fixable, fixed)) {
88
- stylelint.utils.report({
89
- result,
90
- ruleName,
91
- message: messages[ruleName].expected(
92
- substitution.variables,
93
- substitution.value,
94
- substitution.fixable
95
- ),
96
- node: decl,
97
- word: value,
98
- index: originalValueIndex + prop.length + raws.between.length,
99
- });
100
- }
101
-
102
- previousValues.unshift({
103
- ...substitution,
104
- diff: substitution.fixedValue.length - substitution.value.length,
105
- });
106
- }
107
- };
108
-
109
- const checkTypography = (rule, result, context, ruleName) => {
110
- const typographyProps = rule.nodes.reduce((acc, node) => {
111
- if (['font-size', 'line-height', 'font-weight'].includes(node.prop)) {
112
- acc[node.prop] = node.value;
113
- }
114
- return acc;
115
- }, {});
116
-
117
- const hasTypography = 'font-size' in typographyProps;
118
- if (!hasTypography) return;
119
-
120
- const mixins = findTypographyMixins(typographyProps);
121
-
122
- if (!mixins || !mixins.length) return;
123
-
124
- const exactMixin = mixins.length === 1;
125
-
126
- let fixed = false;
127
- if (context.fix && exactMixin) {
128
- fixed = true;
129
- const { name, props } = mixins[0];
130
-
131
- const before = rule.nodes[0].raws.before;
132
- rule.walkDecls((decl) => {
133
- if (decl.prop in props) {
134
- decl.remove();
135
- }
136
- });
137
-
138
- rule.prepend(`${before}@mixin ${name};\n`);
139
- }
140
-
141
- const shouldReport =
142
- !fixed &&
143
- ((ruleName === RULE_USE_ONE_OF_MIXINS && !exactMixin) ||
144
- (ruleName === RULE_USE_MIXINS && exactMixin));
145
-
146
- if (shouldReport) {
147
- stylelint.utils.report({
148
- result,
149
- ruleName,
150
- message: messages[ruleName].expected(mixins),
151
- node: rule,
152
- word: 'font-size',
153
- index: 0,
154
- });
155
- }
156
- };
157
-
158
- const checkDarkColorsUsage = (decl, result, context, ruleName) => {
159
- const { prop, raws } = decl;
160
-
161
- let value = toOneLine(decl.value);
162
-
163
- const matches = /--color-dark-[\w-]+/.exec(value);
164
-
165
- if (matches && colorsSet.has(matches[0])) {
166
- stylelint.utils.report({
167
- result,
168
- ruleName: RULE_DO_NOT_USE_DARK_COLORS,
169
- message: messages[RULE_DO_NOT_USE_DARK_COLORS].expected(),
170
- node: decl,
171
- word: value,
172
- index: prop.length + raws.between.length + decl.value.indexOf(matches[0]),
173
- });
174
- }
175
- };
176
-
177
- module.exports = [
178
- stylelint.createPlugin(RULE_USE_VARS, (enabled, _, context) => {
179
- if (!enabled || !VARS_AVAILABLE) {
180
- return () => {};
181
- }
182
-
183
- return (root, result) => {
184
- root.walkDecls((decl) => {
185
- checkVars(
186
- decl,
187
- result,
188
- context,
189
- RULE_USE_VARS,
190
- findVars,
191
- (fixable, fixed) => fixable && !fixed
192
- );
193
- });
194
- };
195
- }),
196
- stylelint.createPlugin(RULE_USE_ONE_OF_VARS, (enabled, _, context) => {
197
- if (!enabled || !VARS_AVAILABLE) {
198
- return () => {};
199
- }
200
-
201
- return (root, result) => {
202
- root.walkDecls((decl) => {
203
- checkVars(
204
- decl,
205
- result,
206
- context,
207
- RULE_USE_ONE_OF_VARS,
208
- findVars,
209
- (fixable, fixed) => !fixable && !fixed
210
- );
211
- });
212
- };
213
- }),
214
- stylelint.createPlugin(RULE_DO_NOT_USE_OLD_VARS, (enabled, _, context) => {
215
- if (!enabled || !VARS_AVAILABLE) {
216
- return () => {};
217
- }
218
-
219
- return (root, result) => {
220
- root.walkDecls((decl) => {
221
- checkVars(
222
- decl,
223
- result,
224
- context,
225
- RULE_DO_NOT_USE_OLD_VARS,
226
- findOldVars,
227
- (_, fixed) => !fixed
228
- );
229
- });
230
- };
231
- }),
232
- stylelint.createPlugin(RULE_USE_MIXINS, (enabled, _, context) => {
233
- if (!enabled || !VARS_AVAILABLE) {
234
- return () => {};
235
- }
236
-
237
- return (root, result) => {
238
- root.walkRules((rule) => {
239
- checkTypography(rule, result, context, RULE_USE_MIXINS);
240
- });
241
- };
242
- }),
243
- stylelint.createPlugin(RULE_USE_ONE_OF_MIXINS, (enabled, _, context) => {
244
- if (!enabled || !VARS_AVAILABLE) {
245
- return () => {};
246
- }
247
-
248
- return (root, result) => {
249
- root.walkRules((rule) => {
250
- checkTypography(rule, result, context, RULE_USE_ONE_OF_MIXINS);
251
- });
252
- };
253
- }),
254
- stylelint.createPlugin(RULE_DO_NOT_USE_DARK_COLORS, (enabled, _, context) => {
255
- if (!enabled || !VARS_AVAILABLE) {
256
- return () => {};
257
- }
258
-
259
- return (root, result) => {
260
- root.walkDecls((decl) => {
261
- checkDarkColorsUsage(decl, result, context);
262
- });
263
- };
264
- }),
265
- ];
266
-
267
- module.exports.messages = messages;
268
- module.exports.RULE_USE_VARS = RULE_USE_VARS;
269
- module.exports.RULE_USE_ONE_OF_VARS = RULE_USE_ONE_OF_VARS;
270
- module.exports.RULE_USE_MIXINS = RULE_USE_MIXINS;
271
- module.exports.RULE_USE_ONE_OF_MIXINS = RULE_USE_ONE_OF_MIXINS;
272
- module.exports.RULE_DO_NOT_USE_DARK_COLORS = RULE_DO_NOT_USE_DARK_COLORS;
273
- module.exports.RULE_DO_NOT_USE_OLD_VARS = RULE_DO_NOT_USE_OLD_VARS;
1
+ module.exports = require('./lib');
package/lib/index.js ADDED
@@ -0,0 +1,279 @@
1
+ const stylelint = require('stylelint');
2
+ const { findOldVars } = require('./utils');
3
+ const toOneLine = require('./utils').toOneLine;
4
+ const findVars = require('./utils').findVars;
5
+ const colorsSet = require('./utils').colorsSet;
6
+ const findTypographyMixins = require('./utils').findTypographyMixins;
7
+ const VARS_AVAILABLE = require('./utils').VARS_AVAILABLE;
8
+
9
+ const RULE_USE_VARS = 'stylelint-core-vars/use-vars';
10
+ const RULE_USE_ONE_OF_VARS = 'stylelint-core-vars/use-one-of-vars';
11
+ const RULE_USE_MIXINS = 'stylelint-core-vars/use-mixins';
12
+ const RULE_USE_ONE_OF_MIXINS = 'stylelint-core-vars/use-one-of-mixins';
13
+ const RULE_DO_NOT_USE_DARK_COLORS = 'stylelint-core-vars/do-not-use-dark-colors';
14
+ const RULE_DO_NOT_USE_OLD_VARS = 'stylelint-core-vars/do-not-use-old-vars';
15
+
16
+ const messages = {
17
+ [RULE_USE_VARS]: stylelint.utils.ruleMessages(RULE_USE_VARS, {
18
+ expected: (variable, value) => {
19
+ return `Use variable 'var(${variable})' instead of plain value '${value}'`;
20
+ },
21
+ }),
22
+ [RULE_USE_ONE_OF_VARS]: stylelint.utils.ruleMessages(RULE_USE_ONE_OF_VARS, {
23
+ expected: (variables, value) => {
24
+ const variablesPart = variables.map((v) => `var(${v})`).join('\n');
25
+
26
+ return `Use variables instead of plain value '${value}':\n${variablesPart}\n`;
27
+ },
28
+ }),
29
+ [RULE_DO_NOT_USE_OLD_VARS]: stylelint.utils.ruleMessages(RULE_DO_NOT_USE_OLD_VARS, {
30
+ expected: (variables, value, fixable = true) => {
31
+ if (!variables.length) return `Ask you designer how to replace old token '${value}'`;
32
+
33
+ const startMsg = fixable ? 'Use' : 'Cant find proper token, but you can use';
34
+
35
+ if (variables.length === 1) {
36
+ return `${startMsg} variable 'var(${variables[0]})' instead of old '${value}'`;
37
+ }
38
+
39
+ const variablesPart = variables.map((v) => `var(${v})`).join('\n');
40
+
41
+ return `${startMsg} one of new variables instead of old '${value}':\n${variablesPart}\n`;
42
+ },
43
+ }),
44
+ [RULE_USE_MIXINS]: stylelint.utils.ruleMessages(RULE_USE_MIXINS, {
45
+ expected: (mixin) => {
46
+ return `Use mixin '${mixin.name}' instead of plain values`;
47
+ },
48
+ }),
49
+ [RULE_USE_ONE_OF_MIXINS]: stylelint.utils.ruleMessages(RULE_USE_ONE_OF_MIXINS, {
50
+ expected: (mixins) => {
51
+ const mixinsPart = mixins
52
+ .map(({ name, props }) => `${name} (${Object.values(props).join('|')})`)
53
+ .join('\n');
54
+ return `Use mixins instead of plain values:\n${mixinsPart}\n`;
55
+ },
56
+ }),
57
+ [RULE_DO_NOT_USE_DARK_COLORS]: stylelint.utils.ruleMessages(RULE_DO_NOT_USE_DARK_COLORS, {
58
+ expected: () => {
59
+ return 'Do not use dark colors directly. Only light and static colors are allowed';
60
+ },
61
+ }),
62
+ };
63
+
64
+ const checkVars = (decl, result, context, ruleName, matcher, shouldReport, options = {}) => {
65
+ const { prop, raws } = decl;
66
+
67
+ let value = toOneLine(decl.value);
68
+ let substitution;
69
+
70
+ const previousValues = [];
71
+
72
+ while ((substitution = matcher(value, prop, options))) {
73
+ let fixed = false;
74
+
75
+ value = value.replace(substitution.value, substitution.fixedValue);
76
+
77
+ if (context.fix && substitution.fixable) {
78
+ decl.value = value;
79
+ fixed = true;
80
+ }
81
+
82
+ const originalValueIndex = previousValues.reduce(
83
+ (acc, sub) => (acc > sub.index + sub.diff ? acc - sub.diff : acc),
84
+ substitution.index
85
+ );
86
+
87
+ if (shouldReport(substitution.fixable, fixed)) {
88
+ stylelint.utils.report({
89
+ result,
90
+ ruleName,
91
+ message: messages[ruleName].expected(
92
+ substitution.variables,
93
+ substitution.value,
94
+ substitution.fixable
95
+ ),
96
+ node: decl,
97
+ word: value,
98
+ index: originalValueIndex + prop.length + raws.between.length,
99
+ });
100
+ }
101
+
102
+ previousValues.unshift({
103
+ ...substitution,
104
+ diff: substitution.fixedValue.length - substitution.value.length,
105
+ });
106
+ }
107
+ };
108
+
109
+ const checkTypography = (rule, result, context, ruleName) => {
110
+ const typographyProps = rule.nodes.reduce((acc, node) => {
111
+ if (['font-size', 'line-height', 'font-weight'].includes(node.prop)) {
112
+ acc[node.prop] = node.value;
113
+ }
114
+ return acc;
115
+ }, {});
116
+
117
+ const hasTypography = 'font-size' in typographyProps;
118
+ if (!hasTypography) return;
119
+
120
+ const mixins = findTypographyMixins(typographyProps);
121
+
122
+ if (!mixins || !mixins.length) return;
123
+
124
+ const exactMixin = mixins.length === 1;
125
+
126
+ let fixed = false;
127
+ if (context.fix && exactMixin) {
128
+ fixed = true;
129
+ const { name, props } = mixins[0];
130
+
131
+ const before = rule.nodes[0].raws.before;
132
+ rule.walkDecls((decl) => {
133
+ if (decl.prop in props) {
134
+ decl.remove();
135
+ }
136
+ });
137
+
138
+ rule.prepend(`${before}@mixin ${name};\n`);
139
+ }
140
+
141
+ const shouldReport =
142
+ !fixed &&
143
+ ((ruleName === RULE_USE_ONE_OF_MIXINS && !exactMixin) ||
144
+ (ruleName === RULE_USE_MIXINS && exactMixin));
145
+
146
+ if (shouldReport) {
147
+ stylelint.utils.report({
148
+ result,
149
+ ruleName,
150
+ message: messages[ruleName].expected(mixins),
151
+ node: rule,
152
+ word: 'font-size',
153
+ index: 0,
154
+ });
155
+ }
156
+ };
157
+
158
+ const checkDarkColorsUsage = (decl, result, context, ruleName) => {
159
+ const { prop, raws } = decl;
160
+
161
+ let value = toOneLine(decl.value);
162
+
163
+ const matches = /--color-dark-[\w-]+/.exec(value);
164
+
165
+ if (matches && colorsSet.has(matches[0])) {
166
+ stylelint.utils.report({
167
+ result,
168
+ ruleName: RULE_DO_NOT_USE_DARK_COLORS,
169
+ message: messages[RULE_DO_NOT_USE_DARK_COLORS].expected(),
170
+ node: decl,
171
+ word: value,
172
+ index: prop.length + raws.between.length + decl.value.indexOf(matches[0]),
173
+ });
174
+ }
175
+ };
176
+
177
+ module.exports = [
178
+ stylelint.createPlugin(RULE_USE_VARS, (enabled, config, context) => {
179
+ if (!enabled || !VARS_AVAILABLE) {
180
+ return () => {};
181
+ }
182
+
183
+ const allowNumericValues = config?.allowNumericValues || false;
184
+
185
+ return (root, result) => {
186
+ root.walkDecls((decl) => {
187
+ checkVars(
188
+ decl,
189
+ result,
190
+ context,
191
+ RULE_USE_VARS,
192
+ findVars,
193
+ (fixable, fixed) => fixable && !fixed,
194
+ { allowNumericValues }
195
+ );
196
+ });
197
+ };
198
+ }),
199
+ stylelint.createPlugin(RULE_USE_ONE_OF_VARS, (enabled, config, context) => {
200
+ if (!enabled || !VARS_AVAILABLE) {
201
+ return () => {};
202
+ }
203
+
204
+ const allowNumericValues = config?.allowNumericValues || false;
205
+
206
+ return (root, result) => {
207
+ root.walkDecls((decl) => {
208
+ checkVars(
209
+ decl,
210
+ result,
211
+ context,
212
+ RULE_USE_ONE_OF_VARS,
213
+ findVars,
214
+ (fixable, fixed) => !fixable && !fixed,
215
+ { allowNumericValues }
216
+ );
217
+ });
218
+ };
219
+ }),
220
+ stylelint.createPlugin(RULE_DO_NOT_USE_OLD_VARS, (enabled, _, context) => {
221
+ if (!enabled || !VARS_AVAILABLE) {
222
+ return () => {};
223
+ }
224
+
225
+ return (root, result) => {
226
+ root.walkDecls((decl) => {
227
+ checkVars(
228
+ decl,
229
+ result,
230
+ context,
231
+ RULE_DO_NOT_USE_OLD_VARS,
232
+ findOldVars,
233
+ (_, fixed) => !fixed
234
+ );
235
+ });
236
+ };
237
+ }),
238
+ stylelint.createPlugin(RULE_USE_MIXINS, (enabled, _, context) => {
239
+ if (!enabled || !VARS_AVAILABLE) {
240
+ return () => {};
241
+ }
242
+
243
+ return (root, result) => {
244
+ root.walkRules((rule) => {
245
+ checkTypography(rule, result, context, RULE_USE_MIXINS);
246
+ });
247
+ };
248
+ }),
249
+ stylelint.createPlugin(RULE_USE_ONE_OF_MIXINS, (enabled, _, context) => {
250
+ if (!enabled || !VARS_AVAILABLE) {
251
+ return () => {};
252
+ }
253
+
254
+ return (root, result) => {
255
+ root.walkRules((rule) => {
256
+ checkTypography(rule, result, context, RULE_USE_ONE_OF_MIXINS);
257
+ });
258
+ };
259
+ }),
260
+ stylelint.createPlugin(RULE_DO_NOT_USE_DARK_COLORS, (enabled, _, context) => {
261
+ if (!enabled || !VARS_AVAILABLE) {
262
+ return () => {};
263
+ }
264
+
265
+ return (root, result) => {
266
+ root.walkDecls((decl) => {
267
+ checkDarkColorsUsage(decl, result, context);
268
+ });
269
+ };
270
+ }),
271
+ ];
272
+
273
+ module.exports.messages = messages;
274
+ module.exports.RULE_USE_VARS = RULE_USE_VARS;
275
+ module.exports.RULE_USE_ONE_OF_VARS = RULE_USE_ONE_OF_VARS;
276
+ module.exports.RULE_USE_MIXINS = RULE_USE_MIXINS;
277
+ module.exports.RULE_USE_ONE_OF_MIXINS = RULE_USE_ONE_OF_MIXINS;
278
+ module.exports.RULE_DO_NOT_USE_DARK_COLORS = RULE_DO_NOT_USE_DARK_COLORS;
279
+ module.exports.RULE_DO_NOT_USE_OLD_VARS = RULE_DO_NOT_USE_OLD_VARS;
@@ -202,12 +202,18 @@ function choiceVars(variables, prop, group) {
202
202
  return variables;
203
203
  }
204
204
 
205
- function findVars(cssValue, prop) {
205
+ function findVars(cssValue, prop, options) {
206
206
  const vars = varsByProperties[prop];
207
207
  if (!vars) return;
208
208
 
209
209
  const group = getVarsGroup(vars);
210
210
 
211
+ if (group === 'gaps' || group === 'borderRadiuses') {
212
+ if (options.allowNumericValues) {
213
+ return;
214
+ }
215
+ }
216
+
211
217
  for (const [value, variables] of Object.entries(vars)) {
212
218
  const chosen = choiceVars(variables, prop, group);
213
219
 
package/package.json CHANGED
@@ -1,23 +1,48 @@
1
1
  {
2
2
  "name": "@alfalab/stylelint-core-vars",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "core-components css linter",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "jest"
8
8
  },
9
- "author": "reme3d2y",
10
- "license": "ISC",
9
+ "author": "core-ds contributors",
10
+ "license": "MIT",
11
11
  "devDependencies": {
12
- "@alfalab/core-components-vars": "^7.0.0",
13
- "jest": "^26.6.3",
14
- "jest-preset-stylelint": "^3.0.0",
15
- "stylelint": "^13.8.0"
12
+ "@alfalab/core-components-vars": "7.0.0",
13
+ "@semantic-release/changelog": "6.0.3",
14
+ "@semantic-release/commit-analyzer": "11.1.0",
15
+ "@semantic-release/git": "10.0.1",
16
+ "@semantic-release/github": "9.2.6",
17
+ "@semantic-release/npm": "11.0.2",
18
+ "@semantic-release/release-notes-generator": "12.1.0",
19
+ "arui-presets-lint": "7.3.0",
20
+ "jest": "29.7.0",
21
+ "jest-preset-stylelint": "6.3.2",
22
+ "lint-staged": "15.2.7",
23
+ "prettier": "3.3.2",
24
+ "semantic-release": "22.0.12",
25
+ "simple-git-hooks": "2.11.1",
26
+ "stylelint": "13.13.1"
16
27
  },
17
28
  "jest": {
18
29
  "preset": "jest-preset-stylelint",
19
30
  "setupFiles": [
20
31
  "./jest.setup.js"
21
32
  ]
22
- }
33
+ },
34
+ "commitlint": {
35
+ "extends": "./node_modules/arui-presets-lint/commitlint"
36
+ },
37
+ "lint-staged": {
38
+ "*.{js,jsx,ts,tsx,json}": [
39
+ "prettier --write"
40
+ ]
41
+ },
42
+ "simple-git-hooks": {
43
+ "pre-commit": "./node_modules/.bin/lint-staged",
44
+ "commit-msg": "./node_modules/.bin/commitlint --edit $1"
45
+ },
46
+ "prettier": "arui-presets-lint/prettier",
47
+ "packageManager": "yarn@4.3.1"
23
48
  }
package/.prettierrc.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- trailingComma: 'es5',
3
- tabWidth: 4,
4
- semi: true,
5
- singleQuote: true,
6
- printWidth: 100,
7
- };