@servicetitan/stylelint-config 30.3.1 → 31.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,33 +1,37 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- const stylelint_1 = require("stylelint");
6
- const trim_1 = __importDefault(require("lodash/trim"));
2
+ const _stylelint = require("stylelint");
3
+ const _trim = /*#__PURE__*/ _interop_require_default(require("lodash/trim"));
4
+ function _interop_require_default(obj) {
5
+ return obj && obj.__esModule ? obj : {
6
+ default: obj
7
+ };
8
+ }
7
9
  const functionArgumentsSearch = require('stylelint/lib/utils/functionArgumentsSearch.cjs');
8
- const isAbsoluteUrl = (url) => /^\//.test(url) && !/^\/\//.test(url);
10
+ const isAbsoluteUrl = (url)=>/^\//.test(url) && !/^\/\//.test(url);
9
11
  const ruleName = '@servicetitan/function-url-no-absolute';
10
- const messages = stylelint_1.utils.ruleMessages(ruleName, {
11
- rejected: 'Unexpected absolute url',
12
+ const messages = _stylelint.utils.ruleMessages(ruleName, {
13
+ rejected: 'Unexpected absolute url'
12
14
  });
13
- const plugin = actual => {
14
- return (root, result) => {
15
- const validOptions = stylelint_1.utils.validateOptions(result, ruleName, { actual });
15
+ const plugin = (actual)=>{
16
+ return (root, result)=>{
17
+ const validOptions = _stylelint.utils.validateOptions(result, ruleName, {
18
+ actual
19
+ });
16
20
  if (!validOptions) {
17
21
  return;
18
22
  }
19
- root.walkDecls(decl => {
20
- functionArgumentsSearch(decl.toString().toLowerCase(), 'url', (args, index) => {
21
- const url = (0, trim_1.default)(args, ' \'"');
23
+ root.walkDecls((decl)=>{
24
+ functionArgumentsSearch(decl.toString().toLowerCase(), 'url', (args, index)=>{
25
+ const url = (0, _trim.default)(args, ' \'"');
22
26
  if (!isAbsoluteUrl(url)) {
23
27
  return;
24
28
  }
25
- stylelint_1.utils.report({
29
+ _stylelint.utils.report({
26
30
  message: messages.rejected,
27
31
  node: decl,
28
32
  index,
29
33
  result,
30
- ruleName,
34
+ ruleName
31
35
  });
32
36
  });
33
37
  });
@@ -35,5 +39,9 @@ const plugin = actual => {
35
39
  };
36
40
  plugin.ruleName = ruleName;
37
41
  plugin.messages = messages;
38
- module.exports = Object.assign((0, stylelint_1.createPlugin)(ruleName, plugin), { ruleName, messages });
42
+ module.exports = Object.assign((0, _stylelint.createPlugin)(ruleName, plugin), {
43
+ ruleName,
44
+ messages
45
+ });
46
+
39
47
  //# sourceMappingURL=function-url-no-absolute.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"function-url-no-absolute.js","sourceRoot":"","sources":["../src/function-url-no-absolute.ts"],"names":[],"mappings":";;;;AAAA,yCAAsD;AAEtD,uDAA+B;AAE/B,MAAM,uBAAuB,GAAG,OAAO,CAAC,iDAAiD,CAIhF,CAAC;AAEV,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE7E,MAAM,QAAQ,GAAG,wCAAwC,CAAC;AAC1D,MAAM,QAAQ,GAAG,iBAAK,CAAC,YAAY,CAAC,QAAQ,EAAE;IAC1C,QAAQ,EAAE,yBAAyB;CACtC,CAAC,CAAC;AAEH,MAAM,MAAM,GAAS,MAAM,CAAC,EAAE;IAC1B,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;QACpB,MAAM,YAAY,GAAG,iBAAK,CAAC,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAEzE,IAAI,CAAC,YAAY,EAAE,CAAC;YAChB,OAAO;QACX,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;YAClB,uBAAuB,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;gBAC1E,MAAM,GAAG,GAAG,IAAA,cAAI,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;gBAE/B,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;oBACtB,OAAO;gBACX,CAAC;gBAED,iBAAK,CAAC,MAAM,CAAC;oBACT,OAAO,EAAE,QAAQ,CAAC,QAAQ;oBAC1B,IAAI,EAAE,IAAI;oBACV,KAAK;oBACL,MAAM;oBACN,QAAQ;iBACX,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC3B,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAE3B,iBAAS,MAAM,CAAC,MAAM,CAAC,IAAA,wBAAY,EAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC"}
1
+ {"version":3,"sources":["../src/function-url-no-absolute.ts"],"sourcesContent":["import { Rule, createPlugin, utils } from 'stylelint';\n\nimport trim from 'lodash/trim';\n\nconst functionArgumentsSearch = require('stylelint/lib/utils/functionArgumentsSearch.cjs') as (\n source: string,\n functionName: string,\n callback: (args: string, index: number) => void\n) => void;\n\nconst isAbsoluteUrl = (url: string) => /^\\//.test(url) && !/^\\/\\//.test(url);\n\nconst ruleName = '@servicetitan/function-url-no-absolute';\nconst messages = utils.ruleMessages(ruleName, {\n rejected: 'Unexpected absolute url',\n});\n\nconst plugin: Rule = actual => {\n return (root, result) => {\n const validOptions = utils.validateOptions(result, ruleName, { actual });\n\n if (!validOptions) {\n return;\n }\n\n root.walkDecls(decl => {\n functionArgumentsSearch(decl.toString().toLowerCase(), 'url', (args, index) => {\n const url = trim(args, ' \\'\"');\n\n if (!isAbsoluteUrl(url)) {\n return;\n }\n\n utils.report({\n message: messages.rejected,\n node: decl,\n index,\n result,\n ruleName,\n });\n });\n });\n };\n};\n\nplugin.ruleName = ruleName;\nplugin.messages = messages;\n\nexport = Object.assign(createPlugin(ruleName, plugin), { ruleName, messages });\n"],"names":["functionArgumentsSearch","require","isAbsoluteUrl","url","test","ruleName","messages","utils","ruleMessages","rejected","plugin","actual","root","result","validOptions","validateOptions","walkDecls","decl","toString","toLowerCase","args","index","trim","report","message","node","Object","assign","createPlugin"],"mappings":";2BAA0C;6DAEzB;;;;;;AAEjB,MAAMA,0BAA0BC,QAAQ;AAMxC,MAAMC,gBAAgB,CAACC,MAAgB,MAAMC,IAAI,CAACD,QAAQ,CAAC,QAAQC,IAAI,CAACD;AAExE,MAAME,WAAW;AACjB,MAAMC,WAAWC,gBAAK,CAACC,YAAY,CAACH,UAAU;IAC1CI,UAAU;AACd;AAEA,MAAMC,SAAeC,CAAAA;IACjB,OAAO,CAACC,MAAMC;QACV,MAAMC,eAAeP,gBAAK,CAACQ,eAAe,CAACF,QAAQR,UAAU;YAAEM;QAAO;QAEtE,IAAI,CAACG,cAAc;YACf;QACJ;QAEAF,KAAKI,SAAS,CAACC,CAAAA;YACXjB,wBAAwBiB,KAAKC,QAAQ,GAAGC,WAAW,IAAI,OAAO,CAACC,MAAMC;gBACjE,MAAMlB,MAAMmB,IAAAA,aAAI,EAACF,MAAM;gBAEvB,IAAI,CAAClB,cAAcC,MAAM;oBACrB;gBACJ;gBAEAI,gBAAK,CAACgB,MAAM,CAAC;oBACTC,SAASlB,SAASG,QAAQ;oBAC1BgB,MAAMR;oBACNI;oBACAR;oBACAR;gBACJ;YACJ;QACJ;IACJ;AACJ;AAEAK,OAAOL,QAAQ,GAAGA;AAClBK,OAAOJ,QAAQ,GAAGA;iBAEToB,OAAOC,MAAM,CAACC,IAAAA,uBAAY,EAACvB,UAAUK,SAAS;IAAEL;IAAUC;AAAS"}
package/dist/index.js CHANGED
@@ -1,28 +1,44 @@
1
1
  "use strict";
2
2
  module.exports = {
3
- extends: ['stylelint-config-standard', 'stylelint-prettier/recommended'],
4
- plugins: ['./function-url-no-absolute', './use-tokens'],
3
+ extends: [
4
+ 'stylelint-config-standard',
5
+ 'stylelint-prettier/recommended'
6
+ ],
7
+ plugins: [
8
+ './function-url-no-absolute',
9
+ './use-tokens'
10
+ ],
5
11
  overrides: [
6
12
  {
7
- files: ['*.scss', '**/*.scss'],
8
- extends: ['stylelint-config-standard-scss'],
13
+ files: [
14
+ '*.scss',
15
+ '**/*.scss'
16
+ ],
17
+ extends: [
18
+ 'stylelint-config-standard-scss'
19
+ ],
9
20
  rules: {
10
21
  'at-rule-descriptor-no-unknown': null,
11
22
  'at-rule-descriptor-value-no-unknown': null,
12
23
  'at-rule-prelude-no-invalid': null,
13
- 'declaration-property-value-no-unknown': null,
14
- },
24
+ 'declaration-property-value-no-unknown': null
25
+ }
15
26
  },
16
27
  {
17
- files: ['*.less', '**/*.less'],
18
- extends: ['stylelint-config-standard-less'],
28
+ files: [
29
+ '*.less',
30
+ '**/*.less'
31
+ ],
32
+ extends: [
33
+ 'stylelint-config-standard-less'
34
+ ],
19
35
  rules: {
20
36
  'at-rule-descriptor-no-unknown': null,
21
37
  'at-rule-descriptor-value-no-unknown': null,
22
38
  'at-rule-prelude-no-invalid': null,
23
- 'declaration-property-value-no-unknown': null,
24
- },
25
- },
39
+ 'declaration-property-value-no-unknown': null
40
+ }
41
+ }
26
42
  ],
27
43
  rules: {
28
44
  'function-no-unknown': [
@@ -31,8 +47,7 @@ module.exports = {
31
47
  /*
32
48
  * these are all less functions at the moment, see the full list here https://lesscss.org/functions/
33
49
  * 'extend' and '-' are also added to the list as they are identified as functions thought they are not
34
- */
35
- ignoreFunctions: [
50
+ */ ignoreFunctions: [
36
51
  'extend',
37
52
  '-',
38
53
  'if',
@@ -123,47 +138,56 @@ module.exports = {
123
138
  'difference',
124
139
  'exclusion',
125
140
  'average',
126
- 'negation',
127
- ],
128
- },
141
+ 'negation'
142
+ ]
143
+ }
129
144
  ],
130
145
  'selector-pseudo-class-no-unknown': [
131
146
  true,
132
147
  {
133
- ignorePseudoClasses: ['global', 'local'],
134
- },
148
+ ignorePseudoClasses: [
149
+ 'global',
150
+ 'local'
151
+ ]
152
+ }
135
153
  ],
136
154
  '@servicetitan/function-url-no-absolute': true,
137
155
  '@servicetitan/use-tokens': true,
138
- 'no-invalid-position-at-import-rule': null, // Not supported for LESS/SASS. Enable for CSS when https://github.com/stylelint/stylelint/issues/3128 is implemented.
139
- 'at-rule-empty-line-before': null, // Require or disallow an empty line before at-rules
140
- 'alpha-value-notation': null, // Specify percentage or number notation for alpha-values
141
- 'color-function-notation': null, // Specify modern or legacy notation for color-functions
142
- 'color-hex-length': null, // Specify short or long notation for hex colors
143
- 'comment-whitespace-inside': null, // Require or disallow whitespace on the inside of comment markers
144
- 'custom-property-pattern': null, // Specify a pattern for custom properties
145
- 'declaration-block-no-shorthand-property-overrides': [true, { severity: 'warning' }], // Disallow shorthand properties that override related longhand properties
146
- 'declaration-empty-line-before': null, // Require or disallow an empty line before declarations
147
- 'declaration-block-no-redundant-longhand-properties': null, // Disallow redundant longhand properties within declaration-block
148
- 'font-family-name-quotes': null, // Require or disallow quotes for font family names
149
- 'function-url-quotes': null, // Require or disallow quotes for urls.
150
- 'hue-degree-notation': null, // Specify number or angle notation for degree hues
151
- 'import-notation': null, // Specify string or URL notation for @import rules
152
- 'keyframes-name-pattern': null, // Specify a pattern for keyframe names
153
- 'length-zero-no-unit': null, // Disallow units for zero lengths
154
- 'media-feature-range-notation': null, // Specify context or prefix notation for media feature ranges
155
- 'media-query-no-invalid': null, // Disallow invalid media queries (should not turn it on for CSS-like languages, such as Sass or Less)
156
- 'number-max-precision': null, // Limit the number of decimal places allowed in numbers
157
- 'property-no-vendor-prefix': null, // Disallow vendor prefixes for properties
158
- 'rule-empty-line-before': null, // Require or disallow an empty line before rules
159
- 'shorthand-property-no-redundant-values': null, // Disallow redundant values within shorthand properties
160
- 'selector-class-pattern': null, // Specify a pattern for class selectors
161
- 'selector-id-pattern': null, // Specify a pattern for ID selectors
162
- 'selector-not-notation': null, // Specify simple or complex notation for :not() pseudo-class selectors
163
- 'selector-pseudo-element-colon-notation': null, // Specify single or double colon notation for applicable pseudo-element selectors
164
- 'value-keyword-case': null, // Specify lowercase or uppercase for keywords values
165
- 'value-no-vendor-prefix': null, // Specify lowercase or uppercase for keywords values
166
- 'color-function-alias-notation': null, // Specify alias notation for color-functions.
167
- },
156
+ 'no-invalid-position-at-import-rule': null,
157
+ 'at-rule-empty-line-before': null,
158
+ 'alpha-value-notation': null,
159
+ 'color-function-notation': null,
160
+ 'color-hex-length': null,
161
+ 'comment-whitespace-inside': null,
162
+ 'custom-property-pattern': null,
163
+ 'declaration-block-no-shorthand-property-overrides': [
164
+ true,
165
+ {
166
+ severity: 'warning'
167
+ }
168
+ ],
169
+ 'declaration-empty-line-before': null,
170
+ 'declaration-block-no-redundant-longhand-properties': null,
171
+ 'font-family-name-quotes': null,
172
+ 'function-url-quotes': null,
173
+ 'hue-degree-notation': null,
174
+ 'import-notation': null,
175
+ 'keyframes-name-pattern': null,
176
+ 'length-zero-no-unit': null,
177
+ 'media-feature-range-notation': null,
178
+ 'media-query-no-invalid': null,
179
+ 'number-max-precision': null,
180
+ 'property-no-vendor-prefix': null,
181
+ 'rule-empty-line-before': null,
182
+ 'shorthand-property-no-redundant-values': null,
183
+ 'selector-class-pattern': null,
184
+ 'selector-id-pattern': null,
185
+ 'selector-not-notation': null,
186
+ 'selector-pseudo-element-colon-notation': null,
187
+ 'value-keyword-case': null,
188
+ 'value-no-vendor-prefix': null,
189
+ 'color-function-alias-notation': null
190
+ }
168
191
  };
192
+
169
193
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,iBAAS;IACL,OAAO,EAAE,CAAC,2BAA2B,EAAE,gCAAgC,CAAC;IACxE,OAAO,EAAE,CAAC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I,EAAE,mDAAmD;QAChF,iBAAiB,EAAE,IAAI,EAAE,mDAAmD;QAC5E,wBAAwB,EAAE,IAAI,EAAE,uCAAuC;QACvE,qBAAqB,EAAE,IAAI,EAAE,kCAAkC;QAC/D,8BAA8B,EAAE,IAAI,EAAE,8DAA8D;QACpG,wBAAwB,EAAE,IAAI,EAAE,sGAAsG;QACtI,sBAAsB,EAAE,IAAI,EAAE,wDAAwD;QACtF,2BAA2B,EAAE,IAAI,EAAE,0CAA0C;QAC7E,wBAAwB,EAAE,IAAI,EAAE,iDAAiD;QACjF,wCAAwC,EAAE,IAAI,EAAE,wDAAwD;QACxG,wBAAwB,EAAE,IAAI,EAAE,wCAAwC;QACxE,qBAAqB,EAAE,IAAI,EAAE,qCAAqC;QAClE,uBAAuB,EAAE,IAAI,EAAE,uEAAuE;QACtG,wCAAwC,EAAE,IAAI,EAAE,kFAAkF;QAClI,oBAAoB,EAAE,IAAI,EAAE,qDAAqD;QACjF,wBAAwB,EAAE,IAAI,EAAE,qDAAqD;QACrF,+BAA+B,EAAE,IAAI,EAAE,8CAA8C;KACxF;CACe,CAAC"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { Config } from 'stylelint';\n\nexport = {\n extends: ['stylelint-config-standard', 'stylelint-prettier/recommended'],\n plugins: ['./function-url-no-absolute', './use-tokens'],\n overrides: [\n {\n files: ['*.scss', '**/*.scss'],\n extends: ['stylelint-config-standard-scss'],\n rules: {\n 'at-rule-descriptor-no-unknown': null,\n 'at-rule-descriptor-value-no-unknown': null,\n 'at-rule-prelude-no-invalid': null,\n 'declaration-property-value-no-unknown': null,\n },\n },\n {\n files: ['*.less', '**/*.less'],\n extends: ['stylelint-config-standard-less'],\n rules: {\n 'at-rule-descriptor-no-unknown': null,\n 'at-rule-descriptor-value-no-unknown': null,\n 'at-rule-prelude-no-invalid': null,\n 'declaration-property-value-no-unknown': null,\n },\n },\n ],\n rules: {\n 'function-no-unknown': [\n true,\n {\n /*\n * these are all less functions at the moment, see the full list here https://lesscss.org/functions/\n * 'extend' and '-' are also added to the list as they are identified as functions thought they are not\n */\n ignoreFunctions: [\n 'extend',\n '-',\n 'if',\n 'boolean',\n 'escape',\n 'e',\n '%',\n 'replace',\n 'length',\n 'extract',\n 'range',\n 'each',\n 'ceil',\n 'floor',\n 'percentage',\n 'round',\n 'sqrt',\n 'abs',\n 'sin',\n 'asin',\n 'cos',\n 'acos',\n 'tan',\n 'atan',\n 'pi',\n 'pow',\n 'mod',\n 'min',\n 'max',\n 'isnumber',\n 'isstring',\n 'iscolor',\n 'iskeyword',\n 'isurl',\n 'ispixel',\n 'isem',\n 'ispercentage',\n 'isunit',\n 'isruleset',\n 'isdefined',\n 'color',\n 'image-size',\n 'image-width',\n 'image-height',\n 'convert',\n 'data-uri',\n 'default',\n 'unit',\n 'get-unit',\n 'svg-gradient',\n 'rgb',\n 'rgba',\n 'argb',\n 'hsl',\n 'hsla',\n 'hsv',\n 'hsva',\n 'hue',\n 'saturation',\n 'lightness',\n 'hsvhue',\n 'hsvsaturation',\n 'hsvvalue',\n 'red',\n 'green',\n 'blue',\n 'alpha',\n 'luma',\n 'luminance',\n 'saturate',\n 'desaturate',\n 'lighten',\n 'darken',\n 'fadein',\n 'fadeout',\n 'fade',\n 'spin',\n 'mix',\n 'tint',\n 'shade',\n 'greyscale',\n 'contrast',\n 'multiply',\n 'screen',\n 'overlay',\n 'softlight',\n 'hardlight',\n 'difference',\n 'exclusion',\n 'average',\n 'negation',\n ],\n },\n ],\n 'selector-pseudo-class-no-unknown': [\n true,\n {\n ignorePseudoClasses: ['global', 'local'],\n },\n ],\n '@servicetitan/function-url-no-absolute': true,\n '@servicetitan/use-tokens': true,\n 'no-invalid-position-at-import-rule': null, // Not supported for LESS/SASS. Enable for CSS when https://github.com/stylelint/stylelint/issues/3128 is implemented.\n 'at-rule-empty-line-before': null, // Require or disallow an empty line before at-rules\n 'alpha-value-notation': null, // Specify percentage or number notation for alpha-values\n 'color-function-notation': null, // Specify modern or legacy notation for color-functions\n 'color-hex-length': null, // Specify short or long notation for hex colors\n 'comment-whitespace-inside': null, // Require or disallow whitespace on the inside of comment markers\n 'custom-property-pattern': null, // Specify a pattern for custom properties\n 'declaration-block-no-shorthand-property-overrides': [true, { severity: 'warning' }], // Disallow shorthand properties that override related longhand properties\n 'declaration-empty-line-before': null, // Require or disallow an empty line before declarations\n 'declaration-block-no-redundant-longhand-properties': null, // Disallow redundant longhand properties within declaration-block\n 'font-family-name-quotes': null, // Require or disallow quotes for font family names\n 'function-url-quotes': null, // Require or disallow quotes for urls.\n 'hue-degree-notation': null, // Specify number or angle notation for degree hues\n 'import-notation': null, // Specify string or URL notation for @import rules\n 'keyframes-name-pattern': null, // Specify a pattern for keyframe names\n 'length-zero-no-unit': null, // Disallow units for zero lengths\n 'media-feature-range-notation': null, // Specify context or prefix notation for media feature ranges\n 'media-query-no-invalid': null, // Disallow invalid media queries (should not turn it on for CSS-like languages, such as Sass or Less)\n 'number-max-precision': null, // Limit the number of decimal places allowed in numbers\n 'property-no-vendor-prefix': null, // Disallow vendor prefixes for properties\n 'rule-empty-line-before': null, // Require or disallow an empty line before rules\n 'shorthand-property-no-redundant-values': null, // Disallow redundant values within shorthand properties\n 'selector-class-pattern': null, // Specify a pattern for class selectors\n 'selector-id-pattern': null, // Specify a pattern for ID selectors\n 'selector-not-notation': null, // Specify simple or complex notation for :not() pseudo-class selectors\n 'selector-pseudo-element-colon-notation': null, // Specify single or double colon notation for applicable pseudo-element selectors\n 'value-keyword-case': null, // Specify lowercase or uppercase for keywords values\n 'value-no-vendor-prefix': null, // Specify lowercase or uppercase for keywords values\n 'color-function-alias-notation': null, // Specify alias notation for color-functions.\n },\n} as Partial<Config>;\n"],"names":["extends","plugins","overrides","files","rules","ignoreFunctions","ignorePseudoClasses","severity"],"mappings":";iBAES;IACLA,SAAS;QAAC;QAA6B;KAAiC;IACxEC,SAAS;QAAC;QAA8B;KAAe;IACvDC,WAAW;QACP;YACIC,OAAO;gBAAC;gBAAU;aAAY;YAC9BH,SAAS;gBAAC;aAAiC;YAC3CI,OAAO;gBACH,iCAAiC;gBACjC,uCAAuC;gBACvC,8BAA8B;gBAC9B,yCAAyC;YAC7C;QACJ;QACA;YACID,OAAO;gBAAC;gBAAU;aAAY;YAC9BH,SAAS;gBAAC;aAAiC;YAC3CI,OAAO;gBACH,iCAAiC;gBACjC,uCAAuC;gBACvC,8BAA8B;gBAC9B,yCAAyC;YAC7C;QACJ;KACH;IACDA,OAAO;QACH,uBAAuB;YACnB;YACA;gBACI;;;iBAGC,GACDC,iBAAiB;oBACb;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;iBACH;YACL;SACH;QACD,oCAAoC;YAChC;YACA;gBACIC,qBAAqB;oBAAC;oBAAU;iBAAQ;YAC5C;SACH;QACD,0CAA0C;QAC1C,4BAA4B;QAC5B,sCAAsC;QACtC,6BAA6B;QAC7B,wBAAwB;QACxB,2BAA2B;QAC3B,oBAAoB;QACpB,6BAA6B;QAC7B,2BAA2B;QAC3B,qDAAqD;YAAC;YAAM;gBAAEC,UAAU;YAAU;SAAE;QACpF,iCAAiC;QACjC,sDAAsD;QACtD,2BAA2B;QAC3B,uBAAuB;QACvB,uBAAuB;QACvB,mBAAmB;QACnB,0BAA0B;QAC1B,uBAAuB;QACvB,gCAAgC;QAChC,0BAA0B;QAC1B,wBAAwB;QACxB,6BAA6B;QAC7B,0BAA0B;QAC1B,0CAA0C;QAC1C,0BAA0B;QAC1B,uBAAuB;QACvB,yBAAyB;QACzB,0CAA0C;QAC1C,sBAAsB;QACtB,0BAA0B;QAC1B,iCAAiC;IACrC;AACJ"}
@@ -1,20 +1,22 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- const stylelint_1 = require("stylelint");
6
- const color_1 = __importDefault(require("color"));
7
- const values_1 = require("./values");
2
+ const _stylelint = require("stylelint");
3
+ const _color = /*#__PURE__*/ _interop_require_default(require("color"));
4
+ const _values = require("./values");
5
+ function _interop_require_default(obj) {
6
+ return obj && obj.__esModule ? obj : {
7
+ default: obj
8
+ };
9
+ }
8
10
  const ruleName = '@servicetitan/use-tokens';
9
- const messages = stylelint_1.utils.ruleMessages(ruleName, {
10
- variableExpected: (expected, found) => `You should use "${expected}" variable from the \`@servicetitan/tokens\` instead of "${found}".`,
11
+ const messages = _stylelint.utils.ruleMessages(ruleName, {
12
+ variableExpected: (expected, found)=>`You should use "${expected}" variable from the \`@servicetitan/tokens\` instead of "${found}".`
11
13
  });
12
- const plugin = (_0, _1, context) => {
13
- return (root, result) => {
14
- var _a, _b, _c;
15
- const extension = (_c = (_b = (_a = result.opts) === null || _a === void 0 ? void 0 : _a.from) === null || _b === void 0 ? void 0 : _b.split('.').pop()) === null || _c === void 0 ? void 0 : _c.toLowerCase();
14
+ const plugin = (_0, _1, context)=>{
15
+ return (root, result)=>{
16
+ var _result_opts_from_split_pop, _result_opts_from, _result_opts;
17
+ const extension = (_result_opts = result.opts) === null || _result_opts === void 0 ? void 0 : (_result_opts_from = _result_opts.from) === null || _result_opts_from === void 0 ? void 0 : (_result_opts_from_split_pop = _result_opts_from.split('.').pop()) === null || _result_opts_from_split_pop === void 0 ? void 0 : _result_opts_from_split_pop.toLowerCase();
16
18
  function convertToVariable(key) {
17
- switch (extension) {
19
+ switch(extension){
18
20
  case 'less':
19
21
  return `@${key}`;
20
22
  case 'sass':
@@ -24,29 +26,29 @@ const plugin = (_0, _1, context) => {
24
26
  return `var(--${key})`;
25
27
  }
26
28
  }
27
- root.walkDecls(decl => {
28
- function lint(collection, { condition, transformer, solid, } = {}) {
29
- var _a;
29
+ root.walkDecls((decl)=>{
30
+ function lint(collection, { condition, transformer, solid } = {}) {
30
31
  if (condition && !condition(decl.prop)) {
31
32
  return true;
32
33
  }
33
- const values = !solid ? decl.value.split(' ') : [decl.value];
34
+ const values = !solid ? decl.value.split(' ') : [
35
+ decl.value
36
+ ];
34
37
  let reported = false;
35
- for (const rawValue of values) {
36
- const value = (_a = transformer === null || transformer === void 0 ? void 0 : transformer(rawValue)) !== null && _a !== void 0 ? _a : rawValue;
38
+ for (const rawValue of values){
39
+ var _transformer;
40
+ const value = (_transformer = transformer === null || transformer === void 0 ? void 0 : transformer(rawValue)) !== null && _transformer !== void 0 ? _transformer : rawValue;
37
41
  if (collection[value]) {
38
- const variable = (rawValue.startsWith('-') ? '-' : '') +
39
- convertToVariable(collection[value]);
42
+ const variable = (rawValue.startsWith('-') ? '-' : '') + convertToVariable(collection[value]);
40
43
  if (context.fix) {
41
44
  values[values.indexOf(rawValue)] = variable;
42
- }
43
- else {
44
- stylelint_1.utils.report({
45
+ } else {
46
+ _stylelint.utils.report({
45
47
  node: decl,
46
48
  message: messages.variableExpected(variable, rawValue),
47
49
  word: value,
48
50
  ruleName,
49
- result,
51
+ result
50
52
  });
51
53
  }
52
54
  reported = true;
@@ -58,49 +60,51 @@ const plugin = (_0, _1, context) => {
58
60
  return !reported;
59
61
  }
60
62
  const linters = {
61
- colors: () => lint(values_1.colors, {
62
- transformer: value => {
63
- try {
64
- return new color_1.default(value).hex();
63
+ colors: ()=>lint(_values.colors, {
64
+ transformer: (value)=>{
65
+ try {
66
+ return new _color.default(value).hex();
67
+ } catch (e) {
68
+ return '';
69
+ }
65
70
  }
66
- catch (_a) {
67
- return '';
68
- }
69
- },
70
- }),
71
- typescales: () => lint(values_1.typescales, {
72
- condition: property => property === 'font-size',
73
- solid: true,
74
- }),
75
- borderRadiuses: () => lint(values_1.borderRadiuses, {
76
- condition: property => property.startsWith('border-') && property.endsWith('-radius'),
77
- transformer: value => (value === '0px' ? '0' : value),
78
- }),
79
- lintSpacings: () => lint(values_1.spacings, {
80
- // other spacings like "top"?
81
- condition: property => property.startsWith('margin') || property.startsWith('padding'),
82
- transformer: value => value === '0px' ? '0' : value.startsWith('-') ? value.slice(1) : value,
83
- }),
84
- fontWeights: () => lint(values_1.fontWeights, {
85
- condition: property => property === 'font-weight',
86
- solid: true,
87
- }),
88
- opacities: () => lint(values_1.opacities, {
89
- condition: property => property === 'opacity',
90
- transformer: value => (value.startsWith('0.') ? value.slice(1) : value),
91
- solid: true,
92
- }),
93
- zIndexes: () => lint(values_1.zIndexes, { condition: property => property === 'z-index', solid: true }),
94
- lineHeights: () => lint(values_1.lineHeights, {
95
- condition: property => property === 'line-height',
96
- solid: true,
97
- }),
98
- fontFamilies: () => lint(values_1.fontFamilies, {
99
- condition: property => property === 'font-family',
100
- solid: true,
101
- }),
71
+ }),
72
+ typescales: ()=>lint(_values.typescales, {
73
+ condition: (property)=>property === 'font-size',
74
+ solid: true
75
+ }),
76
+ borderRadiuses: ()=>lint(_values.borderRadiuses, {
77
+ condition: (property)=>property.startsWith('border-') && property.endsWith('-radius'),
78
+ transformer: (value)=>value === '0px' ? '0' : value
79
+ }),
80
+ lintSpacings: ()=>lint(_values.spacings, {
81
+ // other spacings like "top"?
82
+ condition: (property)=>property.startsWith('margin') || property.startsWith('padding'),
83
+ transformer: (value)=>value === '0px' ? '0' : value.startsWith('-') ? value.slice(1) : value
84
+ }),
85
+ fontWeights: ()=>lint(_values.fontWeights, {
86
+ condition: (property)=>property === 'font-weight',
87
+ solid: true
88
+ }),
89
+ opacities: ()=>lint(_values.opacities, {
90
+ condition: (property)=>property === 'opacity',
91
+ transformer: (value)=>value.startsWith('0.') ? value.slice(1) : value,
92
+ solid: true
93
+ }),
94
+ zIndexes: ()=>lint(_values.zIndexes, {
95
+ condition: (property)=>property === 'z-index',
96
+ solid: true
97
+ }),
98
+ lineHeights: ()=>lint(_values.lineHeights, {
99
+ condition: (property)=>property === 'line-height',
100
+ solid: true
101
+ }),
102
+ fontFamilies: ()=>lint(_values.fontFamilies, {
103
+ condition: (property)=>property === 'font-family',
104
+ solid: true
105
+ })
102
106
  };
103
- for (const handler of Object.values(linters)) {
107
+ for (const handler of Object.values(linters)){
104
108
  if (!handler()) {
105
109
  return;
106
110
  }
@@ -110,5 +114,9 @@ const plugin = (_0, _1, context) => {
110
114
  };
111
115
  plugin.ruleName = ruleName;
112
116
  plugin.messages = messages;
113
- module.exports = Object.assign((0, stylelint_1.createPlugin)(ruleName, plugin), { ruleName, messages });
117
+ module.exports = Object.assign((0, _stylelint.createPlugin)(ruleName, plugin), {
118
+ ruleName,
119
+ messages
120
+ });
121
+
114
122
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/use-tokens/index.ts"],"names":[],"mappings":";;;;AAAA,yCAAsD;AAEtD,kDAA0B;AAE1B,qCAUkB;AAElB,MAAM,QAAQ,GAAG,0BAA0B,CAAC;AAC5C,MAAM,QAAQ,GAAG,iBAAK,CAAC,YAAY,CAAC,QAAQ,EAAE;IAC1C,gBAAgB,EAAE,CAAC,QAAgB,EAAE,KAAa,EAAE,EAAE,CAClD,mBAAmB,QAAQ,4DAA4D,KAAK,IAAI;CACvG,CAAC,CAAC;AAEH,MAAM,MAAM,GAAS,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE;IACrC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;;QACpB,MAAM,SAAS,GAA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AAE,GAAG,EAAE,CACd,IAAI,CAAC,oBAAW,EAAE;oBACd,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,KAAK,aAAa;oBACjD,KAAK,EAAE,IAAI;iBACd,CAAC;gBAEN,YAAY,EAAE,GAAG,EAAE,CACf,IAAI,CAAC,qBAAY,EAAE;oBACf,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,KAAK,aAAa;oBACjD,KAAK,EAAE,IAAI;iBACd,CAAC;aACT,CAAC;YAEF,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3C,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;oBACb,OAAO;gBACX,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC3B,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAE3B,iBAAS,MAAM,CAAC,MAAM,CAAC,IAAA,wBAAY,EAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../src/use-tokens/index.ts"],"sourcesContent":["import { Rule, createPlugin, utils } from 'stylelint';\n\nimport Color from 'color';\n\nimport {\n colors,\n typescales,\n borderRadiuses,\n spacings,\n fontWeights,\n opacities,\n zIndexes,\n lineHeights,\n fontFamilies,\n} from './values';\n\nconst ruleName = '@servicetitan/use-tokens';\nconst messages = utils.ruleMessages(ruleName, {\n variableExpected: (expected: string, found: string) =>\n `You should use \"${expected}\" variable from the \\`@servicetitan/tokens\\` instead of \"${found}\".`,\n});\n\nconst plugin: Rule = (_0, _1, context) => {\n return (root, result) => {\n const extension = result.opts?.from?.split('.').pop()?.toLowerCase();\n\n function convertToVariable(key: string) {\n switch (extension) {\n case 'less':\n return `@${key}`;\n\n case 'sass':\n case 'scss':\n return `$${key}`;\n\n default:\n return `var(--${key})`;\n }\n }\n\n root.walkDecls(decl => {\n function lint(\n collection: Record<string, string>,\n {\n condition,\n transformer,\n solid,\n }: {\n condition?: (property: string) => boolean;\n transformer?: (value: string) => string;\n solid?: boolean;\n } = {}\n ) {\n if (condition && !condition(decl.prop)) {\n return true;\n }\n\n const values = !solid ? decl.value.split(' ') : [decl.value];\n\n let reported = false;\n for (const rawValue of values) {\n const value = transformer?.(rawValue) ?? rawValue;\n if (collection[value]) {\n const variable =\n (rawValue.startsWith('-') ? '-' : '') +\n convertToVariable(collection[value]);\n\n if (context.fix) {\n values[values.indexOf(rawValue)] = variable;\n } else {\n utils.report({\n node: decl,\n message: messages.variableExpected(variable, rawValue),\n word: value,\n ruleName,\n result,\n });\n }\n reported = true;\n }\n }\n\n if (context.fix) {\n decl.value = values.join(' ');\n }\n\n return !reported;\n }\n\n const linters = {\n colors: () =>\n lint(colors, {\n transformer: value => {\n try {\n return new Color(value).hex();\n } catch {\n return '';\n }\n },\n }),\n\n typescales: () =>\n lint(typescales, {\n condition: property => property === 'font-size',\n solid: true,\n }),\n\n borderRadiuses: () =>\n lint(borderRadiuses, {\n condition: property =>\n property.startsWith('border-') && property.endsWith('-radius'),\n transformer: value => (value === '0px' ? '0' : value),\n }),\n\n lintSpacings: () =>\n lint(spacings, {\n // other spacings like \"top\"?\n condition: property =>\n property.startsWith('margin') || property.startsWith('padding'),\n transformer: value =>\n value === '0px' ? '0' : value.startsWith('-') ? value.slice(1) : value,\n }),\n\n fontWeights: () =>\n lint(fontWeights, {\n condition: property => property === 'font-weight',\n solid: true,\n }),\n\n opacities: () =>\n lint(opacities, {\n condition: property => property === 'opacity',\n transformer: value => (value.startsWith('0.') ? value.slice(1) : value),\n solid: true,\n }),\n\n zIndexes: () =>\n lint(zIndexes, { condition: property => property === 'z-index', solid: true }),\n\n lineHeights: () =>\n lint(lineHeights, {\n condition: property => property === 'line-height',\n solid: true,\n }),\n\n fontFamilies: () =>\n lint(fontFamilies, {\n condition: property => property === 'font-family',\n solid: true,\n }),\n };\n\n for (const handler of Object.values(linters)) {\n if (!handler()) {\n return;\n }\n }\n });\n };\n};\n\nplugin.ruleName = ruleName;\nplugin.messages = messages;\n\nexport = Object.assign(createPlugin(ruleName, plugin), { ruleName, messages });\n"],"names":["ruleName","messages","utils","ruleMessages","variableExpected","expected","found","plugin","_0","_1","context","root","result","extension","opts","from","split","pop","toLowerCase","convertToVariable","key","walkDecls","decl","lint","collection","condition","transformer","solid","prop","values","value","reported","rawValue","variable","startsWith","fix","indexOf","report","node","message","word","join","linters","colors","Color","hex","typescales","property","borderRadiuses","endsWith","lintSpacings","spacings","slice","fontWeights","opacities","zIndexes","lineHeights","fontFamilies","handler","Object","assign","createPlugin"],"mappings":";2BAA0C;8DAExB;wBAYX;;;;;;AAEP,MAAMA,WAAW;AACjB,MAAMC,WAAWC,gBAAK,CAACC,YAAY,CAACH,UAAU;IAC1CI,kBAAkB,CAACC,UAAkBC,QACjC,CAAC,gBAAgB,EAAED,SAAS,yDAAyD,EAAEC,MAAM,EAAE,CAAC;AACxG;AAEA,MAAMC,SAAe,CAACC,IAAIC,IAAIC;IAC1B,OAAO,CAACC,MAAMC;YACQA,6BAAAA,mBAAAA;QAAlB,MAAMC,aAAYD,eAAAA,OAAOE,IAAI,cAAXF,oCAAAA,oBAAAA,aAAaG,IAAI,cAAjBH,yCAAAA,8BAAAA,kBAAmBI,KAAK,CAAC,KAAKC,GAAG,gBAAjCL,kDAAAA,4BAAqCM,WAAW;QAElE,SAASC,kBAAkBC,GAAW;YAClC,OAAQP;gBACJ,KAAK;oBACD,OAAO,CAAC,CAAC,EAAEO,KAAK;gBAEpB,KAAK;gBACL,KAAK;oBACD,OAAO,CAAC,CAAC,EAAEA,KAAK;gBAEpB;oBACI,OAAO,CAAC,MAAM,EAAEA,IAAI,CAAC,CAAC;YAC9B;QACJ;QAEAT,KAAKU,SAAS,CAACC,CAAAA;YACX,SAASC,KACLC,UAA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C,MAAM,CAACC,IAAAA,uBAAY,EAAC7D,UAAUO,SAAS;IAAEP;IAAUC;AAAS"}
@@ -1,37 +1,70 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.fontFamilies = exports.lineHeights = exports.zIndexes = exports.opacities = exports.fontWeights = exports.spacings = exports.borderRadiuses = exports.typescales = exports.colors = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const color_1 = __importDefault(require("color"));
9
- const core_1 = require("@servicetitan/tokens/core");
10
- const toCamelCase = (str) => str.replace(/(-[a-z])/g, ([, letter]) => letter.toUpperCase());
11
- const toSnakeCase = (str) => str.replace(/([A-Z]|[a-z][0-9])/g, ([letter, digit]) => digit === undefined ? `-${letter.toLowerCase()}` : `${letter}-${digit}`);
12
- const aliases = fs_1.default
13
- .readFileSync(require.resolve('@servicetitan/tokens/core/tokens.less'), 'utf8')
14
- .split('\n')
15
- .filter(row => row.startsWith('@') && row.endsWith('(alias)'))
16
- .map(row => toCamelCase(row.split(':')[0].slice(1)));
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get borderRadiuses () {
13
+ return borderRadiuses;
14
+ },
15
+ get colors () {
16
+ return colors;
17
+ },
18
+ get fontFamilies () {
19
+ return fontFamilies;
20
+ },
21
+ get fontWeights () {
22
+ return fontWeights;
23
+ },
24
+ get lineHeights () {
25
+ return lineHeights;
26
+ },
27
+ get opacities () {
28
+ return opacities;
29
+ },
30
+ get spacings () {
31
+ return spacings;
32
+ },
33
+ get typescales () {
34
+ return typescales;
35
+ },
36
+ get zIndexes () {
37
+ return zIndexes;
38
+ }
39
+ });
40
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
41
+ const _color = /*#__PURE__*/ _interop_require_default(require("color"));
42
+ const _core = require("@servicetitan/tokens/core");
43
+ function _interop_require_default(obj) {
44
+ return obj && obj.__esModule ? obj : {
45
+ default: obj
46
+ };
47
+ }
48
+ const toCamelCase = (str)=>str.replace(/(-[a-z])/g, ([, letter])=>letter.toUpperCase());
49
+ const toSnakeCase = (str)=>str.replace(/([A-Z]|[a-z][0-9])/g, ([letter, digit])=>digit === undefined ? `-${letter.toLowerCase()}` : `${letter}-${digit}`);
50
+ const aliases = _fs.default.readFileSync(require.resolve('@servicetitan/tokens/core/tokens.less'), 'utf8').split('\n').filter((row)=>row.startsWith('@') && row.endsWith('(alias)')).map((row)=>toCamelCase(row.split(':')[0].slice(1)));
17
51
  function getValues(condition, transformer) {
18
- return Object.entries(core_1.tokens)
19
- .filter(([variable]) => !aliases.includes(variable) && condition(variable))
20
- .reduce((result, [variable, value]) => {
21
- var _a;
22
- return ({
52
+ return Object.entries(_core.tokens).filter(([variable])=>!aliases.includes(variable) && condition(variable)).reduce((result, [variable, value])=>{
53
+ var _transformer;
54
+ return {
23
55
  ...result,
24
- [(_a = transformer === null || transformer === void 0 ? void 0 : transformer(value)) !== null && _a !== void 0 ? _a : value]: toSnakeCase(variable),
25
- });
56
+ [(_transformer = transformer === null || transformer === void 0 ? void 0 : transformer(value)) !== null && _transformer !== void 0 ? _transformer : value]: toSnakeCase(variable)
57
+ };
26
58
  }, {});
27
59
  }
28
- exports.colors = getValues(variable => variable.startsWith('color'), value => new color_1.default(value).hex());
29
- exports.typescales = getValues(variable => variable.startsWith('typescale'));
30
- exports.borderRadiuses = getValues(variable => variable.startsWith('borderRadius'));
31
- exports.spacings = getValues(variable => variable.startsWith('spacing'));
32
- exports.fontWeights = getValues(variable => variable.startsWith('fontWeight'));
33
- exports.opacities = getValues(variable => variable.startsWith('opacity'));
34
- exports.zIndexes = getValues(variable => variable.startsWith('zIndex'));
35
- exports.lineHeights = getValues(variable => variable.endsWith('LineHeight'));
36
- exports.fontFamilies = getValues(variable => variable.endsWith('FontFamily'), value => value.replace(/&#x27;/g, "'"));
60
+ const colors = getValues((variable)=>variable.startsWith('color'), (value)=>new _color.default(value).hex());
61
+ const typescales = getValues((variable)=>variable.startsWith('typescale'));
62
+ const borderRadiuses = getValues((variable)=>variable.startsWith('borderRadius'));
63
+ const spacings = getValues((variable)=>variable.startsWith('spacing'));
64
+ const fontWeights = getValues((variable)=>variable.startsWith('fontWeight'));
65
+ const opacities = getValues((variable)=>variable.startsWith('opacity'));
66
+ const zIndexes = getValues((variable)=>variable.startsWith('zIndex'));
67
+ const lineHeights = getValues((variable)=>variable.endsWith('LineHeight'));
68
+ const fontFamilies = getValues((variable)=>variable.endsWith('FontFamily'), (value)=>value.replace(/&#x27;/g, "'"));
69
+
37
70
  //# sourceMappingURL=values.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"values.js","sourceRoot":"","sources":["../../src/use-tokens/values.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAEpB,kDAA0B;AAE1B,oDAAmD;AAEnD,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AACpG,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE,CAChC,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,CACnD,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,EAAE,CAC1E,CAAC;AAEN,MAAM,OAAO,GAAG,YAAE;KACb,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,uCAAuC,CAAC,EAAE,MAAM,CA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,cAAc,CAAC,CAAC,CAAC;AAC5E,QAAA,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AACjE,QAAA,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;AACvE,QAAA,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AAClE,QAAA,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;AAChE,QAAA,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;AACrE,QAAA,YAAY,GAAG,SAAS,CACjC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,EAC3C,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CACzC,CAAC"}
1
+ {"version":3,"sources":["../../src/use-tokens/values.ts"],"sourcesContent":["import fs from 'fs';\n\nimport Color from 'color';\n\nimport { tokens } from '@servicetitan/tokens/core';\n\nconst toCamelCase = (str: string) => str.replace(/(-[a-z])/g, ([, letter]) => letter.toUpperCase());\nconst toSnakeCase = (str: string) =>\n str.replace(/([A-Z]|[a-z][0-9])/g, ([letter, digit]) =>\n digit === undefined ? `-${letter.toLowerCase()}` : `${letter}-${digit}`\n );\n\nconst aliases = fs\n .readFileSync(require.resolve('@servicetitan/tokens/core/tokens.less'), 'utf8')\n .split('\\n')\n .filter(row => row.startsWith('@') && row.endsWith('(alias)'))\n .map(row => toCamelCase(row.split(':')[0].slice(1)));\n\nfunction getValues(\n condition: (variable: string) => boolean,\n transformer?: (value: string) => string\n) {\n return Object.entries(tokens)\n .filter(([variable]) => !aliases.includes(variable) && condition(variable))\n .reduce<Record<string, string>>(\n (result, [variable, value]) => ({\n ...result,\n [transformer?.(value) ?? value]: toSnakeCase(variable),\n }),\n {}\n );\n}\n\nexport const colors = getValues(\n variable => variable.startsWith('color'),\n value => new Color(value).hex()\n);\nexport const typescales = getValues(variable => variable.startsWith('typescale'));\nexport const borderRadiuses = getValues(variable => variable.startsWith('borderRadius'));\nexport const spacings = getValues(variable => variable.startsWith('spacing'));\nexport const fontWeights = getValues(variable => variable.startsWith('fontWeight'));\nexport const opacities = getValues(variable => variable.startsWith('opacity'));\nexport const zIndexes = getValues(variable => variable.startsWith('zIndex'));\nexport const lineHeights = getValues(variable => variable.endsWith('LineHeight'));\nexport const fontFamilies = getValues(\n variable => variable.endsWith('FontFamily'),\n value => value.replace(/&#x27;/g, \"'\")\n);\n"],"names":["borderRadiuses","colors","fontFamilies","fontWeights","lineHeights","opacities","spacings","typescales","zIndexes","toCamelCase","str","replace","letter","toUpperCase","toSnakeCase","digit","undefined","toLowerCase","aliases","fs","readFileSync","require","resolve","split","filter","row","startsWith","endsWith","map","slice","getValues","condition","transformer","Object","entries","tokens","variable","includes","reduce","result","value","Color","hex"],"mappings":";;;;;;;;;;;QAsCaA;eAAAA;;QALAC;eAAAA;;QAWAC;eAAAA;;QAJAC;eAAAA;;QAGAC;eAAAA;;QAFAC;eAAAA;;QAFAC;eAAAA;;QAFAC;eAAAA;;QAKAC;eAAAA;;;2DA1CE;8DAEG;sBAEK;;;;;;AAEvB,MAAMC,cAAc,CAACC,MAAgBA,IAAIC,OAAO,CAAC,aAAa,CAAC,GAAGC,OAAO,GAAKA,OAAOC,WAAW;AAChG,MAAMC,cAAc,CAACJ,MACjBA,IAAIC,OAAO,CAAC,uBAAuB,CAAC,CAACC,QAAQG,MAAM,GAC/CA,UAAUC,YAAY,CAAC,CAAC,EAAEJ,OAAOK,WAAW,IAAI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AST,QAAQ,CAAC;AAC5D,MAAMzB,eAAe4B,UACxBM,CAAAA,WAAYA,SAAST,QAAQ,CAAC,eAC9Ba,CAAAA,QAASA,MAAM7B,OAAO,CAAC,WAAW"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/stylelint-config",
3
- "version": "30.3.1",
3
+ "version": "31.0.0",
4
4
  "description": "",
5
5
  "homepage": "https://docs.st.dev/docs/frontend/eslint-stylelint-configurations",
6
6
  "repository": {
@@ -26,12 +26,12 @@
26
26
  "@servicetitan/tokens": "~12.9.0",
27
27
  "@types/color": "~3.0.3",
28
28
  "@types/lodash": "~4.14.178",
29
- "stylelint": "~16.20.0"
29
+ "stylelint": "~16.21.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@servicetitan/tokens": "^12.9.0",
33
- "postcss": "^8.5.4",
34
- "stylelint": "^16.20.0"
33
+ "postcss": "^8.5.6",
34
+ "stylelint": "^16.21.0"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
@@ -39,5 +39,5 @@
39
39
  "cli": {
40
40
  "webpack": false
41
41
  },
42
- "gitHead": "4d7f01d86d64fc00160d63a2e2a3448f28aa7a2d"
42
+ "gitHead": "c52e188a1217df74052774a2eea6a5126089e3d5"
43
43
  }