@breadstone-infrastructure/style-dictionary 0.0.174 → 0.0.176
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/formats/tailwind/DesignTokenType.d.ts +10 -0
- package/formats/tailwind/DesignTokenType.d.ts.map +1 -0
- package/formats/tailwind/DesignTokenType.js +3 -0
- package/formats/tailwind/DesignTokenType.js.map +1 -0
- package/formats/tailwind/TailwindPropertyMapping.d.ts +61 -0
- package/formats/tailwind/TailwindPropertyMapping.d.ts.map +1 -0
- package/formats/tailwind/TailwindPropertyMapping.js +326 -0
- package/formats/tailwind/TailwindPropertyMapping.js.map +1 -0
- package/formats/tailwind/buildTailwindConfig.d.ts +23 -0
- package/formats/tailwind/buildTailwindConfig.d.ts.map +1 -0
- package/formats/tailwind/buildTailwindConfig.js +258 -0
- package/formats/tailwind/buildTailwindConfig.js.map +1 -0
- package/formats/tailwind/index.d.ts +2 -0
- package/formats/tailwind/index.d.ts.map +1 -0
- package/formats/tailwind/index.js +18 -0
- package/formats/tailwind/index.js.map +1 -0
- package/formats/tailwind/tailwindFormat.d.ts +17 -0
- package/formats/tailwind/tailwindFormat.d.ts.map +1 -0
- package/formats/tailwind/tailwindFormat.js +77 -0
- package/formats/tailwind/tailwindFormat.js.map +1 -0
- package/index.d.ts +9 -9
- package/index.d.ts.map +1 -1
- package/index.js +31 -19
- package/index.js.map +1 -1
- package/package.json +4 -3
- package/preprocessors/{Shadow.d.ts → expandShadowPreprocessor.d.ts} +1 -1
- package/preprocessors/expandShadowPreprocessor.d.ts.map +1 -0
- package/preprocessors/{Shadow.js → expandShadowPreprocessor.js} +1 -12
- package/preprocessors/expandShadowPreprocessor.js.map +1 -0
- package/preprocessors/lint/engine/preprocessor.d.ts +12 -0
- package/preprocessors/lint/engine/preprocessor.d.ts.map +1 -0
- package/preprocessors/lint/engine/preprocessor.js +44 -0
- package/preprocessors/lint/engine/preprocessor.js.map +1 -0
- package/preprocessors/lint/engine/types.d.ts +21 -0
- package/preprocessors/lint/engine/types.d.ts.map +1 -0
- package/preprocessors/lint/engine/types.js +4 -0
- package/preprocessors/lint/engine/types.js.map +1 -0
- package/preprocessors/lint/engine/walker.d.ts +13 -0
- package/preprocessors/lint/engine/walker.d.ts.map +1 -0
- package/preprocessors/lint/engine/walker.js +30 -0
- package/preprocessors/lint/engine/walker.js.map +1 -0
- package/preprocessors/lint/index.d.ts +4 -0
- package/preprocessors/lint/index.d.ts.map +1 -0
- package/preprocessors/lint/index.js +19 -0
- package/preprocessors/lint/index.js.map +1 -0
- package/preprocessors/lint/rules/forbiddenTokenName.d.ts +25 -0
- package/preprocessors/lint/rules/forbiddenTokenName.d.ts.map +1 -0
- package/preprocessors/lint/rules/forbiddenTokenName.js +40 -0
- package/preprocessors/lint/rules/forbiddenTokenName.js.map +1 -0
- package/preprocessors/lint/rules/forbiddenValue.d.ts +31 -0
- package/preprocessors/lint/rules/forbiddenValue.d.ts.map +1 -0
- package/preprocessors/lint/rules/forbiddenValue.js +48 -0
- package/preprocessors/lint/rules/forbiddenValue.js.map +1 -0
- package/preprocessors/lint/rules/index.d.ts +9 -0
- package/preprocessors/lint/rules/index.d.ts.map +1 -0
- package/preprocessors/lint/rules/index.js +25 -0
- package/preprocessors/lint/rules/index.js.map +1 -0
- package/preprocessors/lint/rules/namingConvention.d.ts +26 -0
- package/preprocessors/lint/rules/namingConvention.d.ts.map +1 -0
- package/preprocessors/lint/rules/namingConvention.js +35 -0
- package/preprocessors/lint/rules/namingConvention.js.map +1 -0
- package/preprocessors/lint/rules/noDollarProps.d.ts +6 -0
- package/preprocessors/lint/rules/noDollarProps.d.ts.map +1 -0
- package/preprocessors/lint/rules/noDollarProps.js +27 -0
- package/preprocessors/lint/rules/noDollarProps.js.map +1 -0
- package/preprocessors/lint/rules/requireType.d.ts +6 -0
- package/preprocessors/lint/rules/requireType.d.ts.map +1 -0
- package/preprocessors/lint/rules/requireType.js +21 -0
- package/preprocessors/lint/rules/requireType.js.map +1 -0
- package/preprocessors/lint/rules/requireValue.d.ts +6 -0
- package/preprocessors/lint/rules/requireValue.d.ts.map +1 -0
- package/preprocessors/lint/rules/requireValue.js +21 -0
- package/preprocessors/lint/rules/requireValue.js.map +1 -0
- package/preprocessors/lint/rules/validType.d.ts +25 -0
- package/preprocessors/lint/rules/validType.d.ts.map +1 -0
- package/preprocessors/lint/rules/validType.js +41 -0
- package/preprocessors/lint/rules/validType.js.map +1 -0
- package/preprocessors/lint/rules/valueTypeByTokenType.d.ts +40 -0
- package/preprocessors/lint/rules/valueTypeByTokenType.d.ts.map +1 -0
- package/preprocessors/lint/rules/valueTypeByTokenType.js +80 -0
- package/preprocessors/lint/rules/valueTypeByTokenType.js.map +1 -0
- package/transforms/gradientCssTransform.d.ts +3 -0
- package/transforms/gradientCssTransform.d.ts.map +1 -0
- package/transforms/{Gradient.js → gradientCssTransform.js} +4 -4
- package/transforms/gradientCssTransform.js.map +1 -0
- package/transforms/letterSpacingCalcCssTransform.d.ts +3 -0
- package/transforms/letterSpacingCalcCssTransform.d.ts.map +1 -0
- package/transforms/{LetterSpacing.js → letterSpacingCalcCssTransform.js} +4 -4
- package/transforms/letterSpacingCalcCssTransform.js.map +1 -0
- package/transforms/listScssTransform.d.ts +3 -0
- package/transforms/listScssTransform.d.ts.map +1 -0
- package/transforms/{List.js → listScssTransform.js} +4 -4
- package/transforms/listScssTransform.js.map +1 -0
- package/transforms/oklchCssTransform.d.ts +7 -0
- package/transforms/oklchCssTransform.d.ts.map +1 -0
- package/transforms/oklchCssTransform.js +52 -0
- package/transforms/oklchCssTransform.js.map +1 -0
- package/transforms/{QuoteString.d.ts → quoteStringTransform.d.ts} +1 -1
- package/transforms/quoteStringTransform.d.ts.map +1 -0
- package/transforms/{QuoteString.js → quoteStringTransform.js} +2 -2
- package/transforms/quoteStringTransform.js.map +1 -0
- package/transforms/{Shadow.d.ts → shadowCssTransform.d.ts} +1 -1
- package/transforms/shadowCssTransform.d.ts.map +1 -0
- package/transforms/{Shadow.js → shadowCssTransform.js} +2 -2
- package/transforms/shadowCssTransform.js.map +1 -0
- package/utilities/{Extract.d.ts → extractTokensByType.d.ts} +1 -1
- package/utilities/extractTokensByType.d.ts.map +1 -0
- package/utilities/{Extract.js → extractTokensByType.js} +2 -2
- package/utilities/extractTokensByType.js.map +1 -0
- package/formats/tailwind.d.ts +0 -3
- package/formats/tailwind.d.ts.map +0 -1
- package/formats/tailwind.js +0 -209
- package/formats/tailwind.js.map +0 -1
- package/preprocessors/Lint.d.ts +0 -3
- package/preprocessors/Lint.d.ts.map +0 -1
- package/preprocessors/Lint.js +0 -65
- package/preprocessors/Lint.js.map +0 -1
- package/preprocessors/Shadow.d.ts.map +0 -1
- package/preprocessors/Shadow.js.map +0 -1
- package/transforms/Gradient.d.ts +0 -3
- package/transforms/Gradient.d.ts.map +0 -1
- package/transforms/Gradient.js.map +0 -1
- package/transforms/LetterSpacing.d.ts +0 -3
- package/transforms/LetterSpacing.d.ts.map +0 -1
- package/transforms/LetterSpacing.js.map +0 -1
- package/transforms/List.d.ts +0 -3
- package/transforms/List.d.ts.map +0 -1
- package/transforms/List.js.map +0 -1
- package/transforms/NameSnakeUpperCase.d.ts +0 -6
- package/transforms/NameSnakeUpperCase.d.ts.map +0 -1
- package/transforms/NameSnakeUpperCase.js +0 -20
- package/transforms/NameSnakeUpperCase.js.map +0 -1
- package/transforms/QuoteString.d.ts.map +0 -1
- package/transforms/QuoteString.js.map +0 -1
- package/transforms/Shadow.d.ts.map +0 -1
- package/transforms/Shadow.js.map +0 -1
- package/utilities/Extract.d.ts.map +0 -1
- package/utilities/Extract.js.map +0 -1
- /package/utilities/{GetValue.d.ts → getValue.d.ts} +0 -0
- /package/utilities/{GetValue.d.ts.map → getValue.d.ts.map} +0 -0
- /package/utilities/{GetValue.js → getValue.js} +0 -0
- /package/utilities/{GetValue.js.map → getValue.js.map} +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.createLintPreprocessor = createLintPreprocessor;
|
|
5
|
+
const walker_js_1 = require("./walker.js");
|
|
6
|
+
const utilities_1 = require("@breadstone-infrastructure/utilities");
|
|
7
|
+
// #endregion
|
|
8
|
+
/**
|
|
9
|
+
* Creates a lint preprocessor that evaluates all given lint rules.
|
|
10
|
+
*
|
|
11
|
+
* Any rule with severity "error" will terminate the build.
|
|
12
|
+
* Rules with severity "warn" will only be logged.
|
|
13
|
+
*/
|
|
14
|
+
function createLintPreprocessor(options) {
|
|
15
|
+
const { rules } = options;
|
|
16
|
+
return {
|
|
17
|
+
name: 'lint/tokens',
|
|
18
|
+
preprocessor: (dictionary, _config) => {
|
|
19
|
+
console.log('🔍 Running token linting...');
|
|
20
|
+
const issues = [];
|
|
21
|
+
(0, walker_js_1.walkTokens)(dictionary, [], rules, issues);
|
|
22
|
+
if (issues.length === 0) {
|
|
23
|
+
console.log(`${(0, utilities_1.symbol)('success')} Token linting passed with no issues.`);
|
|
24
|
+
return dictionary;
|
|
25
|
+
}
|
|
26
|
+
// Print warnings
|
|
27
|
+
const warnings = issues.filter((i) => i.severity === 'warn');
|
|
28
|
+
for (const warn of warnings) {
|
|
29
|
+
console.warn(`${(0, utilities_1.symbol)('warning')} [WARN] ${warn.path.join('.')}: ${warn.message}`);
|
|
30
|
+
}
|
|
31
|
+
// Print errors
|
|
32
|
+
const errors = issues.filter((i) => i.severity === 'error');
|
|
33
|
+
for (const err of errors) {
|
|
34
|
+
console.error(`${(0, utilities_1.symbol)('error')} [ERROR] ${err.path.join('.')}: ${err.message}`);
|
|
35
|
+
}
|
|
36
|
+
if (errors.length > 0) {
|
|
37
|
+
throw new Error(`Token linting failed with ${errors.length} error(s).`);
|
|
38
|
+
}
|
|
39
|
+
console.log(`${(0, utilities_1.symbol)('warning')} Linting completed with warnings only.`);
|
|
40
|
+
return dictionary;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=preprocessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preprocessor.js","sourceRoot":"","sources":["../../../../src/preprocessors/lint/engine/preprocessor.ts"],"names":[],"mappings":";AAAA,kBAAkB;;AAelB,wDA4CC;AAvDD,2CAAyC;AACzC,oEAA8D;AAE9D,aAAa;AAEb;;;;;GAKG;AACH,SAAgB,sBAAsB,CAClC,OAEC;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAE1B,OAAO;QACH,IAAI,EAAE,aAAa;QACnB,YAAY,EAAE,CACV,UAA8B,EAC9B,OAAgC,EACd,EAAE;YACpB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;YAE3C,MAAM,MAAM,GAAqB,EAAE,CAAC;YAEpC,IAAA,sBAAU,EAAC,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YAE1C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACtB,OAAO,CAAC,GAAG,CAAC,GAAG,IAAA,kBAAM,EAAC,SAAS,CAAC,uCAAuC,CAAC,CAAC;gBACzE,OAAO,UAAU,CAAC;YACtB,CAAC;YAED,iBAAiB;YACjB,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC;YAC7D,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;gBAC1B,OAAO,CAAC,IAAI,CAAC,GAAG,IAAA,kBAAM,EAAC,SAAS,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;YACxF,CAAC;YAED,eAAe;YACf,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;YAC5D,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;gBACvB,OAAO,CAAC,KAAK,CAAC,GAAG,IAAA,kBAAM,EAAC,OAAO,CAAC,YAAY,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YACtF,CAAC;YAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CAAC,6BAA6B,MAAM,CAAC,MAAM,YAAY,CAAC,CAAC;YAC5E,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,GAAG,IAAA,kBAAM,EAAC,SAAS,CAAC,wCAAwC,CAAC,CAAC;YAC1E,OAAO,UAAU,CAAC;QACtB,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { DesignToken } from 'style-dictionary/types';
|
|
2
|
+
/**
|
|
3
|
+
* Severity levels supported by the lint engine.
|
|
4
|
+
* - "error": Build stops.
|
|
5
|
+
* - "warn": Logged, but the build continues.
|
|
6
|
+
*/
|
|
7
|
+
export type LintSeverity = 'error' | 'warn';
|
|
8
|
+
/**
|
|
9
|
+
* A single lint issue identified by a rule.
|
|
10
|
+
*/
|
|
11
|
+
export interface LintIssue {
|
|
12
|
+
readonly message: string;
|
|
13
|
+
readonly severity: LintSeverity;
|
|
14
|
+
readonly path: Array<string>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Function signature of a lint rule.
|
|
18
|
+
* A rule evaluates a token and returns zero or more lint issues.
|
|
19
|
+
*/
|
|
20
|
+
export type LintRule = (token: DesignToken, path: Array<string>) => Array<LintIssue>;
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/preprocessors/lint/engine/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,CACnB,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,KAClB,KAAK,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/preprocessors/lint/engine/types.ts"],"names":[],"mappings":";AAAA,kBAAkB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DesignToken, PreprocessedTokens } from 'style-dictionary/types/DesignToken.js';
|
|
2
|
+
import type { LintRule, LintIssue } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Recursively walks through a Style Dictionary token tree, executing
|
|
5
|
+
* every rule on each discovered leaf token.
|
|
6
|
+
*
|
|
7
|
+
* @param tokens - any nested token structure
|
|
8
|
+
* @param path - accumulated key path
|
|
9
|
+
* @param rules - array of lint rules to execute
|
|
10
|
+
* @param collector - array to collect lint issues
|
|
11
|
+
*/
|
|
12
|
+
export declare function walkTokens(tokens: PreprocessedTokens | DesignToken, path: Array<string>, rules: ReadonlyArray<LintRule>, collector: Array<LintIssue>): void;
|
|
13
|
+
//# sourceMappingURL=walker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walker.d.ts","sourceRoot":"","sources":["../../../../src/preprocessors/lint/engine/walker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AACxF,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAItD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACtB,MAAM,EAAE,kBAAkB,GAAG,WAAW,EACxC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EACnB,KAAK,EAAE,aAAa,CAAC,QAAQ,CAAC,EAC9B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,GAC5B,IAAI,CAaN"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.walkTokens = walkTokens;
|
|
5
|
+
// #endregion
|
|
6
|
+
/**
|
|
7
|
+
* Recursively walks through a Style Dictionary token tree, executing
|
|
8
|
+
* every rule on each discovered leaf token.
|
|
9
|
+
*
|
|
10
|
+
* @param tokens - any nested token structure
|
|
11
|
+
* @param path - accumulated key path
|
|
12
|
+
* @param rules - array of lint rules to execute
|
|
13
|
+
* @param collector - array to collect lint issues
|
|
14
|
+
*/
|
|
15
|
+
function walkTokens(tokens, path, rules, collector) {
|
|
16
|
+
if (typeof tokens === 'object' && tokens !== null) {
|
|
17
|
+
const token = tokens;
|
|
18
|
+
for (const rule of rules) {
|
|
19
|
+
const issues = rule(token, path);
|
|
20
|
+
if (issues.length > 0) {
|
|
21
|
+
collector.push(...issues);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
for (const [key, value] of Object.entries(tokens)) {
|
|
27
|
+
walkTokens(value, [...path, key], rules, collector);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=walker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walker.js","sourceRoot":"","sources":["../../../../src/preprocessors/lint/engine/walker.ts"],"names":[],"mappings":";AAAA,kBAAkB;;AAgBlB,gCAkBC;AA7BD,aAAa;AAEb;;;;;;;;GAQG;AACH,SAAgB,UAAU,CACtB,MAAwC,EACxC,IAAmB,EACnB,KAA8B,EAC9B,SAA2B;IAE3B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAChD,MAAM,KAAK,GAAG,MAAiC,CAAC;QAChD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACjC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAAC,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;YAAC,CAAC;QACzD,CAAC;QACD,OAAO;IACX,CAAC;IAED,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAmC,MAAM,CAAC,EAAE,CAAC;QAClF,UAAU,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACxD,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/preprocessors/lint/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,mBAAmB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./engine/preprocessor.js"), exports);
|
|
18
|
+
__exportStar(require("./rules"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/preprocessors/lint/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,2DAAyC;AACzC,0CAAwB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { LintRule, LintSeverity } from '../engine/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the forbidden token name rule.
|
|
4
|
+
*/
|
|
5
|
+
export interface ForbiddenTokenNameRuleOptions {
|
|
6
|
+
/**
|
|
7
|
+
* List of forbidden exact token names (matches the last segment of the path).
|
|
8
|
+
*/
|
|
9
|
+
readonly names?: ReadonlyArray<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Optional array of regular expressions tested against the last path segment.
|
|
12
|
+
*/
|
|
13
|
+
readonly patterns?: ReadonlyArray<RegExp>;
|
|
14
|
+
/**
|
|
15
|
+
* Severity used when a forbidden name is detected.
|
|
16
|
+
* Defaults to "error".
|
|
17
|
+
*/
|
|
18
|
+
readonly severity?: LintSeverity;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Rule: the last segment of the token path must not match any forbidden name
|
|
22
|
+
* or pattern.
|
|
23
|
+
*/
|
|
24
|
+
export declare function ruleForbiddenTokenName(options: ForbiddenTokenNameRuleOptions): LintRule;
|
|
25
|
+
//# sourceMappingURL=forbiddenTokenName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forbiddenTokenName.d.ts","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/forbiddenTokenName.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIjE;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAE1C;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAEvC;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAE1C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;CACpC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAClC,OAAO,EAAE,6BAA6B,GACvC,QAAQ,CAwCV"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ruleForbiddenTokenName = ruleForbiddenTokenName;
|
|
5
|
+
/**
|
|
6
|
+
* Rule: the last segment of the token path must not match any forbidden name
|
|
7
|
+
* or pattern.
|
|
8
|
+
*/
|
|
9
|
+
function ruleForbiddenTokenName(options) {
|
|
10
|
+
const { names = [], patterns = [], severity = 'error' } = options;
|
|
11
|
+
const exactSet = new Set(names);
|
|
12
|
+
return (_token, path) => {
|
|
13
|
+
if (path.length === 0) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
const name = path[path.length - 1];
|
|
17
|
+
if (exactSet.has(name)) {
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
message: `Token name "${name}" is forbidden.`,
|
|
21
|
+
severity,
|
|
22
|
+
path
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
for (const pattern of patterns) {
|
|
27
|
+
if (pattern.test(name)) {
|
|
28
|
+
return [
|
|
29
|
+
{
|
|
30
|
+
message: `Token name "${name}" matches forbidden pattern ${pattern.toString()}.`,
|
|
31
|
+
severity,
|
|
32
|
+
path
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return [];
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=forbiddenTokenName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forbiddenTokenName.js","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/forbiddenTokenName.ts"],"names":[],"mappings":";AAAA,kBAAkB;;AAgClB,wDA0CC;AA9CD;;;GAGG;AACH,SAAgB,sBAAsB,CAClC,OAAsC;IAEtC,MAAM,EACF,KAAK,GAAG,EAAE,EACV,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,OAAO,EACrB,GAAG,OAAO,CAAC;IAEZ,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAEhC,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;QACpB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpB,OAAO,EAAE,CAAC;QACd,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAEnC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,OAAO;gBACH;oBACI,OAAO,EAAE,eAAe,IAAI,iBAAiB;oBAC7C,QAAQ;oBACR,IAAI;iBACP;aACJ,CAAC;QACN,CAAC;QAED,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC7B,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrB,OAAO;oBACH;wBACI,OAAO,EAAE,eAAe,IAAI,+BAA+B,OAAO,CAAC,QAAQ,EAAE,GAAG;wBAChF,QAAQ;wBACR,IAAI;qBACP;iBACJ,CAAC;YACN,CAAC;QACL,CAAC;QAED,OAAO,EAAE,CAAC;IACd,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { LintRule, LintSeverity } from '../engine/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the forbidden value rule.
|
|
4
|
+
*/
|
|
5
|
+
export interface ForbiddenValueRuleOptions {
|
|
6
|
+
/**
|
|
7
|
+
* List of forbidden raw values. Comparison is done on (optionally trimmed)
|
|
8
|
+
* string values.
|
|
9
|
+
*/
|
|
10
|
+
readonly values: ReadonlyArray<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Severity used when a forbidden value is detected.
|
|
13
|
+
* Defaults to "error".
|
|
14
|
+
*/
|
|
15
|
+
readonly severity?: LintSeverity;
|
|
16
|
+
/**
|
|
17
|
+
* If true, value strings are trimmed before comparison.
|
|
18
|
+
* Defaults to true.
|
|
19
|
+
*/
|
|
20
|
+
readonly trim?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* If true, comparison is done case-insensitive.
|
|
23
|
+
* Defaults to false.
|
|
24
|
+
*/
|
|
25
|
+
readonly ignoreCase?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Rule: token.value must not match any of the forbidden values.
|
|
29
|
+
*/
|
|
30
|
+
export declare function ruleForbiddenValue(options: ForbiddenValueRuleOptions): LintRule;
|
|
31
|
+
//# sourceMappingURL=forbiddenValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forbiddenValue.d.ts","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/forbiddenValue.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIjE;;GAEG;AACH,MAAM,WAAW,yBAAyB;IAEtC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAEvC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAC9B,OAAO,EAAE,yBAAyB,GACnC,QAAQ,CAwCV"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ruleForbiddenValue = ruleForbiddenValue;
|
|
5
|
+
/**
|
|
6
|
+
* Rule: token.value must not match any of the forbidden values.
|
|
7
|
+
*/
|
|
8
|
+
function ruleForbiddenValue(options) {
|
|
9
|
+
const { values, severity = 'error', trim = true, ignoreCase = false } = options;
|
|
10
|
+
const normalizedForbidden = values.map((v) => normalize(v, {
|
|
11
|
+
trim,
|
|
12
|
+
ignoreCase
|
|
13
|
+
}));
|
|
14
|
+
return (token, path) => {
|
|
15
|
+
if (!('value' in token)) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
const raw = token.value;
|
|
19
|
+
if (typeof raw !== 'string') {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
const normalizedValue = normalize(raw, {
|
|
23
|
+
trim,
|
|
24
|
+
ignoreCase
|
|
25
|
+
});
|
|
26
|
+
if (normalizedForbidden.includes(normalizedValue)) {
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
message: `Token uses a forbidden value "${raw}".`,
|
|
30
|
+
severity,
|
|
31
|
+
path
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
return [];
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function normalize(value, opts) {
|
|
39
|
+
let v = value;
|
|
40
|
+
if (opts.trim) {
|
|
41
|
+
v = v.trim();
|
|
42
|
+
}
|
|
43
|
+
if (opts.ignoreCase) {
|
|
44
|
+
v = v.toLowerCase();
|
|
45
|
+
}
|
|
46
|
+
return v;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=forbiddenValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forbiddenValue.js","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/forbiddenValue.ts"],"names":[],"mappings":";AAAA,kBAAkB;;AAuClB,gDA0CC;AA7CD;;GAEG;AACH,SAAgB,kBAAkB,CAC9B,OAAkC;IAElC,MAAM,EACF,MAAM,EACN,QAAQ,GAAG,OAAO,EAClB,IAAI,GAAG,IAAI,EACX,UAAU,GAAG,KAAK,EACrB,GAAG,OAAO,CAAC;IAEZ,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE;QACvD,IAAI;QACJ,UAAU;KACb,CAAC,CAAC,CAAC;IAEJ,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACnB,IAAI,CAAC,CAAC,OAAO,IAAI,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,EAAE,CAAC;QACd,CAAC;QAED,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC;QACxB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC1B,OAAO,EAAE,CAAC;QACd,CAAC;QAED,MAAM,eAAe,GAAG,SAAS,CAAC,GAAG,EAAE;YACnC,IAAI;YACJ,UAAU;SACb,CAAC,CAAC;QAEH,IAAI,mBAAmB,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;YAChD,OAAO;gBACH;oBACI,OAAO,EAAE,iCAAiC,GAAG,IAAI;oBACjD,QAAQ;oBACR,IAAI;iBACP;aACJ,CAAC;QACN,CAAC;QAED,OAAO,EAAE,CAAC;IACd,CAAC,CAAC;AACN,CAAC;AAOD,SAAS,SAAS,CAAC,KAAa,EAAE,IAAsB;IACpD,IAAI,CAAC,GAAG,KAAK,CAAC;IACd,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAAC,CAAC;IAChC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QAAC,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAAC,CAAC;IAC7C,OAAO,CAAC,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './forbiddenTokenName.js';
|
|
2
|
+
export * from './forbiddenValue.js';
|
|
3
|
+
export * from './namingConvention.js';
|
|
4
|
+
export * from './noDollarProps.js';
|
|
5
|
+
export * from './requireType.js';
|
|
6
|
+
export * from './requireValue.js';
|
|
7
|
+
export * from './validType.js';
|
|
8
|
+
export * from './valueTypeByTokenType.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./forbiddenTokenName.js"), exports);
|
|
18
|
+
__exportStar(require("./forbiddenValue.js"), exports);
|
|
19
|
+
__exportStar(require("./namingConvention.js"), exports);
|
|
20
|
+
__exportStar(require("./noDollarProps.js"), exports);
|
|
21
|
+
__exportStar(require("./requireType.js"), exports);
|
|
22
|
+
__exportStar(require("./requireValue.js"), exports);
|
|
23
|
+
__exportStar(require("./validType.js"), exports);
|
|
24
|
+
__exportStar(require("./valueTypeByTokenType.js"), exports);
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,sDAAoC;AACpC,wDAAsC;AACtC,qDAAmC;AACnC,mDAAiC;AACjC,oDAAkC;AAClC,iDAA+B;AAC/B,4DAA0C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { LintRule, LintSeverity } from '../engine/types';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the naming convention rule.
|
|
4
|
+
*/
|
|
5
|
+
export interface NamingConventionRuleOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Pattern that each individual segment must match (e.g. /^[a-z0-9]+$/).
|
|
8
|
+
* If omitted, segment-level checks are skipped.
|
|
9
|
+
*/
|
|
10
|
+
readonly segmentPattern?: RegExp;
|
|
11
|
+
/**
|
|
12
|
+
* Pattern that the full path (joined by ".") must match.
|
|
13
|
+
* If omitted, full-path checks are skipped.
|
|
14
|
+
*/
|
|
15
|
+
readonly fullPathPattern?: RegExp;
|
|
16
|
+
/**
|
|
17
|
+
* Severity used when a naming convention violation is detected.
|
|
18
|
+
* Defaults to "warn".
|
|
19
|
+
*/
|
|
20
|
+
readonly severity?: LintSeverity;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Rule: enforces naming conventions on token path segments and/or full path.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ruleNamingConvention(options: NamingConventionRuleOptions): LintRule;
|
|
26
|
+
//# sourceMappingURL=namingConvention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namingConvention.d.ts","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/namingConvention.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAExC;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;CACpC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,2BAA2B,GACrC,QAAQ,CAmCV"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ruleNamingConvention = ruleNamingConvention;
|
|
4
|
+
/**
|
|
5
|
+
* Rule: enforces naming conventions on token path segments and/or full path.
|
|
6
|
+
*/
|
|
7
|
+
function ruleNamingConvention(options) {
|
|
8
|
+
const { segmentPattern, fullPathPattern, severity = 'warn' } = options;
|
|
9
|
+
return (_token, path) => {
|
|
10
|
+
const issues = [];
|
|
11
|
+
if (segmentPattern) {
|
|
12
|
+
for (const segment of path) {
|
|
13
|
+
if (!segmentPattern.test(segment)) {
|
|
14
|
+
issues.push({
|
|
15
|
+
message: `Path segment "${segment}" does not match naming pattern ${segmentPattern.toString()}.`,
|
|
16
|
+
severity,
|
|
17
|
+
path
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (fullPathPattern) {
|
|
23
|
+
const full = path.join('.');
|
|
24
|
+
if (!fullPathPattern.test(full)) {
|
|
25
|
+
issues.push({
|
|
26
|
+
message: `Token path "${full}" does not match naming pattern ${fullPathPattern.toString()}.`,
|
|
27
|
+
severity,
|
|
28
|
+
path
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return issues;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=namingConvention.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namingConvention.js","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/namingConvention.ts"],"names":[],"mappings":";;AA6BA,oDAqCC;AAxCD;;GAEG;AACH,SAAgB,oBAAoB,CAChC,OAAoC;IAEpC,MAAM,EACF,cAAc,EACd,eAAe,EACf,QAAQ,GAAG,MAAM,EACpB,GAAG,OAAO,CAAC;IAEZ,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;QACpB,MAAM,MAAM,GAAG,EAAE,CAAC;QAElB,IAAI,cAAc,EAAE,CAAC;YACjB,KAAK,MAAM,OAAO,IAAI,IAAI,EAAE,CAAC;gBACzB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;oBAChC,MAAM,CAAC,IAAI,CAAC;wBACR,OAAO,EAAE,iBAAiB,OAAO,mCAAmC,cAAc,CAAC,QAAQ,EAAE,GAAG;wBAChG,QAAQ;wBACR,IAAI;qBACP,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;QACL,CAAC;QAED,IAAI,eAAe,EAAE,CAAC;YAClB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5B,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC9B,MAAM,CAAC,IAAI,CAAC;oBACR,OAAO,EAAE,eAAe,IAAI,mCAAmC,eAAe,CAAC,QAAQ,EAAE,GAAG;oBAC5F,QAAQ;oBACR,IAAI;iBACP,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noDollarProps.d.ts","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/noDollarProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;GAEG;AACH,wBAAgB,eAAe,CAC3B,QAAQ,GAAE,YAAqB,GAChC,QAAQ,CAqBV"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ruleDollarProps = ruleDollarProps;
|
|
4
|
+
/**
|
|
5
|
+
* Rule: "value" and "type" properties are forbidden.
|
|
6
|
+
*/
|
|
7
|
+
function ruleDollarProps(severity = 'warn') {
|
|
8
|
+
return (token, path) => {
|
|
9
|
+
const issues = [];
|
|
10
|
+
if ('value' in token) {
|
|
11
|
+
issues.push({
|
|
12
|
+
message: '"value" is not allowed. Use "$value".',
|
|
13
|
+
severity,
|
|
14
|
+
path
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if ('type' in token) {
|
|
18
|
+
issues.push({
|
|
19
|
+
message: '"type" is not allowed. Use "$type".',
|
|
20
|
+
severity,
|
|
21
|
+
path
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return issues;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=noDollarProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noDollarProps.js","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/noDollarProps.ts"],"names":[],"mappings":";;AAKA,0CAuBC;AA1BD;;GAEG;AACH,SAAgB,eAAe,CAC3B,WAAyB,MAAM;IAE/B,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACnB,MAAM,MAAM,GAAG,EAAE,CAAC;QAElB,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;YACnB,MAAM,CAAC,IAAI,CAAC;gBACR,OAAO,EAAE,uCAAuC;gBAChD,QAAQ;gBACR,IAAI;aACP,CAAC,CAAC;QACP,CAAC;QACD,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC;YAClB,MAAM,CAAC,IAAI,CAAC;gBACR,OAAO,EAAE,qCAAqC;gBAC9C,QAAQ;gBACR,IAAI;aACP,CAAC,CAAC;QACP,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireType.d.ts","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/requireType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;GAEG;AACH,wBAAgB,eAAe,CAC3B,QAAQ,GAAE,YAAsB,GACjC,QAAQ,CAaV"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ruleRequireType = ruleRequireType;
|
|
4
|
+
/**
|
|
5
|
+
* Rule: The token must contain a "type" property.
|
|
6
|
+
*/
|
|
7
|
+
function ruleRequireType(severity = 'error') {
|
|
8
|
+
return (token, path) => {
|
|
9
|
+
if (!('type' in token || '$type' in token)) {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
message: 'Token is missing required "type" property.',
|
|
13
|
+
severity,
|
|
14
|
+
path
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
return [];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=requireType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireType.js","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/requireType.ts"],"names":[],"mappings":";;AAKA,0CAeC;AAlBD;;GAEG;AACH,SAAgB,eAAe,CAC3B,WAAyB,OAAO;IAEhC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACnB,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK,CAAC,EAAE,CAAC;YACzC,OAAO;gBACH;oBACI,OAAO,EAAE,4CAA4C;oBACrD,QAAQ;oBACR,IAAI;iBACP;aACJ,CAAC;QACN,CAAC;QACD,OAAO,EAAE,CAAC;IACd,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireValue.d.ts","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/requireValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;GAEG;AACH,wBAAgB,gBAAgB,CAC5B,QAAQ,GAAE,YAAsB,GACjC,QAAQ,CAaV"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ruleRequireValue = ruleRequireValue;
|
|
4
|
+
/**
|
|
5
|
+
* Rule: The token must contain a "value" property.
|
|
6
|
+
*/
|
|
7
|
+
function ruleRequireValue(severity = 'error') {
|
|
8
|
+
return (token, path) => {
|
|
9
|
+
if (!('value' in token || '$value' in token)) {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
message: 'Token is missing required "value" property.',
|
|
13
|
+
severity,
|
|
14
|
+
path
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
return [];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=requireValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireValue.js","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/requireValue.ts"],"names":[],"mappings":";;AAKA,4CAeC;AAlBD;;GAEG;AACH,SAAgB,gBAAgB,CAC5B,WAAyB,OAAO;IAEhC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACnB,IAAI,CAAC,CAAC,OAAO,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,CAAC,EAAE,CAAC;YAC3C,OAAO;gBACH;oBACI,OAAO,EAAE,6CAA6C;oBACtD,QAAQ;oBACR,IAAI;iBACP;aACJ,CAAC;QACN,CAAC;QACD,OAAO,EAAE,CAAC;IACd,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { LintRule, LintSeverity } from '../engine/types';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the valid type rule.
|
|
4
|
+
*/
|
|
5
|
+
export interface ValidTypeRuleOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Allowed token type values (e.g. ["color", "borderRadius", "spacing"]).
|
|
8
|
+
*/
|
|
9
|
+
readonly allowedTypes: ReadonlyArray<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Severity when an invalid type is detected.
|
|
12
|
+
* Defaults to "error".
|
|
13
|
+
*/
|
|
14
|
+
readonly severity?: LintSeverity;
|
|
15
|
+
/**
|
|
16
|
+
* If true, missing "type" properties are reported as issues.
|
|
17
|
+
* Defaults to false (missing type is ignored).
|
|
18
|
+
*/
|
|
19
|
+
readonly requireType?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Rule: token.type must exist (optional) and must be part of a known set.
|
|
23
|
+
*/
|
|
24
|
+
export declare function ruleValidType(options: ValidTypeRuleOptions): LintRule;
|
|
25
|
+
//# sourceMappingURL=validType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validType.d.ts","sourceRoot":"","sources":["../../../../src/preprocessors/lint/rules/validType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,oBAAoB;IAEjC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAE7C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;GAEG;AACH,wBAAgB,aAAa,CACzB,OAAO,EAAE,oBAAoB,GAC9B,QAAQ,CA8CV"}
|