stylelint-taro 4.0.0-beta.75 → 4.0.0-beta.76

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 (56) hide show
  1. package/LICENSE +1 -8
  2. package/dist/config.d.ts +1 -0
  3. package/dist/index.cjs.js +257 -0
  4. package/dist/index.cjs.js.map +1 -0
  5. package/dist/index.d.ts +3 -0
  6. package/dist/index.esm.js +253 -0
  7. package/dist/index.esm.js.map +1 -0
  8. package/dist/index.js +10 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/platform/constrant.d.ts +4 -0
  11. package/dist/platform/h5.d.ts +3 -0
  12. package/dist/platform/harmony.d.ts +3 -0
  13. package/dist/platform/miniprogram.d.ts +3 -0
  14. package/dist/platform/rn.d.ts +3 -0
  15. package/dist/platform/type.d.ts +14 -0
  16. package/dist/rules/declaration-property-value-allowed-list/index.d.ts +7 -0
  17. package/dist/rules/declaration-property-value-allowed-list/index.js +80 -0
  18. package/dist/rules/declaration-property-value-allowed-list/index.js.map +1 -0
  19. package/dist/rules/index.d.ts +6 -0
  20. package/dist/rules/index.js +12 -0
  21. package/dist/rules/index.js.map +1 -0
  22. package/dist/rules/no-nested-selectors/index.d.ts +7 -0
  23. package/dist/rules/no-nested-selectors/index.js +39 -0
  24. package/dist/rules/no-nested-selectors/index.js.map +1 -0
  25. package/dist/rules/property-allowed-list/index.d.ts +7 -0
  26. package/dist/rules/property-allowed-list/index.js +78 -0
  27. package/dist/rules/property-allowed-list/index.js.map +1 -0
  28. package/dist/utils/index.d.ts +11 -0
  29. package/{lib → dist}/utils/index.js +6 -14
  30. package/dist/utils/index.js.map +1 -0
  31. package/package.json +26 -46
  32. package/lib/config.js +0 -121
  33. package/lib/index.js +0 -12
  34. package/lib/platform/constrant.js +0 -7
  35. package/lib/platform/h5.js +0 -4
  36. package/lib/platform/harmony.js +0 -108
  37. package/lib/platform/miniprogram.js +0 -4
  38. package/lib/platform/rn.js +0 -29
  39. package/lib/platform/type.js +0 -2
  40. package/lib/rules/declaration-property-value-allowed-list/index.js +0 -83
  41. package/lib/rules/index.js +0 -14
  42. package/lib/rules/no-nested-selectors/index.js +0 -62
  43. package/lib/rules/property-allowed-list/index.js +0 -81
  44. package/src/config.ts +0 -133
  45. package/src/index.ts +0 -10
  46. package/src/platform/constrant.ts +0 -4
  47. package/src/platform/h5.ts +0 -7
  48. package/src/platform/harmony.ts +0 -109
  49. package/src/platform/miniprogram.ts +0 -7
  50. package/src/platform/rn.ts +0 -31
  51. package/src/platform/type.ts +0 -9
  52. package/src/rules/declaration-property-value-allowed-list/index.ts +0 -96
  53. package/src/rules/index.ts +0 -11
  54. package/src/rules/no-nested-selectors/index.ts +0 -46
  55. package/src/rules/property-allowed-list/index.ts +0 -92
  56. package/src/utils/index.ts +0 -69
package/LICENSE CHANGED
@@ -154,15 +154,8 @@ See `/LICENSE` for details of the license.
154
154
 
155
155
  ==================
156
156
 
157
- MIT (stencil-vue2-output-target):
158
- The following files embed [stencil-vue2-output-target](https://github.com/diondree/stencil-vue2-output-target) MIT:
159
- `/packages/taro-components-library-vue2/src/vue-component-lib/utils.ts`
160
- See `/LICENSE` for details of the license.
161
-
162
- ==================
163
-
164
157
  MIT (weui):
165
- The following files embed [stencil-vue2-output-target](https://github.com/Tencent/weui) MIT:
158
+ The following files embed [weui](https://github.com/Tencent/weui) MIT:
166
159
  `/packages/taro-components/src/components/*.scss`
167
160
  See `/LICENSE.txt` for details of the license.
168
161
 
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,257 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var stylelint = require('stylelint');
6
+ var declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
7
+ var matchesStringOrRegExp = require('stylelint/lib/utils/matchesStringOrRegExp.cjs');
8
+ var optionsMatches = require('stylelint/lib/utils/optionsMatches.cjs');
9
+ var validateObjectWithArrayProps = require('stylelint/lib/utils/validateObjectWithArrayProps.cjs');
10
+ var validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
11
+ var validateTypes_cjs = require('stylelint/lib/utils/validateTypes.cjs');
12
+ var vendor = require('stylelint/lib/utils/vendor.cjs');
13
+ var _ = require('lodash');
14
+ var isCustomProperty = require('stylelint/lib/utils/isCustomProperty.mjs');
15
+ var isStandardSyntaxProperty = require('stylelint/lib/utils/isStandardSyntaxProperty.mjs');
16
+ var matchesStringOrRegExp$1 = require('stylelint/lib/utils/matchesStringOrRegExp.mjs');
17
+ var validateObjectWithArrayProps$1 = require('stylelint/lib/utils/validateObjectWithArrayProps.mjs');
18
+ var validateOptions$1 = require('stylelint/lib/utils/validateOptions.mjs');
19
+ var validateTypes_mjs = require('stylelint/lib/utils/validateTypes.mjs');
20
+ var vendor$1 = require('stylelint/lib/utils/vendor.mjs');
21
+
22
+ function taroDocsUrl(_) {
23
+ return `https://taro-docs.jd.com/docs/`;
24
+ }
25
+ function nameSpace(ruleName) {
26
+ // 前缀视个人情况而定
27
+ return `taro/${ruleName}`;
28
+ }
29
+ function report(problem) {
30
+ return stylelint.utils.report(problem);
31
+ }
32
+ function log(text) {
33
+ // vscode下不添加颜色
34
+ if (!process.env.TARO_ENV) {
35
+ return text;
36
+ }
37
+ return text;
38
+ // return highlightQuotaValue(text)
39
+ }
40
+ function findIntersection(data) {
41
+ const keys = Object.keys(data);
42
+ let intersection = {};
43
+ if (keys.length > 1) {
44
+ const firstKey = keys[0];
45
+ const firstProps = data[firstKey];
46
+ for (const prop in firstProps) {
47
+ const firstValues = firstProps[prop];
48
+ let commonValues = firstValues || [];
49
+ for (let i = 1; i < keys.length; i++) {
50
+ const currentKey = keys[i];
51
+ const currentProps = data[currentKey];
52
+ const currentValues = currentProps[prop];
53
+ if (Array.isArray(commonValues)) {
54
+ if (Array.isArray(currentValues)) {
55
+ commonValues = commonValues.filter(value => currentValues.includes(value));
56
+ }
57
+ else if (currentValues) {
58
+ commonValues = commonValues.filter(value => currentValues === true || currentValues.includes(value));
59
+ }
60
+ }
61
+ else if (commonValues === true) {
62
+ commonValues = currentValues || [];
63
+ }
64
+ else {
65
+ commonValues = [];
66
+ }
67
+ }
68
+ if (commonValues.length > 0) {
69
+ intersection[prop] = commonValues;
70
+ }
71
+ }
72
+ }
73
+ else {
74
+ intersection = data[keys[0]];
75
+ }
76
+ return { intersection };
77
+ }
78
+
79
+ const ruleName$2 = nameSpace('declaration-property-value-allowed-list');
80
+ const messages$2 = stylelint.utils.ruleMessages(ruleName$2, {
81
+ rejected: (property, value, platfrom) => log(`"${property}" 暂不支持值 "${value}",受限端: "${platfrom}"`)
82
+ });
83
+ const meta$2 = {
84
+ // TODO: 使用Taro文档的规则
85
+ url: taroDocsUrl(),
86
+ };
87
+ const rule$2 = (primary) => {
88
+ return (root, result) => {
89
+ const validOptions = Object.keys(primary).every((key) => {
90
+ if (primary[key]) {
91
+ return validateOptions(result, ruleName$2, {
92
+ actual: primary[key],
93
+ possible: [validateObjectWithArrayProps(validateTypes_cjs.isString, validateTypes_cjs.isRegExp, validateTypes_cjs.isBoolean)],
94
+ });
95
+ }
96
+ return true;
97
+ });
98
+ if (!validOptions) {
99
+ return;
100
+ }
101
+ const { intersection } = findIntersection(primary);
102
+ Object.keys(intersection).forEach(key => {
103
+ if (intersection[key] === true) {
104
+ delete intersection[key];
105
+ }
106
+ });
107
+ const propKeys = Object.keys(intersection);
108
+ // 在这里可以添加额外的逻辑
109
+ root.walkDecls(decl => {
110
+ const { prop, value } = decl;
111
+ const unprefixedProp = vendor.unprefixed(prop);
112
+ const propPatterns = propKeys.filter((key) => matchesStringOrRegExp(unprefixedProp, key));
113
+ if (propPatterns.length === 0) {
114
+ return;
115
+ }
116
+ if (propPatterns.some((pattern) => optionsMatches(intersection, pattern, value))) {
117
+ return;
118
+ }
119
+ const platforms = [];
120
+ Object.keys(primary).forEach((platform) => {
121
+ if (primary[platform]) {
122
+ if (propPatterns.some((pattern) => {
123
+ return optionsMatches(primary[platform], pattern, value) || primary[platform][pattern] === true;
124
+ })) {
125
+ return;
126
+ }
127
+ platforms.push(platform);
128
+ }
129
+ });
130
+ const index = declarationValueIndex(decl);
131
+ const endIndex = index + decl.value.length;
132
+ report({
133
+ message: messages$2.rejected(prop, value, platforms.join(', ')),
134
+ node: decl,
135
+ index,
136
+ endIndex,
137
+ result,
138
+ ruleName: ruleName$2,
139
+ });
140
+ });
141
+ };
142
+ };
143
+ rule$2.ruleName = ruleName$2;
144
+ rule$2.messages = messages$2;
145
+ rule$2.meta = meta$2;
146
+
147
+ const ruleName$1 = nameSpace('no-nested-selectors');
148
+ const messages$1 = stylelint.utils.ruleMessages(ruleName$1, {
149
+ rejected: (selector, platfrom) => log(`"${selector}" 仅能使用单个class选择器,受限端 "${platfrom}"`)
150
+ });
151
+ const meta$1 = {
152
+ // TODO: 使用Taro文档的规则
153
+ url: taroDocsUrl(),
154
+ };
155
+ const rule$1 = (primary) => {
156
+ return (root, result) => {
157
+ const validOptions = stylelint.utils.validateOptions(result, ruleName$1, {
158
+ actual: primary
159
+ });
160
+ if (!validOptions) {
161
+ return;
162
+ }
163
+ const platform = ['harmony', 'rn'];
164
+ root.walkRules(ruleNode => {
165
+ const selector = ruleNode.selector;
166
+ if (!/^[.#]?[a-zA-Z0-9_-]+$/.test(selector)) {
167
+ report({
168
+ ruleName: ruleName$1,
169
+ result,
170
+ node: ruleNode,
171
+ message: messages$1.rejected(selector, platform.join(', ')),
172
+ });
173
+ }
174
+ });
175
+ };
176
+ };
177
+ rule$1.ruleName = ruleName$1;
178
+ rule$1.messages = messages$1;
179
+ rule$1.meta = meta$1;
180
+
181
+ const ruleName = nameSpace('property-allowed-list');
182
+ const messages = stylelint.utils.ruleMessages(ruleName, {
183
+ rejected: (property, platfrom) => log(`"${property}" 暂不支持该属性,受限端 "${platfrom}"`)
184
+ });
185
+ const meta = {
186
+ // TODO: 使用Taro文档的规则
187
+ url: taroDocsUrl(),
188
+ };
189
+ const rule = (primary) => {
190
+ return (root, result) => {
191
+ const validOptions = Object.keys(primary).every((key) => {
192
+ if (primary[key]) {
193
+ return validateOptions$1(result, ruleName, {
194
+ actual: primary[key],
195
+ possible: [validateObjectWithArrayProps$1(validateTypes_mjs.isString, validateTypes_mjs.isRegExp, validateTypes_mjs.isBoolean)],
196
+ });
197
+ }
198
+ return true;
199
+ });
200
+ if (!validOptions) {
201
+ return;
202
+ }
203
+ const _arr = [];
204
+ Object.keys(primary).forEach(key => {
205
+ _arr.push(...Object.keys(primary[key]));
206
+ });
207
+ const intersectionKeys = _.intersection(_arr);
208
+ // 在这里可以添加额外的逻辑
209
+ root.walkDecls(decl => {
210
+ const prop = decl.prop;
211
+ if (!isStandardSyntaxProperty(prop)) {
212
+ return;
213
+ }
214
+ if (isCustomProperty(prop)) {
215
+ return;
216
+ }
217
+ // either the prefix or unprefixed version is in the list
218
+ if (matchesStringOrRegExp$1([prop, vendor$1.unprefixed(prop)], intersectionKeys)) {
219
+ return;
220
+ }
221
+ const platform = [];
222
+ Object.keys(primary).forEach(key => {
223
+ if (primary[key]) {
224
+ const platformKeys = Object.keys(primary[key]);
225
+ if (platformKeys.length > 0) {
226
+ if (!platformKeys.includes(prop)) {
227
+ platform.push(key);
228
+ }
229
+ }
230
+ }
231
+ });
232
+ report({
233
+ message: messages.rejected(prop, platform.join(', ')),
234
+ word: prop,
235
+ node: decl,
236
+ result,
237
+ ruleName,
238
+ });
239
+ });
240
+ };
241
+ };
242
+ rule.ruleName = ruleName;
243
+ rule.messages = messages;
244
+ rule.meta = meta;
245
+
246
+ const rules = {
247
+ 'no-nested-selectors': rule$1,
248
+ 'property-allowed-list': rule,
249
+ 'declaration-property-value-allowed-list': rule$2,
250
+ };
251
+
252
+ const rulesPlugins = Object.keys(rules).map(ruleName => {
253
+ return stylelint.createPlugin(nameSpace(ruleName), rules[ruleName]);
254
+ });
255
+
256
+ exports.default = rulesPlugins;
257
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/utils/index.ts","../src/rules/declaration-property-value-allowed-list/index.ts","../src/rules/no-nested-selectors/index.ts","../src/rules/property-allowed-list/index.ts","../src/rules/index.ts","../src/index.ts"],"sourcesContent":["import stylelint from 'stylelint'\n\nimport type { Problem } from 'stylelint'\n\nexport function taroDocsUrl(_: string) {\n return `https://taro-docs.jd.com/docs/`\n}\n\nexport function nameSpace(ruleName: string) {\n // 前缀视个人情况而定\n return `taro/${ruleName}`\n}\nexport function newMessage(ruleName: string, options) {\n return stylelint.utils.ruleMessages(ruleName, options)\n}\n\nexport function report(problem: Problem) {\n return stylelint.utils.report(problem)\n}\n\nexport function log(text: string) {\n // vscode下不添加颜色\n if (!process.env.TARO_ENV) {\n return text\n }\n return text\n // return highlightQuotaValue(text)\n}\n\nexport function findIntersection(data) {\n const keys = Object.keys(data)\n let intersection = {}\n\n if (keys.length > 1) {\n const firstKey = keys[0]\n const firstProps = data[firstKey]\n\n for (const prop in firstProps) {\n const firstValues = firstProps[prop]\n let commonValues = firstValues || []\n\n for (let i = 1; i < keys.length; i++) {\n const currentKey = keys[i]\n const currentProps = data[currentKey]\n const currentValues = currentProps[prop]\n\n if (Array.isArray(commonValues)) {\n if (Array.isArray(currentValues)) {\n commonValues = commonValues.filter(value => currentValues.includes(value))\n } else if (currentValues) {\n commonValues = commonValues.filter(value => currentValues === true || currentValues.includes(value))\n }\n } else if (commonValues === true) {\n commonValues = currentValues || []\n } else {\n commonValues = []\n }\n }\n\n if (commonValues.length > 0) {\n intersection[prop] = commonValues\n }\n }\n } else {\n intersection = data[keys[0]]\n }\n\n return { intersection }\n}\n","import stylelint from 'stylelint'\nimport declarationValueIndex from 'stylelint/lib/utils/declarationValueIndex.cjs'\nimport matchesStringOrRegExp from 'stylelint/lib/utils/matchesStringOrRegExp.cjs'\nimport optionsMatches from 'stylelint/lib/utils/optionsMatches.cjs'\nimport validateObjectWithArrayProps from 'stylelint/lib/utils/validateObjectWithArrayProps.cjs'\nimport validateOptions from 'stylelint/lib/utils/validateOptions.cjs'\nimport { isBoolean, isRegExp, isString } from 'stylelint/lib/utils/validateTypes.cjs'\nimport vendor from 'stylelint/lib/utils/vendor.cjs'\n\nimport { findIntersection, log, nameSpace, report, taroDocsUrl } from '../../utils/index.ts'\n\nimport type { Rule } from 'stylelint'\n\nexport const ruleName = nameSpace('declaration-property-value-allowed-list')\n\nexport const messages = stylelint.utils.ruleMessages(ruleName, {\n rejected: (property, value, platfrom) => log(`\"${property}\" 暂不支持值 \"${value}\",受限端: \"${platfrom}\"`)\n})\n\nconst meta = {\n // TODO: 使用Taro文档的规则\n url: taroDocsUrl('declaration-property-value-allowed-list'),\n}\n\nconst rule: Rule = (primary) => {\n return (root, result) => {\n const validOptions = Object.keys(primary).every((key) => {\n if (primary[key]) {\n return validateOptions(result, ruleName, {\n actual: primary[key],\n possible: [validateObjectWithArrayProps(isString, isRegExp, isBoolean)],\n })\n }\n return true\n })\n\n if (!validOptions) {\n return\n }\n\n const { intersection } = findIntersection(primary)\n\n Object.keys(intersection).forEach(key => {\n if (intersection[key] === true) {\n delete intersection[key]\n }\n })\n const propKeys = Object.keys(intersection)\n\n // 在这里可以添加额外的逻辑\n root.walkDecls(decl => {\n const { prop, value } = decl\n\n const unprefixedProp = vendor.unprefixed(prop)\n const propPatterns = propKeys.filter((key) => matchesStringOrRegExp(unprefixedProp, key))\n\n if (propPatterns.length === 0) {\n return\n }\n\n if (propPatterns.some((pattern) => optionsMatches(intersection, pattern, value))) {\n return\n }\n\n const platforms: string[] = []\n Object.keys(primary).forEach((platform) => {\n if (primary[platform]) {\n if (propPatterns.some((pattern) => {\n return optionsMatches(primary[platform], pattern, value) || primary[platform][pattern] === true\n })) {\n return\n }\n platforms.push(platform)\n }\n })\n\n const index = declarationValueIndex(decl)\n const endIndex = index + decl.value.length\n\n report({\n message: messages.rejected(prop, value, platforms.join(', ')),\n node: decl,\n index,\n endIndex,\n result,\n ruleName,\n })\n })\n }\n}\n\nrule.ruleName = ruleName\nrule.messages = messages\nrule.meta = meta\n\nexport default rule\n","import stylelint from 'stylelint'\n\nimport { log, nameSpace, report, taroDocsUrl } from '../../utils/index.ts'\n\nimport type { Rule } from 'stylelint'\n\nexport const ruleName = nameSpace('no-nested-selectors')\n\nexport const messages = stylelint.utils.ruleMessages(ruleName, {\n rejected: (selector, platfrom) => log(`\"${selector}\" 仅能使用单个class选择器,受限端 \"${platfrom}\"`)\n})\n\nconst meta = {\n // TODO: 使用Taro文档的规则\n url: taroDocsUrl('no-nested-selectors'),\n}\n\nconst rule: Rule = (primary) => {\n return (root, result) => {\n const validOptions = stylelint.utils.validateOptions(result, ruleName, {\n actual: primary\n })\n if (!validOptions) {\n return\n }\n const platform = ['harmony', 'rn']\n\n root.walkRules(ruleNode => {\n const selector = ruleNode.selector\n if (!/^[.#]?[a-zA-Z0-9_-]+$/.test(selector)) {\n report({\n ruleName,\n result,\n node: ruleNode,\n message: messages.rejected(selector, platform.join(', ')),\n })\n }\n })\n }\n}\n\nrule.ruleName = ruleName\nrule.messages = messages\nrule.meta = meta\n\nexport default rule\n","import _ from 'lodash'\nimport stylelint from 'stylelint'\nimport isCustomProperty from 'stylelint/lib/utils/isCustomProperty.mjs'\nimport isStandardSyntaxProperty from 'stylelint/lib/utils/isStandardSyntaxProperty.mjs'\nimport matchesStringOrRegExp from 'stylelint/lib/utils/matchesStringOrRegExp.mjs'\nimport validateObjectWithArrayProps from 'stylelint/lib/utils/validateObjectWithArrayProps.mjs'\nimport validateOptions from 'stylelint/lib/utils/validateOptions.mjs'\nimport { isBoolean, isRegExp, isString } from 'stylelint/lib/utils/validateTypes.mjs'\nimport vendor from 'stylelint/lib/utils/vendor.mjs'\n\nimport { log, nameSpace, report, taroDocsUrl } from '../../utils/index.ts'\n\nimport type { Rule } from 'stylelint'\n\nexport const ruleName = nameSpace('property-allowed-list')\n\nexport const messages = stylelint.utils.ruleMessages(ruleName, {\n rejected: (property, platfrom) => log(`\"${property}\" 暂不支持该属性,受限端 \"${platfrom}\"`)\n})\n\nconst meta = {\n // TODO: 使用Taro文档的规则\n url: taroDocsUrl('property-allowed-list'),\n}\n\nconst rule: Rule = (primary) => {\n return (root, result) => {\n const validOptions = Object.keys(primary).every((key) => {\n if (primary[key]) {\n return validateOptions(result, ruleName, {\n actual: primary[key],\n possible: [validateObjectWithArrayProps(isString, isRegExp, isBoolean)],\n })\n }\n return true\n })\n\n if (!validOptions) {\n return\n }\n\n const _arr: string[] = []\n Object.keys(primary).forEach(key => {\n _arr.push(...Object.keys(primary[key]))\n })\n const intersectionKeys = _.intersection(_arr)\n\n // 在这里可以添加额外的逻辑\n root.walkDecls(decl => {\n const prop = decl.prop\n\n if (!isStandardSyntaxProperty(prop)) {\n return\n }\n\n if (isCustomProperty(prop)) {\n return\n }\n\n // either the prefix or unprefixed version is in the list\n if (matchesStringOrRegExp([prop, vendor.unprefixed(prop)], intersectionKeys)) {\n return\n }\n\n const platform: string[] = []\n Object.keys(primary).forEach(key => {\n if (primary[key]) {\n const platformKeys = Object.keys(primary[key])\n if (platformKeys.length > 0) {\n if (!platformKeys.includes(prop)) {\n platform.push(key)\n }\n }\n }\n })\n\n report({\n message: messages.rejected(prop, platform.join(', ')),\n word: prop,\n node: decl,\n result,\n ruleName,\n })\n })\n }\n}\n\nrule.ruleName = ruleName\nrule.messages = messages\nrule.meta = meta\n\nexport default rule\n","import declarationPropertyValueAllowedList from './declaration-property-value-allowed-list/index.ts'\nimport noNestedSelectors from './no-nested-selectors/index.ts'\nimport propertyAllowedList from './property-allowed-list/index.ts'\n\nconst rules = {\n 'no-nested-selectors': noNestedSelectors,\n 'property-allowed-list': propertyAllowedList,\n 'declaration-property-value-allowed-list': declarationPropertyValueAllowedList,\n}\n\nexport default rules\n","import stylelint from 'stylelint'\n\nimport rules from './rules/index.ts'\nimport { nameSpace } from './utils/index.ts'\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","meta","rule","isString","isRegExp","isBoolean","validateOptions","validateObjectWithArrayProps","matchesStringOrRegExp","vendor","noNestedSelectors","propertyAllowedList","declarationPropertyValueAllowedList"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAIM,SAAU,WAAW,CAAC,CAAS,EAAA;AACnC,IAAA,OAAO,gCAAgC,CAAA;AACzC,CAAC;AAEK,SAAU,SAAS,CAAC,QAAgB,EAAA;;IAExC,OAAO,CAAA,KAAA,EAAQ,QAAQ,CAAA,CAAE,CAAA;AAC3B,CAAC;AAKK,SAAU,MAAM,CAAC,OAAgB,EAAA;IACrC,OAAO,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AACxC,CAAC;AAEK,SAAU,GAAG,CAAC,IAAY,EAAA;;AAE9B,IAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE;AACzB,QAAA,OAAO,IAAI,CAAA;KACZ;AACD,IAAA,OAAO,IAAI,CAAA;;AAEb,CAAC;AAEK,SAAU,gBAAgB,CAAC,IAAI,EAAA;IACnC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC9B,IAAI,YAAY,GAAG,EAAE,CAAA;AAErB,IAAA,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;AACnB,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACxB,QAAA,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAA;AAEjC,QAAA,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE;AAC7B,YAAA,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;AACpC,YAAA,IAAI,YAAY,GAAG,WAAW,IAAI,EAAE,CAAA;AAEpC,YAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACpC,gBA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QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrD,gBAAA,IAAI,EAAE,IAAI;AACV,gBAAA,IAAI,EAAE,IAAI;gBACV,MAAM;gBACN,QAAQ;AACT,aAAA,CAAC,CAAA;AACJ,SAAC,CAAC,CAAA;AACJ,KAAC,CAAA;AACH,CAAC,CAAA;AAED,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;AACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;AACxB,IAAI,CAAC,IAAI,GAAG,IAAI;;ACrFhB,MAAM,KAAK,GAAG;AACZ,IAAA,qBAAqB,EAAEC,MAAiB;AACxC,IAAA,uBAAuB,EAAEC,IAAmB;AAC5C,IAAA,yCAAyC,EAAEC,MAAmC;CAC/E;;ACHD,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,IAAG;AACrD,IAAA,OAAO,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AACrE,CAAC;;;;"}
@@ -0,0 +1,3 @@
1
+ import stylelint from 'stylelint';
2
+ declare const rulesPlugins: stylelint.Plugin[];
3
+ export default rulesPlugins;
@@ -0,0 +1,253 @@
1
+ import stylelint from 'stylelint';
2
+ import declarationValueIndex from 'stylelint/lib/utils/declarationValueIndex.cjs';
3
+ import matchesStringOrRegExp from 'stylelint/lib/utils/matchesStringOrRegExp.cjs';
4
+ import optionsMatches from 'stylelint/lib/utils/optionsMatches.cjs';
5
+ import validateObjectWithArrayProps from 'stylelint/lib/utils/validateObjectWithArrayProps.cjs';
6
+ import validateOptions from 'stylelint/lib/utils/validateOptions.cjs';
7
+ import { isString, isRegExp, isBoolean } from 'stylelint/lib/utils/validateTypes.cjs';
8
+ import vendor from 'stylelint/lib/utils/vendor.cjs';
9
+ import _ from 'lodash';
10
+ import isCustomProperty from 'stylelint/lib/utils/isCustomProperty.mjs';
11
+ import isStandardSyntaxProperty from 'stylelint/lib/utils/isStandardSyntaxProperty.mjs';
12
+ import matchesStringOrRegExp$1 from 'stylelint/lib/utils/matchesStringOrRegExp.mjs';
13
+ import validateObjectWithArrayProps$1 from 'stylelint/lib/utils/validateObjectWithArrayProps.mjs';
14
+ import validateOptions$1 from 'stylelint/lib/utils/validateOptions.mjs';
15
+ import { isString as isString$1, isRegExp as isRegExp$1, isBoolean as isBoolean$1 } from 'stylelint/lib/utils/validateTypes.mjs';
16
+ import vendor$1 from 'stylelint/lib/utils/vendor.mjs';
17
+
18
+ function taroDocsUrl(_) {
19
+ return `https://taro-docs.jd.com/docs/`;
20
+ }
21
+ function nameSpace(ruleName) {
22
+ // 前缀视个人情况而定
23
+ return `taro/${ruleName}`;
24
+ }
25
+ function report(problem) {
26
+ return stylelint.utils.report(problem);
27
+ }
28
+ function log(text) {
29
+ // vscode下不添加颜色
30
+ if (!process.env.TARO_ENV) {
31
+ return text;
32
+ }
33
+ return text;
34
+ // return highlightQuotaValue(text)
35
+ }
36
+ function findIntersection(data) {
37
+ const keys = Object.keys(data);
38
+ let intersection = {};
39
+ if (keys.length > 1) {
40
+ const firstKey = keys[0];
41
+ const firstProps = data[firstKey];
42
+ for (const prop in firstProps) {
43
+ const firstValues = firstProps[prop];
44
+ let commonValues = firstValues || [];
45
+ for (let i = 1; i < keys.length; i++) {
46
+ const currentKey = keys[i];
47
+ const currentProps = data[currentKey];
48
+ const currentValues = currentProps[prop];
49
+ if (Array.isArray(commonValues)) {
50
+ if (Array.isArray(currentValues)) {
51
+ commonValues = commonValues.filter(value => currentValues.includes(value));
52
+ }
53
+ else if (currentValues) {
54
+ commonValues = commonValues.filter(value => currentValues === true || currentValues.includes(value));
55
+ }
56
+ }
57
+ else if (commonValues === true) {
58
+ commonValues = currentValues || [];
59
+ }
60
+ else {
61
+ commonValues = [];
62
+ }
63
+ }
64
+ if (commonValues.length > 0) {
65
+ intersection[prop] = commonValues;
66
+ }
67
+ }
68
+ }
69
+ else {
70
+ intersection = data[keys[0]];
71
+ }
72
+ return { intersection };
73
+ }
74
+
75
+ const ruleName$2 = nameSpace('declaration-property-value-allowed-list');
76
+ const messages$2 = stylelint.utils.ruleMessages(ruleName$2, {
77
+ rejected: (property, value, platfrom) => log(`"${property}" 暂不支持值 "${value}",受限端: "${platfrom}"`)
78
+ });
79
+ const meta$2 = {
80
+ // TODO: 使用Taro文档的规则
81
+ url: taroDocsUrl(),
82
+ };
83
+ const rule$2 = (primary) => {
84
+ return (root, result) => {
85
+ const validOptions = Object.keys(primary).every((key) => {
86
+ if (primary[key]) {
87
+ return validateOptions(result, ruleName$2, {
88
+ actual: primary[key],
89
+ possible: [validateObjectWithArrayProps(isString, isRegExp, isBoolean)],
90
+ });
91
+ }
92
+ return true;
93
+ });
94
+ if (!validOptions) {
95
+ return;
96
+ }
97
+ const { intersection } = findIntersection(primary);
98
+ Object.keys(intersection).forEach(key => {
99
+ if (intersection[key] === true) {
100
+ delete intersection[key];
101
+ }
102
+ });
103
+ const propKeys = Object.keys(intersection);
104
+ // 在这里可以添加额外的逻辑
105
+ root.walkDecls(decl => {
106
+ const { prop, value } = decl;
107
+ const unprefixedProp = vendor.unprefixed(prop);
108
+ const propPatterns = propKeys.filter((key) => matchesStringOrRegExp(unprefixedProp, key));
109
+ if (propPatterns.length === 0) {
110
+ return;
111
+ }
112
+ if (propPatterns.some((pattern) => optionsMatches(intersection, pattern, value))) {
113
+ return;
114
+ }
115
+ const platforms = [];
116
+ Object.keys(primary).forEach((platform) => {
117
+ if (primary[platform]) {
118
+ if (propPatterns.some((pattern) => {
119
+ return optionsMatches(primary[platform], pattern, value) || primary[platform][pattern] === true;
120
+ })) {
121
+ return;
122
+ }
123
+ platforms.push(platform);
124
+ }
125
+ });
126
+ const index = declarationValueIndex(decl);
127
+ const endIndex = index + decl.value.length;
128
+ report({
129
+ message: messages$2.rejected(prop, value, platforms.join(', ')),
130
+ node: decl,
131
+ index,
132
+ endIndex,
133
+ result,
134
+ ruleName: ruleName$2,
135
+ });
136
+ });
137
+ };
138
+ };
139
+ rule$2.ruleName = ruleName$2;
140
+ rule$2.messages = messages$2;
141
+ rule$2.meta = meta$2;
142
+
143
+ const ruleName$1 = nameSpace('no-nested-selectors');
144
+ const messages$1 = stylelint.utils.ruleMessages(ruleName$1, {
145
+ rejected: (selector, platfrom) => log(`"${selector}" 仅能使用单个class选择器,受限端 "${platfrom}"`)
146
+ });
147
+ const meta$1 = {
148
+ // TODO: 使用Taro文档的规则
149
+ url: taroDocsUrl(),
150
+ };
151
+ const rule$1 = (primary) => {
152
+ return (root, result) => {
153
+ const validOptions = stylelint.utils.validateOptions(result, ruleName$1, {
154
+ actual: primary
155
+ });
156
+ if (!validOptions) {
157
+ return;
158
+ }
159
+ const platform = ['harmony', 'rn'];
160
+ root.walkRules(ruleNode => {
161
+ const selector = ruleNode.selector;
162
+ if (!/^[.#]?[a-zA-Z0-9_-]+$/.test(selector)) {
163
+ report({
164
+ ruleName: ruleName$1,
165
+ result,
166
+ node: ruleNode,
167
+ message: messages$1.rejected(selector, platform.join(', ')),
168
+ });
169
+ }
170
+ });
171
+ };
172
+ };
173
+ rule$1.ruleName = ruleName$1;
174
+ rule$1.messages = messages$1;
175
+ rule$1.meta = meta$1;
176
+
177
+ const ruleName = nameSpace('property-allowed-list');
178
+ const messages = stylelint.utils.ruleMessages(ruleName, {
179
+ rejected: (property, platfrom) => log(`"${property}" 暂不支持该属性,受限端 "${platfrom}"`)
180
+ });
181
+ const meta = {
182
+ // TODO: 使用Taro文档的规则
183
+ url: taroDocsUrl(),
184
+ };
185
+ const rule = (primary) => {
186
+ return (root, result) => {
187
+ const validOptions = Object.keys(primary).every((key) => {
188
+ if (primary[key]) {
189
+ return validateOptions$1(result, ruleName, {
190
+ actual: primary[key],
191
+ possible: [validateObjectWithArrayProps$1(isString$1, isRegExp$1, isBoolean$1)],
192
+ });
193
+ }
194
+ return true;
195
+ });
196
+ if (!validOptions) {
197
+ return;
198
+ }
199
+ const _arr = [];
200
+ Object.keys(primary).forEach(key => {
201
+ _arr.push(...Object.keys(primary[key]));
202
+ });
203
+ const intersectionKeys = _.intersection(_arr);
204
+ // 在这里可以添加额外的逻辑
205
+ root.walkDecls(decl => {
206
+ const prop = decl.prop;
207
+ if (!isStandardSyntaxProperty(prop)) {
208
+ return;
209
+ }
210
+ if (isCustomProperty(prop)) {
211
+ return;
212
+ }
213
+ // either the prefix or unprefixed version is in the list
214
+ if (matchesStringOrRegExp$1([prop, vendor$1.unprefixed(prop)], intersectionKeys)) {
215
+ return;
216
+ }
217
+ const platform = [];
218
+ Object.keys(primary).forEach(key => {
219
+ if (primary[key]) {
220
+ const platformKeys = Object.keys(primary[key]);
221
+ if (platformKeys.length > 0) {
222
+ if (!platformKeys.includes(prop)) {
223
+ platform.push(key);
224
+ }
225
+ }
226
+ }
227
+ });
228
+ report({
229
+ message: messages.rejected(prop, platform.join(', ')),
230
+ word: prop,
231
+ node: decl,
232
+ result,
233
+ ruleName,
234
+ });
235
+ });
236
+ };
237
+ };
238
+ rule.ruleName = ruleName;
239
+ rule.messages = messages;
240
+ rule.meta = meta;
241
+
242
+ const rules = {
243
+ 'no-nested-selectors': rule$1,
244
+ 'property-allowed-list': rule,
245
+ 'declaration-property-value-allowed-list': rule$2,
246
+ };
247
+
248
+ const rulesPlugins = Object.keys(rules).map(ruleName => {
249
+ return stylelint.createPlugin(nameSpace(ruleName), rules[ruleName]);
250
+ });
251
+
252
+ export { rulesPlugins as default };
253
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/utils/index.ts","../src/rules/declaration-property-value-allowed-list/index.ts","../src/rules/no-nested-selectors/index.ts","../src/rules/property-allowed-list/index.ts","../src/rules/index.ts","../src/index.ts"],"sourcesContent":["import stylelint from 'stylelint'\n\nimport type { Problem } from 'stylelint'\n\nexport function taroDocsUrl(_: string) {\n return `https://taro-docs.jd.com/docs/`\n}\n\nexport function nameSpace(ruleName: string) {\n // 前缀视个人情况而定\n return `taro/${ruleName}`\n}\nexport function newMessage(ruleName: string, options) {\n return stylelint.utils.ruleMessages(ruleName, options)\n}\n\nexport function report(problem: Problem) {\n return stylelint.utils.report(problem)\n}\n\nexport function log(text: string) {\n // vscode下不添加颜色\n if (!process.env.TARO_ENV) {\n return text\n }\n return text\n // return highlightQuotaValue(text)\n}\n\nexport function findIntersection(data) {\n const keys = Object.keys(data)\n let intersection = {}\n\n if (keys.length > 1) {\n const firstKey = keys[0]\n const firstProps = data[firstKey]\n\n for (const prop in firstProps) {\n const firstValues = firstProps[prop]\n let commonValues = firstValues || []\n\n for (let i = 1; i < keys.length; i++) {\n const currentKey = keys[i]\n const currentProps = data[currentKey]\n const currentValues = currentProps[prop]\n\n if (Array.isArray(commonValues)) {\n if (Array.isArray(currentValues)) {\n commonValues = commonValues.filter(value => currentValues.includes(value))\n } else if (currentValues) {\n commonValues = commonValues.filter(value => currentValues === true || currentValues.includes(value))\n }\n } else if (commonValues === true) {\n commonValues = currentValues || []\n } else {\n commonValues = []\n }\n }\n\n if (commonValues.length > 0) {\n intersection[prop] = commonValues\n }\n }\n } else {\n intersection = data[keys[0]]\n }\n\n return { intersection }\n}\n","import stylelint from 'stylelint'\nimport declarationValueIndex from 'stylelint/lib/utils/declarationValueIndex.cjs'\nimport matchesStringOrRegExp from 'stylelint/lib/utils/matchesStringOrRegExp.cjs'\nimport optionsMatches from 'stylelint/lib/utils/optionsMatches.cjs'\nimport validateObjectWithArrayProps from 'stylelint/lib/utils/validateObjectWithArrayProps.cjs'\nimport validateOptions from 'stylelint/lib/utils/validateOptions.cjs'\nimport { isBoolean, isRegExp, isString } from 'stylelint/lib/utils/validateTypes.cjs'\nimport vendor from 'stylelint/lib/utils/vendor.cjs'\n\nimport { findIntersection, log, nameSpace, report, taroDocsUrl } from '../../utils/index.ts'\n\nimport type { Rule } from 'stylelint'\n\nexport const ruleName = nameSpace('declaration-property-value-allowed-list')\n\nexport const messages = stylelint.utils.ruleMessages(ruleName, {\n rejected: (property, value, platfrom) => log(`\"${property}\" 暂不支持值 \"${value}\",受限端: \"${platfrom}\"`)\n})\n\nconst meta = {\n // TODO: 使用Taro文档的规则\n url: taroDocsUrl('declaration-property-value-allowed-list'),\n}\n\nconst rule: Rule = (primary) => {\n return (root, result) => {\n const validOptions = Object.keys(primary).every((key) => {\n if (primary[key]) {\n return validateOptions(result, ruleName, {\n actual: primary[key],\n possible: [validateObjectWithArrayProps(isString, isRegExp, isBoolean)],\n })\n }\n return true\n })\n\n if (!validOptions) {\n return\n }\n\n const { intersection } = findIntersection(primary)\n\n Object.keys(intersection).forEach(key => {\n if (intersection[key] === true) {\n delete intersection[key]\n }\n })\n const propKeys = Object.keys(intersection)\n\n // 在这里可以添加额外的逻辑\n root.walkDecls(decl => {\n const { prop, value } = decl\n\n const unprefixedProp = vendor.unprefixed(prop)\n const propPatterns = propKeys.filter((key) => matchesStringOrRegExp(unprefixedProp, key))\n\n if (propPatterns.length === 0) {\n return\n }\n\n if (propPatterns.some((pattern) => optionsMatches(intersection, pattern, value))) {\n return\n }\n\n const platforms: string[] = []\n Object.keys(primary).forEach((platform) => {\n if (primary[platform]) {\n if (propPatterns.some((pattern) => {\n return optionsMatches(primary[platform], pattern, value) || primary[platform][pattern] === true\n })) {\n return\n }\n platforms.push(platform)\n }\n })\n\n const index = declarationValueIndex(decl)\n const endIndex = index + decl.value.length\n\n report({\n message: messages.rejected(prop, value, platforms.join(', ')),\n node: decl,\n index,\n endIndex,\n result,\n ruleName,\n })\n })\n }\n}\n\nrule.ruleName = ruleName\nrule.messages = messages\nrule.meta = meta\n\nexport default rule\n","import stylelint from 'stylelint'\n\nimport { log, nameSpace, report, taroDocsUrl } from '../../utils/index.ts'\n\nimport type { Rule } from 'stylelint'\n\nexport const ruleName = nameSpace('no-nested-selectors')\n\nexport const messages = stylelint.utils.ruleMessages(ruleName, {\n rejected: (selector, platfrom) => log(`\"${selector}\" 仅能使用单个class选择器,受限端 \"${platfrom}\"`)\n})\n\nconst meta = {\n // TODO: 使用Taro文档的规则\n url: taroDocsUrl('no-nested-selectors'),\n}\n\nconst rule: Rule = (primary) => {\n return (root, result) => {\n const validOptions = stylelint.utils.validateOptions(result, ruleName, {\n actual: primary\n })\n if (!validOptions) {\n return\n }\n const platform = ['harmony', 'rn']\n\n root.walkRules(ruleNode => {\n const selector = ruleNode.selector\n if (!/^[.#]?[a-zA-Z0-9_-]+$/.test(selector)) {\n report({\n ruleName,\n result,\n node: ruleNode,\n message: messages.rejected(selector, platform.join(', ')),\n })\n }\n })\n }\n}\n\nrule.ruleName = ruleName\nrule.messages = messages\nrule.meta = meta\n\nexport default rule\n","import _ from 'lodash'\nimport stylelint from 'stylelint'\nimport isCustomProperty from 'stylelint/lib/utils/isCustomProperty.mjs'\nimport isStandardSyntaxProperty from 'stylelint/lib/utils/isStandardSyntaxProperty.mjs'\nimport matchesStringOrRegExp from 'stylelint/lib/utils/matchesStringOrRegExp.mjs'\nimport validateObjectWithArrayProps from 'stylelint/lib/utils/validateObjectWithArrayProps.mjs'\nimport validateOptions from 'stylelint/lib/utils/validateOptions.mjs'\nimport { isBoolean, isRegExp, isString } from 'stylelint/lib/utils/validateTypes.mjs'\nimport vendor from 'stylelint/lib/utils/vendor.mjs'\n\nimport { log, nameSpace, report, taroDocsUrl } from '../../utils/index.ts'\n\nimport type { Rule } from 'stylelint'\n\nexport const ruleName = nameSpace('property-allowed-list')\n\nexport const messages = stylelint.utils.ruleMessages(ruleName, {\n rejected: (property, platfrom) => log(`\"${property}\" 暂不支持该属性,受限端 \"${platfrom}\"`)\n})\n\nconst meta = {\n // TODO: 使用Taro文档的规则\n url: taroDocsUrl('property-allowed-list'),\n}\n\nconst rule: Rule = (primary) => {\n return (root, result) => {\n const validOptions = Object.keys(primary).every((key) => {\n if (primary[key]) {\n return validateOptions(result, ruleName, {\n actual: primary[key],\n possible: [validateObjectWithArrayProps(isString, isRegExp, isBoolean)],\n })\n }\n return true\n })\n\n if (!validOptions) {\n return\n }\n\n const _arr: string[] = []\n Object.keys(primary).forEach(key => {\n _arr.push(...Object.keys(primary[key]))\n })\n const intersectionKeys = _.intersection(_arr)\n\n // 在这里可以添加额外的逻辑\n root.walkDecls(decl => {\n const prop = decl.prop\n\n if (!isStandardSyntaxProperty(prop)) {\n return\n }\n\n if (isCustomProperty(prop)) {\n return\n }\n\n // either the prefix or unprefixed version is in the list\n if (matchesStringOrRegExp([prop, vendor.unprefixed(prop)], intersectionKeys)) {\n return\n }\n\n const platform: string[] = []\n Object.keys(primary).forEach(key => {\n if (primary[key]) {\n const platformKeys = Object.keys(primary[key])\n if (platformKeys.length > 0) {\n if (!platformKeys.includes(prop)) {\n platform.push(key)\n }\n }\n }\n })\n\n report({\n message: messages.rejected(prop, platform.join(', ')),\n word: prop,\n node: decl,\n result,\n ruleName,\n })\n })\n }\n}\n\nrule.ruleName = ruleName\nrule.messages = messages\nrule.meta = meta\n\nexport default rule\n","import declarationPropertyValueAllowedList from './declaration-property-value-allowed-list/index.ts'\nimport noNestedSelectors from './no-nested-selectors/index.ts'\nimport propertyAllowedList from './property-allowed-list/index.ts'\n\nconst rules = {\n 'no-nested-selectors': noNestedSelectors,\n 'property-allowed-list': propertyAllowedList,\n 'declaration-property-value-allowed-list': declarationPropertyValueAllowedList,\n}\n\nexport default rules\n","import stylelint from 'stylelint'\n\nimport rules from './rules/index.ts'\nimport { nameSpace } from './utils/index.ts'\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","meta","rule","validateOptions","validateObjectWithArrayProps","isString","isRegExp","isBoolean","matchesStringOrRegExp","vendor","noNestedSelectors","propertyAllowedList","declarationPropertyValueAllowedList"],"mappings":";;;;;;;;;;;;;;;;;AAIM,SAAU,WAAW,CAAC,CAAS,EAAA;AACnC,IAAA,OAAO,gCAAgC,CAAA;AACzC,CAAC;AAEK,SAA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;AACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;AACxB,IAAI,CAAC,IAAI,GAAG,IAAI;;ACrFhB,MAAM,KAAK,GAAG;AACZ,IAAA,qBAAqB,EAAEC,MAAiB;AACxC,IAAA,uBAAuB,EAAEC,IAAmB;AAC5C,IAAA,yCAAyC,EAAEC,MAAmC;CAC/E;;ACHD,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,IAAG;AACrD,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/index.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.ts"],"sourcesContent":["import stylelint from 'stylelint'\n\nimport rules from './rules/index.ts'\nimport { nameSpace } from './utils/index.ts'\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,QAAQ,IAAG;AACrD,IAAA,OAAO,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AACrE,CAAC;;;;"}
@@ -0,0 +1,4 @@
1
+ export declare const LENGTH_REGEX: RegExp;
2
+ export declare const LENGTH_REGEX_SPLIT: RegExp;
3
+ export declare const NUMBER: RegExp;
4
+ export declare const BACKGROUND_IMAGE: RegExp;
@@ -0,0 +1,3 @@
1
+ import { TaroStylelintConfig } from './type';
2
+ declare const config: TaroStylelintConfig;
3
+ export default config;
@@ -0,0 +1,3 @@
1
+ import { TaroStylelintConfig } from './type';
2
+ declare const config: TaroStylelintConfig;
3
+ export default config;
@@ -0,0 +1,3 @@
1
+ import { TaroStylelintConfig } from './type';
2
+ declare const config: TaroStylelintConfig;
3
+ export default config;
@@ -0,0 +1,3 @@
1
+ import { TaroStylelintConfig } from './type';
2
+ declare const config: TaroStylelintConfig;
3
+ export default config;