@atlaskit/eslint-plugin-design-system 10.17.3 → 10.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/rules/no-legacy-icons/checks.js +29 -137
  4. package/dist/cjs/rules/no-legacy-icons/helpers.js +247 -16
  5. package/dist/cjs/rules/no-legacy-icons/index.js +1 -0
  6. package/dist/cjs/rules/use-latest-xcss-syntax-typography/config/index.js +2 -1
  7. package/dist/cjs/rules/use-latest-xcss-syntax-typography/index.js +22 -5
  8. package/dist/cjs/rules/use-latest-xcss-syntax-typography/linters/common.js +5 -0
  9. package/dist/cjs/rules/use-latest-xcss-syntax-typography/linters/index.js +10 -3
  10. package/dist/cjs/rules/use-latest-xcss-syntax-typography/linters/{banned-property/index.js → restricted-property.js} +30 -10
  11. package/dist/cjs/rules/use-latest-xcss-syntax-typography/linters/wrapped-token-value.js +50 -0
  12. package/dist/es2019/rules/no-legacy-icons/checks.js +30 -108
  13. package/dist/es2019/rules/no-legacy-icons/helpers.js +200 -15
  14. package/dist/es2019/rules/no-legacy-icons/index.js +1 -0
  15. package/dist/es2019/rules/use-latest-xcss-syntax-typography/config/index.js +2 -1
  16. package/dist/es2019/rules/use-latest-xcss-syntax-typography/index.js +19 -6
  17. package/dist/es2019/rules/use-latest-xcss-syntax-typography/linters/common.js +1 -0
  18. package/dist/es2019/rules/use-latest-xcss-syntax-typography/linters/index.js +2 -1
  19. package/dist/es2019/rules/use-latest-xcss-syntax-typography/linters/restricted-property.js +61 -0
  20. package/dist/es2019/rules/use-latest-xcss-syntax-typography/linters/wrapped-token-value.js +44 -0
  21. package/dist/esm/rules/no-legacy-icons/checks.js +30 -137
  22. package/dist/esm/rules/no-legacy-icons/helpers.js +246 -15
  23. package/dist/esm/rules/no-legacy-icons/index.js +1 -0
  24. package/dist/esm/rules/use-latest-xcss-syntax-typography/config/index.js +2 -1
  25. package/dist/esm/rules/use-latest-xcss-syntax-typography/index.js +23 -6
  26. package/dist/esm/rules/use-latest-xcss-syntax-typography/linters/common.js +1 -0
  27. package/dist/esm/rules/use-latest-xcss-syntax-typography/linters/index.js +2 -1
  28. package/dist/esm/rules/use-latest-xcss-syntax-typography/linters/{banned-property/index.js → restricted-property.js} +29 -9
  29. package/dist/esm/rules/use-latest-xcss-syntax-typography/linters/wrapped-token-value.js +44 -0
  30. package/dist/types/rules/no-legacy-icons/helpers.d.ts +31 -60
  31. package/dist/types/rules/use-latest-xcss-syntax-typography/config/index.d.ts +3 -0
  32. package/dist/types/rules/use-latest-xcss-syntax-typography/linters/common.d.ts +6 -0
  33. package/dist/types/rules/use-latest-xcss-syntax-typography/linters/index.d.ts +2 -1
  34. package/dist/types/rules/use-latest-xcss-syntax-typography/linters/restricted-property.d.ts +6 -0
  35. package/dist/types/rules/use-latest-xcss-syntax-typography/linters/wrapped-token-value.d.ts +7 -0
  36. package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +31 -60
  37. package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/config/index.d.ts +3 -0
  38. package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/linters/common.d.ts +6 -0
  39. package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/linters/index.d.ts +2 -1
  40. package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/linters/restricted-property.d.ts +6 -0
  41. package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/linters/wrapped-token-value.d.ts +7 -0
  42. package/package.json +2 -6
  43. package/dist/es2019/rules/use-latest-xcss-syntax-typography/linters/banned-property/index.js +0 -40
  44. package/dist/types/rules/use-latest-xcss-syntax-typography/linters/banned-property/index.d.ts +0 -7
  45. package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/linters/banned-property/index.d.ts +0 -7
@@ -1 +1,2 @@
1
- export { BannedProperty } from './banned-property';
1
+ export { RestrictedProperty } from './restricted-property';
2
+ export { WrappedTokenValue } from './wrapped-token-value';
@@ -4,10 +4,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4
4
  /* eslint-disable @repo/internal/react/require-jsdoc */
5
5
 
6
6
  import { isNodeOfType } from 'eslint-codemod-utils';
7
- export var BannedProperty = {
7
+ export var RestrictedProperty = {
8
8
  lint: function lint(node, _ref) {
9
- var context = _ref.context;
10
- if (BannedProperty._check(node)) {
9
+ var context = _ref.context,
10
+ config = _ref.config;
11
+ if (RestrictedProperty._check(node, {
12
+ context: context,
13
+ config: config
14
+ })) {
11
15
  var property = 'fontSize, lineHeight, fontWeight or letterSpacing';
12
16
  if (isNodeOfType(node, 'Identifier')) {
13
17
  property = node.name;
@@ -16,14 +20,19 @@ export var BannedProperty = {
16
20
  }
17
21
  context.report({
18
22
  node: node,
19
- messageId: 'noUnsafeTypographyProperties',
23
+ messageId: property === 'fontWeight' ? 'noRestrictedTypographyPropertiesHeading' : 'noRestrictedTypographyProperties',
20
24
  data: {
21
25
  property: property
22
26
  }
23
27
  });
24
28
  }
25
29
  },
26
- _check: function _check(node) {
30
+ _check: function _check(node, _ref2) {
31
+ var config = _ref2.config;
32
+ if (!config.patterns.includes('restricted-property')) {
33
+ return false;
34
+ }
35
+
27
36
  // Prevent font weight being used in combination with heading tokens
28
37
  if (isNodeOfType(node, 'Identifier') && node.name === 'fontWeight' || isNodeOfType(node, 'Literal') && node.value === 'fontWeight') {
29
38
  if (isNodeOfType(node.parent.parent, 'ObjectExpression')) {
@@ -31,11 +40,22 @@ export var BannedProperty = {
31
40
  _step;
32
41
  try {
33
42
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
43
+ var _property$value$value;
34
44
  var property = _step.value;
35
- if (isNodeOfType(property, 'Property') && isNodeOfType(property.value, 'CallExpression') && isNodeOfType(property.value.callee, 'Identifier') && isNodeOfType(property.value.arguments[0], 'Literal')) {
36
- if (property.value.callee.name === 'token' && typeof property.value.arguments[0].value === 'string' && property.value.arguments[0].value.includes('font.heading')) {
37
- return true;
38
- }
45
+ // Only looking for heading token on `font` property
46
+ var isFontProperty = isNodeOfType(property, 'Property') && (isNodeOfType(property.key, 'Literal') && property.key.value === 'font' || isNodeOfType(property.key, 'Identifier') && property.key.name === 'font');
47
+ if (!isFontProperty) {
48
+ continue;
49
+ }
50
+
51
+ // Checking for heading token string, for example xcss({ font: 'font.heading.medium' })
52
+ if (isNodeOfType(property.value, 'Literal') && typeof property.value.value === 'string' && (_property$value$value = property.value.value) !== null && _property$value$value !== void 0 && _property$value$value.startsWith('font.heading')) {
53
+ return true;
54
+ }
55
+
56
+ // Checking for wrapped heading token, for example xcss({ font: token('font.heading.medium') })
57
+ if (isNodeOfType(property.value, 'CallExpression') && isNodeOfType(property.value.callee, 'Identifier') && property.value.callee.name === 'token' && isNodeOfType(property.value.arguments[0], 'Literal') && typeof property.value.arguments[0].value === 'string' && property.value.arguments[0].value.startsWith('font.heading')) {
58
+ return true;
39
59
  }
40
60
  }
41
61
  } catch (err) {
@@ -0,0 +1,44 @@
1
+ /* eslint-disable @repo/internal/react/require-jsdoc */
2
+
3
+ import { isNodeOfType } from 'eslint-codemod-utils';
4
+ var messageId = 'noWrappedTokenTypographyValues';
5
+ export var WrappedTokenValue = {
6
+ lint: function lint(node, _ref) {
7
+ var context = _ref.context,
8
+ config = _ref.config;
9
+ if (WrappedTokenValue._check(node, {
10
+ context: context,
11
+ config: config
12
+ })) {
13
+ context.report({
14
+ node: node,
15
+ messageId: messageId,
16
+ fix: WrappedTokenValue._fix(node)
17
+ });
18
+ }
19
+ },
20
+ _check: function _check(node, _ref2) {
21
+ var config = _ref2.config;
22
+ if (!config.patterns.includes('wrapped-token-value')) {
23
+ return false;
24
+ }
25
+ if (isNodeOfType(node.parent, 'Property') && isNodeOfType(node.parent.value, 'CallExpression') && isNodeOfType(node.parent.value.callee, 'Identifier') && node.parent.value.callee.name === 'token' && node.parent.value.arguments.length >= 1) {
26
+ return true;
27
+ }
28
+ return false;
29
+ },
30
+ _fix: function _fix(node) {
31
+ return function (fixer) {
32
+ var wrappedTokenFix;
33
+ if (isNodeOfType(node.parent, 'Property') && isNodeOfType(node.parent.value, 'CallExpression') && node.parent.value.arguments.length >= 1) {
34
+ var firstArg = node.parent.value.arguments[0];
35
+ if (isNodeOfType(firstArg, 'Literal') && typeof firstArg.value === 'string') {
36
+ wrappedTokenFix = fixer.replaceText(node.parent.value, "'".concat(firstArg.value, "'"));
37
+ }
38
+ }
39
+ return [wrappedTokenFix].filter(function (fix) {
40
+ return Boolean(fix);
41
+ }); // Some of the transformers can return arrays with undefined, so filter them out
42
+ };
43
+ }
44
+ };
@@ -19,6 +19,22 @@ export type ErrorListAuto = {
19
19
  export type GuidanceList = {
20
20
  [loc: string]: string;
21
21
  };
22
+ export type LegacyIconImportList = {
23
+ [key: string]: {
24
+ packageName: string;
25
+ exported: boolean;
26
+ importNode: ImportDeclaration;
27
+ importSpecifier: string;
28
+ };
29
+ };
30
+ export type MigrationIconImportList = {
31
+ [key: string]: {
32
+ packageName: string;
33
+ exported: boolean;
34
+ importNode: ImportDeclaration;
35
+ importSpecifier: string;
36
+ };
37
+ };
22
38
  declare const sizes: readonly ["small", "medium", "large", "xlarge"];
23
39
  export type Size = (typeof sizes)[number];
24
40
  export declare const isSize: (size: any) => size is "small" | "medium" | "large" | "xlarge";
@@ -47,15 +63,6 @@ export declare const getUpcomingIcons: (iconPackage: string) => {
47
63
  * Checks if a new icon can be auto-migrated based on guidance from the migration map
48
64
  */
49
65
  export declare const canAutoMigrateNewIconBasedOnSize: (guidance?: string) => boolean;
50
- /**
51
- *
52
- * @param iconPackage string
53
- * @returns object of new icon name and import path
54
- */
55
- export declare const getNewIconNameAndImportPath: (iconPackage: string, shouldUseMigrationPath?: boolean) => {
56
- iconName?: string;
57
- importPath?: string;
58
- };
59
66
  /**
60
67
  * Creates the written guidance for migrating a legacy icon to a new icon
61
68
  */
@@ -88,7 +95,6 @@ export declare const createAutoMigrationError: ({ node, importSource, iconName,
88
95
  shouldAddSpaciousSpacing?: boolean | undefined;
89
96
  insideNewButton?: boolean | undefined;
90
97
  }) => void;
91
- export declare const getLiteralStringValue: (value: any) => string | undefined;
92
98
  export declare const createHelpers: (context: Rule.RuleContext) => {
93
99
  /**
94
100
  * Extracts the primaryColor value from a JSXAttribute
@@ -98,7 +104,6 @@ export declare const createHelpers: (context: Rule.RuleContext) => {
98
104
  getConfigFlag: (key: string, defaultValue: boolean) => boolean;
99
105
  };
100
106
  export declare const addToListOfRanges: (node: Node, sortedListOfRangesForErrors: RangeList) => void;
101
- export declare const isInRangeList: (node: Node, sortedListOfRangesForErrors: RangeList) => boolean;
102
107
  /**
103
108
  *
104
109
  * @param node Icon JSXelement
@@ -113,54 +118,20 @@ export declare const isInsideNewButton: (node: Rule.Node, newButtonImports: Set<
113
118
  * @returns if Icon is inside a legacy button
114
119
  */
115
120
  export declare const isInsideLegacyButton: (node: Rule.Node, legacyButtonImports: Set<string>) => boolean;
116
- /**
117
- *
118
- * Creates a list of fixers to update the icon import path
119
- * @param metadata Metadata including the import source and spacing
120
- * @param fixer The original fix function
121
- * @param legacyImportNode The import declaration node to replace
122
- * @param shouldUseMigrationPath The eslint rule config, whether to use migration entrypoint or not
123
- * @param migrationImportNode The migration import declaration node to replace, only present if shouldUseMigrationPath is false
124
- * @returns A list of fixers to migrate the icon
125
- */
126
- export declare const createImportFix: ({ fixer, legacyImportNode, metadata, shouldUseMigrationPath, migrationImportNode, }: {
127
- fixer: Rule.RuleFixer;
128
- metadata: {
129
- importSource: string;
130
- spacing: string;
131
- };
132
- legacyImportNode?: ImportDeclaration | undefined;
133
- shouldUseMigrationPath: boolean;
134
- migrationImportNode?: ImportDeclaration | undefined;
135
- }) => Rule.Fix[];
136
- /**
137
- * Creates a list of fixers to update the icon props
138
- * @param node The Icon element to migrate
139
- * @param metadata Metadata including the import source and spacing
140
- * @param fixer The original fix function
141
- * @param legacyImportNode The import declaration node to replace
142
- * @param shouldUseMigrationPath The eslint rule config, whether to use migration entrypoint or not
143
- * @param migrationImportNode The migration import declaration node to replace, only present if shouldUseMigrationPath is false
144
- * @returns A list of fixers to migrate the icon
145
- */
146
- export declare const createPropFixes: ({ node, fixer, legacyImportNode, metadata, shouldUseMigrationPath, migrationImportNode, }: {
147
- node: Node;
148
- fixer: Rule.RuleFixer;
149
- metadata: {
150
- importSource: string;
151
- spacing: string;
152
- insideNewButton: string;
153
- };
154
- legacyImportNode?: ImportDeclaration | undefined;
121
+ export declare const throwManualErrors: ({ errorsManual, errorRanges, guidance, context, isQuietMode, }: {
122
+ errorsManual: ErrorListManual;
123
+ errorRanges: RangeList;
124
+ guidance: GuidanceList;
125
+ context: Rule.RuleContext;
126
+ isQuietMode: boolean;
127
+ }) => void;
128
+ export declare const throwAutoErrors: ({ errorsManual, errorsAuto, legacyIconImports, guidance, migrationIconImports, shouldUseMigrationPath, context, }: {
129
+ errorsManual: ErrorListManual;
130
+ errorsAuto: ErrorListAuto;
131
+ legacyIconImports: LegacyIconImportList;
132
+ guidance: GuidanceList;
133
+ migrationIconImports: MigrationIconImportList;
155
134
  shouldUseMigrationPath: boolean;
156
- migrationImportNode?: ImportDeclaration | undefined;
157
- }) => Rule.Fix[];
158
- /**
159
- * Check if the new icon exists in the migration map
160
- */
161
- export declare const checkIfNewIconExist: (error: {
162
- data?: {
163
- importSource?: string;
164
- };
165
- }) => boolean;
135
+ context: Rule.RuleContext;
136
+ }) => void;
166
137
  export {};
@@ -1,4 +1,7 @@
1
+ type Pattern = 'restricted-property' | 'wrapped-token-value';
1
2
  export interface RuleConfig {
2
3
  failSilently: boolean;
4
+ patterns: Pattern[];
3
5
  }
4
6
  export declare const getConfig: (overrides: Partial<RuleConfig>) => RuleConfig;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { Rule } from 'eslint';
2
+ import { type RuleConfig } from '../config';
3
+ export type MetaData = {
4
+ context: Rule.RuleContext;
5
+ config: RuleConfig;
6
+ };
@@ -1 +1,2 @@
1
- export { BannedProperty } from './banned-property';
1
+ export { RestrictedProperty } from './restricted-property';
2
+ export { WrappedTokenValue } from './wrapped-token-value';
@@ -0,0 +1,6 @@
1
+ import type { Rule } from 'eslint';
2
+ import { type MetaData } from './common';
3
+ export declare const RestrictedProperty: {
4
+ lint(node: Rule.Node, { context, config }: MetaData): void;
5
+ _check(node: Rule.Node, { config }: MetaData): boolean;
6
+ };
@@ -0,0 +1,7 @@
1
+ import type { Rule } from 'eslint';
2
+ import { type MetaData } from './common';
3
+ export declare const WrappedTokenValue: {
4
+ lint(node: Rule.Node, { context, config }: MetaData): void;
5
+ _check(node: Rule.Node, { config }: MetaData): boolean;
6
+ _fix(node: Rule.Node): Rule.ReportFixer;
7
+ };
@@ -19,6 +19,22 @@ export type ErrorListAuto = {
19
19
  export type GuidanceList = {
20
20
  [loc: string]: string;
21
21
  };
22
+ export type LegacyIconImportList = {
23
+ [key: string]: {
24
+ packageName: string;
25
+ exported: boolean;
26
+ importNode: ImportDeclaration;
27
+ importSpecifier: string;
28
+ };
29
+ };
30
+ export type MigrationIconImportList = {
31
+ [key: string]: {
32
+ packageName: string;
33
+ exported: boolean;
34
+ importNode: ImportDeclaration;
35
+ importSpecifier: string;
36
+ };
37
+ };
22
38
  declare const sizes: readonly [
23
39
  "small",
24
40
  "medium",
@@ -52,15 +68,6 @@ export declare const getUpcomingIcons: (iconPackage: string) => {
52
68
  * Checks if a new icon can be auto-migrated based on guidance from the migration map
53
69
  */
54
70
  export declare const canAutoMigrateNewIconBasedOnSize: (guidance?: string) => boolean;
55
- /**
56
- *
57
- * @param iconPackage string
58
- * @returns object of new icon name and import path
59
- */
60
- export declare const getNewIconNameAndImportPath: (iconPackage: string, shouldUseMigrationPath?: boolean) => {
61
- iconName?: string;
62
- importPath?: string;
63
- };
64
71
  /**
65
72
  * Creates the written guidance for migrating a legacy icon to a new icon
66
73
  */
@@ -93,7 +100,6 @@ export declare const createAutoMigrationError: ({ node, importSource, iconName,
93
100
  shouldAddSpaciousSpacing?: boolean | undefined;
94
101
  insideNewButton?: boolean | undefined;
95
102
  }) => void;
96
- export declare const getLiteralStringValue: (value: any) => string | undefined;
97
103
  export declare const createHelpers: (context: Rule.RuleContext) => {
98
104
  /**
99
105
  * Extracts the primaryColor value from a JSXAttribute
@@ -103,7 +109,6 @@ export declare const createHelpers: (context: Rule.RuleContext) => {
103
109
  getConfigFlag: (key: string, defaultValue: boolean) => boolean;
104
110
  };
105
111
  export declare const addToListOfRanges: (node: Node, sortedListOfRangesForErrors: RangeList) => void;
106
- export declare const isInRangeList: (node: Node, sortedListOfRangesForErrors: RangeList) => boolean;
107
112
  /**
108
113
  *
109
114
  * @param node Icon JSXelement
@@ -118,54 +123,20 @@ export declare const isInsideNewButton: (node: Rule.Node, newButtonImports: Set<
118
123
  * @returns if Icon is inside a legacy button
119
124
  */
120
125
  export declare const isInsideLegacyButton: (node: Rule.Node, legacyButtonImports: Set<string>) => boolean;
121
- /**
122
- *
123
- * Creates a list of fixers to update the icon import path
124
- * @param metadata Metadata including the import source and spacing
125
- * @param fixer The original fix function
126
- * @param legacyImportNode The import declaration node to replace
127
- * @param shouldUseMigrationPath The eslint rule config, whether to use migration entrypoint or not
128
- * @param migrationImportNode The migration import declaration node to replace, only present if shouldUseMigrationPath is false
129
- * @returns A list of fixers to migrate the icon
130
- */
131
- export declare const createImportFix: ({ fixer, legacyImportNode, metadata, shouldUseMigrationPath, migrationImportNode, }: {
132
- fixer: Rule.RuleFixer;
133
- metadata: {
134
- importSource: string;
135
- spacing: string;
136
- };
137
- legacyImportNode?: ImportDeclaration | undefined;
138
- shouldUseMigrationPath: boolean;
139
- migrationImportNode?: ImportDeclaration | undefined;
140
- }) => Rule.Fix[];
141
- /**
142
- * Creates a list of fixers to update the icon props
143
- * @param node The Icon element to migrate
144
- * @param metadata Metadata including the import source and spacing
145
- * @param fixer The original fix function
146
- * @param legacyImportNode The import declaration node to replace
147
- * @param shouldUseMigrationPath The eslint rule config, whether to use migration entrypoint or not
148
- * @param migrationImportNode The migration import declaration node to replace, only present if shouldUseMigrationPath is false
149
- * @returns A list of fixers to migrate the icon
150
- */
151
- export declare const createPropFixes: ({ node, fixer, legacyImportNode, metadata, shouldUseMigrationPath, migrationImportNode, }: {
152
- node: Node;
153
- fixer: Rule.RuleFixer;
154
- metadata: {
155
- importSource: string;
156
- spacing: string;
157
- insideNewButton: string;
158
- };
159
- legacyImportNode?: ImportDeclaration | undefined;
126
+ export declare const throwManualErrors: ({ errorsManual, errorRanges, guidance, context, isQuietMode, }: {
127
+ errorsManual: ErrorListManual;
128
+ errorRanges: RangeList;
129
+ guidance: GuidanceList;
130
+ context: Rule.RuleContext;
131
+ isQuietMode: boolean;
132
+ }) => void;
133
+ export declare const throwAutoErrors: ({ errorsManual, errorsAuto, legacyIconImports, guidance, migrationIconImports, shouldUseMigrationPath, context, }: {
134
+ errorsManual: ErrorListManual;
135
+ errorsAuto: ErrorListAuto;
136
+ legacyIconImports: LegacyIconImportList;
137
+ guidance: GuidanceList;
138
+ migrationIconImports: MigrationIconImportList;
160
139
  shouldUseMigrationPath: boolean;
161
- migrationImportNode?: ImportDeclaration | undefined;
162
- }) => Rule.Fix[];
163
- /**
164
- * Check if the new icon exists in the migration map
165
- */
166
- export declare const checkIfNewIconExist: (error: {
167
- data?: {
168
- importSource?: string;
169
- };
170
- }) => boolean;
140
+ context: Rule.RuleContext;
141
+ }) => void;
171
142
  export {};
@@ -1,4 +1,7 @@
1
+ type Pattern = 'restricted-property' | 'wrapped-token-value';
1
2
  export interface RuleConfig {
2
3
  failSilently: boolean;
4
+ patterns: Pattern[];
3
5
  }
4
6
  export declare const getConfig: (overrides: Partial<RuleConfig>) => RuleConfig;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { Rule } from 'eslint';
2
+ import { type RuleConfig } from '../config';
3
+ export type MetaData = {
4
+ context: Rule.RuleContext;
5
+ config: RuleConfig;
6
+ };
@@ -1 +1,2 @@
1
- export { BannedProperty } from './banned-property';
1
+ export { RestrictedProperty } from './restricted-property';
2
+ export { WrappedTokenValue } from './wrapped-token-value';
@@ -0,0 +1,6 @@
1
+ import type { Rule } from 'eslint';
2
+ import { type MetaData } from './common';
3
+ export declare const RestrictedProperty: {
4
+ lint(node: Rule.Node, { context, config }: MetaData): void;
5
+ _check(node: Rule.Node, { config }: MetaData): boolean;
6
+ };
@@ -0,0 +1,7 @@
1
+ import type { Rule } from 'eslint';
2
+ import { type MetaData } from './common';
3
+ export declare const WrappedTokenValue: {
4
+ lint(node: Rule.Node, { context, config }: MetaData): void;
5
+ _check(node: Rule.Node, { config }: MetaData): boolean;
6
+ _fix(node: Rule.Node): Rule.ReportFixer;
7
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlaskit/eslint-plugin-design-system",
3
3
  "description": "The essential plugin for use with the Atlassian Design System.",
4
- "version": "10.17.3",
4
+ "version": "10.18.1",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {
@@ -9,10 +9,6 @@
9
9
  },
10
10
  "atlassian": {
11
11
  "team": "Design System Team",
12
- "releaseModel": "continuous",
13
- "productPushConsumption": [
14
- "jira"
15
- ],
16
12
  "website": {
17
13
  "name": "ESLint plugin",
18
14
  "category": "Tooling"
@@ -68,7 +64,7 @@
68
64
  "@types/eslint": "^8.56.6",
69
65
  "@types/esquery": "^1.5.3",
70
66
  "@types/estraverse": "^5.1.7",
71
- "eslint": "^8.49.0",
67
+ "eslint": "^8.57.0",
72
68
  "jscodeshift": "^0.13.0",
73
69
  "outdent": "^0.5.0",
74
70
  "react": "^16.8.0",
@@ -1,40 +0,0 @@
1
- /* eslint-disable @repo/internal/react/require-jsdoc */
2
-
3
- import { isNodeOfType } from 'eslint-codemod-utils';
4
- export const BannedProperty = {
5
- lint(node, {
6
- context
7
- }) {
8
- if (BannedProperty._check(node)) {
9
- let property = 'fontSize, lineHeight, fontWeight or letterSpacing';
10
- if (isNodeOfType(node, 'Identifier')) {
11
- property = node.name;
12
- } else if (isNodeOfType(node, 'Literal')) {
13
- property = String(node.value);
14
- }
15
- context.report({
16
- node,
17
- messageId: 'noUnsafeTypographyProperties',
18
- data: {
19
- property
20
- }
21
- });
22
- }
23
- },
24
- _check(node) {
25
- // Prevent font weight being used in combination with heading tokens
26
- if (isNodeOfType(node, 'Identifier') && node.name === 'fontWeight' || isNodeOfType(node, 'Literal') && node.value === 'fontWeight') {
27
- if (isNodeOfType(node.parent.parent, 'ObjectExpression')) {
28
- for (const property of node.parent.parent.properties) {
29
- if (isNodeOfType(property, 'Property') && isNodeOfType(property.value, 'CallExpression') && isNodeOfType(property.value.callee, 'Identifier') && isNodeOfType(property.value.arguments[0], 'Literal')) {
30
- if (property.value.callee.name === 'token' && typeof property.value.arguments[0].value === 'string' && property.value.arguments[0].value.includes('font.heading')) {
31
- return true;
32
- }
33
- }
34
- }
35
- }
36
- return false;
37
- }
38
- return true;
39
- }
40
- };
@@ -1,7 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- export declare const BannedProperty: {
3
- lint(node: Rule.Node, { context }: {
4
- context: Rule.RuleContext;
5
- }): void;
6
- _check(node: Rule.Node): boolean;
7
- };
@@ -1,7 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- export declare const BannedProperty: {
3
- lint(node: Rule.Node, { context }: {
4
- context: Rule.RuleContext;
5
- }): void;
6
- _check(node: Rule.Node): boolean;
7
- };