@atlaskit/eslint-plugin-design-system 13.41.3 → 13.43.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.
Files changed (100) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/presets/all-flat.codegen.js +2 -2
  4. package/dist/cjs/presets/all.codegen.js +2 -2
  5. package/dist/cjs/presets/recommended-flat.codegen.js +2 -1
  6. package/dist/cjs/presets/recommended.codegen.js +2 -1
  7. package/dist/cjs/rules/index.codegen.js +3 -3
  8. package/dist/cjs/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +5 -4
  9. package/dist/cjs/rules/use-textfield-autocomplete/index.js +153 -0
  10. package/dist/es2019/presets/all-flat.codegen.js +2 -2
  11. package/dist/es2019/presets/all.codegen.js +2 -2
  12. package/dist/es2019/presets/recommended-flat.codegen.js +2 -1
  13. package/dist/es2019/presets/recommended.codegen.js +2 -1
  14. package/dist/es2019/rules/index.codegen.js +3 -3
  15. package/dist/es2019/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +5 -4
  16. package/dist/es2019/rules/use-textfield-autocomplete/index.js +147 -0
  17. package/dist/esm/presets/all-flat.codegen.js +2 -2
  18. package/dist/esm/presets/all.codegen.js +2 -2
  19. package/dist/esm/presets/recommended-flat.codegen.js +2 -1
  20. package/dist/esm/presets/recommended.codegen.js +2 -1
  21. package/dist/esm/rules/index.codegen.js +3 -3
  22. package/dist/esm/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +5 -4
  23. package/dist/esm/rules/use-textfield-autocomplete/index.js +147 -0
  24. package/dist/types/presets/all-flat.codegen.d.ts +1 -1
  25. package/dist/types/presets/all.codegen.d.ts +1 -1
  26. package/dist/types/presets/recommended-flat.codegen.d.ts +1 -1
  27. package/dist/types/presets/recommended.codegen.d.ts +1 -1
  28. package/dist/types/rules/ensure-design-token-usage/index.d.ts +1 -1
  29. package/dist/types/rules/ensure-design-token-usage/rule-meta.d.ts +1 -1
  30. package/dist/types/rules/ensure-design-token-usage/utils.d.ts +1 -1
  31. package/dist/types/rules/index.codegen.d.ts +1 -1
  32. package/dist/types/rules/no-deprecated-imports/handlers/icon.d.ts +1 -1
  33. package/dist/types/rules/use-heading/transformers/common.d.ts +2 -2
  34. package/dist/types/rules/use-latest-xcss-syntax-typography/linters/common.d.ts +1 -1
  35. package/dist/types/rules/use-latest-xcss-syntax-typography/linters/wrapped-token-value.d.ts +1 -1
  36. package/dist/types/rules/use-primitives/transformers/compiled-styled/index.d.ts +1 -1
  37. package/dist/types/rules/use-primitives/transformers/emotion-css/index.d.ts +1 -1
  38. package/dist/types/rules/use-primitives/utils/is-valid-css-properties-to-transform.d.ts +1 -1
  39. package/dist/types/rules/use-primitives/utils/validate-styles.d.ts +1 -1
  40. package/dist/types/rules/use-primitives-text/transformers/common.d.ts +1 -1
  41. package/dist/types/rules/use-primitives-text/transformers/unsafe-small-text.d.ts +1 -1
  42. package/dist/types/rules/use-textfield-autocomplete/index.d.ts +4 -0
  43. package/dist/types/rules/use-tokens-typography/config/index.d.ts +1 -1
  44. package/dist/types/rules/use-tokens-typography/transformers/banned-properties.d.ts +1 -1
  45. package/dist/types/rules/use-tokens-typography/transformers/font-family.d.ts +1 -1
  46. package/dist/types/rules/use-tokens-typography/transformers/font-weight.d.ts +1 -1
  47. package/dist/types/rules/use-tokens-typography/transformers/restricted-capitalisation.d.ts +1 -1
  48. package/dist/types/rules/use-tokens-typography/transformers/style-object.d.ts +1 -1
  49. package/dist/types/rules/use-tokens-typography/transformers/untokenized-properties.d.ts +1 -1
  50. package/dist/types/rules/utils/create-no-exported-rule/check-if-supported-export.d.ts +1 -1
  51. package/dist/types/rules/utils/get-first-supported-import.d.ts +1 -1
  52. package/dist/types-ts4.5/presets/all-flat.codegen.d.ts +1 -1
  53. package/dist/types-ts4.5/presets/all.codegen.d.ts +1 -1
  54. package/dist/types-ts4.5/presets/recommended-flat.codegen.d.ts +1 -1
  55. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +1 -1
  56. package/dist/types-ts4.5/rules/ensure-design-token-usage/index.d.ts +1 -1
  57. package/dist/types-ts4.5/rules/ensure-design-token-usage/rule-meta.d.ts +1 -1
  58. package/dist/types-ts4.5/rules/ensure-design-token-usage/utils.d.ts +1 -1
  59. package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -1
  60. package/dist/types-ts4.5/rules/no-deprecated-imports/handlers/icon.d.ts +1 -1
  61. package/dist/types-ts4.5/rules/use-heading/transformers/common.d.ts +2 -2
  62. package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/linters/common.d.ts +1 -1
  63. package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/linters/wrapped-token-value.d.ts +1 -1
  64. package/dist/types-ts4.5/rules/use-primitives/transformers/compiled-styled/index.d.ts +1 -1
  65. package/dist/types-ts4.5/rules/use-primitives/transformers/emotion-css/index.d.ts +1 -1
  66. package/dist/types-ts4.5/rules/use-primitives/utils/is-valid-css-properties-to-transform.d.ts +1 -1
  67. package/dist/types-ts4.5/rules/use-primitives/utils/validate-styles.d.ts +1 -1
  68. package/dist/types-ts4.5/rules/use-primitives-text/transformers/common.d.ts +1 -1
  69. package/dist/types-ts4.5/rules/use-primitives-text/transformers/unsafe-small-text.d.ts +1 -1
  70. package/dist/types-ts4.5/rules/use-textfield-autocomplete/index.d.ts +4 -0
  71. package/dist/types-ts4.5/rules/use-tokens-typography/config/index.d.ts +1 -1
  72. package/dist/types-ts4.5/rules/use-tokens-typography/transformers/banned-properties.d.ts +1 -1
  73. package/dist/types-ts4.5/rules/use-tokens-typography/transformers/font-family.d.ts +1 -1
  74. package/dist/types-ts4.5/rules/use-tokens-typography/transformers/font-weight.d.ts +1 -1
  75. package/dist/types-ts4.5/rules/use-tokens-typography/transformers/restricted-capitalisation.d.ts +1 -1
  76. package/dist/types-ts4.5/rules/use-tokens-typography/transformers/style-object.d.ts +1 -1
  77. package/dist/types-ts4.5/rules/use-tokens-typography/transformers/untokenized-properties.d.ts +1 -1
  78. package/dist/types-ts4.5/rules/utils/create-no-exported-rule/check-if-supported-export.d.ts +1 -1
  79. package/dist/types-ts4.5/rules/utils/get-first-supported-import.d.ts +1 -1
  80. package/package.json +4 -4
  81. package/dist/cjs/rules/no-legacy-icons/checks.js +0 -619
  82. package/dist/cjs/rules/no-legacy-icons/helpers.js +0 -900
  83. package/dist/cjs/rules/no-legacy-icons/index.js +0 -91
  84. package/dist/cjs/rules/no-legacy-icons/upcoming-icons.js +0 -7
  85. package/dist/es2019/rules/no-legacy-icons/checks.js +0 -520
  86. package/dist/es2019/rules/no-legacy-icons/helpers.js +0 -853
  87. package/dist/es2019/rules/no-legacy-icons/index.js +0 -87
  88. package/dist/es2019/rules/no-legacy-icons/upcoming-icons.js +0 -1
  89. package/dist/esm/rules/no-legacy-icons/checks.js +0 -613
  90. package/dist/esm/rules/no-legacy-icons/helpers.js +0 -891
  91. package/dist/esm/rules/no-legacy-icons/index.js +0 -85
  92. package/dist/esm/rules/no-legacy-icons/upcoming-icons.js +0 -1
  93. package/dist/types/rules/no-legacy-icons/checks.d.ts +0 -16
  94. package/dist/types/rules/no-legacy-icons/helpers.d.ts +0 -151
  95. package/dist/types/rules/no-legacy-icons/index.d.ts +0 -2
  96. package/dist/types/rules/no-legacy-icons/upcoming-icons.d.ts +0 -1
  97. package/dist/types-ts4.5/rules/no-legacy-icons/checks.d.ts +0 -16
  98. package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +0 -156
  99. package/dist/types-ts4.5/rules/no-legacy-icons/index.d.ts +0 -2
  100. package/dist/types-ts4.5/rules/no-legacy-icons/upcoming-icons.d.ts +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 13.43.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`7c66756e9392b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7c66756e9392b) -
8
+ Add use-textfield-autocomplete rule to flag inaccessible use of autocomplete prop for email, url
9
+ and tel text fields
10
+
11
+ ## 13.42.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`0daada0469ab8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0daada0469ab8) -
16
+ Remove `@atlaskit/icon/migration-map` entry point, `IconMigrationMap` and
17
+ `IconMigrationSizeGuidance` types from `@atlaskit/icon`, and `@atlaskit/icon-lab/migration-map`
18
+ entry point. These were only needed to support the legacy glyph icon migration path which has now
19
+ been fully completed. Remove the `no-legacy-icons` ESLint rule from
20
+ `@atlaskit/eslint-plugin-design-system` as `@atlaskit/icon/glyph` and
21
+ `@atlaskit/icon/core/migration` no longer exist.
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies
26
+
3
27
  ## 13.41.3
4
28
 
5
29
  ### Patch Changes
package/README.md CHANGED
@@ -85,7 +85,6 @@ module.exports = {
85
85
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-icon-spacing-prop/README.md">no-icon-spacing-prop</a> | Disallows usage of the deprecated spacing prop on new icons. Use Flex with cssMap for spacing instead. | Yes | | Yes |
86
86
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-invalid-css-map/README.md">no-invalid-css-map</a> | Checks the validity of a CSS map created through cssMap. This is intended to be used alongside TypeScript's type-checking. | Yes | | |
87
87
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-keyframes-tagged-template-expression/README.md">no-keyframes-tagged-template-expression</a> | Disallows any `keyframe` tagged template expressions that originate from Emotion, Styled Components or Compiled | | Yes | |
88
- | <a href="./packages/design-system/eslint-plugin/src/rules/no-legacy-icons/README.md">no-legacy-icons</a> | Enforces no legacy icons are used. | | Yes | Yes |
89
88
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-margin/README.md">no-margin</a> | Disallow using the margin CSS property. | | | |
90
89
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-nested-styles/README.md">no-nested-styles</a> | Disallows use of nested styles in `css` functions. | Yes | | |
91
90
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-physical-properties/README.md">no-physical-properties</a> | Disallow physical properties and values in `css` and `cssMap` function calls. | | Yes | |
@@ -122,6 +121,7 @@ module.exports = {
122
121
  | <a href="./packages/design-system/eslint-plugin/src/rules/use-simple-form/README.md">use-simple-form</a> | Encourage use of simple form for better developer experience and accessibility. | Yes | | Yes |
123
122
  | <a href="./packages/design-system/eslint-plugin/src/rules/use-spotlight-package/README.md">use-spotlight-package</a> | Discourage the use of @atlaskit/onboarding in favor of @atlaskit/spotlight. | | Yes | Yes |
124
123
  | <a href="./packages/design-system/eslint-plugin/src/rules/use-tag-group-label/README.md">use-tag-group-label</a> | Ensures tag groups are described to assistive technology by a direct label or by another element. | Yes | | Yes |
124
+ | <a href="./packages/design-system/eslint-plugin/src/rules/use-textfield-autocomplete/README.md">use-textfield-autocomplete</a> | Enforce that Textfield components with type="email", "tel", or "url" have an appropriate autocomplete value for WCAG 2.2 SC 1.3.5 compliance (Identify Input Purpose). | Yes | Yes | |
125
125
  | <a href="./packages/design-system/eslint-plugin/src/rules/use-tokens-shape/README.md">use-tokens-shape</a> | Enforces usage of shape design tokens rather than hard-coded values. | | Yes | Yes |
126
126
  | <a href="./packages/design-system/eslint-plugin/src/rules/use-tokens-space/README.md">use-tokens-space</a> | Enforces usage of space design tokens rather than hard-coded values. | | Yes | Yes |
127
127
  | <a href="./packages/design-system/eslint-plugin/src/rules/use-tokens-typography/README.md">use-tokens-typography</a> | Enforces usage of design tokens for typography properties rather than hard-coded values. | Yes | Yes | Yes |
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  /**
8
8
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
9
- * @codegen <<SignedSource::6a7b233fc5b211ee3868899e1525bbdb>>
9
+ * @codegen <<SignedSource::d924c9b1f1f815e7bbe77b86ee42ad86>>
10
10
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
11
11
  */
12
12
 
@@ -49,7 +49,6 @@ var rules = {
49
49
  allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
50
50
  }],
51
51
  '@atlaskit/design-system/no-keyframes-tagged-template-expression': 'error',
52
- '@atlaskit/design-system/no-legacy-icons': 'warn',
53
52
  '@atlaskit/design-system/no-margin': 'warn',
54
53
  '@atlaskit/design-system/no-nested-styles': 'error',
55
54
  '@atlaskit/design-system/no-physical-properties': 'error',
@@ -86,6 +85,7 @@ var rules = {
86
85
  '@atlaskit/design-system/use-simple-form': 'warn',
87
86
  '@atlaskit/design-system/use-spotlight-package': 'warn',
88
87
  '@atlaskit/design-system/use-tag-group-label': 'warn',
88
+ '@atlaskit/design-system/use-textfield-autocomplete': 'warn',
89
89
  '@atlaskit/design-system/use-tokens-shape': 'error',
90
90
  '@atlaskit/design-system/use-tokens-space': 'error',
91
91
  '@atlaskit/design-system/use-tokens-typography': 'warn',
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  /**
8
8
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
9
- * @codegen <<SignedSource::69b963bac3d18247c1cba21a3bca7bb4>>
9
+ * @codegen <<SignedSource::9dbc4d90a7430699860bd67938cfd53b>>
10
10
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
11
11
  */
12
12
 
@@ -48,7 +48,6 @@ var rules = {
48
48
  allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
49
49
  }],
50
50
  '@atlaskit/design-system/no-keyframes-tagged-template-expression': 'error',
51
- '@atlaskit/design-system/no-legacy-icons': 'warn',
52
51
  '@atlaskit/design-system/no-margin': 'warn',
53
52
  '@atlaskit/design-system/no-nested-styles': 'error',
54
53
  '@atlaskit/design-system/no-physical-properties': 'error',
@@ -85,6 +84,7 @@ var rules = {
85
84
  '@atlaskit/design-system/use-simple-form': 'warn',
86
85
  '@atlaskit/design-system/use-spotlight-package': 'warn',
87
86
  '@atlaskit/design-system/use-tag-group-label': 'warn',
87
+ '@atlaskit/design-system/use-textfield-autocomplete': 'warn',
88
88
  '@atlaskit/design-system/use-tokens-shape': 'error',
89
89
  '@atlaskit/design-system/use-tokens-space': 'error',
90
90
  '@atlaskit/design-system/use-tokens-typography': 'warn',
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  /**
8
8
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
9
- * @codegen <<SignedSource::6f0d931df90a4eea8dc4201b3a8e0866>>
9
+ * @codegen <<SignedSource::e38fe36e83da94463de0e055c45eac02>>
10
10
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
11
11
  */
12
12
 
@@ -67,6 +67,7 @@ var rules = {
67
67
  '@atlaskit/design-system/use-simple-field': 'warn',
68
68
  '@atlaskit/design-system/use-simple-form': 'warn',
69
69
  '@atlaskit/design-system/use-tag-group-label': 'warn',
70
+ '@atlaskit/design-system/use-textfield-autocomplete': 'warn',
70
71
  '@atlaskit/design-system/use-tokens-typography': 'warn',
71
72
  '@atlaskit/design-system/use-visually-hidden': 'error'
72
73
  }
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  /**
8
8
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
9
- * @codegen <<SignedSource::aa118aeb6a9c0d954f6e3a5ea7bd10af>>
9
+ * @codegen <<SignedSource::a12b7837d2a4105c5d20b49d5b9b54ab>>
10
10
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
11
11
  */
12
12
 
@@ -66,6 +66,7 @@ var rules = {
66
66
  '@atlaskit/design-system/use-simple-field': 'warn',
67
67
  '@atlaskit/design-system/use-simple-form': 'warn',
68
68
  '@atlaskit/design-system/use-tag-group-label': 'warn',
69
+ '@atlaskit/design-system/use-textfield-autocomplete': 'warn',
69
70
  '@atlaskit/design-system/use-tokens-typography': 'warn',
70
71
  '@atlaskit/design-system/use-visually-hidden': 'error'
71
72
  }
@@ -41,7 +41,6 @@ var _noHtmlTextarea = _interopRequireDefault(require("./no-html-textarea"));
41
41
  var _noIconSpacingProp = _interopRequireDefault(require("./no-icon-spacing-prop"));
42
42
  var _noInvalidCssMap = _interopRequireDefault(require("./no-invalid-css-map"));
43
43
  var _noKeyframesTaggedTemplateExpression = _interopRequireDefault(require("./no-keyframes-tagged-template-expression"));
44
- var _noLegacyIcons = _interopRequireDefault(require("./no-legacy-icons"));
45
44
  var _noMargin = _interopRequireDefault(require("./no-margin"));
46
45
  var _noNestedStyles = _interopRequireDefault(require("./no-nested-styles"));
47
46
  var _noPhysicalProperties = _interopRequireDefault(require("./no-physical-properties"));
@@ -78,13 +77,14 @@ var _useSimpleField = _interopRequireDefault(require("./use-simple-field"));
78
77
  var _useSimpleForm = _interopRequireDefault(require("./use-simple-form"));
79
78
  var _useSpotlightPackage = _interopRequireDefault(require("./use-spotlight-package"));
80
79
  var _useTagGroupLabel = _interopRequireDefault(require("./use-tag-group-label"));
80
+ var _useTextfieldAutocomplete = _interopRequireDefault(require("./use-textfield-autocomplete"));
81
81
  var _useTokensShape = _interopRequireDefault(require("./use-tokens-shape"));
82
82
  var _useTokensSpace = _interopRequireDefault(require("./use-tokens-space"));
83
83
  var _useTokensTypography = _interopRequireDefault(require("./use-tokens-typography"));
84
84
  var _useVisuallyHidden = _interopRequireDefault(require("./use-visually-hidden"));
85
85
  /**
86
86
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
87
- * @codegen <<SignedSource::5d0d1213db83267889fa81e0aab419f7>>
87
+ * @codegen <<SignedSource::aec1237f211398c8225cd256e75476ff>>
88
88
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
89
89
  */
90
90
 
@@ -125,7 +125,6 @@ var rules = exports.rules = {
125
125
  'no-icon-spacing-prop': _noIconSpacingProp.default,
126
126
  'no-invalid-css-map': _noInvalidCssMap.default,
127
127
  'no-keyframes-tagged-template-expression': _noKeyframesTaggedTemplateExpression.default,
128
- 'no-legacy-icons': _noLegacyIcons.default,
129
128
  'no-margin': _noMargin.default,
130
129
  'no-nested-styles': _noNestedStyles.default,
131
130
  'no-physical-properties': _noPhysicalProperties.default,
@@ -162,6 +161,7 @@ var rules = exports.rules = {
162
161
  'use-simple-form': _useSimpleForm.default,
163
162
  'use-spotlight-package': _useSpotlightPackage.default,
164
163
  'use-tag-group-label': _useTagGroupLabel.default,
164
+ 'use-textfield-autocomplete': _useTextfieldAutocomplete.default,
165
165
  'use-tokens-shape': _useTokensShape.default,
166
166
  'use-tokens-space': _useTokensSpace.default,
167
167
  'use-tokens-typography': _useTokensTypography.default,
@@ -73,10 +73,11 @@ var isValidCssPropertiesToTransform = exports.isValidCssPropertiesToTransform =
73
73
  return _cssToXcss.supportedStylesMap[styleProperty] && _cssToXcss.supportedStylesMap[styleProperty][styleValue.fallbackValue] === styleValue.tokenName;
74
74
  } else {
75
75
  // direct value used
76
- return _cssToXcss.supportedStylesMap[styleProperty] &&
77
- // Is the key something we can map
78
- _cssToXcss.supportedStylesMap[styleProperty][styleValue] // Is the value something we can map
79
- ;
76
+ return (
77
+ // Is the value something we can map
78
+ // Is the key something we can map
79
+ _cssToXcss.supportedStylesMap[styleProperty] && _cssToXcss.supportedStylesMap[styleProperty][styleValue]
80
+ );
80
81
  }
81
82
  });
82
83
  if (!containsOnlyValidStyles) {
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ruleName = exports.default = void 0;
7
+ var _eslintCodemodUtils = require("eslint-codemod-utils");
8
+ var _jsxAttribute = require("../../ast-nodes/jsx-attribute");
9
+ var _jsxElement = require("../../ast-nodes/jsx-element");
10
+ var _createRule = require("../utils/create-rule");
11
+ var TEXTFIELD_PACKAGE = '@atlaskit/textfield';
12
+ var TYPE_PROP = 'type';
13
+ var AUTOCOMPLETE_PROP = 'autoComplete';
14
+
15
+ /**
16
+ * Mapping of input types to their corresponding autocomplete values
17
+ * Can be expanded in the future for other input types (tel, url, etc.)
18
+ */
19
+ var TYPE_TO_AUTOCOMPLETE = {
20
+ email: 'email',
21
+ tel: 'tel',
22
+ url: 'url'
23
+ };
24
+ var ruleName = exports.ruleName = __dirname.split('/').slice(-1)[0];
25
+ var rule = (0, _createRule.createLintRule)({
26
+ meta: {
27
+ name: ruleName,
28
+ type: 'suggestion',
29
+ fixable: 'code',
30
+ docs: {
31
+ description: 'Enforce that Textfield components with type="email", "tel", or "url" have an appropriate autocomplete value for WCAG 2.2 SC 1.3.5 compliance (Identify Input Purpose).',
32
+ recommended: true,
33
+ severity: 'warn'
34
+ },
35
+ messages: {
36
+ missingAutocomplete: 'Textfield with type="email", "tel", or "url" should have an appropriate autocomplete value to comply with WCAG 2.2 SC 1.3.5 (Identify Input Purpose).',
37
+ noAutocompleteOff: 'Textfield with type="email", "tel", or "url" should not have autocomplete="off". Set it to an appropriate autocomplete value to comply with WCAG 2.2 SC 1.3.5 (Identify Input Purpose).'
38
+ }
39
+ },
40
+ create: function create(context) {
41
+ // Track locally imported Textfield component names
42
+ var textfieldImportNames = [];
43
+ return {
44
+ // Track imports from @atlaskit/textfield
45
+ ImportDeclaration: function ImportDeclaration(node) {
46
+ if (node.source.value !== TEXTFIELD_PACKAGE) {
47
+ return;
48
+ }
49
+ node.specifiers.forEach(function (spec) {
50
+ // Handle: import Textfield from '@atlaskit/textfield'
51
+ if ((0, _eslintCodemodUtils.isNodeOfType)(spec, 'ImportDefaultSpecifier')) {
52
+ textfieldImportNames.push(spec.local.name);
53
+ }
54
+ // Handle: import { default as Textfield } from '@atlaskit/textfield' (edge case)
55
+ if ((0, _eslintCodemodUtils.isNodeOfType)(spec, 'ImportSpecifier') && spec.imported.name === 'default') {
56
+ textfieldImportNames.push(spec.local.name);
57
+ }
58
+ });
59
+ },
60
+ JSXElement: function JSXElement(node) {
61
+ if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'JSXElement')) {
62
+ return;
63
+ }
64
+
65
+ // Check if this is a Textfield component
66
+ if (!(0, _eslintCodemodUtils.isNodeOfType)(node.openingElement.name, 'JSXIdentifier')) {
67
+ return;
68
+ }
69
+ var componentName = node.openingElement.name.name;
70
+ if (!textfieldImportNames.includes(componentName)) {
71
+ return;
72
+ }
73
+
74
+ // Check for type prop
75
+ var typeProp = _jsxElement.JSXElementHelper.getAttributeByName(node, TYPE_PROP);
76
+ if (!typeProp) {
77
+ return;
78
+ }
79
+
80
+ // Get the type value - only process if it's a static string literal
81
+ var typeValue = _jsxAttribute.JSXAttribute.getValue(typeProp);
82
+ if (!typeValue || typeValue.type !== 'Literal') {
83
+ // Skip dynamic types (e.g., type={inputType})
84
+ return;
85
+ }
86
+ var typeString = String(typeValue.value);
87
+ if (!(typeString in TYPE_TO_AUTOCOMPLETE)) {
88
+ // Skip if type is not one we're checking
89
+ return;
90
+ }
91
+ var expectedAutocomplete = TYPE_TO_AUTOCOMPLETE[typeString];
92
+
93
+ // Check for autoComplete prop
94
+ var autoCompleteProp = _jsxElement.JSXElementHelper.getAttributeByName(node, AUTOCOMPLETE_PROP);
95
+ if (!autoCompleteProp) {
96
+ // Missing autoComplete entirely
97
+ return context.report({
98
+ node: node,
99
+ messageId: 'missingAutocomplete',
100
+ fix: function fix(fixer) {
101
+ return _jsxElement.JSXElementHelper.addAttribute(node, AUTOCOMPLETE_PROP, expectedAutocomplete, fixer);
102
+ }
103
+ });
104
+ }
105
+
106
+ // Check the autoComplete value
107
+ var autoCompleteValue = _jsxAttribute.JSXAttribute.getValue(autoCompleteProp);
108
+ if (!autoCompleteValue) {
109
+ // Boolean `autoComplete` has no value node — add the prop. `autoComplete=""` also yields no
110
+ // getValue() (shared helper skips falsy literals); we report but do not autofix to avoid
111
+ // inserting a duplicate attribute.
112
+ return context.report({
113
+ node: node,
114
+ messageId: 'missingAutocomplete',
115
+ fix: function fix(fixer) {
116
+ if (!autoCompleteProp.value) {
117
+ return _jsxElement.JSXElementHelper.addAttribute(node, AUTOCOMPLETE_PROP, expectedAutocomplete, fixer);
118
+ }
119
+ return null;
120
+ }
121
+ });
122
+ }
123
+
124
+ // Handle different value types
125
+ if (autoCompleteValue.type === 'Literal') {
126
+ var valueString = String(autoCompleteValue.value);
127
+
128
+ // Check for "off"
129
+ if (valueString === 'off') {
130
+ return context.report({
131
+ node: node,
132
+ messageId: 'noAutocompleteOff',
133
+ fix: function fix(fixer) {
134
+ if (autoCompleteProp.value && (0, _eslintCodemodUtils.isNodeOfType)(autoCompleteProp.value, 'Literal')) {
135
+ return fixer.replaceText(autoCompleteProp.value, "\"".concat(expectedAutocomplete, "\""));
136
+ }
137
+ return null;
138
+ }
139
+ });
140
+ }
141
+
142
+ // Valid autoComplete value (e.g. "email")
143
+ // If it is an invalid value, it will be caught by the jsx-a11y/autocomplete-valid rule
144
+ return;
145
+ }
146
+
147
+ // If it's a dynamic expression (e.g., autoComplete={someVar}), we can't statically analyze it
148
+ // so we allow it
149
+ }
150
+ };
151
+ }
152
+ });
153
+ var _default = exports.default = rule;
@@ -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::6a7b233fc5b211ee3868899e1525bbdb>>
3
+ * @codegen <<SignedSource::d924c9b1f1f815e7bbe77b86ee42ad86>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
 
@@ -43,7 +43,6 @@ const rules = {
43
43
  allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
44
44
  }],
45
45
  '@atlaskit/design-system/no-keyframes-tagged-template-expression': 'error',
46
- '@atlaskit/design-system/no-legacy-icons': 'warn',
47
46
  '@atlaskit/design-system/no-margin': 'warn',
48
47
  '@atlaskit/design-system/no-nested-styles': 'error',
49
48
  '@atlaskit/design-system/no-physical-properties': 'error',
@@ -80,6 +79,7 @@ const rules = {
80
79
  '@atlaskit/design-system/use-simple-form': 'warn',
81
80
  '@atlaskit/design-system/use-spotlight-package': 'warn',
82
81
  '@atlaskit/design-system/use-tag-group-label': 'warn',
82
+ '@atlaskit/design-system/use-textfield-autocomplete': 'warn',
83
83
  '@atlaskit/design-system/use-tokens-shape': 'error',
84
84
  '@atlaskit/design-system/use-tokens-space': 'error',
85
85
  '@atlaskit/design-system/use-tokens-typography': 'warn',
@@ -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::69b963bac3d18247c1cba21a3bca7bb4>>
3
+ * @codegen <<SignedSource::9dbc4d90a7430699860bd67938cfd53b>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
 
@@ -42,7 +42,6 @@ const rules = {
42
42
  allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
43
43
  }],
44
44
  '@atlaskit/design-system/no-keyframes-tagged-template-expression': 'error',
45
- '@atlaskit/design-system/no-legacy-icons': 'warn',
46
45
  '@atlaskit/design-system/no-margin': 'warn',
47
46
  '@atlaskit/design-system/no-nested-styles': 'error',
48
47
  '@atlaskit/design-system/no-physical-properties': 'error',
@@ -79,6 +78,7 @@ const rules = {
79
78
  '@atlaskit/design-system/use-simple-form': 'warn',
80
79
  '@atlaskit/design-system/use-spotlight-package': 'warn',
81
80
  '@atlaskit/design-system/use-tag-group-label': 'warn',
81
+ '@atlaskit/design-system/use-textfield-autocomplete': 'warn',
82
82
  '@atlaskit/design-system/use-tokens-shape': 'error',
83
83
  '@atlaskit/design-system/use-tokens-space': 'error',
84
84
  '@atlaskit/design-system/use-tokens-typography': 'warn',
@@ -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::6f0d931df90a4eea8dc4201b3a8e0866>>
3
+ * @codegen <<SignedSource::e38fe36e83da94463de0e055c45eac02>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
 
@@ -61,6 +61,7 @@ const rules = {
61
61
  '@atlaskit/design-system/use-simple-field': 'warn',
62
62
  '@atlaskit/design-system/use-simple-form': 'warn',
63
63
  '@atlaskit/design-system/use-tag-group-label': 'warn',
64
+ '@atlaskit/design-system/use-textfield-autocomplete': 'warn',
64
65
  '@atlaskit/design-system/use-tokens-typography': 'warn',
65
66
  '@atlaskit/design-system/use-visually-hidden': 'error'
66
67
  }
@@ -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::aa118aeb6a9c0d954f6e3a5ea7bd10af>>
3
+ * @codegen <<SignedSource::a12b7837d2a4105c5d20b49d5b9b54ab>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
 
@@ -60,6 +60,7 @@ const rules = {
60
60
  '@atlaskit/design-system/use-simple-field': 'warn',
61
61
  '@atlaskit/design-system/use-simple-form': 'warn',
62
62
  '@atlaskit/design-system/use-tag-group-label': 'warn',
63
+ '@atlaskit/design-system/use-textfield-autocomplete': 'warn',
63
64
  '@atlaskit/design-system/use-tokens-typography': 'warn',
64
65
  '@atlaskit/design-system/use-visually-hidden': 'error'
65
66
  }
@@ -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::5d0d1213db83267889fa81e0aab419f7>>
3
+ * @codegen <<SignedSource::aec1237f211398c8225cd256e75476ff>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
 
@@ -40,7 +40,6 @@ import noHtmlTextarea from './no-html-textarea';
40
40
  import noIconSpacingProp from './no-icon-spacing-prop';
41
41
  import noInvalidCssMap from './no-invalid-css-map';
42
42
  import noKeyframesTaggedTemplateExpression from './no-keyframes-tagged-template-expression';
43
- import noLegacyIcons from './no-legacy-icons';
44
43
  import noMargin from './no-margin';
45
44
  import noNestedStyles from './no-nested-styles';
46
45
  import noPhysicalProperties from './no-physical-properties';
@@ -77,6 +76,7 @@ import useSimpleField from './use-simple-field';
77
76
  import useSimpleForm from './use-simple-form';
78
77
  import useSpotlightPackage from './use-spotlight-package';
79
78
  import useTagGroupLabel from './use-tag-group-label';
79
+ import useTextfieldAutocomplete from './use-textfield-autocomplete';
80
80
  import useTokensShape from './use-tokens-shape';
81
81
  import useTokensSpace from './use-tokens-space';
82
82
  import useTokensTypography from './use-tokens-typography';
@@ -118,7 +118,6 @@ export const rules = {
118
118
  'no-icon-spacing-prop': noIconSpacingProp,
119
119
  'no-invalid-css-map': noInvalidCssMap,
120
120
  'no-keyframes-tagged-template-expression': noKeyframesTaggedTemplateExpression,
121
- 'no-legacy-icons': noLegacyIcons,
122
121
  'no-margin': noMargin,
123
122
  'no-nested-styles': noNestedStyles,
124
123
  'no-physical-properties': noPhysicalProperties,
@@ -155,6 +154,7 @@ export const rules = {
155
154
  'use-simple-form': useSimpleForm,
156
155
  'use-spotlight-package': useSpotlightPackage,
157
156
  'use-tag-group-label': useTagGroupLabel,
157
+ 'use-textfield-autocomplete': useTextfieldAutocomplete,
158
158
  'use-tokens-shape': useTokensShape,
159
159
  'use-tokens-space': useTokensSpace,
160
160
  'use-tokens-typography': useTokensTypography,
@@ -58,10 +58,11 @@ export const isValidCssPropertiesToTransform = (node, config) => {
58
58
  return supportedStylesMap[styleProperty] && supportedStylesMap[styleProperty][styleValue.fallbackValue] === styleValue.tokenName;
59
59
  } else {
60
60
  // direct value used
61
- return supportedStylesMap[styleProperty] &&
62
- // Is the key something we can map
63
- supportedStylesMap[styleProperty][styleValue] // Is the value something we can map
64
- ;
61
+ return (
62
+ // Is the value something we can map
63
+ // Is the key something we can map
64
+ supportedStylesMap[styleProperty] && supportedStylesMap[styleProperty][styleValue]
65
+ );
65
66
  }
66
67
  });
67
68
  if (!containsOnlyValidStyles) {
@@ -0,0 +1,147 @@
1
+ import { isNodeOfType } from 'eslint-codemod-utils';
2
+ import { JSXAttribute } from '../../ast-nodes/jsx-attribute';
3
+ import { JSXElementHelper } from '../../ast-nodes/jsx-element';
4
+ import { createLintRule } from '../utils/create-rule';
5
+ const TEXTFIELD_PACKAGE = '@atlaskit/textfield';
6
+ const TYPE_PROP = 'type';
7
+ const AUTOCOMPLETE_PROP = 'autoComplete';
8
+
9
+ /**
10
+ * Mapping of input types to their corresponding autocomplete values
11
+ * Can be expanded in the future for other input types (tel, url, etc.)
12
+ */
13
+ const TYPE_TO_AUTOCOMPLETE = {
14
+ email: 'email',
15
+ tel: 'tel',
16
+ url: 'url'
17
+ };
18
+ export const ruleName = __dirname.split('/').slice(-1)[0];
19
+ const rule = createLintRule({
20
+ meta: {
21
+ name: ruleName,
22
+ type: 'suggestion',
23
+ fixable: 'code',
24
+ docs: {
25
+ description: 'Enforce that Textfield components with type="email", "tel", or "url" have an appropriate autocomplete value for WCAG 2.2 SC 1.3.5 compliance (Identify Input Purpose).',
26
+ recommended: true,
27
+ severity: 'warn'
28
+ },
29
+ messages: {
30
+ missingAutocomplete: 'Textfield with type="email", "tel", or "url" should have an appropriate autocomplete value to comply with WCAG 2.2 SC 1.3.5 (Identify Input Purpose).',
31
+ noAutocompleteOff: 'Textfield with type="email", "tel", or "url" should not have autocomplete="off". Set it to an appropriate autocomplete value to comply with WCAG 2.2 SC 1.3.5 (Identify Input Purpose).'
32
+ }
33
+ },
34
+ create(context) {
35
+ // Track locally imported Textfield component names
36
+ const textfieldImportNames = [];
37
+ return {
38
+ // Track imports from @atlaskit/textfield
39
+ ImportDeclaration(node) {
40
+ if (node.source.value !== TEXTFIELD_PACKAGE) {
41
+ return;
42
+ }
43
+ node.specifiers.forEach(spec => {
44
+ // Handle: import Textfield from '@atlaskit/textfield'
45
+ if (isNodeOfType(spec, 'ImportDefaultSpecifier')) {
46
+ textfieldImportNames.push(spec.local.name);
47
+ }
48
+ // Handle: import { default as Textfield } from '@atlaskit/textfield' (edge case)
49
+ if (isNodeOfType(spec, 'ImportSpecifier') && spec.imported.name === 'default') {
50
+ textfieldImportNames.push(spec.local.name);
51
+ }
52
+ });
53
+ },
54
+ JSXElement(node) {
55
+ if (!isNodeOfType(node, 'JSXElement')) {
56
+ return;
57
+ }
58
+
59
+ // Check if this is a Textfield component
60
+ if (!isNodeOfType(node.openingElement.name, 'JSXIdentifier')) {
61
+ return;
62
+ }
63
+ const componentName = node.openingElement.name.name;
64
+ if (!textfieldImportNames.includes(componentName)) {
65
+ return;
66
+ }
67
+
68
+ // Check for type prop
69
+ const typeProp = JSXElementHelper.getAttributeByName(node, TYPE_PROP);
70
+ if (!typeProp) {
71
+ return;
72
+ }
73
+
74
+ // Get the type value - only process if it's a static string literal
75
+ const typeValue = JSXAttribute.getValue(typeProp);
76
+ if (!typeValue || typeValue.type !== 'Literal') {
77
+ // Skip dynamic types (e.g., type={inputType})
78
+ return;
79
+ }
80
+ const typeString = String(typeValue.value);
81
+ if (!(typeString in TYPE_TO_AUTOCOMPLETE)) {
82
+ // Skip if type is not one we're checking
83
+ return;
84
+ }
85
+ const expectedAutocomplete = TYPE_TO_AUTOCOMPLETE[typeString];
86
+
87
+ // Check for autoComplete prop
88
+ const autoCompleteProp = JSXElementHelper.getAttributeByName(node, AUTOCOMPLETE_PROP);
89
+ if (!autoCompleteProp) {
90
+ // Missing autoComplete entirely
91
+ return context.report({
92
+ node,
93
+ messageId: 'missingAutocomplete',
94
+ fix(fixer) {
95
+ return JSXElementHelper.addAttribute(node, AUTOCOMPLETE_PROP, expectedAutocomplete, fixer);
96
+ }
97
+ });
98
+ }
99
+
100
+ // Check the autoComplete value
101
+ const autoCompleteValue = JSXAttribute.getValue(autoCompleteProp);
102
+ if (!autoCompleteValue) {
103
+ // Boolean `autoComplete` has no value node — add the prop. `autoComplete=""` also yields no
104
+ // getValue() (shared helper skips falsy literals); we report but do not autofix to avoid
105
+ // inserting a duplicate attribute.
106
+ return context.report({
107
+ node,
108
+ messageId: 'missingAutocomplete',
109
+ fix(fixer) {
110
+ if (!autoCompleteProp.value) {
111
+ return JSXElementHelper.addAttribute(node, AUTOCOMPLETE_PROP, expectedAutocomplete, fixer);
112
+ }
113
+ return null;
114
+ }
115
+ });
116
+ }
117
+
118
+ // Handle different value types
119
+ if (autoCompleteValue.type === 'Literal') {
120
+ const valueString = String(autoCompleteValue.value);
121
+
122
+ // Check for "off"
123
+ if (valueString === 'off') {
124
+ return context.report({
125
+ node,
126
+ messageId: 'noAutocompleteOff',
127
+ fix(fixer) {
128
+ if (autoCompleteProp.value && isNodeOfType(autoCompleteProp.value, 'Literal')) {
129
+ return fixer.replaceText(autoCompleteProp.value, `"${expectedAutocomplete}"`);
130
+ }
131
+ return null;
132
+ }
133
+ });
134
+ }
135
+
136
+ // Valid autoComplete value (e.g. "email")
137
+ // If it is an invalid value, it will be caught by the jsx-a11y/autocomplete-valid rule
138
+ return;
139
+ }
140
+
141
+ // If it's a dynamic expression (e.g., autoComplete={someVar}), we can't statically analyze it
142
+ // so we allow it
143
+ }
144
+ };
145
+ }
146
+ });
147
+ export default rule;