@atlaskit/eslint-plugin-design-system 8.33.0 → 8.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +1 -0
- package/constellation/ensure-design-token-usage/usage.mdx +2 -2
- package/constellation/index/usage.mdx +1 -0
- package/constellation/use-primitives-text/usage.mdx +13 -3
- package/constellation/use-tokens-typography/usage.mdx +42 -0
- package/dist/cjs/ast-nodes/index.js +7 -0
- package/dist/cjs/ast-nodes/object-entry.js +27 -0
- package/dist/cjs/ast-nodes/object.js +1 -1
- package/dist/cjs/presets/all.codegen.js +2 -1
- package/dist/cjs/rules/ensure-design-token-usage/index.js +5 -4
- package/dist/cjs/rules/ensure-design-token-usage/rule-meta.js +1 -1
- package/dist/cjs/rules/ensure-design-token-usage/spacing.js +5 -1
- package/dist/cjs/rules/ensure-design-token-usage/utils.js +52 -42
- package/dist/cjs/rules/index.codegen.js +3 -1
- package/dist/cjs/rules/use-primitives/transformers/compiled-styled/find-valid-jsx-usage-to-transform.js +24 -1
- package/dist/cjs/rules/use-primitives/transformers/compiled-styled/index.js +2 -1
- package/dist/cjs/rules/use-primitives-text/config/index.js +2 -1
- package/dist/cjs/rules/use-primitives-text/transformers/common.js +10 -1
- package/dist/cjs/rules/use-primitives-text/transformers/emphasis-elements.js +6 -3
- package/dist/cjs/rules/use-primitives-text/transformers/paragraph-elements.js +19 -4
- package/dist/cjs/rules/use-primitives-text/transformers/span-elements.js +6 -4
- package/dist/cjs/rules/use-primitives-text/transformers/strong-elements.js +6 -3
- package/dist/cjs/rules/use-tokens-typography/config/index.js +26 -0
- package/dist/cjs/rules/use-tokens-typography/error-boundary.js +24 -0
- package/dist/cjs/rules/use-tokens-typography/index.js +44 -0
- package/dist/cjs/rules/use-tokens-typography/transformers/style-object.js +212 -0
- package/dist/cjs/rules/use-tokens-typography/utils.js +146 -0
- package/dist/es2019/ast-nodes/index.js +1 -0
- package/dist/es2019/ast-nodes/object-entry.js +22 -0
- package/dist/es2019/ast-nodes/object.js +1 -1
- package/dist/es2019/presets/all.codegen.js +2 -1
- package/dist/es2019/rules/ensure-design-token-usage/index.js +6 -5
- package/dist/es2019/rules/ensure-design-token-usage/rule-meta.js +1 -1
- package/dist/es2019/rules/ensure-design-token-usage/spacing.js +5 -1
- package/dist/es2019/rules/ensure-design-token-usage/utils.js +42 -38
- package/dist/es2019/rules/index.codegen.js +3 -1
- package/dist/es2019/rules/use-primitives/transformers/compiled-styled/find-valid-jsx-usage-to-transform.js +17 -3
- package/dist/es2019/rules/use-primitives/transformers/compiled-styled/index.js +2 -1
- package/dist/es2019/rules/use-primitives-text/config/index.js +2 -1
- package/dist/es2019/rules/use-primitives-text/transformers/common.js +9 -2
- package/dist/es2019/rules/use-primitives-text/transformers/emphasis-elements.js +7 -4
- package/dist/es2019/rules/use-primitives-text/transformers/paragraph-elements.js +20 -5
- package/dist/es2019/rules/use-primitives-text/transformers/span-elements.js +7 -5
- package/dist/es2019/rules/use-primitives-text/transformers/strong-elements.js +7 -4
- package/dist/es2019/rules/use-tokens-typography/config/index.js +20 -0
- package/dist/es2019/rules/use-tokens-typography/error-boundary.js +19 -0
- package/dist/es2019/rules/use-tokens-typography/index.js +36 -0
- package/dist/es2019/rules/use-tokens-typography/transformers/style-object.js +209 -0
- package/dist/es2019/rules/use-tokens-typography/utils.js +99 -0
- package/dist/esm/ast-nodes/index.js +1 -0
- package/dist/esm/ast-nodes/object-entry.js +22 -0
- package/dist/esm/ast-nodes/object.js +1 -1
- package/dist/esm/presets/all.codegen.js +2 -1
- package/dist/esm/rules/ensure-design-token-usage/index.js +6 -5
- package/dist/esm/rules/ensure-design-token-usage/rule-meta.js +1 -1
- package/dist/esm/rules/ensure-design-token-usage/spacing.js +5 -1
- package/dist/esm/rules/ensure-design-token-usage/utils.js +46 -38
- package/dist/esm/rules/index.codegen.js +3 -1
- package/dist/esm/rules/use-primitives/transformers/compiled-styled/find-valid-jsx-usage-to-transform.js +23 -2
- package/dist/esm/rules/use-primitives/transformers/compiled-styled/index.js +2 -1
- package/dist/esm/rules/use-primitives-text/config/index.js +2 -1
- package/dist/esm/rules/use-primitives-text/transformers/common.js +9 -2
- package/dist/esm/rules/use-primitives-text/transformers/emphasis-elements.js +7 -4
- package/dist/esm/rules/use-primitives-text/transformers/paragraph-elements.js +20 -5
- package/dist/esm/rules/use-primitives-text/transformers/span-elements.js +7 -5
- package/dist/esm/rules/use-primitives-text/transformers/strong-elements.js +7 -4
- package/dist/esm/rules/use-tokens-typography/config/index.js +20 -0
- package/dist/esm/rules/use-tokens-typography/error-boundary.js +18 -0
- package/dist/esm/rules/use-tokens-typography/index.js +38 -0
- package/dist/esm/rules/use-tokens-typography/transformers/style-object.js +206 -0
- package/dist/esm/rules/use-tokens-typography/utils.js +129 -0
- package/dist/types/ast-nodes/index.d.ts +1 -0
- package/dist/types/ast-nodes/object-entry.d.ts +6 -0
- package/dist/types/ast-nodes/object.d.ts +1 -1
- package/dist/types/index.codegen.d.ts +1 -0
- package/dist/types/presets/all.codegen.d.ts +2 -1
- package/dist/types/rules/ensure-design-token-usage/types.d.ts +1 -1
- package/dist/types/rules/ensure-design-token-usage/utils.d.ts +22 -22
- package/dist/types/rules/index.codegen.d.ts +1 -0
- package/dist/types/rules/use-primitives/config/index.d.ts +1 -1
- package/dist/types/rules/use-primitives/transformers/compiled-styled/find-valid-jsx-usage-to-transform.d.ts +3 -1
- package/dist/types/rules/use-primitives/transformers/compiled-styled/index.d.ts +1 -1
- package/dist/types/rules/use-primitives/transformers/emotion-css/index.d.ts +1 -2
- package/dist/types/rules/use-primitives-text/config/index.d.ts +1 -0
- package/dist/types/rules/use-primitives-text/transformers/common.d.ts +6 -0
- package/dist/types/rules/use-primitives-text/transformers/emphasis-elements.d.ts +2 -10
- package/dist/types/rules/use-primitives-text/transformers/paragraph-elements.d.ts +4 -12
- package/dist/types/rules/use-primitives-text/transformers/span-elements.d.ts +2 -10
- package/dist/types/rules/use-primitives-text/transformers/strong-elements.d.ts +2 -10
- package/dist/types/rules/use-tokens-typography/config/index.d.ts +6 -0
- package/dist/types/rules/use-tokens-typography/error-boundary.d.ts +11 -0
- package/dist/types/rules/use-tokens-typography/index.d.ts +3 -0
- package/dist/types/rules/use-tokens-typography/transformers/style-object.d.ts +31 -0
- package/dist/types/rules/use-tokens-typography/utils.d.ts +194 -0
- package/dist/types-ts4.5/ast-nodes/index.d.ts +1 -0
- package/dist/types-ts4.5/ast-nodes/object-entry.d.ts +6 -0
- package/dist/types-ts4.5/ast-nodes/object.d.ts +1 -1
- package/dist/types-ts4.5/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
- package/dist/types-ts4.5/rules/ensure-design-token-usage/types.d.ts +1 -1
- package/dist/types-ts4.5/rules/ensure-design-token-usage/utils.d.ts +22 -22
- package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-primitives/config/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-primitives/transformers/compiled-styled/find-valid-jsx-usage-to-transform.d.ts +3 -1
- package/dist/types-ts4.5/rules/use-primitives/transformers/compiled-styled/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-primitives/transformers/emotion-css/index.d.ts +1 -2
- package/dist/types-ts4.5/rules/use-primitives-text/config/index.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/common.d.ts +6 -0
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/emphasis-elements.d.ts +2 -10
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/paragraph-elements.d.ts +4 -12
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/span-elements.d.ts +2 -10
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/strong-elements.d.ts +2 -10
- package/dist/types-ts4.5/rules/use-tokens-typography/config/index.d.ts +6 -0
- package/dist/types-ts4.5/rules/use-tokens-typography/error-boundary.d.ts +11 -0
- package/dist/types-ts4.5/rules/use-tokens-typography/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/use-tokens-typography/transformers/style-object.d.ts +31 -0
- package/dist/types-ts4.5/rules/use-tokens-typography/utils.d.ts +194 -0
- package/package.json +1 -1
- package/dist/cjs/rules/ensure-design-token-usage/typography.js +0 -39
- package/dist/es2019/rules/ensure-design-token-usage/typography.js +0 -19
- package/dist/esm/rules/ensure-design-token-usage/typography.js +0 -33
- package/dist/types/rules/ensure-design-token-usage/typography.d.ts +0 -9
- package/dist/types-ts4.5/rules/ensure-design-token-usage/typography.d.ts +0 -9
|
@@ -6,7 +6,6 @@ import { spacing as spacingScale } from '@atlaskit/tokens/tokens-raw';
|
|
|
6
6
|
import { findIdentifierInParentScope } from '../utils/find-in-parent';
|
|
7
7
|
import { isColorCssPropertyName, isCurrentSurfaceCustomPropertyName } from '../utils/is-color';
|
|
8
8
|
import { borderWidthValueToToken, isBorderRadius, isBorderSizeProperty, isShapeProperty, radiusValueToToken } from './shape';
|
|
9
|
-
import { isCodeFontFamily, isFontFamily, isFontSize, isFontSizeSmall, isTypographyProperty, typographyValueToToken } from './typography';
|
|
10
9
|
var properties = ['padding', 'paddingBlock', 'paddingInline', 'paddingLeft', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd', 'marginLeft', 'marginTop', 'marginRight', 'marginBottom', 'marginInline', 'marginInlineStart', 'marginInlineEnd', 'marginBlock', 'marginBlockStart', 'marginBlockEnd', 'margin', 'gap', 'rowGap', 'gridRowGap', 'columnGap', 'gridColumnGap', 'top', 'left', 'right', 'bottom', 'inlineStart', 'inlineEnd', 'blockStart', 'blockEnd', 'outline-offset'];
|
|
11
10
|
var spacingValueToToken = Object.fromEntries(spacingScale.map(function (token) {
|
|
12
11
|
return [token.value, token.cleanName];
|
|
@@ -34,8 +33,10 @@ export var splitShorthandValues = function splitShorthandValues(str) {
|
|
|
34
33
|
};
|
|
35
34
|
export var getValueFromShorthand = function getValueFromShorthand(str) {
|
|
36
35
|
var valueString = String(str);
|
|
37
|
-
var fontFamily = /(sans-serif$)|(monospace$)/;
|
|
38
|
-
|
|
36
|
+
var fontFamily = /(Charlie)|(sans-serif$)|(monospace$)/;
|
|
37
|
+
var fontWeightString = /(regular$)|(medium$)|(semibold$)|(bold$)/;
|
|
38
|
+
var fontStyleString = /(inherit$)|(normal$)|(italic$)/;
|
|
39
|
+
if (fontFamily.test(valueString) || fontWeightString.test(valueString) || fontStyleString.test(valueString)) {
|
|
39
40
|
return [valueString];
|
|
40
41
|
}
|
|
41
42
|
// If we want to filter out NaN just add .filter(Boolean)
|
|
@@ -64,6 +65,12 @@ var getRawExpressionForToken = function getRawExpressionForToken(node, context)
|
|
|
64
65
|
}).join(', '), ")}");
|
|
65
66
|
return call;
|
|
66
67
|
};
|
|
68
|
+
var isFontSize = function isFontSize(node) {
|
|
69
|
+
return isNodeOfType(node, 'CallExpression') && isNodeOfType(node.callee, 'Identifier') && (node.callee.name === 'fontSize' || node.callee.name === 'getFontSize');
|
|
70
|
+
};
|
|
71
|
+
var isFontSizeSmall = function isFontSizeSmall(node) {
|
|
72
|
+
return isNodeOfType(node, 'CallExpression') && isNodeOfType(node.callee, 'Identifier') && node.callee.name === 'fontSizeSmall';
|
|
73
|
+
};
|
|
67
74
|
var getValueFromCallExpression = function getValueFromCallExpression(node, context) {
|
|
68
75
|
if (!isNodeOfType(node, 'CallExpression')) {
|
|
69
76
|
return null;
|
|
@@ -80,12 +87,6 @@ var getValueFromCallExpression = function getValueFromCallExpression(node, conte
|
|
|
80
87
|
if (isFontSizeSmall(node)) {
|
|
81
88
|
return 11;
|
|
82
89
|
}
|
|
83
|
-
if (isFontFamily(node)) {
|
|
84
|
-
return "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif";
|
|
85
|
-
}
|
|
86
|
-
if (isCodeFontFamily(node)) {
|
|
87
|
-
return "'SFMono-Medium', 'SF Mono', 'Segoe UI Mono', 'Roboto Mono', 'Ubuntu Mono', Menlo, Consolas, Courier, monospace";
|
|
88
|
-
}
|
|
89
90
|
if (isToken(node)) {
|
|
90
91
|
return getRawExpressionForToken(node, context);
|
|
91
92
|
}
|
|
@@ -290,7 +291,7 @@ export var convertHyphenatedNameToCamelCase = function convertHyphenatedNameToCa
|
|
|
290
291
|
|
|
291
292
|
/**
|
|
292
293
|
* @param node
|
|
293
|
-
* @returns The furthest parent node that is on the same line as the input node
|
|
294
|
+
* @returns The furthest parent node that is on the same line as the input node.
|
|
294
295
|
*/
|
|
295
296
|
export var findParentNodeForLine = function findParentNodeForLine(node) {
|
|
296
297
|
var _node$loc, _node$parent$loc;
|
|
@@ -305,14 +306,13 @@ export var findParentNodeForLine = function findParentNodeForLine(node) {
|
|
|
305
306
|
};
|
|
306
307
|
|
|
307
308
|
/**
|
|
308
|
-
* Returns an array of domains that are relevant to the provided property based on the rule options
|
|
309
|
+
* Returns an array of domains that are relevant to the provided property based on the rule options.
|
|
309
310
|
* @param propertyName camelCase CSS property
|
|
310
|
-
* @param targetOptions Array containing the types of properties that should be included in the rule
|
|
311
|
+
* @param targetOptions Array containing the types of properties that should be included in the rule.
|
|
311
312
|
* @example
|
|
312
313
|
* ```
|
|
313
314
|
* propertyName: padding, targetOptions: ['spacing'] -> returns ['spacing']
|
|
314
|
-
* propertyName:
|
|
315
|
-
* propertyName: backgroundColor, targetOptions: ['spacing', 'typography'] -> returns []
|
|
315
|
+
* propertyName: backgroundColor, targetOptions: ['spacing'] -> returns []
|
|
316
316
|
* propertyName: backgroundColor, targetOptions: ['color', 'spacing'] -> returns ['color']
|
|
317
317
|
* ```
|
|
318
318
|
*/
|
|
@@ -327,15 +327,12 @@ export function getDomainsForProperty(propertyName, targetOptions) {
|
|
|
327
327
|
if (isShapeProperty(propertyName) && targetOptions.includes('shape')) {
|
|
328
328
|
domains.push('shape');
|
|
329
329
|
}
|
|
330
|
-
if (isTypographyProperty(propertyName) && targetOptions.includes('typography')) {
|
|
331
|
-
domains.push('typography');
|
|
332
|
-
}
|
|
333
330
|
return domains;
|
|
334
331
|
}
|
|
335
332
|
|
|
336
333
|
/**
|
|
337
334
|
* Function that removes JS comments from a string of code,
|
|
338
|
-
* sometimes makers will have single or multiline comments in their tagged template literals styles, this can mess with our parsing logic
|
|
335
|
+
* sometimes makers will have single or multiline comments in their tagged template literals styles, this can mess with our parsing logic.
|
|
339
336
|
*/
|
|
340
337
|
export function cleanComments(str) {
|
|
341
338
|
return str.replace(/\/\*([\s\S]*?)\*\//g, '').replace(/\/\/(.*)/g, '');
|
|
@@ -343,11 +340,11 @@ export function cleanComments(str) {
|
|
|
343
340
|
|
|
344
341
|
/**
|
|
345
342
|
* Returns an array of tuples representing a processed css within `TaggedTemplateExpression` node.
|
|
346
|
-
*
|
|
343
|
+
* Each element of the array is a tuple `[string, string]`,
|
|
347
344
|
* where the first element is the processed css line with computed values
|
|
348
|
-
* and the second element of the tuple is the original css line from source
|
|
349
|
-
* @param node TaggedTemplateExpression node
|
|
350
|
-
* @param context Rule.RuleContext
|
|
345
|
+
* and the second element of the tuple is the original css line from source.
|
|
346
|
+
* @param node TaggedTemplateExpression node.
|
|
347
|
+
* @param context Rule.RuleContext.
|
|
351
348
|
* @example
|
|
352
349
|
* ```
|
|
353
350
|
* `[['padding: 8', 'padding: ${gridSize()}'], ['margin: 6', 'margin: 6px' ]]`
|
|
@@ -422,7 +419,7 @@ export function getFontSizeValueInScope(cssProperties) {
|
|
|
422
419
|
|
|
423
420
|
/**
|
|
424
421
|
* Attempts to remove all non-essential words & characters from a style block.
|
|
425
|
-
* Including selectors and queries
|
|
422
|
+
* Including selectors and queries.
|
|
426
423
|
* @param styleString string of css properties
|
|
427
424
|
*/
|
|
428
425
|
export function splitCssProperties(styleString) {
|
|
@@ -447,8 +444,8 @@ export function splitCssProperties(styleString) {
|
|
|
447
444
|
}
|
|
448
445
|
|
|
449
446
|
/**
|
|
450
|
-
*
|
|
451
|
-
* @param originalVaue string representing a css property value e.g 1em, 12px
|
|
447
|
+
* Returns whether the current string is a token value.
|
|
448
|
+
* @param originalVaue string representing a css property value e.g 1em, 12px.
|
|
452
449
|
*/
|
|
453
450
|
export function isTokenValueString(originalValue) {
|
|
454
451
|
return originalValue.startsWith('${token(') && originalValue.endsWith('}');
|
|
@@ -462,19 +459,27 @@ export function includesTokenString(originalValue) {
|
|
|
462
459
|
*
|
|
463
460
|
* -> for pixels this '8px'
|
|
464
461
|
* -> for weights '400'
|
|
465
|
-
* -> for family 'Arial'
|
|
462
|
+
* -> for family 'Arial'.
|
|
466
463
|
*
|
|
467
464
|
* @internal
|
|
468
465
|
*/
|
|
469
466
|
export function normaliseValue(propertyName, value) {
|
|
470
|
-
var
|
|
467
|
+
var isFontStringProperty = /fontWeight|fontFamily|fontStyle/.test(propertyName);
|
|
468
|
+
var isLineHeight = /lineHeight/.test(propertyName);
|
|
471
469
|
var propertyValue = typeof value === 'string' ? value.trim() : value;
|
|
472
|
-
var lookupValue
|
|
470
|
+
var lookupValue;
|
|
471
|
+
if (isFontStringProperty) {
|
|
472
|
+
lookupValue = "".concat(propertyValue);
|
|
473
|
+
} else if (isLineHeight) {
|
|
474
|
+
lookupValue = value === 1 ? "".concat(propertyValue) : "".concat(propertyValue, "px");
|
|
475
|
+
} else {
|
|
476
|
+
lookupValue = typeof propertyValue === 'string' ? propertyValue : "".concat(propertyValue, "px");
|
|
477
|
+
}
|
|
473
478
|
return lookupValue;
|
|
474
479
|
}
|
|
475
480
|
export function findTokenNameByPropertyValue(propertyName, value) {
|
|
476
481
|
var lookupValue = normaliseValue(propertyName, value);
|
|
477
|
-
var tokenName = isShapeProperty(propertyName) ? isBorderSizeProperty(propertyName) ? borderWidthValueToToken[lookupValue] : radiusValueToToken[lookupValue] :
|
|
482
|
+
var tokenName = isShapeProperty(propertyName) ? isBorderSizeProperty(propertyName) ? borderWidthValueToToken[lookupValue] : radiusValueToToken[lookupValue] : spacingValueToToken[lookupValue];
|
|
478
483
|
if (!tokenName) {
|
|
479
484
|
return undefined;
|
|
480
485
|
}
|
|
@@ -483,9 +488,9 @@ export function findTokenNameByPropertyValue(propertyName, value) {
|
|
|
483
488
|
|
|
484
489
|
/**
|
|
485
490
|
* Returns a stringifiable node with the token expression corresponding to its matching token.
|
|
486
|
-
*
|
|
487
|
-
* @param propertyName string camelCased css property
|
|
488
|
-
* @param value
|
|
491
|
+
* If no token found for the pair the function returns undefined.
|
|
492
|
+
* @param propertyName string camelCased css property.
|
|
493
|
+
* @param value The computed value e.g '8px' -> '8'.
|
|
489
494
|
*/
|
|
490
495
|
export function getTokenReplacement(propertyName, value) {
|
|
491
496
|
var tokenName = findTokenNameByPropertyValue(propertyName, value);
|
|
@@ -495,17 +500,20 @@ export function getTokenReplacement(propertyName, value) {
|
|
|
495
500
|
var fallbackValue = normaliseValue(propertyName, value);
|
|
496
501
|
return getTokenNodeForValue(propertyName, fallbackValue);
|
|
497
502
|
}
|
|
498
|
-
export function
|
|
499
|
-
var
|
|
503
|
+
export function getPropertyNodeFromParent(property, parentNode) {
|
|
504
|
+
var propertyNode = parentNode.properties.find(function (node) {
|
|
500
505
|
if (!isNodeOfType(node, 'Property')) {
|
|
501
506
|
return;
|
|
502
507
|
}
|
|
503
508
|
if (!isNodeOfType(node.key, 'Identifier')) {
|
|
504
509
|
return;
|
|
505
510
|
}
|
|
506
|
-
return node.key.name ===
|
|
511
|
+
return node.key.name === property;
|
|
507
512
|
});
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
513
|
+
return propertyNode;
|
|
514
|
+
}
|
|
515
|
+
export function getValueForPropertyNode(propertyNode, context) {
|
|
516
|
+
var propertyValueRaw = isNodeOfType(propertyNode, 'Property') ? getValue(propertyNode.value, context) : null;
|
|
517
|
+
var propertyValue = Array.isArray(propertyValueRaw) ? propertyValueRaw[0] : propertyValueRaw;
|
|
518
|
+
return propertyValue;
|
|
511
519
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::c283cd7ede5e813a9119cd707d339273>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import consistentCssPropUsage from './consistent-css-prop-usage';
|
|
@@ -32,6 +32,7 @@ import useHeadingLevelInSpotlightCard from './use-heading-level-in-spotlight-car
|
|
|
32
32
|
import useHrefInLinkItem from './use-href-in-link-item';
|
|
33
33
|
import usePrimitives from './use-primitives';
|
|
34
34
|
import usePrimitivesText from './use-primitives-text';
|
|
35
|
+
import useTokensTypography from './use-tokens-typography';
|
|
35
36
|
import useVisuallyHidden from './use-visually-hidden';
|
|
36
37
|
export default {
|
|
37
38
|
'consistent-css-prop-usage': consistentCssPropUsage,
|
|
@@ -63,5 +64,6 @@ export default {
|
|
|
63
64
|
'use-href-in-link-item': useHrefInLinkItem,
|
|
64
65
|
'use-primitives': usePrimitives,
|
|
65
66
|
'use-primitives-text': usePrimitivesText,
|
|
67
|
+
'use-tokens-typography': useTokensTypography,
|
|
66
68
|
'use-visually-hidden': useVisuallyHidden
|
|
67
69
|
};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
-
|
|
3
|
+
var JSX_IDENTIFIER = 'JSXIdentifier';
|
|
3
4
|
/**
|
|
4
5
|
* Given a component name finds its JSX usages and performs some
|
|
5
6
|
* additional validations to ensure transformation can be done correctly
|
|
7
|
+
*
|
|
8
|
+
* anyOrder: if true, the order of the references doesn't matter (JSX or style declaration)
|
|
6
9
|
*/
|
|
7
10
|
export var findValidJsxUsageToTransform = function findValidJsxUsageToTransform(componentName, scope) {
|
|
11
|
+
var _variableDeclaration$;
|
|
12
|
+
var anyOrder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
8
13
|
var variableDeclaration = scope.variables.find(function (v) {
|
|
9
14
|
return v.name === componentName;
|
|
10
15
|
});
|
|
@@ -20,7 +25,23 @@ export var findValidJsxUsageToTransform = function findValidJsxUsageToTransform(
|
|
|
20
25
|
if (variableDeclaration.references.length !== 2) {
|
|
21
26
|
return;
|
|
22
27
|
}
|
|
23
|
-
var jsxUsage = variableDeclaration.references[1]
|
|
28
|
+
var jsxUsage = (_variableDeclaration$ = variableDeclaration.references[1]) === null || _variableDeclaration$ === void 0 ? void 0 : _variableDeclaration$.identifier;
|
|
29
|
+
if (anyOrder) {
|
|
30
|
+
var _variableDeclaration$2 = variableDeclaration.references.map(function (ref) {
|
|
31
|
+
return ref === null || ref === void 0 ? void 0 : ref.identifier;
|
|
32
|
+
}),
|
|
33
|
+
_variableDeclaration$3 = _slicedToArray(_variableDeclaration$2, 2),
|
|
34
|
+
firstIdentifier = _variableDeclaration$3[0],
|
|
35
|
+
secondIdentifier = _variableDeclaration$3[1];
|
|
36
|
+
// Check if the first reference is a JSXOpeningElement and the second is not or vice versa
|
|
37
|
+
if (isNodeOfType(firstIdentifier, JSX_IDENTIFIER) && !isNodeOfType(secondIdentifier, JSX_IDENTIFIER)) {
|
|
38
|
+
jsxUsage = firstIdentifier;
|
|
39
|
+
} else if (isNodeOfType(secondIdentifier, JSX_IDENTIFIER) && !isNodeOfType(firstIdentifier, JSX_IDENTIFIER)) {
|
|
40
|
+
jsxUsage = secondIdentifier;
|
|
41
|
+
} else {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
24
45
|
if (!isNodeOfType(jsxUsage, 'JSXIdentifier')) {
|
|
25
46
|
return;
|
|
26
47
|
}
|
|
@@ -55,7 +55,8 @@ export var CompiledStyled = {
|
|
|
55
55
|
success: false
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
var
|
|
58
|
+
var anyOrder = config.patterns.includes('jsx-order-fix');
|
|
59
|
+
var styledComponentJsxRef = findValidJsxUsageToTransform(styledComponentVariableRef.id.name, context.getScope(), anyOrder);
|
|
59
60
|
if (!styledComponentJsxRef) {
|
|
60
61
|
return {
|
|
61
62
|
success: false
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
var defaults = {
|
|
2
|
-
patterns: ['paragraph-elements', 'span-elements', 'strong-elements', 'emphasis-elements']
|
|
2
|
+
patterns: ['paragraph-elements', 'span-elements', 'strong-elements', 'emphasis-elements'],
|
|
3
|
+
inheritColor: false
|
|
3
4
|
};
|
|
4
5
|
export var getConfig = function getConfig(overrides) {
|
|
5
6
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
2
|
import * as ast from '../../../ast-nodes';
|
|
3
|
-
|
|
4
3
|
// Rename data-testid prop to testId if present
|
|
5
4
|
export function updateTestIdAttributeFix(node, fixer) {
|
|
6
5
|
var testIdAttr = ast.JSXElement.getAttributeByName(node, 'data-testid');
|
|
@@ -8,10 +7,18 @@ export function updateTestIdAttributeFix(node, fixer) {
|
|
|
8
7
|
return ast.JSXAttribute.updateName(testIdAttr, 'testId', fixer);
|
|
9
8
|
}
|
|
10
9
|
}
|
|
10
|
+
|
|
11
|
+
// Add color="inherit" prop depending on config
|
|
12
|
+
export function addColorInheritAttributeFix(node, config, fixer) {
|
|
13
|
+
if (!config.inheritColor) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
return ast.JSXElement.addAttribute(node, 'color', 'inherit', fixer);
|
|
17
|
+
}
|
|
11
18
|
export var allowedAttrs = ['id', 'data-testid', 'key'];
|
|
12
19
|
|
|
13
20
|
// Only allow elements with strings as children
|
|
14
|
-
// The use of
|
|
21
|
+
// The use of `<FormattedMessage ... />` component and `{formatMessage(...)}` are allowed as these are used for i18n
|
|
15
22
|
export function hasTextChildrenOnly(node) {
|
|
16
23
|
var _node$children;
|
|
17
24
|
return (_node$children = node.children) === null || _node$children === void 0 ? void 0 : _node$children.every(function (child) {
|
|
@@ -4,7 +4,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
4
4
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
5
5
|
import * as ast from '../../../ast-nodes';
|
|
6
6
|
import { upsertImportDeclaration } from '../../use-primitives/transformers/emotion-css/upsert-import-declaration';
|
|
7
|
-
import { allowedAttrs, updateTestIdAttributeFix } from './common';
|
|
7
|
+
import { addColorInheritAttributeFix, allowedAttrs, updateTestIdAttributeFix } from './common';
|
|
8
8
|
export var EmphasisElements = {
|
|
9
9
|
lint: function lint(node, _ref) {
|
|
10
10
|
var context = _ref.context,
|
|
@@ -26,7 +26,8 @@ export var EmphasisElements = {
|
|
|
26
26
|
suggest: [{
|
|
27
27
|
desc: "Convert to Text",
|
|
28
28
|
fix: EmphasisElements._fix(node, {
|
|
29
|
-
context: context
|
|
29
|
+
context: context,
|
|
30
|
+
config: config
|
|
30
31
|
})
|
|
31
32
|
}]
|
|
32
33
|
});
|
|
@@ -55,7 +56,8 @@ export var EmphasisElements = {
|
|
|
55
56
|
return true;
|
|
56
57
|
},
|
|
57
58
|
_fix: function _fix(node, _ref3) {
|
|
58
|
-
var context = _ref3.context
|
|
59
|
+
var context = _ref3.context,
|
|
60
|
+
config = _ref3.config;
|
|
59
61
|
return function (fixer) {
|
|
60
62
|
var importFix = upsertImportDeclaration({
|
|
61
63
|
module: '@atlaskit/primitives',
|
|
@@ -63,8 +65,9 @@ export var EmphasisElements = {
|
|
|
63
65
|
}, context, fixer);
|
|
64
66
|
var elementNameFixes = ast.JSXElement.updateName(node, 'Text', fixer);
|
|
65
67
|
var asAttributeFix = ast.JSXElement.addAttribute(node, 'as', 'em', fixer);
|
|
68
|
+
var colorAttributeFix = addColorInheritAttributeFix(node, config, fixer);
|
|
66
69
|
var testAttributeFix = updateTestIdAttributeFix(node, fixer);
|
|
67
|
-
return [importFix].concat(_toConsumableArray(elementNameFixes), [asAttributeFix, testAttributeFix]).filter(function (fix) {
|
|
70
|
+
return [importFix].concat(_toConsumableArray(elementNameFixes), [asAttributeFix, colorAttributeFix, testAttributeFix]).filter(function (fix) {
|
|
68
71
|
return Boolean(fix);
|
|
69
72
|
}); // Some of the transformers can return arrays with undefined, so filter them out
|
|
70
73
|
};
|
|
@@ -4,7 +4,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
4
4
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
5
5
|
import * as ast from '../../../ast-nodes';
|
|
6
6
|
import { upsertImportDeclaration } from '../../use-primitives/transformers/emotion-css/upsert-import-declaration';
|
|
7
|
-
import { allowedAttrs, updateTestIdAttributeFix } from './common';
|
|
7
|
+
import { addColorInheritAttributeFix, allowedAttrs, updateTestIdAttributeFix } from './common';
|
|
8
8
|
export var ParagraphElements = {
|
|
9
9
|
lint: function lint(node, _ref) {
|
|
10
10
|
var context = _ref.context,
|
|
@@ -43,6 +43,7 @@ export var ParagraphElements = {
|
|
|
43
43
|
desc: 'Convert to Text and Stack',
|
|
44
44
|
fix: ParagraphElements._fixMultiple(node, {
|
|
45
45
|
context: context,
|
|
46
|
+
config: config,
|
|
46
47
|
refs: refs
|
|
47
48
|
})
|
|
48
49
|
}]
|
|
@@ -54,7 +55,8 @@ export var ParagraphElements = {
|
|
|
54
55
|
suggest: [{
|
|
55
56
|
desc: 'Convert to Text',
|
|
56
57
|
fix: ParagraphElements._fixSingle(node, {
|
|
57
|
-
context: context
|
|
58
|
+
context: context,
|
|
59
|
+
config: config
|
|
58
60
|
})
|
|
59
61
|
}]
|
|
60
62
|
});
|
|
@@ -120,6 +122,13 @@ export var ParagraphElements = {
|
|
|
120
122
|
}
|
|
121
123
|
};
|
|
122
124
|
}
|
|
125
|
+
} else if (!ast.JSXElement.hasAllowedAttrsOnly(node, allowedAttrs)) {
|
|
126
|
+
return {
|
|
127
|
+
success: false,
|
|
128
|
+
refs: {
|
|
129
|
+
siblings: siblings
|
|
130
|
+
}
|
|
131
|
+
};
|
|
123
132
|
}
|
|
124
133
|
var importDeclaration = ast.Root.findImportsByModule(context.getSourceCode().ast.body, '@atlaskit/primitives');
|
|
125
134
|
|
|
@@ -140,21 +149,25 @@ export var ParagraphElements = {
|
|
|
140
149
|
};
|
|
141
150
|
},
|
|
142
151
|
_fixSingle: function _fixSingle(node, _ref3) {
|
|
143
|
-
var context = _ref3.context
|
|
152
|
+
var context = _ref3.context,
|
|
153
|
+
config = _ref3.config;
|
|
144
154
|
return function (fixer) {
|
|
145
155
|
var importFix = upsertImportDeclaration({
|
|
146
156
|
module: '@atlaskit/primitives',
|
|
147
157
|
specifiers: ['Text']
|
|
148
158
|
}, context, fixer);
|
|
149
159
|
var elementNameFixes = ast.JSXElement.updateName(node, 'Text', fixer);
|
|
160
|
+
var asAttributeFix = ast.JSXElement.addAttribute(node, 'as', 'p', fixer);
|
|
161
|
+
var colorAttributeFix = addColorInheritAttributeFix(node, config, fixer);
|
|
150
162
|
var testAttributeFix = updateTestIdAttributeFix(node, fixer);
|
|
151
|
-
return [importFix].concat(_toConsumableArray(elementNameFixes), [testAttributeFix]).filter(function (fix) {
|
|
163
|
+
return [importFix].concat(_toConsumableArray(elementNameFixes), [asAttributeFix, colorAttributeFix, testAttributeFix]).filter(function (fix) {
|
|
152
164
|
return Boolean(fix);
|
|
153
165
|
}); // Some of the transformers can return arrays with undefined, so filter them out
|
|
154
166
|
};
|
|
155
167
|
},
|
|
156
168
|
_fixMultiple: function _fixMultiple(node, _ref4) {
|
|
157
169
|
var context = _ref4.context,
|
|
170
|
+
config = _ref4.config,
|
|
158
171
|
refs = _ref4.refs;
|
|
159
172
|
return function (fixer) {
|
|
160
173
|
if (!isNodeOfType(node.parent, 'JSXElement') || !node.parent.closingElement) {
|
|
@@ -169,8 +182,10 @@ export var ParagraphElements = {
|
|
|
169
182
|
var siblingFixes = refs.siblings.map(function (sibling) {
|
|
170
183
|
if (isNodeOfType(sibling, 'JSXElement')) {
|
|
171
184
|
var elementNameFixes = ast.JSXElement.updateName(sibling, 'Text', fixer);
|
|
185
|
+
var asAttributeFix = ast.JSXElement.addAttribute(sibling, 'as', 'p', fixer);
|
|
186
|
+
var colorAttributeFix = addColorInheritAttributeFix(sibling, config, fixer);
|
|
172
187
|
var testAttributeFix = updateTestIdAttributeFix(sibling, fixer);
|
|
173
|
-
return [].concat(_toConsumableArray(elementNameFixes), [testAttributeFix]);
|
|
188
|
+
return [].concat(_toConsumableArray(elementNameFixes), [asAttributeFix, colorAttributeFix, testAttributeFix]);
|
|
174
189
|
}
|
|
175
190
|
return undefined;
|
|
176
191
|
}).flat();
|
|
@@ -4,7 +4,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
4
4
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
5
5
|
import * as ast from '../../../ast-nodes';
|
|
6
6
|
import { upsertImportDeclaration } from '../../use-primitives/transformers/emotion-css/upsert-import-declaration';
|
|
7
|
-
import { allowedAttrs, hasTextChildrenOnly, updateTestIdAttributeFix } from './common';
|
|
7
|
+
import { addColorInheritAttributeFix, allowedAttrs, hasTextChildrenOnly, updateTestIdAttributeFix } from './common';
|
|
8
8
|
export var SpanElements = {
|
|
9
9
|
lint: function lint(node, _ref) {
|
|
10
10
|
var context = _ref.context,
|
|
@@ -26,7 +26,8 @@ export var SpanElements = {
|
|
|
26
26
|
suggest: [{
|
|
27
27
|
desc: "Convert to Text",
|
|
28
28
|
fix: SpanElements._fix(node, {
|
|
29
|
-
context: context
|
|
29
|
+
context: context,
|
|
30
|
+
config: config
|
|
30
31
|
})
|
|
31
32
|
}]
|
|
32
33
|
});
|
|
@@ -60,16 +61,17 @@ export var SpanElements = {
|
|
|
60
61
|
return true;
|
|
61
62
|
},
|
|
62
63
|
_fix: function _fix(node, _ref3) {
|
|
63
|
-
var context = _ref3.context
|
|
64
|
+
var context = _ref3.context,
|
|
65
|
+
config = _ref3.config;
|
|
64
66
|
return function (fixer) {
|
|
65
67
|
var importFix = upsertImportDeclaration({
|
|
66
68
|
module: '@atlaskit/primitives',
|
|
67
69
|
specifiers: ['Text']
|
|
68
70
|
}, context, fixer);
|
|
69
71
|
var elementNameFixes = ast.JSXElement.updateName(node, 'Text', fixer);
|
|
70
|
-
var
|
|
72
|
+
var colorAttributeFix = addColorInheritAttributeFix(node, config, fixer);
|
|
71
73
|
var testAttributeFix = updateTestIdAttributeFix(node, fixer);
|
|
72
|
-
return [importFix].concat(_toConsumableArray(elementNameFixes), [
|
|
74
|
+
return [importFix].concat(_toConsumableArray(elementNameFixes), [colorAttributeFix, testAttributeFix]).filter(function (fix) {
|
|
73
75
|
return Boolean(fix);
|
|
74
76
|
}); // Some of the transformers can return arrays with undefined, so filter them out
|
|
75
77
|
};
|
|
@@ -4,7 +4,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
4
4
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
5
5
|
import * as ast from '../../../ast-nodes';
|
|
6
6
|
import { upsertImportDeclaration } from '../../use-primitives/transformers/emotion-css/upsert-import-declaration';
|
|
7
|
-
import { allowedAttrs, updateTestIdAttributeFix } from './common';
|
|
7
|
+
import { addColorInheritAttributeFix, allowedAttrs, updateTestIdAttributeFix } from './common';
|
|
8
8
|
export var StrongElements = {
|
|
9
9
|
lint: function lint(node, _ref) {
|
|
10
10
|
var context = _ref.context,
|
|
@@ -26,7 +26,8 @@ export var StrongElements = {
|
|
|
26
26
|
suggest: [{
|
|
27
27
|
desc: "Convert to Text",
|
|
28
28
|
fix: StrongElements._fix(node, {
|
|
29
|
-
context: context
|
|
29
|
+
context: context,
|
|
30
|
+
config: config
|
|
30
31
|
})
|
|
31
32
|
}]
|
|
32
33
|
});
|
|
@@ -55,7 +56,8 @@ export var StrongElements = {
|
|
|
55
56
|
return true;
|
|
56
57
|
},
|
|
57
58
|
_fix: function _fix(node, _ref3) {
|
|
58
|
-
var context = _ref3.context
|
|
59
|
+
var context = _ref3.context,
|
|
60
|
+
config = _ref3.config;
|
|
59
61
|
return function (fixer) {
|
|
60
62
|
var importFix = upsertImportDeclaration({
|
|
61
63
|
module: '@atlaskit/primitives',
|
|
@@ -63,8 +65,9 @@ export var StrongElements = {
|
|
|
63
65
|
}, context, fixer);
|
|
64
66
|
var elementNameFixes = ast.JSXElement.updateName(node, 'Text', fixer);
|
|
65
67
|
var asAttributeFix = ast.JSXElement.addAttribute(node, 'as', 'strong', fixer);
|
|
68
|
+
var colorAttributeFix = addColorInheritAttributeFix(node, config, fixer);
|
|
66
69
|
var testAttributeFix = updateTestIdAttributeFix(node, fixer);
|
|
67
|
-
return [importFix].concat(_toConsumableArray(elementNameFixes), [asAttributeFix, testAttributeFix]).filter(function (fix) {
|
|
70
|
+
return [importFix].concat(_toConsumableArray(elementNameFixes), [asAttributeFix, colorAttributeFix, testAttributeFix]).filter(function (fix) {
|
|
68
71
|
return Boolean(fix);
|
|
69
72
|
}); // Some of the transformers can return arrays with undefined, so filter them out
|
|
70
73
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export var ruleSchema = {
|
|
2
|
+
type: 'array',
|
|
3
|
+
items: {
|
|
4
|
+
type: 'object',
|
|
5
|
+
properties: {
|
|
6
|
+
failSilently: {
|
|
7
|
+
type: 'boolean'
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
var defaultConfig = {
|
|
13
|
+
failSilently: false
|
|
14
|
+
};
|
|
15
|
+
export var getConfig = function getConfig(overrides) {
|
|
16
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
17
|
+
// start with an empty object, then merge in the defaults, then merge in overrides.
|
|
18
|
+
// The empty object is returned, as well as modified in place
|
|
19
|
+
return Object.assign({}, defaultConfig, overrides);
|
|
20
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint rules should NEVER throw exceptions, because that breaks the VSCode ESLint server
|
|
3
|
+
* (and probably the IntelliJ one too), which causes linting to fail in a file.
|
|
4
|
+
*
|
|
5
|
+
* It also breaks CI, which was the reason this error boundary was added. It's a final
|
|
6
|
+
* catch all.
|
|
7
|
+
*/
|
|
8
|
+
export var errorBoundary = function errorBoundary(func, _ref) {
|
|
9
|
+
var config = _ref.config;
|
|
10
|
+
try {
|
|
11
|
+
func();
|
|
12
|
+
} catch (err) {
|
|
13
|
+
if (!config.failSilently) {
|
|
14
|
+
// eslint-disable-next-line no-console
|
|
15
|
+
console.warn(err);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createLintRule } from '../utils/create-rule';
|
|
2
|
+
import { getConfig, ruleSchema } from './config';
|
|
3
|
+
import { errorBoundary } from './error-boundary';
|
|
4
|
+
import { StyleObject } from './transformers/style-object';
|
|
5
|
+
var create = function create(context) {
|
|
6
|
+
var config = getConfig(context.options[0]);
|
|
7
|
+
return {
|
|
8
|
+
// const styles = css({ fontSize: '14px, ... }), styled.div({ fontSize: 14, ... })
|
|
9
|
+
ObjectExpression: function ObjectExpression(node) {
|
|
10
|
+
return errorBoundary(function () {
|
|
11
|
+
return StyleObject.lint(node, {
|
|
12
|
+
context: context
|
|
13
|
+
});
|
|
14
|
+
}, {
|
|
15
|
+
config: config
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
var rule = createLintRule({
|
|
21
|
+
meta: {
|
|
22
|
+
name: 'use-tokens-typography',
|
|
23
|
+
type: 'problem',
|
|
24
|
+
fixable: 'code',
|
|
25
|
+
hasSuggestions: true,
|
|
26
|
+
docs: {
|
|
27
|
+
description: 'Enforces usage of design tokens for typography properties rather than hard-coded values.',
|
|
28
|
+
recommended: false,
|
|
29
|
+
severity: 'warn'
|
|
30
|
+
},
|
|
31
|
+
messages: {
|
|
32
|
+
noRawTypographyValues: 'Typography primitives or tokens should be used instead of hard-coded values.\n\n@meta <<{{payload}}>>.'
|
|
33
|
+
},
|
|
34
|
+
schema: ruleSchema
|
|
35
|
+
},
|
|
36
|
+
create: create
|
|
37
|
+
});
|
|
38
|
+
export default rule;
|