@atlaskit/eslint-plugin-design-system 9.3.1 → 9.4.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 (76) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +36 -35
  3. package/constellation/index/usage.mdx +36 -35
  4. package/constellation/no-direct-use-of-web-platform-drag-and-drop/usage.mdx +140 -0
  5. package/constellation/use-tokens-typography/usage.mdx +6 -2
  6. package/dist/cjs/presets/all.codegen.js +2 -1
  7. package/dist/cjs/presets/recommended.codegen.js +2 -1
  8. package/dist/cjs/rules/index.codegen.js +3 -1
  9. package/dist/cjs/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-add-event-listener.js +31 -0
  10. package/dist/cjs/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind-all.js +63 -0
  11. package/dist/cjs/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind.js +48 -0
  12. package/dist/cjs/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-jsx-attribute.js +55 -0
  13. package/dist/cjs/rules/no-direct-use-of-web-platform-drag-and-drop/index.js +55 -0
  14. package/dist/cjs/rules/no-direct-use-of-web-platform-drag-and-drop/shared/blocked.js +8 -0
  15. package/dist/cjs/rules/no-direct-use-of-web-platform-drag-and-drop/shared/is-blocked-event-binding.js +31 -0
  16. package/dist/cjs/rules/use-tokens-typography/config/index.js +5 -1
  17. package/dist/cjs/rules/use-tokens-typography/index.js +2 -1
  18. package/dist/cjs/rules/use-tokens-typography/transformers/style-object.js +16 -9
  19. package/dist/cjs/rules/use-tokens-typography/utils.js +9 -9
  20. package/dist/es2019/presets/all.codegen.js +2 -1
  21. package/dist/es2019/presets/recommended.codegen.js +2 -1
  22. package/dist/es2019/rules/index.codegen.js +3 -1
  23. package/dist/es2019/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-add-event-listener.js +25 -0
  24. package/dist/es2019/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind-all.js +38 -0
  25. package/dist/es2019/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind.js +33 -0
  26. package/dist/es2019/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-jsx-attribute.js +49 -0
  27. package/dist/es2019/rules/no-direct-use-of-web-platform-drag-and-drop/index.js +49 -0
  28. package/dist/es2019/rules/no-direct-use-of-web-platform-drag-and-drop/shared/blocked.js +2 -0
  29. package/dist/es2019/rules/no-direct-use-of-web-platform-drag-and-drop/shared/is-blocked-event-binding.js +25 -0
  30. package/dist/es2019/rules/use-tokens-typography/config/index.js +5 -1
  31. package/dist/es2019/rules/use-tokens-typography/index.js +2 -1
  32. package/dist/es2019/rules/use-tokens-typography/transformers/style-object.js +16 -9
  33. package/dist/es2019/rules/use-tokens-typography/utils.js +8 -9
  34. package/dist/esm/presets/all.codegen.js +2 -1
  35. package/dist/esm/presets/recommended.codegen.js +2 -1
  36. package/dist/esm/rules/index.codegen.js +3 -1
  37. package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-add-event-listener.js +25 -0
  38. package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind-all.js +59 -0
  39. package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind.js +44 -0
  40. package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-jsx-attribute.js +49 -0
  41. package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/index.js +49 -0
  42. package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/shared/blocked.js +2 -0
  43. package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/shared/is-blocked-event-binding.js +25 -0
  44. package/dist/esm/rules/use-tokens-typography/config/index.js +5 -1
  45. package/dist/esm/rules/use-tokens-typography/index.js +2 -1
  46. package/dist/esm/rules/use-tokens-typography/transformers/style-object.js +16 -9
  47. package/dist/esm/rules/use-tokens-typography/utils.js +9 -9
  48. package/dist/types/index.codegen.d.ts +2 -0
  49. package/dist/types/presets/all.codegen.d.ts +2 -1
  50. package/dist/types/presets/recommended.codegen.d.ts +2 -1
  51. package/dist/types/rules/index.codegen.d.ts +1 -0
  52. package/dist/types/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-add-event-listener.d.ts +2 -0
  53. package/dist/types/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind-all.d.ts +3 -0
  54. package/dist/types/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind.d.ts +3 -0
  55. package/dist/types/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-jsx-attribute.d.ts +3 -0
  56. package/dist/types/rules/no-direct-use-of-web-platform-drag-and-drop/index.d.ts +2 -0
  57. package/dist/types/rules/no-direct-use-of-web-platform-drag-and-drop/shared/blocked.d.ts +2 -0
  58. package/dist/types/rules/no-direct-use-of-web-platform-drag-and-drop/shared/is-blocked-event-binding.d.ts +2 -0
  59. package/dist/types/rules/use-tokens-typography/config/index.d.ts +1 -0
  60. package/dist/types/rules/use-tokens-typography/transformers/style-object.d.ts +6 -2
  61. package/dist/types/rules/use-tokens-typography/utils.d.ts +1 -1
  62. package/dist/types-ts4.5/index.codegen.d.ts +2 -0
  63. package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
  64. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +2 -1
  65. package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
  66. package/dist/types-ts4.5/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-add-event-listener.d.ts +2 -0
  67. package/dist/types-ts4.5/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind-all.d.ts +3 -0
  68. package/dist/types-ts4.5/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind.d.ts +3 -0
  69. package/dist/types-ts4.5/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-jsx-attribute.d.ts +3 -0
  70. package/dist/types-ts4.5/rules/no-direct-use-of-web-platform-drag-and-drop/index.d.ts +2 -0
  71. package/dist/types-ts4.5/rules/no-direct-use-of-web-platform-drag-and-drop/shared/blocked.d.ts +2 -0
  72. package/dist/types-ts4.5/rules/no-direct-use-of-web-platform-drag-and-drop/shared/is-blocked-event-binding.d.ts +2 -0
  73. package/dist/types-ts4.5/rules/use-tokens-typography/config/index.d.ts +1 -0
  74. package/dist/types-ts4.5/rules/use-tokens-typography/transformers/style-object.d.ts +6 -2
  75. package/dist/types-ts4.5/rules/use-tokens-typography/utils.d.ts +1 -1
  76. package/package.json +1 -1
@@ -7,7 +7,8 @@ import { isDecendantOfGlobalToken, isDecendantOfStyleBlock, isDecendantOfType }
7
7
  import { convertPropertyNodeToStringableNode, defaultFontWeight, findFontFamilyValueForToken, findFontWeightTokenForValue, findTypographyTokenForValues, fontWeightMap, getLiteralProperty, getTokenProperty, insertFallbackImportFull, insertFallbackImportSpecifier, insertTokensImport, isValidPropertyNode, notUndefined } from '../utils';
8
8
  export var StyleObject = {
9
9
  lint: function lint(node, _ref) {
10
- var context = _ref.context;
10
+ var context = _ref.context,
11
+ config = _ref.config;
11
12
  // To force the correct node type
12
13
  if (!isNodeOfType(node, 'ObjectExpression')) {
13
14
  return {
@@ -17,7 +18,8 @@ export var StyleObject = {
17
18
 
18
19
  // Check whether all criteria needed to make a transformation are met
19
20
  var _StyleObject$_check = StyleObject._check(node, {
20
- context: context
21
+ context: context,
22
+ config: config
21
23
  }),
22
24
  success = _StyleObject$_check.success,
23
25
  refs = _StyleObject$_check.refs;
@@ -28,6 +30,7 @@ export var StyleObject = {
28
30
  fontSizeRaw = refs.fontSizeRaw,
29
31
  tokensImportNode = refs.tokensImportNode,
30
32
  themeImportNode = refs.themeImportNode,
33
+ shouldAddFallback = refs.shouldAddFallback,
31
34
  shouldAddFallbackImport = refs.shouldAddFallbackImport;
32
35
  var fontSizeValue = normaliseValue('fontSize', fontSizeRaw);
33
36
 
@@ -110,16 +113,17 @@ export var StyleObject = {
110
113
  var nodesToReplace = [fontSizeNode, fontWeightNode, lineHeightNode, fontFamilyNode, fontStyleNode, letterSpacingNode].filter(notUndefined);
111
114
  var fontFamilyTokenName = fontFamilyToAdd ? "font.family.brand.".concat(fontFamilyToAdd) : '';
112
115
  var fontWeightReplacementToken = shouldAddFontWeight ? findFontWeightTokenForValue(fontWeightValue) : undefined;
113
- var fontWeightReplacement = fontWeightReplacementToken && getTokenProperty('fontWeight', fontWeightReplacementToken.tokenName, fontWeightValue);
116
+ var fontWeightReplacement = fontWeightReplacementToken && getTokenProperty('fontWeight', fontWeightReplacementToken.tokenName, shouldAddFallback ? fontWeightValue : undefined);
114
117
  var fontFamilyReplacement = fontFamilyToAdd && (fontFamilyToAdd === 'original' ? convertPropertyNodeToStringableNode(
115
118
  // This will always exist if fontFamilyToAdd === 'original', TS can't figure that out.
116
- fontFamilyNode) : getTokenProperty('fontFamily', fontFamilyTokenName, findFontFamilyValueForToken(fontFamilyTokenName)));
119
+ fontFamilyNode) : getTokenProperty('fontFamily', fontFamilyTokenName, shouldAddFallback ? findFontFamilyValueForToken(fontFamilyTokenName) : undefined));
117
120
  var fontStyleReplacement = fontStyleToAdd && getLiteralProperty('fontStyle', fontStyleToAdd);
118
121
  var fixerRefs = {
119
122
  matchingToken: matchingToken,
120
123
  nodesToReplace: nodesToReplace,
121
124
  tokensImportNode: tokensImportNode,
122
125
  themeImportNode: themeImportNode,
126
+ shouldAddFallback: shouldAddFallback,
123
127
  shouldAddFallbackImport: shouldAddFallbackImport,
124
128
  fontWeightReplacement: fontWeightReplacement,
125
129
  fontFamilyReplacement: fontFamilyReplacement,
@@ -145,7 +149,8 @@ export var StyleObject = {
145
149
  return;
146
150
  },
147
151
  _check: function _check(node, _ref2) {
148
- var context = _ref2.context;
152
+ var context = _ref2.context,
153
+ config = _ref2.config;
149
154
  if (!isDecendantOfStyleBlock(node) && !isDecendantOfType(node, 'JSXExpressionContainer')) {
150
155
  return {
151
156
  success: false
@@ -175,13 +180,13 @@ export var StyleObject = {
175
180
  success: false
176
181
  };
177
182
  }
178
-
183
+ var shouldAddFallback = Boolean(config.shouldEnforceFallbacks);
179
184
  // This exists purely because we're not inlining the fallback values
180
185
  // and instead referencing a `fontFallback` object that exists in @atlaskit/theme/typography.
181
186
  // This is a temporary measure until fallbacks are no longer required
182
- var shouldAddFallbackImport = 'full';
187
+ var shouldAddFallbackImport = shouldAddFallback && 'full';
183
188
  var themeImportDeclaration = Root.findImportsByModule(context.getSourceCode().ast.body, '@atlaskit/theme/typography');
184
- if (themeImportDeclaration.length) {
189
+ if (themeImportDeclaration.length && shouldAddFallback) {
185
190
  // Import exists, check if specifier exists
186
191
  shouldAddFallbackImport = 'specifier';
187
192
  var fallbackImport = themeImportDeclaration[0].specifiers.find(function (specifier) {
@@ -207,6 +212,7 @@ export var StyleObject = {
207
212
  fontSizeRaw: fontSizeRaw,
208
213
  tokensImportNode: tokensImportDeclaration[0],
209
214
  themeImportNode: themeImportDeclaration[0],
215
+ shouldAddFallback: shouldAddFallback,
210
216
  shouldAddFallbackImport: shouldAddFallbackImport
211
217
  }
212
218
  };
@@ -217,6 +223,7 @@ export var StyleObject = {
217
223
  nodesToReplace = refs.nodesToReplace,
218
224
  tokensImportNode = refs.tokensImportNode,
219
225
  themeImportNode = refs.themeImportNode,
226
+ shouldAddFallback = refs.shouldAddFallback,
220
227
  shouldAddFallbackImport = refs.shouldAddFallbackImport,
221
228
  fontWeightReplacement = refs.fontWeightReplacement,
222
229
  fontFamilyReplacement = refs.fontFamilyReplacement,
@@ -233,7 +240,7 @@ export var StyleObject = {
233
240
  return (!tokensImportNode ? [insertTokensImport(root, fixer)] : []).concat(fallbackImport ? [fallbackImport] : [], nodesToReplace.map(function (node, index) {
234
241
  // Replace first node with token, delete remaining nodes. Guaranteed to be fontSize
235
242
  if (index === 0) {
236
- return fixer.replaceText(node, "".concat(getTokenProperty('font', matchingToken.tokenName, fallbackName, true)));
243
+ return fixer.replaceText(node, "".concat(getTokenProperty('font', matchingToken.tokenName, shouldAddFallback ? fallbackName : undefined, true)));
237
244
  }
238
245
 
239
246
  // We don't replace fontWeight/fontFamily/fontStyle here in case it occurs before the font property.
@@ -99,20 +99,20 @@ export function isValidPropertyNode(node) {
99
99
  }
100
100
  return true;
101
101
  }
102
- function getTokenNode(tokenName, tokenValue, isFallbackMember) {
103
- var fallback;
104
- if (isFallbackMember) {
105
- fallback = createMemberExpressionFromArray(tokenValue.split('.'));
106
- } else {
107
- fallback = literal(tokenValue);
102
+ function getTokenNode(tokenName, fallbackValue) {
103
+ var isFallbackMember = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
104
+ var callExpressionArgs = [literal({
105
+ value: "'".concat(tokenName, "'")
106
+ })];
107
+ if (fallbackValue) {
108
+ var fallback = isFallbackMember ? createMemberExpressionFromArray(fallbackValue.split('.')) : literal(fallbackValue);
109
+ callExpressionArgs.push(fallback);
108
110
  }
109
111
  return callExpression({
110
112
  callee: identifier({
111
113
  name: 'token'
112
114
  }),
113
- arguments: [literal({
114
- value: "'".concat(tokenName, "'")
115
- }), fallback],
115
+ arguments: callExpressionArgs,
116
116
  optional: false
117
117
  });
118
118
  }
@@ -12,6 +12,7 @@ export declare const configs: {
12
12
  '@atlaskit/design-system/no-deprecated-apis': string;
13
13
  '@atlaskit/design-system/no-deprecated-design-token-usage': string;
14
14
  '@atlaskit/design-system/no-deprecated-imports': string;
15
+ '@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': string;
15
16
  '@atlaskit/design-system/no-empty-styled-expression': string;
16
17
  '@atlaskit/design-system/no-exported-css': string;
17
18
  '@atlaskit/design-system/no-exported-keyframes': string;
@@ -48,6 +49,7 @@ export declare const configs: {
48
49
  '@atlaskit/design-system/no-deprecated-apis': string;
49
50
  '@atlaskit/design-system/no-deprecated-design-token-usage': string;
50
51
  '@atlaskit/design-system/no-deprecated-imports': string;
52
+ '@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': string;
51
53
  '@atlaskit/design-system/no-empty-styled-expression': string;
52
54
  '@atlaskit/design-system/no-exported-css': string;
53
55
  '@atlaskit/design-system/no-exported-keyframes': string;
@@ -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::2e2cf6c0ecfe1b01f3eb24caa223f09e>>
3
+ * @codegen <<SignedSource::1ab11547db880eba1206f334a9b2150f>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  declare const _default: {
@@ -15,6 +15,7 @@ declare const _default: {
15
15
  '@atlaskit/design-system/no-deprecated-apis': string;
16
16
  '@atlaskit/design-system/no-deprecated-design-token-usage': string;
17
17
  '@atlaskit/design-system/no-deprecated-imports': string;
18
+ '@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': string;
18
19
  '@atlaskit/design-system/no-empty-styled-expression': string;
19
20
  '@atlaskit/design-system/no-exported-css': string;
20
21
  '@atlaskit/design-system/no-exported-keyframes': string;
@@ -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::aebc778f0b10032cbb2941b55189d766>>
3
+ * @codegen <<SignedSource::05b4fe8f97edc4f7e46ded52b4917037>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  declare const _default: {
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  '@atlaskit/design-system/no-deprecated-apis': string;
14
14
  '@atlaskit/design-system/no-deprecated-design-token-usage': string;
15
15
  '@atlaskit/design-system/no-deprecated-imports': string;
16
+ '@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': string;
16
17
  '@atlaskit/design-system/no-empty-styled-expression': string;
17
18
  '@atlaskit/design-system/no-exported-css': string;
18
19
  '@atlaskit/design-system/no-exported-keyframes': string;
@@ -12,6 +12,7 @@ declare const _default: {
12
12
  'no-deprecated-imports': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<string, [{
13
13
  deprecatedConfig: import("./utils/types").DeprecatedConfig;
14
14
  }], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
15
+ 'no-direct-use-of-web-platform-drag-and-drop': import("eslint").Rule.RuleModule;
15
16
  'no-empty-styled-expression': import("eslint").Rule.RuleModule;
16
17
  'no-exported-css': import("eslint").Rule.RuleModule;
17
18
  'no-exported-keyframes': import("eslint").Rule.RuleModule;
@@ -0,0 +1,2 @@
1
+ import { CallExpression } from 'eslint-codemod-utils';
2
+ export declare function isBlockedAddEventListener(node: CallExpression): boolean;
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ import { CallExpression } from 'eslint-codemod-utils';
3
+ export declare function isBlockedBindAll(context: Rule.RuleContext, node: CallExpression): boolean;
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ import { CallExpression } from 'eslint-codemod-utils';
3
+ export declare function isBlockedBind(context: Rule.RuleContext, node: CallExpression): boolean;
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ import { JSXAttribute } from 'eslint-codemod-utils';
3
+ export declare function isBlockedJSXAttribute(context: Rule.RuleContext, node: JSXAttribute): boolean;
@@ -0,0 +1,2 @@
1
+ declare const rule: import("eslint").Rule.RuleModule;
2
+ export default rule;
@@ -0,0 +1,2 @@
1
+ export declare const blockedJSXAttributeLookup: Set<string>;
2
+ export declare const blockedEventNameLookup: Set<string>;
@@ -0,0 +1,2 @@
1
+ import { Property, SpreadElement } from 'eslint-codemod-utils';
2
+ export declare function isBlockedEventBinding(property: Property | SpreadElement): boolean;
@@ -1,6 +1,7 @@
1
1
  import { JSONSchema4 } from '@typescript-eslint/utils/dist/json-schema';
2
2
  export type RuleConfig = {
3
3
  failSilently?: boolean;
4
+ shouldEnforceFallbacks?: boolean;
4
5
  };
5
6
  export declare const ruleSchema: JSONSchema4;
6
7
  export declare const getConfig: (overrides: RuleConfig) => RuleConfig;
@@ -1,14 +1,17 @@
1
1
  import type { Rule } from 'eslint';
2
2
  import { ImportDeclaration, ObjectExpression, Property, StringableASTNode } from 'eslint-codemod-utils';
3
+ import { RuleConfig } from '../config';
3
4
  import { TokenValueMap } from '../utils';
4
5
  interface MetaData {
5
6
  context: Rule.RuleContext;
7
+ config: RuleConfig;
6
8
  }
7
9
  interface Refs {
8
10
  fontSizeNode: Property;
9
11
  fontSizeRaw: string | number;
10
12
  tokensImportNode: ImportDeclaration | undefined;
11
13
  themeImportNode: ImportDeclaration | undefined;
14
+ shouldAddFallback: boolean;
12
15
  shouldAddFallbackImport: 'full' | 'specifier' | false;
13
16
  }
14
17
  type Check = {
@@ -20,16 +23,17 @@ interface FixerRefs {
20
23
  nodesToReplace: Property[];
21
24
  tokensImportNode: ImportDeclaration | undefined;
22
25
  themeImportNode: ImportDeclaration | undefined;
26
+ shouldAddFallback: boolean;
23
27
  shouldAddFallbackImport: Refs['shouldAddFallbackImport'];
24
28
  fontWeightReplacement: StringableASTNode<Property> | undefined;
25
29
  fontFamilyReplacement: StringableASTNode<Property> | undefined;
26
30
  fontStyleReplacement: StringableASTNode<Property> | undefined;
27
31
  }
28
32
  export declare const StyleObject: {
29
- lint(node: Rule.Node, { context }: MetaData): {
33
+ lint(node: Rule.Node, { context, config }: MetaData): {
30
34
  success: boolean;
31
35
  } | undefined;
32
- _check(node: ObjectExpression & Rule.NodeParentExtension, { context }: MetaData): Check;
36
+ _check(node: ObjectExpression & Rule.NodeParentExtension, { context, config }: MetaData): Check;
33
37
  _fix(refs: FixerRefs, context: Rule.RuleContext): (fixer: Rule.RuleFixer) => Rule.Fix[];
34
38
  };
35
39
  export {};
@@ -190,7 +190,7 @@ export declare const fontFamilyTokens: ({
190
190
  export declare function findFontFamilyValueForToken(tokenName: string): string;
191
191
  export declare function notUndefined<V>(value: V | undefined): value is V;
192
192
  export declare function isValidPropertyNode(node: Property): boolean;
193
- export declare function getTokenProperty(propertyName: string, tokenName: string, tokenFallback: string, isFallbackMember?: boolean): StringableASTNode<Property>;
193
+ export declare function getTokenProperty(propertyName: string, tokenName: string, tokenFallback?: string, isFallbackMember?: boolean): StringableASTNode<Property>;
194
194
  export declare function getLiteralProperty(propertyName: string, propertyValue: string): StringableASTNode<Property>;
195
195
  export declare function convertPropertyNodeToStringableNode(node: Property): StringableASTNode<Property>;
196
196
  export declare function insertTokensImport(root: (Directive | Statement | ModuleDeclaration)[], fixer: Rule.RuleFixer): Rule.Fix;
@@ -12,6 +12,7 @@ export declare const configs: {
12
12
  '@atlaskit/design-system/no-deprecated-apis': string;
13
13
  '@atlaskit/design-system/no-deprecated-design-token-usage': string;
14
14
  '@atlaskit/design-system/no-deprecated-imports': string;
15
+ '@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': string;
15
16
  '@atlaskit/design-system/no-empty-styled-expression': string;
16
17
  '@atlaskit/design-system/no-exported-css': string;
17
18
  '@atlaskit/design-system/no-exported-keyframes': string;
@@ -48,6 +49,7 @@ export declare const configs: {
48
49
  '@atlaskit/design-system/no-deprecated-apis': string;
49
50
  '@atlaskit/design-system/no-deprecated-design-token-usage': string;
50
51
  '@atlaskit/design-system/no-deprecated-imports': string;
52
+ '@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': string;
51
53
  '@atlaskit/design-system/no-empty-styled-expression': string;
52
54
  '@atlaskit/design-system/no-exported-css': string;
53
55
  '@atlaskit/design-system/no-exported-keyframes': string;
@@ -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::2e2cf6c0ecfe1b01f3eb24caa223f09e>>
3
+ * @codegen <<SignedSource::1ab11547db880eba1206f334a9b2150f>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  declare const _default: {
@@ -15,6 +15,7 @@ declare const _default: {
15
15
  '@atlaskit/design-system/no-deprecated-apis': string;
16
16
  '@atlaskit/design-system/no-deprecated-design-token-usage': string;
17
17
  '@atlaskit/design-system/no-deprecated-imports': string;
18
+ '@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': string;
18
19
  '@atlaskit/design-system/no-empty-styled-expression': string;
19
20
  '@atlaskit/design-system/no-exported-css': string;
20
21
  '@atlaskit/design-system/no-exported-keyframes': string;
@@ -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::aebc778f0b10032cbb2941b55189d766>>
3
+ * @codegen <<SignedSource::05b4fe8f97edc4f7e46ded52b4917037>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  declare const _default: {
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  '@atlaskit/design-system/no-deprecated-apis': string;
14
14
  '@atlaskit/design-system/no-deprecated-design-token-usage': string;
15
15
  '@atlaskit/design-system/no-deprecated-imports': string;
16
+ '@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': string;
16
17
  '@atlaskit/design-system/no-empty-styled-expression': string;
17
18
  '@atlaskit/design-system/no-exported-css': string;
18
19
  '@atlaskit/design-system/no-exported-keyframes': string;
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  deprecatedConfig: import("./utils/types").DeprecatedConfig;
17
17
  }
18
18
  ], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
19
+ 'no-direct-use-of-web-platform-drag-and-drop': import("eslint").Rule.RuleModule;
19
20
  'no-empty-styled-expression': import("eslint").Rule.RuleModule;
20
21
  'no-exported-css': import("eslint").Rule.RuleModule;
21
22
  'no-exported-keyframes': import("eslint").Rule.RuleModule;
@@ -0,0 +1,2 @@
1
+ import { CallExpression } from 'eslint-codemod-utils';
2
+ export declare function isBlockedAddEventListener(node: CallExpression): boolean;
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ import { CallExpression } from 'eslint-codemod-utils';
3
+ export declare function isBlockedBindAll(context: Rule.RuleContext, node: CallExpression): boolean;
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ import { CallExpression } from 'eslint-codemod-utils';
3
+ export declare function isBlockedBind(context: Rule.RuleContext, node: CallExpression): boolean;
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ import { JSXAttribute } from 'eslint-codemod-utils';
3
+ export declare function isBlockedJSXAttribute(context: Rule.RuleContext, node: JSXAttribute): boolean;
@@ -0,0 +1,2 @@
1
+ declare const rule: import("eslint").Rule.RuleModule;
2
+ export default rule;
@@ -0,0 +1,2 @@
1
+ export declare const blockedJSXAttributeLookup: Set<string>;
2
+ export declare const blockedEventNameLookup: Set<string>;
@@ -0,0 +1,2 @@
1
+ import { Property, SpreadElement } from 'eslint-codemod-utils';
2
+ export declare function isBlockedEventBinding(property: Property | SpreadElement): boolean;
@@ -1,6 +1,7 @@
1
1
  import { JSONSchema4 } from '@typescript-eslint/utils/dist/json-schema';
2
2
  export type RuleConfig = {
3
3
  failSilently?: boolean;
4
+ shouldEnforceFallbacks?: boolean;
4
5
  };
5
6
  export declare const ruleSchema: JSONSchema4;
6
7
  export declare const getConfig: (overrides: RuleConfig) => RuleConfig;
@@ -1,14 +1,17 @@
1
1
  import type { Rule } from 'eslint';
2
2
  import { ImportDeclaration, ObjectExpression, Property, StringableASTNode } from 'eslint-codemod-utils';
3
+ import { RuleConfig } from '../config';
3
4
  import { TokenValueMap } from '../utils';
4
5
  interface MetaData {
5
6
  context: Rule.RuleContext;
7
+ config: RuleConfig;
6
8
  }
7
9
  interface Refs {
8
10
  fontSizeNode: Property;
9
11
  fontSizeRaw: string | number;
10
12
  tokensImportNode: ImportDeclaration | undefined;
11
13
  themeImportNode: ImportDeclaration | undefined;
14
+ shouldAddFallback: boolean;
12
15
  shouldAddFallbackImport: 'full' | 'specifier' | false;
13
16
  }
14
17
  type Check = {
@@ -20,16 +23,17 @@ interface FixerRefs {
20
23
  nodesToReplace: Property[];
21
24
  tokensImportNode: ImportDeclaration | undefined;
22
25
  themeImportNode: ImportDeclaration | undefined;
26
+ shouldAddFallback: boolean;
23
27
  shouldAddFallbackImport: Refs['shouldAddFallbackImport'];
24
28
  fontWeightReplacement: StringableASTNode<Property> | undefined;
25
29
  fontFamilyReplacement: StringableASTNode<Property> | undefined;
26
30
  fontStyleReplacement: StringableASTNode<Property> | undefined;
27
31
  }
28
32
  export declare const StyleObject: {
29
- lint(node: Rule.Node, { context }: MetaData): {
33
+ lint(node: Rule.Node, { context, config }: MetaData): {
30
34
  success: boolean;
31
35
  } | undefined;
32
- _check(node: ObjectExpression & Rule.NodeParentExtension, { context }: MetaData): Check;
36
+ _check(node: ObjectExpression & Rule.NodeParentExtension, { context, config }: MetaData): Check;
33
37
  _fix(refs: FixerRefs, context: Rule.RuleContext): (fixer: Rule.RuleFixer) => Rule.Fix[];
34
38
  };
35
39
  export {};
@@ -190,7 +190,7 @@ export declare const fontFamilyTokens: ({
190
190
  export declare function findFontFamilyValueForToken(tokenName: string): string;
191
191
  export declare function notUndefined<V>(value: V | undefined): value is V;
192
192
  export declare function isValidPropertyNode(node: Property): boolean;
193
- export declare function getTokenProperty(propertyName: string, tokenName: string, tokenFallback: string, isFallbackMember?: boolean): StringableASTNode<Property>;
193
+ export declare function getTokenProperty(propertyName: string, tokenName: string, tokenFallback?: string, isFallbackMember?: boolean): StringableASTNode<Property>;
194
194
  export declare function getLiteralProperty(propertyName: string, propertyValue: string): StringableASTNode<Property>;
195
195
  export declare function convertPropertyNodeToStringableNode(node: Property): StringableASTNode<Property>;
196
196
  export declare function insertTokensImport(root: (Directive | Statement | ModuleDeclaration)[], fixer: Rule.RuleFixer): Rule.Fix;
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": "9.3.1",
4
+ "version": "9.4.1",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {