@htyf-mp/stylelint-taro-rn 0.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 (67) hide show
  1. package/README.md +67 -0
  2. package/dist/index.cjs.js +378 -0
  3. package/dist/index.cjs.js.map +1 -0
  4. package/dist/index.d.ts +3 -0
  5. package/dist/index.esm.js +369 -0
  6. package/dist/index.esm.js.map +1 -0
  7. package/dist/index.js +10 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/rules/css-property-no-unknown/index.d.ts +5 -0
  10. package/dist/rules/css-property-no-unknown/index.js +62 -0
  11. package/dist/rules/css-property-no-unknown/index.js.map +1 -0
  12. package/dist/rules/font-weight-no-ignored-values/index.d.ts +5 -0
  13. package/dist/rules/font-weight-no-ignored-values/index.js +36 -0
  14. package/dist/rules/font-weight-no-ignored-values/index.js.map +1 -0
  15. package/dist/rules/index.d.ts +11 -0
  16. package/dist/rules/index.js +14 -0
  17. package/dist/rules/index.js.map +1 -0
  18. package/dist/rules/line-height-no-value-without-unit/index.d.ts +5 -0
  19. package/dist/rules/line-height-no-value-without-unit/index.js +37 -0
  20. package/dist/rules/line-height-no-value-without-unit/index.js.map +1 -0
  21. package/dist/rules/style-property-no-unknown/index.d.ts +5 -0
  22. package/dist/rules/style-property-no-unknown/index.js +58 -0
  23. package/dist/rules/style-property-no-unknown/index.js.map +1 -0
  24. package/dist/utils/endsWith.d.ts +1 -0
  25. package/dist/utils/endsWith.js +4 -0
  26. package/dist/utils/endsWith.js.map +1 -0
  27. package/dist/utils/hasInterpolation.d.ts +7 -0
  28. package/dist/utils/hasInterpolation.js +22 -0
  29. package/dist/utils/hasInterpolation.js.map +1 -0
  30. package/dist/utils/hasLessInterpolation.d.ts +7 -0
  31. package/dist/utils/hasLessInterpolation.js +15 -0
  32. package/dist/utils/hasLessInterpolation.js.map +1 -0
  33. package/dist/utils/hasPsvInterpolation.d.ts +4 -0
  34. package/dist/utils/hasPsvInterpolation.js +12 -0
  35. package/dist/utils/hasPsvInterpolation.js.map +1 -0
  36. package/dist/utils/hasScssInterpolation.d.ts +4 -0
  37. package/dist/utils/hasScssInterpolation.js +12 -0
  38. package/dist/utils/hasScssInterpolation.js.map +1 -0
  39. package/dist/utils/index.d.ts +13 -0
  40. package/dist/utils/isCustomProperty.d.ts +4 -0
  41. package/dist/utils/isCustomProperty.js +9 -0
  42. package/dist/utils/isCustomProperty.js.map +1 -0
  43. package/dist/utils/isExportBlock.d.ts +4 -0
  44. package/dist/utils/isExportBlock.js +12 -0
  45. package/dist/utils/isExportBlock.js.map +1 -0
  46. package/dist/utils/isStandardSyntaxDeclaration.d.ts +4 -0
  47. package/dist/utils/isStandardSyntaxDeclaration.js +29 -0
  48. package/dist/utils/isStandardSyntaxDeclaration.js.map +1 -0
  49. package/dist/utils/isStandardSyntaxProperty.d.ts +4 -0
  50. package/dist/utils/isStandardSyntaxProperty.js +28 -0
  51. package/dist/utils/isStandardSyntaxProperty.js.map +1 -0
  52. package/dist/utils/isString.d.ts +1 -0
  53. package/dist/utils/isString.js +4 -0
  54. package/dist/utils/isString.js.map +1 -0
  55. package/dist/utils/kebabCase.d.ts +1 -0
  56. package/dist/utils/kebabCase.js +4 -0
  57. package/dist/utils/kebabCase.js.map +1 -0
  58. package/dist/utils/matchesStringOrRegExp.d.ts +12 -0
  59. package/dist/utils/matchesStringOrRegExp.js +60 -0
  60. package/dist/utils/matchesStringOrRegExp.js.map +1 -0
  61. package/dist/utils/namespace.d.ts +1 -0
  62. package/dist/utils/namespace.js +7 -0
  63. package/dist/utils/namespace.js.map +1 -0
  64. package/dist/utils/optionsMatches.d.ts +5 -0
  65. package/dist/utils/optionsMatches.js +15 -0
  66. package/dist/utils/optionsMatches.js.map +1 -0
  67. package/package.json +55 -0
@@ -0,0 +1,369 @@
1
+ import stylelint from 'stylelint';
2
+ import { allCSS2RNProps, allProps } from 'react-native-known-styling-properties';
3
+ import declarationValueIndex from 'stylelint/lib/utils/declarationValueIndex.cjs';
4
+
5
+ const endsWith = (str, suffix) => str.indexOf(suffix, str.length - suffix.length) !== -1;
6
+
7
+ /**
8
+ * Check whether a string has less interpolation
9
+ *
10
+ * @param {string} string
11
+ * @return {boolean} If `true`, a string has less interpolation
12
+ */
13
+ function hasLessInterpolation(string /*: string */) {
14
+ if (/@{.+?}/.test(string)) {
15
+ return true;
16
+ }
17
+ return false;
18
+ }
19
+
20
+ /**
21
+ * Check whether a string has postcss-simple-vars interpolation
22
+ */
23
+ function hasPsvInterpolation(string /*: string */) {
24
+ if (/\$\(.+?\)/.test(string)) {
25
+ return true;
26
+ }
27
+ return false;
28
+ }
29
+
30
+ /**
31
+ * Check whether a string has scss interpolation
32
+ */
33
+ function hasScssInterpolation(string /*: string */) {
34
+ if (/#{.+?}/.test(string)) {
35
+ return true;
36
+ }
37
+ return false;
38
+ }
39
+
40
+ /**
41
+ * Check whether a string has interpolation
42
+ *
43
+ * @param {string} string
44
+ * @return {boolean} If `true`, a string has interpolation
45
+ */
46
+ function hasInterpolation(string /*: string */) {
47
+ // SCSS or Less interpolation
48
+ if (hasLessInterpolation(string) ||
49
+ hasScssInterpolation(string) ||
50
+ hasPsvInterpolation(string)) {
51
+ return true;
52
+ }
53
+ return false;
54
+ }
55
+
56
+ /**
57
+ * Check whether a property is a custom one
58
+ */
59
+ function isCustomProperty(property /*: string */) {
60
+ return property.slice(0, 2) === '--';
61
+ }
62
+
63
+ /**
64
+ * Check whether a node is an :export block
65
+ */
66
+ function isExportBlock(node /*: Object */) {
67
+ if (node.type === 'rule' && node.selector && node.selector === ':export') {
68
+ return true;
69
+ }
70
+ return false;
71
+ }
72
+
73
+ /**
74
+ * Check whether a declaration is standard
75
+ */
76
+ function isStandardSyntaxDeclaration(decl /*: Object */) {
77
+ const prop = decl.prop;
78
+ const parent = decl.parent;
79
+ // Declarations belong in a declaration block
80
+ if (parent.type === 'root') {
81
+ return false;
82
+ }
83
+ // Sass var (e.g. $var: x), nested list (e.g. $list: (x)) or nested map (e.g. $map: (key:value))
84
+ if (prop[0] === '$') {
85
+ return false;
86
+ }
87
+ // Less var (e.g. @var: x), but exclude variable interpolation (e.g. @{var})
88
+ if (prop[0] === '@' && prop[1] !== '{') {
89
+ return false;
90
+ }
91
+ // Sass nested properties (e.g. border: { style: solid; color: red; })
92
+ if (parent.selector &&
93
+ parent.selector[parent.selector.length - 1] === ':' &&
94
+ parent.selector.substring(0, 2) !== '--') {
95
+ return false;
96
+ }
97
+ return true;
98
+ }
99
+
100
+ /**
101
+ * Check whether a property is standard
102
+ */
103
+ function isStandardSyntaxProperty(property /*: string */) {
104
+ // SCSS var (e.g. $var: x), list (e.g. $list: (x)) or map (e.g. $map: (key:value))
105
+ if (property[0] === '$') {
106
+ return false;
107
+ }
108
+ // Less var (e.g. @var: x)
109
+ if (property[0] === '@') {
110
+ return false;
111
+ }
112
+ // Less append property value with space (e.g. transform+_: scale(2))
113
+ if (endsWith(property, '+') || endsWith(property, '+_')) {
114
+ return false;
115
+ }
116
+ // SCSS or Less interpolation
117
+ if (hasInterpolation(property)) {
118
+ return false;
119
+ }
120
+ return true;
121
+ }
122
+
123
+ const isString = string => typeof string === 'string';
124
+
125
+ const kebabCase = string => string.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
126
+
127
+ const prefix = 'taro-rn';
128
+ function namespace(ruleName) {
129
+ return `${prefix}/${ruleName}`;
130
+ }
131
+
132
+ /**
133
+ * Compares a string to a second value that, if it fits a certain convention,
134
+ * is converted to a regular expression before the comparison.
135
+ * If it doesn't fit the convention, then two strings are compared.
136
+ *
137
+ * Any strings starting and ending with `/` are interpreted
138
+ * as regular expressions.
139
+ */
140
+ function matchesStringOrRegExp(input /*: string | Array<string> */, comparison /*: string | Array<string> */) {
141
+ if (!Array.isArray(input)) {
142
+ return testAgainstStringOrRegExpOrArray(input, comparison);
143
+ }
144
+ for (const inputItem of input) {
145
+ const testResult = testAgainstStringOrRegExpOrArray(inputItem, comparison);
146
+ if (testResult) {
147
+ return testResult;
148
+ }
149
+ }
150
+ return false;
151
+ }
152
+ function testAgainstStringOrRegExpOrArray(value, comparison) {
153
+ if (!Array.isArray(comparison)) {
154
+ return testAgainstStringOrRegExp(value, comparison);
155
+ }
156
+ for (const comparisonItem of comparison) {
157
+ const testResult = testAgainstStringOrRegExp(value, comparisonItem);
158
+ if (testResult) {
159
+ return testResult;
160
+ }
161
+ }
162
+ return false;
163
+ }
164
+ function testAgainstStringOrRegExp(value, comparison) {
165
+ // If it's a RegExp, test directly
166
+ if (comparison instanceof RegExp) {
167
+ return comparison.test(value)
168
+ ? { match: value, pattern: comparison }
169
+ : false;
170
+ }
171
+ // Check if it's RegExp in a string
172
+ const firstComparisonChar = comparison[0];
173
+ const lastComparisonChar = comparison[comparison.length - 1];
174
+ const secondToLastComparisonChar = comparison[comparison.length - 2];
175
+ const comparisonIsRegex = firstComparisonChar === '/' &&
176
+ (lastComparisonChar === '/' ||
177
+ (secondToLastComparisonChar === '/' && lastComparisonChar === 'i'));
178
+ const hasCaseInsensitiveFlag = comparisonIsRegex && lastComparisonChar === 'i';
179
+ // If so, create a new RegExp from it
180
+ if (comparisonIsRegex) {
181
+ const valueMatches = hasCaseInsensitiveFlag
182
+ ? new RegExp(comparison.slice(1, -2), 'i').test(value)
183
+ : new RegExp(comparison.slice(1, -1)).test(value);
184
+ return valueMatches ? { match: value, pattern: comparison } : false;
185
+ }
186
+ // Otherwise, it's a string. Do a strict comparison
187
+ return value === comparison ? { match: value, pattern: comparison } : false;
188
+ }
189
+
190
+ /**
191
+ * Check if an options object's propertyName contains a user-defined string or
192
+ * regex that matches the passed in input.
193
+ */
194
+ function optionsMatches(options /*: Object */, propertyName /*: string */, input /*: string */) {
195
+ return !!(options &&
196
+ options[propertyName] &&
197
+ typeof input === 'string' &&
198
+ matchesStringOrRegExp(input, options[propertyName]));
199
+ }
200
+
201
+ const ruleName$3 = namespace('css-property-no-unknown');
202
+ const messages$3 = stylelint.utils.ruleMessages(ruleName$3, {
203
+ rejected: (property) => `无效的 React Native 样式属性 "${property}"`
204
+ });
205
+ const props$1 = allCSS2RNProps.map(kebabCase);
206
+ function cssPropertyNoUnknown (actual, options) {
207
+ return function (root, result) {
208
+ const validOptions = stylelint.utils.validateOptions(result, ruleName$3, {
209
+ actual
210
+ }, {
211
+ actual: options,
212
+ possible: {
213
+ ignoreProperties: [isString]
214
+ },
215
+ optional: true
216
+ });
217
+ if (!validOptions) {
218
+ return;
219
+ }
220
+ root.walkDecls((decl) => {
221
+ const prop = decl.prop;
222
+ if (!isStandardSyntaxProperty(prop)) {
223
+ return;
224
+ }
225
+ if (!isStandardSyntaxDeclaration(decl)) {
226
+ return;
227
+ }
228
+ if (isCustomProperty(prop)) {
229
+ return;
230
+ }
231
+ if (isExportBlock(decl.parent)) {
232
+ return;
233
+ }
234
+ if (optionsMatches(options, 'ignoreProperties', prop)) {
235
+ return;
236
+ }
237
+ if (props$1.indexOf(prop.toLowerCase()) !== -1) {
238
+ return;
239
+ }
240
+ stylelint.utils.report({
241
+ message: messages$3.rejected(prop),
242
+ node: decl,
243
+ result,
244
+ ruleName: ruleName$3
245
+ });
246
+ });
247
+ };
248
+ }
249
+
250
+ const ruleName$2 = namespace('font-weight-no-ignored-values');
251
+ const messages$2 = stylelint.utils.ruleMessages(ruleName$2, {
252
+ rejected: (weight) => `Unexpected font-weight "${weight}"`
253
+ });
254
+ const acceptedWeights = ['400', '700', 'normal', 'bold'];
255
+ function fontWeightNoIgnoredValues (actual) {
256
+ return function (root, result) {
257
+ const validOptions = stylelint.utils.validateOptions(result, ruleName$2, {
258
+ actual
259
+ });
260
+ if (!validOptions) {
261
+ return;
262
+ }
263
+ root.walkDecls(/^font-weight$/i, (decl) => {
264
+ if (acceptedWeights.indexOf(decl.value) > -1) {
265
+ return;
266
+ }
267
+ const weightValueOffset = decl.value.indexOf(decl.value);
268
+ const index = declarationValueIndex(decl) + weightValueOffset;
269
+ stylelint.utils.report({
270
+ message: messages$2.rejected(decl.value),
271
+ node: decl,
272
+ result,
273
+ ruleName: ruleName$2,
274
+ index
275
+ });
276
+ });
277
+ };
278
+ }
279
+
280
+ const ruleName$1 = namespace('line-height-no-value-without-unit');
281
+ const messages$1 = stylelint.utils.ruleMessages(ruleName$1, {
282
+ rejected: (height) => `Unexpected line-height "${height}", expect a value with units`
283
+ });
284
+ const lengthRe = /^(0$|(?:[+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?)(?=px|PX|rem$))/;
285
+ const viewportUnitRe = /^([+-]?[0-9.]+)(vh|vw|vmin|vmax)$/;
286
+ function lineHeightNoValueWithoutUnit (actual) {
287
+ return function (root, result) {
288
+ const validOptions = stylelint.utils.validateOptions(result, ruleName$1, {
289
+ actual
290
+ });
291
+ if (!validOptions) {
292
+ return;
293
+ }
294
+ root.walkDecls(/^line-height$/i, (decl) => {
295
+ if (lengthRe.test(decl.value) || viewportUnitRe.test(decl.value)) {
296
+ return;
297
+ }
298
+ const valueOffset = decl.value.indexOf(decl.value);
299
+ const index = declarationValueIndex(decl) + valueOffset;
300
+ stylelint.utils.report({
301
+ message: messages$1.rejected(decl.value),
302
+ node: decl,
303
+ result,
304
+ ruleName: ruleName$1,
305
+ index
306
+ });
307
+ });
308
+ };
309
+ }
310
+
311
+ const ruleName = namespace('style-property-no-unknown');
312
+ const messages = stylelint.utils.ruleMessages(ruleName, {
313
+ rejected: (property) => `无效的 React Native 样式属性 "${property}"`
314
+ });
315
+ const props = allProps.map(kebabCase);
316
+ function stylePropertyNoUnknown (actual, options) {
317
+ return function (root, result) {
318
+ const validOptions = stylelint.utils.validateOptions(result, ruleName, {
319
+ actual
320
+ }, {
321
+ actual: options,
322
+ possible: {
323
+ ignoreProperties: [isString]
324
+ },
325
+ optional: true
326
+ });
327
+ if (!validOptions) {
328
+ return;
329
+ }
330
+ root.walkDecls((decl) => {
331
+ const prop = decl.prop;
332
+ if (!isStandardSyntaxProperty(prop)) {
333
+ return;
334
+ }
335
+ if (!isStandardSyntaxDeclaration(decl)) {
336
+ return;
337
+ }
338
+ if (isCustomProperty(prop)) {
339
+ return;
340
+ }
341
+ if (optionsMatches(options, 'ignoreProperties', prop)) {
342
+ return;
343
+ }
344
+ if (props.indexOf(prop.toLowerCase()) !== -1) {
345
+ return;
346
+ }
347
+ stylelint.utils.report({
348
+ message: messages.rejected(prop),
349
+ node: decl,
350
+ result,
351
+ ruleName
352
+ });
353
+ });
354
+ };
355
+ }
356
+
357
+ var rules = {
358
+ 'font-weight-no-ignored-values': fontWeightNoIgnoredValues,
359
+ 'css-property-no-unknown': cssPropertyNoUnknown,
360
+ 'style-property-no-unknown': stylePropertyNoUnknown,
361
+ 'line-height-no-value-without-unit': lineHeightNoValueWithoutUnit
362
+ };
363
+
364
+ const rulesPlugins = Object.keys(rules).map((ruleName) => {
365
+ return stylelint.createPlugin(namespace(ruleName), rules[ruleName]);
366
+ });
367
+
368
+ export { rulesPlugins as default };
369
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/utils/endsWith.js","../src/utils/hasLessInterpolation.js","../src/utils/hasPsvInterpolation.js","../src/utils/hasScssInterpolation.js","../src/utils/hasInterpolation.js","../src/utils/isCustomProperty.js","../src/utils/isExportBlock.js","../src/utils/isStandardSyntaxDeclaration.js","../src/utils/isStandardSyntaxProperty.js","../src/utils/isString.js","../src/utils/kebabCase.js","../src/utils/namespace.js","../src/utils/matchesStringOrRegExp.js","../src/utils/optionsMatches.js","../src/rules/css-property-no-unknown/index.js","../src/rules/font-weight-no-ignored-values/index.js","../src/rules/line-height-no-value-without-unit/index.js","../src/rules/style-property-no-unknown/index.js","../src/rules/index.js","../src/index.js"],"sourcesContent":["export const endsWith = (str, suffix) =>\n str.indexOf(suffix, str.length - suffix.length) !== -1\n","/**\n * Check whether a string has less interpolation\n *\n * @param {string} string\n * @return {boolean} If `true`, a string has less interpolation\n */\nexport function hasLessInterpolation (string /*: string */) /*: boolean */ {\n if (/@{.+?}/.test(string)) {\n return true\n }\n\n return false\n}\n","/**\n * Check whether a string has postcss-simple-vars interpolation\n */\nexport function hasPsvInterpolation (string /*: string */) /*: boolean */ {\n if (/\\$\\(.+?\\)/.test(string)) {\n return true\n }\n\n return false\n}\n","/**\n * Check whether a string has scss interpolation\n */\nexport function hasScssInterpolation (string /*: string */) /*: boolean */ {\n if (/#{.+?}/.test(string)) {\n return true\n }\n\n return false\n}\n","import { hasLessInterpolation } from './hasLessInterpolation.js'\nimport { hasPsvInterpolation } from './hasPsvInterpolation.js'\nimport { hasScssInterpolation } from './hasScssInterpolation.js'\n\n/**\n * Check whether a string has interpolation\n *\n * @param {string} string\n * @return {boolean} If `true`, a string has interpolation\n */\nexport function hasInterpolation (string /*: string */) /*: boolean */ {\n // SCSS or Less interpolation\n if (\n hasLessInterpolation(string) ||\n hasScssInterpolation(string) ||\n hasPsvInterpolation(string)\n ) {\n return true\n }\n\n return false\n}\n","/**\n * Check whether a property is a custom one\n */\nexport function isCustomProperty (property /*: string */) /*: boolean */ {\n return property.slice(0, 2) === '--'\n}\n","/**\n * Check whether a node is an :export block\n */\nexport function isExportBlock (node /*: Object */) /*: boolean */ {\n if (node.type === 'rule' && node.selector && node.selector === ':export') {\n return true\n }\n\n return false\n}\n","/**\n * Check whether a declaration is standard\n */\nexport function isStandardSyntaxDeclaration (decl /*: Object */) /*: boolean */ {\n const prop = decl.prop\n const parent = decl.parent\n\n // Declarations belong in a declaration block\n\n if (parent.type === 'root') {\n return false\n }\n\n // Sass var (e.g. $var: x), nested list (e.g. $list: (x)) or nested map (e.g. $map: (key:value))\n if (prop[0] === '$') {\n return false\n }\n\n // Less var (e.g. @var: x), but exclude variable interpolation (e.g. @{var})\n if (prop[0] === '@' && prop[1] !== '{') {\n return false\n }\n\n // Sass nested properties (e.g. border: { style: solid; color: red; })\n if (\n parent.selector &&\n parent.selector[parent.selector.length - 1] === ':' &&\n parent.selector.substring(0, 2) !== '--'\n ) {\n return false\n }\n\n return true\n}\n","import { endsWith } from './endsWith.js'\nimport { hasInterpolation } from './hasInterpolation.js'\n\n/**\n * Check whether a property is standard\n */\nexport function isStandardSyntaxProperty (\n property /*: string */\n) /*: boolean */ {\n // SCSS var (e.g. $var: x), list (e.g. $list: (x)) or map (e.g. $map: (key:value))\n if (property[0] === '$') {\n return false\n }\n\n // Less var (e.g. @var: x)\n if (property[0] === '@') {\n return false\n }\n\n // Less append property value with space (e.g. transform+_: scale(2))\n if (endsWith(property, '+') || endsWith(property, '+_')) {\n return false\n }\n\n // SCSS or Less interpolation\n if (hasInterpolation(property)) {\n return false\n }\n\n return true\n}\n","export const isString = string => typeof string === 'string'\n","export const kebabCase = string =>\n string.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()\n","const prefix = 'taro-rn'\n\nexport function namespace (ruleName) {\n return `${prefix}/${ruleName}`\n}\n","/**\n * Compares a string to a second value that, if it fits a certain convention,\n * is converted to a regular expression before the comparison.\n * If it doesn't fit the convention, then two strings are compared.\n *\n * Any strings starting and ending with `/` are interpreted\n * as regular expressions.\n */\nexport function matchesStringOrRegExp (\n input /*: string | Array<string> */,\n comparison /*: string | Array<string> */\n) /*: false | { match: string, pattern: string } */ {\n if (!Array.isArray(input)) {\n return testAgainstStringOrRegExpOrArray(input, comparison)\n }\n\n for (const inputItem of input) {\n const testResult = testAgainstStringOrRegExpOrArray(inputItem, comparison)\n if (testResult) {\n return testResult\n }\n }\n\n return false\n}\n\nfunction testAgainstStringOrRegExpOrArray (value, comparison) {\n if (!Array.isArray(comparison)) {\n return testAgainstStringOrRegExp(value, comparison)\n }\n\n for (const comparisonItem of comparison) {\n const testResult = testAgainstStringOrRegExp(value, comparisonItem)\n if (testResult) {\n return testResult\n }\n }\n return false\n}\n\nfunction testAgainstStringOrRegExp (value, comparison) {\n // If it's a RegExp, test directly\n if (comparison instanceof RegExp) {\n return comparison.test(value)\n ? { match: value, pattern: comparison }\n : false\n }\n\n // Check if it's RegExp in a string\n const firstComparisonChar = comparison[0]\n const lastComparisonChar = comparison[comparison.length - 1]\n const secondToLastComparisonChar = comparison[comparison.length - 2]\n\n const comparisonIsRegex =\n firstComparisonChar === '/' &&\n (lastComparisonChar === '/' ||\n (secondToLastComparisonChar === '/' && lastComparisonChar === 'i'))\n\n const hasCaseInsensitiveFlag =\n comparisonIsRegex && lastComparisonChar === 'i'\n\n // If so, create a new RegExp from it\n if (comparisonIsRegex) {\n const valueMatches = hasCaseInsensitiveFlag\n ? new RegExp(comparison.slice(1, -2), 'i').test(value)\n : new RegExp(comparison.slice(1, -1)).test(value)\n return valueMatches ? { match: value, pattern: comparison } : false\n }\n\n // Otherwise, it's a string. Do a strict comparison\n return value === comparison ? { match: value, pattern: comparison } : false\n}\n","import { matchesStringOrRegExp } from './matchesStringOrRegExp.js'\n\n/**\n * Check if an options object's propertyName contains a user-defined string or\n * regex that matches the passed in input.\n */\nexport function optionsMatches (\n options /*: Object */,\n propertyName /*: string */,\n input /*: string */\n) /*: boolean */ {\n return !!(\n options &&\n options[propertyName] &&\n typeof input === 'string' &&\n matchesStringOrRegExp(input, options[propertyName])\n )\n}\n","import { allCSS2RNProps } from 'react-native-known-styling-properties'\nimport stylelint from 'stylelint'\n\nimport {\n isCustomProperty,\n isExportBlock,\n isStandardSyntaxDeclaration,\n isStandardSyntaxProperty,\n isString,\n kebabCase,\n namespace,\n optionsMatches\n} from '../../utils/index.js'\n\nexport const ruleName = namespace('css-property-no-unknown')\n\nexport const messages = stylelint.utils.ruleMessages(ruleName, {\n rejected: (property) => `无效的 React Native 样式属性 \"${property}\"`\n})\n\nconst props = allCSS2RNProps.map(kebabCase)\n\nexport default function (actual, options) {\n return function (root, result) {\n const validOptions = stylelint.utils.validateOptions(\n result,\n ruleName,\n {\n actual\n },\n {\n actual: options,\n possible: {\n ignoreProperties: [isString]\n },\n optional: true\n }\n )\n\n if (!validOptions) {\n return\n }\n\n root.walkDecls((decl) => {\n const prop = decl.prop\n\n if (!isStandardSyntaxProperty(prop)) {\n return\n }\n\n if (!isStandardSyntaxDeclaration(decl)) {\n return\n }\n\n if (isCustomProperty(prop)) {\n return\n }\n\n if (isExportBlock(decl.parent)) {\n return\n }\n\n if (optionsMatches(options, 'ignoreProperties', prop)) {\n return\n }\n\n if (props.indexOf(prop.toLowerCase()) !== -1) {\n return\n }\n\n stylelint.utils.report({\n message: messages.rejected(prop),\n node: decl,\n result,\n ruleName\n })\n })\n }\n}\n","import stylelint from 'stylelint'\nimport declarationValueIndex from 'stylelint/lib/utils/declarationValueIndex.cjs'\n\nimport { namespace } from '../../utils/index.js'\n\nexport const ruleName = namespace('font-weight-no-ignored-values')\n\nexport const messages = stylelint.utils.ruleMessages(ruleName, {\n rejected: (weight) => `Unexpected font-weight \"${weight}\"`\n})\n\nconst acceptedWeights = ['400', '700', 'normal', 'bold']\n\nexport default function (actual) {\n return function (root, result) {\n const validOptions = stylelint.utils.validateOptions(result, ruleName, {\n actual\n })\n\n if (!validOptions) {\n return\n }\n\n root.walkDecls(/^font-weight$/i, (decl) => {\n if (acceptedWeights.indexOf(decl.value) > -1) {\n return\n }\n\n const weightValueOffset = decl.value.indexOf(decl.value)\n const index = declarationValueIndex(decl) + weightValueOffset\n\n stylelint.utils.report({\n message: messages.rejected(decl.value),\n node: decl,\n result,\n ruleName,\n index\n })\n })\n }\n}\n","import stylelint from 'stylelint'\nimport declarationValueIndex from 'stylelint/lib/utils/declarationValueIndex.cjs'\n\nimport { namespace } from '../../utils/index.js'\n\nexport const ruleName = namespace('line-height-no-value-without-unit')\n\nexport const messages = stylelint.utils.ruleMessages(ruleName, {\n rejected: (height) =>\n `Unexpected line-height \"${height}\", expect a value with units`\n})\n\nconst lengthRe = /^(0$|(?:[+-]?(?:\\d*\\.)?\\d+(?:[Ee][+-]?\\d+)?)(?=px|PX|rem$))/\nconst viewportUnitRe = /^([+-]?[0-9.]+)(vh|vw|vmin|vmax)$/\n\nexport default function (actual) {\n return function (root, result) {\n const validOptions = stylelint.utils.validateOptions(result, ruleName, {\n actual\n })\n\n if (!validOptions) {\n return\n }\n\n root.walkDecls(/^line-height$/i, (decl) => {\n if (lengthRe.test(decl.value) || viewportUnitRe.test(decl.value)) {\n return\n }\n\n const valueOffset = decl.value.indexOf(decl.value)\n const index = declarationValueIndex(decl) + valueOffset\n\n stylelint.utils.report({\n message: messages.rejected(decl.value),\n node: decl,\n result,\n ruleName,\n index\n })\n })\n }\n}\n","import { allProps } from 'react-native-known-styling-properties'\nimport stylelint from 'stylelint'\n\nimport {\n isCustomProperty,\n isStandardSyntaxDeclaration,\n isStandardSyntaxProperty,\n isString,\n kebabCase,\n namespace,\n optionsMatches\n} from '../../utils/index.js'\n\nexport const ruleName = namespace('style-property-no-unknown')\n\nexport const messages = stylelint.utils.ruleMessages(ruleName, {\n rejected: (property) => `无效的 React Native 样式属性 \"${property}\"`\n})\n\nconst props = allProps.map(kebabCase)\n\nexport default function (actual, options) {\n return function (root, result) {\n const validOptions = stylelint.utils.validateOptions(\n result,\n ruleName,\n {\n actual\n },\n {\n actual: options,\n possible: {\n ignoreProperties: [isString]\n },\n optional: true\n }\n )\n\n if (!validOptions) {\n return\n }\n\n root.walkDecls((decl) => {\n const prop = decl.prop\n\n if (!isStandardSyntaxProperty(prop)) {\n return\n }\n\n if (!isStandardSyntaxDeclaration(decl)) {\n return\n }\n\n if (isCustomProperty(prop)) {\n return\n }\n\n if (optionsMatches(options, 'ignoreProperties', prop)) {\n return\n }\n\n if (props.indexOf(prop.toLowerCase()) !== -1) {\n return\n }\n\n stylelint.utils.report({\n message: messages.rejected(prop),\n node: decl,\n result,\n ruleName\n })\n })\n }\n}\n","import cssPropertyNoUnknown from './css-property-no-unknown/index.js'\nimport fontWeightNoIgnoredValues from './font-weight-no-ignored-values/index.js'\nimport lineHeightNoValueWithoutUnit from './line-height-no-value-without-unit/index.js'\nimport stylePropertyNoUnknown from './style-property-no-unknown/index.js'\n\nexport default {\n 'font-weight-no-ignored-values': fontWeightNoIgnoredValues,\n 'css-property-no-unknown': cssPropertyNoUnknown,\n 'style-property-no-unknown': stylePropertyNoUnknown,\n 'line-height-no-value-without-unit': lineHeightNoValueWithoutUnit\n}\n","import stylelint from 'stylelint'\n\nimport rules from './rules/index.js'\nimport { namespace } from './utils/index.js'\n\nconst rulesPlugins = Object.keys(rules).map((ruleName) => {\n return stylelint.createPlugin(namespace(ruleName), rules[ruleName])\n})\n\nexport default rulesPlugins\n"],"names":["ruleName","messages","props"],"mappings":";;;;AAAO,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,MAAM,KAClC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;;ACDxD;;;;;AAKG;AACa,SAAA,oBAAoB,CAAE,MAAM,gBAAc;AACxD,IAAA,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;AACzB,QAAA,OAAO,IAAI,CAAA;AACZ,KAAA;AAED,IAAA,OAAO,KAAK,CAAA;AACd;;ACZA;;AAEG;AACa,SAAA,mBAAmB,CAAE,MAAM,gBAAc;AACvD,IAAA,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;AAC5B,QAAA,OAAO,IAAI,CAAA;AACZ,KAAA;AAED,IAAA,OAAO,KAAK,CAAA;AACd;;ACTA;;AAEG;AACa,SAAA,oBAAoB,CAAE,MAAM,gBAAc;AACxD,IAAA,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;AACzB,QAAA,OAAO,IAAI,CAAA;AACZ,KAAA;AAED,IAAA,OAAO,KAAK,CAAA;AACd;;ACLA;;;;;AAKG;AACa,SAAA,gBAAgB,CAAE,MAAM,gBAAc;;IAEpD,IACE,oBAAoB,CAAC,MAAM,CAAC;QAC5B,oBAAoB,CAAC,MAAM,CAAC;QAC5B,mBAAmB,CAAC,MAAM,CAAC,EAC3B;AACA,QAAA,OAAO,IAAI,CAAA;AACZ,KAAA;AAED,IAAA,OAAO,KAAK,CAAA;AACd;;ACrBA;;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A;AACJ,SAAC,CAAC,CAAA;AACJ,KAAC,CAAA;AACH;;ACpEA,YAAe;AACb,IAAA,+BAA+B,EAAE,yBAAyB;AAC1D,IAAA,yBAAyB,EAAE,oBAAoB;AAC/C,IAAA,2BAA2B,EAAE,sBAAsB;AACnD,IAAA,mCAAmC,EAAE,4BAA4B;CAClE;;ACLD,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAI;AACvD,IAAA,OAAO,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AACrE,CAAC;;;;"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import stylelint from 'stylelint';
2
+ import rules from './rules/index.js';
3
+ import { namespace } from './utils/namespace.js';
4
+
5
+ const rulesPlugins = Object.keys(rules).map((ruleName) => {
6
+ return stylelint.createPlugin(namespace(ruleName), rules[ruleName]);
7
+ });
8
+
9
+ export { rulesPlugins as default };
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/index.js"],"sourcesContent":["import stylelint from 'stylelint'\n\nimport rules from './rules/index.js'\nimport { namespace } from './utils/index.js'\n\nconst rulesPlugins = Object.keys(rules).map((ruleName) => {\n return stylelint.createPlugin(namespace(ruleName), rules[ruleName])\n})\n\nexport default rulesPlugins\n"],"names":[],"mappings":";;;;AAKA,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAI;AACvD,IAAA,OAAO,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AACrE,CAAC;;;;"}
@@ -0,0 +1,5 @@
1
+ export default function _default(actual: any, options: any): (root: any, result: any) => void;
2
+ export const ruleName: string;
3
+ export const messages: {
4
+ rejected: (property: string | number | boolean | RegExp) => string;
5
+ };
@@ -0,0 +1,62 @@
1
+ import { allCSS2RNProps } from 'react-native-known-styling-properties';
2
+ import stylelint from 'stylelint';
3
+ import { isCustomProperty } from '../../utils/isCustomProperty.js';
4
+ import { isExportBlock } from '../../utils/isExportBlock.js';
5
+ import { isStandardSyntaxDeclaration } from '../../utils/isStandardSyntaxDeclaration.js';
6
+ import { isStandardSyntaxProperty } from '../../utils/isStandardSyntaxProperty.js';
7
+ import { isString } from '../../utils/isString.js';
8
+ import { kebabCase } from '../../utils/kebabCase.js';
9
+ import { namespace } from '../../utils/namespace.js';
10
+ import { optionsMatches } from '../../utils/optionsMatches.js';
11
+
12
+ const ruleName = namespace('css-property-no-unknown');
13
+ const messages = stylelint.utils.ruleMessages(ruleName, {
14
+ rejected: (property) => `无效的 React Native 样式属性 "${property}"`
15
+ });
16
+ const props = allCSS2RNProps.map(kebabCase);
17
+ function cssPropertyNoUnknown (actual, options) {
18
+ return function (root, result) {
19
+ const validOptions = stylelint.utils.validateOptions(result, ruleName, {
20
+ actual
21
+ }, {
22
+ actual: options,
23
+ possible: {
24
+ ignoreProperties: [isString]
25
+ },
26
+ optional: true
27
+ });
28
+ if (!validOptions) {
29
+ return;
30
+ }
31
+ root.walkDecls((decl) => {
32
+ const prop = decl.prop;
33
+ if (!isStandardSyntaxProperty(prop)) {
34
+ return;
35
+ }
36
+ if (!isStandardSyntaxDeclaration(decl)) {
37
+ return;
38
+ }
39
+ if (isCustomProperty(prop)) {
40
+ return;
41
+ }
42
+ if (isExportBlock(decl.parent)) {
43
+ return;
44
+ }
45
+ if (optionsMatches(options, 'ignoreProperties', prop)) {
46
+ return;
47
+ }
48
+ if (props.indexOf(prop.toLowerCase()) !== -1) {
49
+ return;
50
+ }
51
+ stylelint.utils.report({
52
+ message: messages.rejected(prop),
53
+ node: decl,
54
+ result,
55
+ ruleName
56
+ });
57
+ });
58
+ };
59
+ }
60
+
61
+ export { cssPropertyNoUnknown as default, messages, ruleName };
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/rules/css-property-no-unknown/index.js"],"sourcesContent":["import { allCSS2RNProps } from 'react-native-known-styling-properties'\nimport stylelint from 'stylelint'\n\nimport {\n isCustomProperty,\n isExportBlock,\n isStandardSyntaxDeclaration,\n isStandardSyntaxProperty,\n isString,\n kebabCase,\n namespace,\n optionsMatches\n} from '../../utils/index.js'\n\nexport const ruleName = namespace('css-property-no-unknown')\n\nexport const messages = stylelint.utils.ruleMessages(ruleName, {\n rejected: (property) => `无效的 React Native 样式属性 \"${property}\"`\n})\n\nconst props = allCSS2RNProps.map(kebabCase)\n\nexport default function (actual, options) {\n return function (root, result) {\n const validOptions = stylelint.utils.validateOptions(\n result,\n ruleName,\n {\n actual\n },\n {\n actual: options,\n possible: {\n ignoreProperties: [isString]\n },\n optional: true\n }\n )\n\n if (!validOptions) {\n return\n }\n\n root.walkDecls((decl) => {\n const prop = decl.prop\n\n if (!isStandardSyntaxProperty(prop)) {\n return\n }\n\n if (!isStandardSyntaxDeclaration(decl)) {\n return\n }\n\n if (isCustomProperty(prop)) {\n return\n }\n\n if (isExportBlock(decl.parent)) {\n return\n }\n\n if (optionsMatches(options, 'ignoreProperties', prop)) {\n return\n }\n\n if (props.indexOf(prop.toLowerCase()) !== -1) {\n return\n }\n\n stylelint.utils.report({\n message: messages.rejected(prop),\n node: decl,\n result,\n ruleName\n })\n })\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;MAca,QAAQ,GAAG,SAAS,CAAC,yBAAyB,EAAC;AAE/C,MAAA,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE;IAC7D,QAAQ,EAAE,CAAC,QAAQ,KAAK,CAAA,uBAAA,EAA0B,QAAQ,CAAG,CAAA,CAAA;AAC9D,CAAA,EAAC;AAEF,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,SA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CAAC,CAAA;AACJ,SAAC,CAAC,CAAA;AACJ,KAAC,CAAA;AACH;;;;"}
@@ -0,0 +1,5 @@
1
+ export default function _default(actual: any): (root: any, result: any) => void;
2
+ export const ruleName: string;
3
+ export const messages: {
4
+ rejected: (weight: string | number | boolean | RegExp) => string;
5
+ };
@@ -0,0 +1,36 @@
1
+ import stylelint from 'stylelint';
2
+ import declarationValueIndex from 'stylelint/lib/utils/declarationValueIndex.cjs';
3
+ import { namespace } from '../../utils/namespace.js';
4
+
5
+ const ruleName = namespace('font-weight-no-ignored-values');
6
+ const messages = stylelint.utils.ruleMessages(ruleName, {
7
+ rejected: (weight) => `Unexpected font-weight "${weight}"`
8
+ });
9
+ const acceptedWeights = ['400', '700', 'normal', 'bold'];
10
+ function fontWeightNoIgnoredValues (actual) {
11
+ return function (root, result) {
12
+ const validOptions = stylelint.utils.validateOptions(result, ruleName, {
13
+ actual
14
+ });
15
+ if (!validOptions) {
16
+ return;
17
+ }
18
+ root.walkDecls(/^font-weight$/i, (decl) => {
19
+ if (acceptedWeights.indexOf(decl.value) > -1) {
20
+ return;
21
+ }
22
+ const weightValueOffset = decl.value.indexOf(decl.value);
23
+ const index = declarationValueIndex(decl) + weightValueOffset;
24
+ stylelint.utils.report({
25
+ message: messages.rejected(decl.value),
26
+ node: decl,
27
+ result,
28
+ ruleName,
29
+ index
30
+ });
31
+ });
32
+ };
33
+ }
34
+
35
+ export { fontWeightNoIgnoredValues as default, messages, ruleName };
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/rules/font-weight-no-ignored-values/index.js"],"sourcesContent":["import stylelint from 'stylelint'\nimport declarationValueIndex from 'stylelint/lib/utils/declarationValueIndex.cjs'\n\nimport { namespace } from '../../utils/index.js'\n\nexport const ruleName = namespace('font-weight-no-ignored-values')\n\nexport const messages = stylelint.utils.ruleMessages(ruleName, {\n rejected: (weight) => `Unexpected font-weight \"${weight}\"`\n})\n\nconst acceptedWeights = ['400', '700', 'normal', 'bold']\n\nexport default function (actual) {\n return function (root, result) {\n const validOptions = stylelint.utils.validateOptions(result, ruleName, {\n actual\n })\n\n if (!validOptions) {\n return\n }\n\n root.walkDecls(/^font-weight$/i, (decl) => {\n if (acceptedWeights.indexOf(decl.value) > -1) {\n return\n }\n\n const weightValueOffset = decl.value.indexOf(decl.value)\n const index = declarationValueIndex(decl) + weightValueOffset\n\n stylelint.utils.report({\n message: messages.rejected(decl.value),\n node: decl,\n result,\n ruleName,\n index\n })\n })\n }\n}\n"],"names":[],"mappings":";;;;MAKa,QAAQ,GAAG,SAAS,CAAC,+BAA+B,EAAC;AAErD,MAAA,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE;IAC7D,QAAQ,EAAE,CAAC,MAAM,KAAK,CAAA,wBAAA,EAA2B,MAAM,CAAG,CAAA,CAAA;AAC3D,CAAA,EAAC;AAEF,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;AAE1C,kCAAA,EAAW,MAAM,EAAA;IAC7B,OAAO,UAAU,IAAI,EAAE,MAAM,EAAA;QAC3B,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE;YACrE,MAAM;AACP,SAAA,CAAC,CAAA;QAEF,IAAI,CAAC,YAAY,EAAE;YACjB,OAAM;AACP,SAAA;QAED,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC,IAAI,KAAI;YACxC,IAAI,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE;gBAC5C,OAAM;AACP,aAAA;AAED,YAAA,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACxD,MAAM,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAA;AAE7D,YAAA,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;gBACrB,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;AACtC,gBAAA,IAAI,EAAE,IAAI;gBACV,MAAM;gBACN,QAAQ;gBACR,KAAK;AACN,aAAA,CAAC,CAAA;AACJ,SAAC,CAAC,CAAA;AACJ,KAAC,CAAA;AACH;;;;"}
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ 'font-weight-no-ignored-values': typeof fontWeightNoIgnoredValues;
3
+ 'css-property-no-unknown': typeof cssPropertyNoUnknown;
4
+ 'style-property-no-unknown': typeof stylePropertyNoUnknown;
5
+ 'line-height-no-value-without-unit': typeof lineHeightNoValueWithoutUnit;
6
+ };
7
+ export default _default;
8
+ import fontWeightNoIgnoredValues from "./font-weight-no-ignored-values/index.js";
9
+ import cssPropertyNoUnknown from "./css-property-no-unknown/index.js";
10
+ import stylePropertyNoUnknown from "./style-property-no-unknown/index.js";
11
+ import lineHeightNoValueWithoutUnit from "./line-height-no-value-without-unit/index.js";
@@ -0,0 +1,14 @@
1
+ import cssPropertyNoUnknown from './css-property-no-unknown/index.js';
2
+ import fontWeightNoIgnoredValues from './font-weight-no-ignored-values/index.js';
3
+ import lineHeightNoValueWithoutUnit from './line-height-no-value-without-unit/index.js';
4
+ import stylePropertyNoUnknown from './style-property-no-unknown/index.js';
5
+
6
+ var rules = {
7
+ 'font-weight-no-ignored-values': fontWeightNoIgnoredValues,
8
+ 'css-property-no-unknown': cssPropertyNoUnknown,
9
+ 'style-property-no-unknown': stylePropertyNoUnknown,
10
+ 'line-height-no-value-without-unit': lineHeightNoValueWithoutUnit
11
+ };
12
+
13
+ export { rules as default };
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/rules/index.js"],"sourcesContent":["import cssPropertyNoUnknown from './css-property-no-unknown/index.js'\nimport fontWeightNoIgnoredValues from './font-weight-no-ignored-values/index.js'\nimport lineHeightNoValueWithoutUnit from './line-height-no-value-without-unit/index.js'\nimport stylePropertyNoUnknown from './style-property-no-unknown/index.js'\n\nexport default {\n 'font-weight-no-ignored-values': fontWeightNoIgnoredValues,\n 'css-property-no-unknown': cssPropertyNoUnknown,\n 'style-property-no-unknown': stylePropertyNoUnknown,\n 'line-height-no-value-without-unit': lineHeightNoValueWithoutUnit\n}\n"],"names":[],"mappings":";;;;;AAKA,YAAe;AACb,IAAA,+BAA+B,EAAE,yBAAyB;AAC1D,IAAA,yBAAyB,EAAE,oBAAoB;AAC/C,IAAA,2BAA2B,EAAE,sBAAsB;AACnD,IAAA,mCAAmC,EAAE,4BAA4B;CAClE;;;;"}
@@ -0,0 +1,5 @@
1
+ export default function _default(actual: any): (root: any, result: any) => void;
2
+ export const ruleName: string;
3
+ export const messages: {
4
+ rejected: (height: string | number | boolean | RegExp) => string;
5
+ };
@@ -0,0 +1,37 @@
1
+ import stylelint from 'stylelint';
2
+ import declarationValueIndex from 'stylelint/lib/utils/declarationValueIndex.cjs';
3
+ import { namespace } from '../../utils/namespace.js';
4
+
5
+ const ruleName = namespace('line-height-no-value-without-unit');
6
+ const messages = stylelint.utils.ruleMessages(ruleName, {
7
+ rejected: (height) => `Unexpected line-height "${height}", expect a value with units`
8
+ });
9
+ const lengthRe = /^(0$|(?:[+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?)(?=px|PX|rem$))/;
10
+ const viewportUnitRe = /^([+-]?[0-9.]+)(vh|vw|vmin|vmax)$/;
11
+ function lineHeightNoValueWithoutUnit (actual) {
12
+ return function (root, result) {
13
+ const validOptions = stylelint.utils.validateOptions(result, ruleName, {
14
+ actual
15
+ });
16
+ if (!validOptions) {
17
+ return;
18
+ }
19
+ root.walkDecls(/^line-height$/i, (decl) => {
20
+ if (lengthRe.test(decl.value) || viewportUnitRe.test(decl.value)) {
21
+ return;
22
+ }
23
+ const valueOffset = decl.value.indexOf(decl.value);
24
+ const index = declarationValueIndex(decl) + valueOffset;
25
+ stylelint.utils.report({
26
+ message: messages.rejected(decl.value),
27
+ node: decl,
28
+ result,
29
+ ruleName,
30
+ index
31
+ });
32
+ });
33
+ };
34
+ }
35
+
36
+ export { lineHeightNoValueWithoutUnit as default, messages, ruleName };
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/rules/line-height-no-value-without-unit/index.js"],"sourcesContent":["import stylelint from 'stylelint'\nimport declarationValueIndex from 'stylelint/lib/utils/declarationValueIndex.cjs'\n\nimport { namespace } from '../../utils/index.js'\n\nexport const ruleName = namespace('line-height-no-value-without-unit')\n\nexport const messages = stylelint.utils.ruleMessages(ruleName, {\n rejected: (height) =>\n `Unexpected line-height \"${height}\", expect a value with units`\n})\n\nconst lengthRe = /^(0$|(?:[+-]?(?:\\d*\\.)?\\d+(?:[Ee][+-]?\\d+)?)(?=px|PX|rem$))/\nconst viewportUnitRe = /^([+-]?[0-9.]+)(vh|vw|vmin|vmax)$/\n\nexport default function (actual) {\n return function (root, result) {\n const validOptions = stylelint.utils.validateOptions(result, ruleName, {\n actual\n })\n\n if (!validOptions) {\n return\n }\n\n root.walkDecls(/^line-height$/i, (decl) => {\n if (lengthRe.test(decl.value) || viewportUnitRe.test(decl.value)) {\n return\n }\n\n const valueOffset = decl.value.indexOf(decl.value)\n const index = declarationValueIndex(decl) + valueOffset\n\n stylelint.utils.report({\n message: messages.rejected(decl.value),\n node: decl,\n result,\n ruleName,\n index\n })\n })\n }\n}\n"],"names":[],"mappings":";;;;MAKa,QAAQ,GAAG,SAAS,CAAC,mCAAmC,EAAC;AAEzD,MAAA,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE;IAC7D,QAAQ,EAAE,CAAC,MAAM,KACf,CAAA,wBAAA,EAA2B,MAAM,CAA8B,4BAAA,CAAA;AAClE,CAAA,EAAC;AAEF,MAAM,QAAQ,GAAG,6DAA6D,CAAA;AAC9E,MAAM,cAAc,GAAG,mCAAmC,CAAA;AAE5C,qCAAA,EAAW,MAAM,EAAA;IAC7B,OAAO,UAAU,IAAI,EAAE,MAAM,EAAA;QAC3B,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE;YACrE,MAAM;AACP,SAAA,CAAC,CAAA;QAEF,IAAI,CAAC,YAAY,EAAE;YACjB,OAAM;AACP,SAAA;QAED,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC,IAAI,KAAI;AACxC,YAAA,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;gBAChE,OAAM;AACP,aAAA;AAED,YAAA,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YAClD,MAAM,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,GAAG,WAAW,CAAA;AAEvD,YAAA,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;gBACrB,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;AACtC,gBAAA,IAAI,EAAE,IAAI;gBACV,MAAM;gBACN,QAAQ;gBACR,KAAK;AACN,aAAA,CAAC,CAAA;AACJ,SAAC,CAAC,CAAA;AACJ,KAAC,CAAA;AACH;;;;"}
@@ -0,0 +1,5 @@
1
+ export default function _default(actual: any, options: any): (root: any, result: any) => void;
2
+ export const ruleName: string;
3
+ export const messages: {
4
+ rejected: (property: string | number | boolean | RegExp) => string;
5
+ };