@atlaskit/eslint-plugin-design-system 13.1.2 → 13.3.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 (38) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +1 -0
  3. package/dist/cjs/presets/all-flat.codegen.js +2 -1
  4. package/dist/cjs/presets/all.codegen.js +2 -1
  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/consistent-css-prop-usage/index.js +14 -4
  8. package/dist/cjs/rules/index.codegen.js +3 -1
  9. package/dist/cjs/rules/no-boolean-autofocus-on-modal-dialog/index.js +82 -0
  10. package/dist/es2019/presets/all-flat.codegen.js +2 -1
  11. package/dist/es2019/presets/all.codegen.js +2 -1
  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/consistent-css-prop-usage/index.js +14 -4
  15. package/dist/es2019/rules/index.codegen.js +3 -1
  16. package/dist/es2019/rules/no-boolean-autofocus-on-modal-dialog/index.js +76 -0
  17. package/dist/esm/presets/all-flat.codegen.js +2 -1
  18. package/dist/esm/presets/all.codegen.js +2 -1
  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/consistent-css-prop-usage/index.js +14 -4
  22. package/dist/esm/rules/index.codegen.js +3 -1
  23. package/dist/esm/rules/no-boolean-autofocus-on-modal-dialog/index.js +76 -0
  24. package/dist/types/index.codegen.d.ts +9 -0
  25. package/dist/types/presets/all-flat.codegen.d.ts +1 -0
  26. package/dist/types/presets/all.codegen.d.ts +1 -0
  27. package/dist/types/presets/recommended-flat.codegen.d.ts +1 -0
  28. package/dist/types/presets/recommended.codegen.d.ts +1 -0
  29. package/dist/types/rules/index.codegen.d.ts +1 -0
  30. package/dist/types/rules/no-boolean-autofocus-on-modal-dialog/index.d.ts +5 -0
  31. package/dist/types-ts4.5/index.codegen.d.ts +9 -0
  32. package/dist/types-ts4.5/presets/all-flat.codegen.d.ts +1 -0
  33. package/dist/types-ts4.5/presets/all.codegen.d.ts +1 -0
  34. package/dist/types-ts4.5/presets/recommended-flat.codegen.d.ts +1 -0
  35. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +1 -0
  36. package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
  37. package/dist/types-ts4.5/rules/no-boolean-autofocus-on-modal-dialog/index.d.ts +5 -0
  38. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 13.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#131514](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/131514)
8
+ [`74ddca032fe0f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/74ddca032fe0f) -
9
+ Fixes @atlaskit/eslint-plugin-ui-styling-standard/consistent-css-prop-usage to allow aliased
10
+ imports, eg., import { css as css2 } from '@compiled/react'
11
+
12
+ ## 13.2.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#132664](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/132664)
17
+ [`30cdea781a4b2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/30cdea781a4b2) -
18
+ Add rule for booleans on `autoFocus` in modal dialog.
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+
3
24
  ## 13.1.2
4
25
 
5
26
  ### Patch Changes
package/README.md CHANGED
@@ -55,6 +55,7 @@ module.exports = {
55
55
  | <a href="./packages/design-system/eslint-plugin/src/rules/ensure-icon-color/README.md">ensure-icon-color</a> | Enforces that upcoming icon components have a color prop set, to enable a migration of the default value. | | | |
56
56
  | <a href="./packages/design-system/eslint-plugin/src/rules/icon-label/README.md">icon-label</a> | Enforces accessible usage of icon labels when composed with Atlassian Design System components. | Yes | Yes | |
57
57
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-banned-imports/README.md">no-banned-imports</a> | Disallow importing banned modules. | Yes | | |
58
+ | <a href="./packages/design-system/eslint-plugin/src/rules/no-boolean-autofocus-on-modal-dialog/README.md">no-boolean-autofocus-on-modal-dialog</a> | Encourages makers to not use boolean values for `autoFocus` on Atlassian Design System's modal dialog component. | Yes | | |
58
59
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-css-tagged-template-expression/README.md">no-css-tagged-template-expression</a> | Disallows any `css` tagged template expressions that originate from Emotion, Styled Components or Compiled | | Yes | |
59
60
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-custom-icons/README.md">no-custom-icons</a> | Enforces custom glyph icons are used. | | | |
60
61
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-dark-theme-vr-tests/README.md">no-dark-theme-vr-tests</a> | Disallow using dark colorScheme in VR tests. | | 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::f4b6800bf45a85f5c3acea28681b1cbc>>
9
+ * @codegen <<SignedSource::f468eaa1b0e61e0eba404cafc58f6977>>
10
10
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
11
11
  */
12
12
  var _default = exports.default = {
@@ -19,6 +19,7 @@ var _default = exports.default = {
19
19
  '@atlaskit/design-system/ensure-icon-color': 'error',
20
20
  '@atlaskit/design-system/icon-label': 'warn',
21
21
  '@atlaskit/design-system/no-banned-imports': 'error',
22
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
22
23
  '@atlaskit/design-system/no-css-tagged-template-expression': 'error',
23
24
  '@atlaskit/design-system/no-custom-icons': 'warn',
24
25
  '@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
@@ -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::d9b89cc91a0359b1083c0020c56e1e7f>>
9
+ * @codegen <<SignedSource::29cc321a798c65c8464afd9e46366540>>
10
10
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
11
11
  */
12
12
  var _default = exports.default = {
@@ -18,6 +18,7 @@ var _default = exports.default = {
18
18
  '@atlaskit/design-system/ensure-icon-color': 'error',
19
19
  '@atlaskit/design-system/icon-label': 'warn',
20
20
  '@atlaskit/design-system/no-banned-imports': 'error',
21
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
21
22
  '@atlaskit/design-system/no-css-tagged-template-expression': 'error',
22
23
  '@atlaskit/design-system/no-custom-icons': 'warn',
23
24
  '@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
@@ -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::f697bb4e7d6f53db6d4d1f522ae0ba43>>
9
+ * @codegen <<SignedSource::76f6f7b7602ea240cbcfc6bc98a781af>>
10
10
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
11
11
  */
12
12
  var _default = exports.default = {
@@ -17,6 +17,7 @@ var _default = exports.default = {
17
17
  '@atlaskit/design-system/ensure-design-token-usage': 'error',
18
18
  '@atlaskit/design-system/icon-label': 'warn',
19
19
  '@atlaskit/design-system/no-banned-imports': 'error',
20
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
20
21
  '@atlaskit/design-system/no-deprecated-apis': 'error',
21
22
  '@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
22
23
  '@atlaskit/design-system/no-deprecated-imports': 'error',
@@ -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::c593f40801552ec33891506bcba81689>>
9
+ * @codegen <<SignedSource::98f3a7e3c7f8f8532248994786f11c98>>
10
10
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
11
11
  */
12
12
  var _default = exports.default = {
@@ -16,6 +16,7 @@ var _default = exports.default = {
16
16
  '@atlaskit/design-system/ensure-design-token-usage': 'error',
17
17
  '@atlaskit/design-system/icon-label': 'warn',
18
18
  '@atlaskit/design-system/no-banned-imports': 'error',
19
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
19
20
  '@atlaskit/design-system/no-deprecated-apis': 'error',
20
21
  '@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
21
22
  '@atlaskit/design-system/no-deprecated-imports': 'error',
@@ -24,9 +24,19 @@ var _getImportNodeBySource = require("../utils/get-import-node-by-source");
24
24
  var isDOMElementName = function isDOMElementName(elementName) {
25
25
  return elementName.charAt(0) !== elementName.charAt(0).toUpperCase() && elementName.charAt(0) === elementName.charAt(0).toLowerCase();
26
26
  };
27
- function isCssCallExpression(node, cssFunctions) {
27
+ function isCssCallExpression(node, cssFunctions, context) {
28
28
  cssFunctions = [].concat((0, _toConsumableArray2.default)(cssFunctions), ['cssMap']);
29
- return !!((0, _eslintCodemodUtils.isNodeOfType)(node, 'CallExpression') && node.callee && node.callee.type === 'Identifier' && cssFunctions.includes(node.callee.name) && node.arguments.length && node.arguments[0].type === 'ObjectExpression');
29
+ if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'CallExpression') || !(0, _eslintCodemodUtils.isNodeOfType)(node.callee, 'Identifier')) {
30
+ return false;
31
+ }
32
+ var module = (0, _getImportNodeBySource.getModuleOfIdentifier)((0, _contextCompat.getSourceCode)(context), node.callee.name);
33
+ if (!module) {
34
+ return false;
35
+ }
36
+ if (!cssFunctions.includes(module.importName)) {
37
+ return false;
38
+ }
39
+ return node.arguments.length > 0 && node.arguments[0].type === 'ObjectExpression';
30
40
  }
31
41
  function findSpreadProperties(node) {
32
42
  return node.properties.filter(function (property) {
@@ -161,7 +171,7 @@ var JSXExpressionLinter = /*#__PURE__*/function () {
161
171
  });
162
172
  return;
163
173
  }
164
- if (identifier.parent && identifier.parent.init && !isCssCallExpression(identifier.parent.init, this.configuration.cssFunctions)) {
174
+ if (identifier.parent && identifier.parent.init && !isCssCallExpression(identifier.parent.init, this.configuration.cssFunctions, this.context)) {
165
175
  // When variable value is not of type css({})
166
176
  var value = identifier.parent.init;
167
177
  if (!value) {
@@ -473,7 +483,7 @@ var JSXExpressionLinter = /*#__PURE__*/function () {
473
483
  }
474
484
 
475
485
  // Don't fix CallExpressions unless they're from cssFunctions or cssMap
476
- if (expression.type === 'CallExpression' && !isCssCallExpression(expression, _this3.configuration.cssFunctions)) {
486
+ if (expression.type === 'CallExpression' && !isCssCallExpression(expression, _this3.configuration.cssFunctions, _this3.context)) {
477
487
  return [];
478
488
  }
479
489
  if (expression.type === 'ObjectExpression') {
@@ -11,6 +11,7 @@ var _ensureDesignTokenUsagePreview = _interopRequireDefault(require("./ensure-de
11
11
  var _ensureIconColor = _interopRequireDefault(require("./ensure-icon-color"));
12
12
  var _iconLabel = _interopRequireDefault(require("./icon-label"));
13
13
  var _noBannedImports = _interopRequireDefault(require("./no-banned-imports"));
14
+ var _noBooleanAutofocusOnModalDialog = _interopRequireDefault(require("./no-boolean-autofocus-on-modal-dialog"));
14
15
  var _noCssTaggedTemplateExpression = _interopRequireDefault(require("./no-css-tagged-template-expression"));
15
16
  var _noCustomIcons = _interopRequireDefault(require("./no-custom-icons"));
16
17
  var _noDarkThemeVrTests = _interopRequireDefault(require("./no-dark-theme-vr-tests"));
@@ -55,7 +56,7 @@ var _useTokensTypography = _interopRequireDefault(require("./use-tokens-typograp
55
56
  var _useVisuallyHidden = _interopRequireDefault(require("./use-visually-hidden"));
56
57
  /**
57
58
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
58
- * @codegen <<SignedSource::4655f06909a45281bdcc9780314776c5>>
59
+ * @codegen <<SignedSource::551d1887446166d5a78fc51663d43e9c>>
59
60
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
60
61
  */
61
62
 
@@ -66,6 +67,7 @@ var rules = exports.rules = {
66
67
  'ensure-icon-color': _ensureIconColor.default,
67
68
  'icon-label': _iconLabel.default,
68
69
  'no-banned-imports': _noBannedImports.default,
70
+ 'no-boolean-autofocus-on-modal-dialog': _noBooleanAutofocusOnModalDialog.default,
69
71
  'no-css-tagged-template-expression': _noCssTaggedTemplateExpression.default,
70
72
  'no-custom-icons': _noCustomIcons.default,
71
73
  'no-dark-theme-vr-tests': _noDarkThemeVrTests.default,
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ruleName = exports.message = 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
+ // eslint-disable-next-line import/no-extraneous-dependencies
12
+
13
+ var PROP_NAME = 'autoFocus';
14
+
15
+ // Lint rule message
16
+ var message = exports.message = "`autoFocus` should be set to a component's `ref` or left to resolve to the default value of `true`. It is recommended to leave it as is for a maximally accessible experience.";
17
+ var ruleName = exports.ruleName = __dirname.split('/').slice(-1)[0];
18
+ var rule = (0, _createRule.createLintRule)({
19
+ meta: {
20
+ name: ruleName,
21
+ type: 'problem',
22
+ docs: {
23
+ description: "Encourages makers to not use boolean values for `autoFocus` on Atlassian Design System's modal dialog component.",
24
+ recommended: true,
25
+ severity: 'warn'
26
+ },
27
+ messages: {
28
+ noBooleanForAutoFocus: message
29
+ }
30
+ },
31
+ create: function create(context) {
32
+ // List of component's locally imported names that match
33
+ var defaultImportLocalName;
34
+ return {
35
+ // Only run rule in files where the package is imported
36
+ ImportDeclaration: function ImportDeclaration(node) {
37
+ // Ignore non-modal imports
38
+ if (node.source.value !== '@atlaskit/modal-dialog') {
39
+ return;
40
+ }
41
+ node.specifiers.filter(function (identifier) {
42
+ return (0, _eslintCodemodUtils.isNodeOfType)(identifier, 'ImportDefaultSpecifier');
43
+ }).forEach(function (identifier) {
44
+ defaultImportLocalName = identifier.local.name;
45
+ });
46
+ },
47
+ JSXElement: function JSXElement(node) {
48
+ if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'JSXElement')) {
49
+ return;
50
+ }
51
+ if (!(0, _eslintCodemodUtils.isNodeOfType)(node.openingElement.name, 'JSXIdentifier')) {
52
+ return;
53
+ }
54
+ var name = node.openingElement.name.name;
55
+ if (name !== defaultImportLocalName) {
56
+ return;
57
+ }
58
+ var prop = _jsxElement.JSXElementHelper.getAttributeByName(node, PROP_NAME);
59
+
60
+ // if no autoFocus attribute exists, skip
61
+ if (!prop) {
62
+ return;
63
+ }
64
+ var attrValue = _jsxAttribute.JSXAttribute.getValue(prop);
65
+ if (!attrValue) {
66
+ return;
67
+ }
68
+ var type = attrValue.type,
69
+ value = attrValue.value;
70
+
71
+ // If the value is a boolean with value `false`
72
+ if (type === 'ExpressionStatement Literal' && typeof value === 'boolean') {
73
+ return context.report({
74
+ node: node,
75
+ messageId: 'noBooleanForAutoFocus'
76
+ });
77
+ }
78
+ }
79
+ };
80
+ }
81
+ });
82
+ 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::f4b6800bf45a85f5c3acea28681b1cbc>>
3
+ * @codegen <<SignedSource::f468eaa1b0e61e0eba404cafc58f6977>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
 
@@ -14,6 +14,7 @@ export default {
14
14
  '@atlaskit/design-system/ensure-icon-color': 'error',
15
15
  '@atlaskit/design-system/icon-label': 'warn',
16
16
  '@atlaskit/design-system/no-banned-imports': 'error',
17
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
17
18
  '@atlaskit/design-system/no-css-tagged-template-expression': 'error',
18
19
  '@atlaskit/design-system/no-custom-icons': 'warn',
19
20
  '@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
@@ -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::d9b89cc91a0359b1083c0020c56e1e7f>>
3
+ * @codegen <<SignedSource::29cc321a798c65c8464afd9e46366540>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
 
@@ -13,6 +13,7 @@ export default {
13
13
  '@atlaskit/design-system/ensure-icon-color': 'error',
14
14
  '@atlaskit/design-system/icon-label': 'warn',
15
15
  '@atlaskit/design-system/no-banned-imports': 'error',
16
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
16
17
  '@atlaskit/design-system/no-css-tagged-template-expression': 'error',
17
18
  '@atlaskit/design-system/no-custom-icons': 'warn',
18
19
  '@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
@@ -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::f697bb4e7d6f53db6d4d1f522ae0ba43>>
3
+ * @codegen <<SignedSource::76f6f7b7602ea240cbcfc6bc98a781af>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
 
@@ -12,6 +12,7 @@ export default {
12
12
  '@atlaskit/design-system/ensure-design-token-usage': 'error',
13
13
  '@atlaskit/design-system/icon-label': 'warn',
14
14
  '@atlaskit/design-system/no-banned-imports': 'error',
15
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
15
16
  '@atlaskit/design-system/no-deprecated-apis': 'error',
16
17
  '@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
17
18
  '@atlaskit/design-system/no-deprecated-imports': 'error',
@@ -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::c593f40801552ec33891506bcba81689>>
3
+ * @codegen <<SignedSource::98f3a7e3c7f8f8532248994786f11c98>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
 
@@ -11,6 +11,7 @@ export default {
11
11
  '@atlaskit/design-system/ensure-design-token-usage': 'error',
12
12
  '@atlaskit/design-system/icon-label': 'warn',
13
13
  '@atlaskit/design-system/no-banned-imports': 'error',
14
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
14
15
  '@atlaskit/design-system/no-deprecated-apis': 'error',
15
16
  '@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
16
17
  '@atlaskit/design-system/no-deprecated-imports': 'error',
@@ -11,9 +11,19 @@ import { createLintRule } from '../utils/create-rule';
11
11
  import { getFirstSupportedImport } from '../utils/get-first-supported-import';
12
12
  import { getModuleOfIdentifier } from '../utils/get-import-node-by-source';
13
13
  const isDOMElementName = elementName => elementName.charAt(0) !== elementName.charAt(0).toUpperCase() && elementName.charAt(0) === elementName.charAt(0).toLowerCase();
14
- function isCssCallExpression(node, cssFunctions) {
14
+ function isCssCallExpression(node, cssFunctions, context) {
15
15
  cssFunctions = [...cssFunctions, 'cssMap'];
16
- return !!(isNodeOfType(node, 'CallExpression') && node.callee && node.callee.type === 'Identifier' && cssFunctions.includes(node.callee.name) && node.arguments.length && node.arguments[0].type === 'ObjectExpression');
16
+ if (!isNodeOfType(node, 'CallExpression') || !isNodeOfType(node.callee, 'Identifier')) {
17
+ return false;
18
+ }
19
+ const module = getModuleOfIdentifier(getSourceCode(context), node.callee.name);
20
+ if (!module) {
21
+ return false;
22
+ }
23
+ if (!cssFunctions.includes(module.importName)) {
24
+ return false;
25
+ }
26
+ return node.arguments.length > 0 && node.arguments[0].type === 'ObjectExpression';
17
27
  }
18
28
  function findSpreadProperties(node) {
19
29
  return node.properties.filter(property => property.type === 'SpreadElement' ||
@@ -135,7 +145,7 @@ class JSXExpressionLinter {
135
145
  });
136
146
  return;
137
147
  }
138
- if (identifier.parent && identifier.parent.init && !isCssCallExpression(identifier.parent.init, this.configuration.cssFunctions)) {
148
+ if (identifier.parent && identifier.parent.init && !isCssCallExpression(identifier.parent.init, this.configuration.cssFunctions, this.context)) {
139
149
  // When variable value is not of type css({})
140
150
  const value = identifier.parent.init;
141
151
  if (!value) {
@@ -429,7 +439,7 @@ class JSXExpressionLinter {
429
439
  }
430
440
 
431
441
  // Don't fix CallExpressions unless they're from cssFunctions or cssMap
432
- if (expression.type === 'CallExpression' && !isCssCallExpression(expression, this.configuration.cssFunctions)) {
442
+ if (expression.type === 'CallExpression' && !isCssCallExpression(expression, this.configuration.cssFunctions, this.context)) {
433
443
  return [];
434
444
  }
435
445
  if (expression.type === 'ObjectExpression') {
@@ -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::4655f06909a45281bdcc9780314776c5>>
3
+ * @codegen <<SignedSource::551d1887446166d5a78fc51663d43e9c>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  import consistentCssPropUsage from './consistent-css-prop-usage';
@@ -9,6 +9,7 @@ import ensureDesignTokenUsagePreview from './ensure-design-token-usage-preview';
9
9
  import ensureIconColor from './ensure-icon-color';
10
10
  import iconLabel from './icon-label';
11
11
  import noBannedImports from './no-banned-imports';
12
+ import noBooleanAutofocusOnModalDialog from './no-boolean-autofocus-on-modal-dialog';
12
13
  import noCssTaggedTemplateExpression from './no-css-tagged-template-expression';
13
14
  import noCustomIcons from './no-custom-icons';
14
15
  import noDarkThemeVrTests from './no-dark-theme-vr-tests';
@@ -58,6 +59,7 @@ export const rules = {
58
59
  'ensure-icon-color': ensureIconColor,
59
60
  'icon-label': iconLabel,
60
61
  'no-banned-imports': noBannedImports,
62
+ 'no-boolean-autofocus-on-modal-dialog': noBooleanAutofocusOnModalDialog,
61
63
  'no-css-tagged-template-expression': noCssTaggedTemplateExpression,
62
64
  'no-custom-icons': noCustomIcons,
63
65
  'no-dark-theme-vr-tests': noDarkThemeVrTests,
@@ -0,0 +1,76 @@
1
+ // eslint-disable-next-line import/no-extraneous-dependencies
2
+
3
+ import { isNodeOfType } from 'eslint-codemod-utils';
4
+ import { JSXAttribute } from '../../ast-nodes/jsx-attribute';
5
+ import { JSXElementHelper } from '../../ast-nodes/jsx-element';
6
+ import { createLintRule } from '../utils/create-rule';
7
+ const PROP_NAME = 'autoFocus';
8
+
9
+ // Lint rule message
10
+ export const message = "`autoFocus` should be set to a component's `ref` or left to resolve to the default value of `true`. It is recommended to leave it as is for a maximally accessible experience.";
11
+ export const ruleName = __dirname.split('/').slice(-1)[0];
12
+ const rule = createLintRule({
13
+ meta: {
14
+ name: ruleName,
15
+ type: 'problem',
16
+ docs: {
17
+ description: "Encourages makers to not use boolean values for `autoFocus` on Atlassian Design System's modal dialog component.",
18
+ recommended: true,
19
+ severity: 'warn'
20
+ },
21
+ messages: {
22
+ noBooleanForAutoFocus: message
23
+ }
24
+ },
25
+ create(context) {
26
+ // List of component's locally imported names that match
27
+ let defaultImportLocalName;
28
+ return {
29
+ // Only run rule in files where the package is imported
30
+ ImportDeclaration(node) {
31
+ // Ignore non-modal imports
32
+ if (node.source.value !== '@atlaskit/modal-dialog') {
33
+ return;
34
+ }
35
+ node.specifiers.filter(identifier => isNodeOfType(identifier, 'ImportDefaultSpecifier')).forEach(identifier => {
36
+ defaultImportLocalName = identifier.local.name;
37
+ });
38
+ },
39
+ JSXElement(node) {
40
+ if (!isNodeOfType(node, 'JSXElement')) {
41
+ return;
42
+ }
43
+ if (!isNodeOfType(node.openingElement.name, 'JSXIdentifier')) {
44
+ return;
45
+ }
46
+ const name = node.openingElement.name.name;
47
+ if (name !== defaultImportLocalName) {
48
+ return;
49
+ }
50
+ const prop = JSXElementHelper.getAttributeByName(node, PROP_NAME);
51
+
52
+ // if no autoFocus attribute exists, skip
53
+ if (!prop) {
54
+ return;
55
+ }
56
+ const attrValue = JSXAttribute.getValue(prop);
57
+ if (!attrValue) {
58
+ return;
59
+ }
60
+ const {
61
+ type,
62
+ value
63
+ } = attrValue;
64
+
65
+ // If the value is a boolean with value `false`
66
+ if (type === 'ExpressionStatement Literal' && typeof value === 'boolean') {
67
+ return context.report({
68
+ node,
69
+ messageId: 'noBooleanForAutoFocus'
70
+ });
71
+ }
72
+ }
73
+ };
74
+ }
75
+ });
76
+ export 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::f4b6800bf45a85f5c3acea28681b1cbc>>
3
+ * @codegen <<SignedSource::f468eaa1b0e61e0eba404cafc58f6977>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
 
@@ -14,6 +14,7 @@ export default {
14
14
  '@atlaskit/design-system/ensure-icon-color': 'error',
15
15
  '@atlaskit/design-system/icon-label': 'warn',
16
16
  '@atlaskit/design-system/no-banned-imports': 'error',
17
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
17
18
  '@atlaskit/design-system/no-css-tagged-template-expression': 'error',
18
19
  '@atlaskit/design-system/no-custom-icons': 'warn',
19
20
  '@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
@@ -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::d9b89cc91a0359b1083c0020c56e1e7f>>
3
+ * @codegen <<SignedSource::29cc321a798c65c8464afd9e46366540>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
 
@@ -13,6 +13,7 @@ export default {
13
13
  '@atlaskit/design-system/ensure-icon-color': 'error',
14
14
  '@atlaskit/design-system/icon-label': 'warn',
15
15
  '@atlaskit/design-system/no-banned-imports': 'error',
16
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
16
17
  '@atlaskit/design-system/no-css-tagged-template-expression': 'error',
17
18
  '@atlaskit/design-system/no-custom-icons': 'warn',
18
19
  '@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
@@ -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::f697bb4e7d6f53db6d4d1f522ae0ba43>>
3
+ * @codegen <<SignedSource::76f6f7b7602ea240cbcfc6bc98a781af>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
 
@@ -12,6 +12,7 @@ export default {
12
12
  '@atlaskit/design-system/ensure-design-token-usage': 'error',
13
13
  '@atlaskit/design-system/icon-label': 'warn',
14
14
  '@atlaskit/design-system/no-banned-imports': 'error',
15
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
15
16
  '@atlaskit/design-system/no-deprecated-apis': 'error',
16
17
  '@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
17
18
  '@atlaskit/design-system/no-deprecated-imports': 'error',
@@ -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::c593f40801552ec33891506bcba81689>>
3
+ * @codegen <<SignedSource::98f3a7e3c7f8f8532248994786f11c98>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
 
@@ -11,6 +11,7 @@ export default {
11
11
  '@atlaskit/design-system/ensure-design-token-usage': 'error',
12
12
  '@atlaskit/design-system/icon-label': 'warn',
13
13
  '@atlaskit/design-system/no-banned-imports': 'error',
14
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
14
15
  '@atlaskit/design-system/no-deprecated-apis': 'error',
15
16
  '@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
16
17
  '@atlaskit/design-system/no-deprecated-imports': 'error',
@@ -17,9 +17,19 @@ import { getModuleOfIdentifier } from '../utils/get-import-node-by-source';
17
17
  var isDOMElementName = function isDOMElementName(elementName) {
18
18
  return elementName.charAt(0) !== elementName.charAt(0).toUpperCase() && elementName.charAt(0) === elementName.charAt(0).toLowerCase();
19
19
  };
20
- function isCssCallExpression(node, cssFunctions) {
20
+ function isCssCallExpression(node, cssFunctions, context) {
21
21
  cssFunctions = [].concat(_toConsumableArray(cssFunctions), ['cssMap']);
22
- return !!(isNodeOfType(node, 'CallExpression') && node.callee && node.callee.type === 'Identifier' && cssFunctions.includes(node.callee.name) && node.arguments.length && node.arguments[0].type === 'ObjectExpression');
22
+ if (!isNodeOfType(node, 'CallExpression') || !isNodeOfType(node.callee, 'Identifier')) {
23
+ return false;
24
+ }
25
+ var module = getModuleOfIdentifier(getSourceCode(context), node.callee.name);
26
+ if (!module) {
27
+ return false;
28
+ }
29
+ if (!cssFunctions.includes(module.importName)) {
30
+ return false;
31
+ }
32
+ return node.arguments.length > 0 && node.arguments[0].type === 'ObjectExpression';
23
33
  }
24
34
  function findSpreadProperties(node) {
25
35
  return node.properties.filter(function (property) {
@@ -154,7 +164,7 @@ var JSXExpressionLinter = /*#__PURE__*/function () {
154
164
  });
155
165
  return;
156
166
  }
157
- if (identifier.parent && identifier.parent.init && !isCssCallExpression(identifier.parent.init, this.configuration.cssFunctions)) {
167
+ if (identifier.parent && identifier.parent.init && !isCssCallExpression(identifier.parent.init, this.configuration.cssFunctions, this.context)) {
158
168
  // When variable value is not of type css({})
159
169
  var value = identifier.parent.init;
160
170
  if (!value) {
@@ -466,7 +476,7 @@ var JSXExpressionLinter = /*#__PURE__*/function () {
466
476
  }
467
477
 
468
478
  // Don't fix CallExpressions unless they're from cssFunctions or cssMap
469
- if (expression.type === 'CallExpression' && !isCssCallExpression(expression, _this3.configuration.cssFunctions)) {
479
+ if (expression.type === 'CallExpression' && !isCssCallExpression(expression, _this3.configuration.cssFunctions, _this3.context)) {
470
480
  return [];
471
481
  }
472
482
  if (expression.type === 'ObjectExpression') {
@@ -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::4655f06909a45281bdcc9780314776c5>>
3
+ * @codegen <<SignedSource::551d1887446166d5a78fc51663d43e9c>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  import consistentCssPropUsage from './consistent-css-prop-usage';
@@ -9,6 +9,7 @@ import ensureDesignTokenUsagePreview from './ensure-design-token-usage-preview';
9
9
  import ensureIconColor from './ensure-icon-color';
10
10
  import iconLabel from './icon-label';
11
11
  import noBannedImports from './no-banned-imports';
12
+ import noBooleanAutofocusOnModalDialog from './no-boolean-autofocus-on-modal-dialog';
12
13
  import noCssTaggedTemplateExpression from './no-css-tagged-template-expression';
13
14
  import noCustomIcons from './no-custom-icons';
14
15
  import noDarkThemeVrTests from './no-dark-theme-vr-tests';
@@ -58,6 +59,7 @@ export var rules = {
58
59
  'ensure-icon-color': ensureIconColor,
59
60
  'icon-label': iconLabel,
60
61
  'no-banned-imports': noBannedImports,
62
+ 'no-boolean-autofocus-on-modal-dialog': noBooleanAutofocusOnModalDialog,
61
63
  'no-css-tagged-template-expression': noCssTaggedTemplateExpression,
62
64
  'no-custom-icons': noCustomIcons,
63
65
  'no-dark-theme-vr-tests': noDarkThemeVrTests,
@@ -0,0 +1,76 @@
1
+ // eslint-disable-next-line import/no-extraneous-dependencies
2
+
3
+ import { isNodeOfType } from 'eslint-codemod-utils';
4
+ import { JSXAttribute } from '../../ast-nodes/jsx-attribute';
5
+ import { JSXElementHelper } from '../../ast-nodes/jsx-element';
6
+ import { createLintRule } from '../utils/create-rule';
7
+ var PROP_NAME = 'autoFocus';
8
+
9
+ // Lint rule message
10
+ export var message = "`autoFocus` should be set to a component's `ref` or left to resolve to the default value of `true`. It is recommended to leave it as is for a maximally accessible experience.";
11
+ export var ruleName = __dirname.split('/').slice(-1)[0];
12
+ var rule = createLintRule({
13
+ meta: {
14
+ name: ruleName,
15
+ type: 'problem',
16
+ docs: {
17
+ description: "Encourages makers to not use boolean values for `autoFocus` on Atlassian Design System's modal dialog component.",
18
+ recommended: true,
19
+ severity: 'warn'
20
+ },
21
+ messages: {
22
+ noBooleanForAutoFocus: message
23
+ }
24
+ },
25
+ create: function create(context) {
26
+ // List of component's locally imported names that match
27
+ var defaultImportLocalName;
28
+ return {
29
+ // Only run rule in files where the package is imported
30
+ ImportDeclaration: function ImportDeclaration(node) {
31
+ // Ignore non-modal imports
32
+ if (node.source.value !== '@atlaskit/modal-dialog') {
33
+ return;
34
+ }
35
+ node.specifiers.filter(function (identifier) {
36
+ return isNodeOfType(identifier, 'ImportDefaultSpecifier');
37
+ }).forEach(function (identifier) {
38
+ defaultImportLocalName = identifier.local.name;
39
+ });
40
+ },
41
+ JSXElement: function JSXElement(node) {
42
+ if (!isNodeOfType(node, 'JSXElement')) {
43
+ return;
44
+ }
45
+ if (!isNodeOfType(node.openingElement.name, 'JSXIdentifier')) {
46
+ return;
47
+ }
48
+ var name = node.openingElement.name.name;
49
+ if (name !== defaultImportLocalName) {
50
+ return;
51
+ }
52
+ var prop = JSXElementHelper.getAttributeByName(node, PROP_NAME);
53
+
54
+ // if no autoFocus attribute exists, skip
55
+ if (!prop) {
56
+ return;
57
+ }
58
+ var attrValue = JSXAttribute.getValue(prop);
59
+ if (!attrValue) {
60
+ return;
61
+ }
62
+ var type = attrValue.type,
63
+ value = attrValue.value;
64
+
65
+ // If the value is a boolean with value `false`
66
+ if (type === 'ExpressionStatement Literal' && typeof value === 'boolean') {
67
+ return context.report({
68
+ node: node,
69
+ messageId: 'noBooleanForAutoFocus'
70
+ });
71
+ }
72
+ }
73
+ };
74
+ }
75
+ });
76
+ export default rule;
@@ -21,6 +21,7 @@ export declare const plugin: {
21
21
  'ensure-icon-color': import("eslint").Rule.RuleModule;
22
22
  'icon-label': import("eslint").Rule.RuleModule;
23
23
  'no-banned-imports': import("eslint").Rule.RuleModule;
24
+ 'no-boolean-autofocus-on-modal-dialog': import("eslint").Rule.RuleModule;
24
25
  'no-css-tagged-template-expression': import("eslint").Rule.RuleModule;
25
26
  'no-custom-icons': import("eslint").Rule.RuleModule;
26
27
  'no-dark-theme-vr-tests': import("eslint").Rule.RuleModule;
@@ -74,6 +75,7 @@ export declare const plugin: {
74
75
  '@atlaskit/design-system/ensure-icon-color': "error";
75
76
  '@atlaskit/design-system/icon-label': "warn";
76
77
  '@atlaskit/design-system/no-banned-imports': "error";
78
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
77
79
  '@atlaskit/design-system/no-css-tagged-template-expression': "error";
78
80
  '@atlaskit/design-system/no-custom-icons': "warn";
79
81
  '@atlaskit/design-system/no-dark-theme-vr-tests': "error";
@@ -128,6 +130,7 @@ export declare const plugin: {
128
130
  '@atlaskit/design-system/ensure-icon-color': "error";
129
131
  '@atlaskit/design-system/icon-label': "warn";
130
132
  '@atlaskit/design-system/no-banned-imports': "error";
133
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
131
134
  '@atlaskit/design-system/no-css-tagged-template-expression': "error";
132
135
  '@atlaskit/design-system/no-custom-icons': "warn";
133
136
  '@atlaskit/design-system/no-dark-theme-vr-tests': "error";
@@ -178,6 +181,7 @@ export declare const plugin: {
178
181
  '@atlaskit/design-system/ensure-design-token-usage': "error";
179
182
  '@atlaskit/design-system/icon-label': "warn";
180
183
  '@atlaskit/design-system/no-banned-imports': "error";
184
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
181
185
  '@atlaskit/design-system/no-deprecated-apis': "error";
182
186
  '@atlaskit/design-system/no-deprecated-design-token-usage': "warn";
183
187
  '@atlaskit/design-system/no-deprecated-imports': "error";
@@ -216,6 +220,7 @@ export declare const plugin: {
216
220
  '@atlaskit/design-system/ensure-design-token-usage': "error";
217
221
  '@atlaskit/design-system/icon-label': "warn";
218
222
  '@atlaskit/design-system/no-banned-imports': "error";
223
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
219
224
  '@atlaskit/design-system/no-deprecated-apis': "error";
220
225
  '@atlaskit/design-system/no-deprecated-design-token-usage': "warn";
221
226
  '@atlaskit/design-system/no-deprecated-imports': "error";
@@ -257,6 +262,7 @@ declare const configs: {
257
262
  '@atlaskit/design-system/ensure-icon-color': "error";
258
263
  '@atlaskit/design-system/icon-label': "warn";
259
264
  '@atlaskit/design-system/no-banned-imports': "error";
265
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
260
266
  '@atlaskit/design-system/no-css-tagged-template-expression': "error";
261
267
  '@atlaskit/design-system/no-custom-icons': "warn";
262
268
  '@atlaskit/design-system/no-dark-theme-vr-tests': "error";
@@ -311,6 +317,7 @@ declare const configs: {
311
317
  '@atlaskit/design-system/ensure-icon-color': "error";
312
318
  '@atlaskit/design-system/icon-label': "warn";
313
319
  '@atlaskit/design-system/no-banned-imports': "error";
320
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
314
321
  '@atlaskit/design-system/no-css-tagged-template-expression': "error";
315
322
  '@atlaskit/design-system/no-custom-icons': "warn";
316
323
  '@atlaskit/design-system/no-dark-theme-vr-tests': "error";
@@ -361,6 +368,7 @@ declare const configs: {
361
368
  '@atlaskit/design-system/ensure-design-token-usage': "error";
362
369
  '@atlaskit/design-system/icon-label': "warn";
363
370
  '@atlaskit/design-system/no-banned-imports': "error";
371
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
364
372
  '@atlaskit/design-system/no-deprecated-apis': "error";
365
373
  '@atlaskit/design-system/no-deprecated-design-token-usage': "warn";
366
374
  '@atlaskit/design-system/no-deprecated-imports': "error";
@@ -399,6 +407,7 @@ declare const configs: {
399
407
  '@atlaskit/design-system/ensure-design-token-usage': "error";
400
408
  '@atlaskit/design-system/icon-label': "warn";
401
409
  '@atlaskit/design-system/no-banned-imports': "error";
410
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
402
411
  '@atlaskit/design-system/no-deprecated-apis': "error";
403
412
  '@atlaskit/design-system/no-deprecated-design-token-usage': "warn";
404
413
  '@atlaskit/design-system/no-deprecated-imports': "error";
@@ -7,6 +7,7 @@ declare const _default: {
7
7
  '@atlaskit/design-system/ensure-icon-color': "error";
8
8
  '@atlaskit/design-system/icon-label': "warn";
9
9
  '@atlaskit/design-system/no-banned-imports': "error";
10
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
10
11
  '@atlaskit/design-system/no-css-tagged-template-expression': "error";
11
12
  '@atlaskit/design-system/no-custom-icons': "warn";
12
13
  '@atlaskit/design-system/no-dark-theme-vr-tests': "error";
@@ -7,6 +7,7 @@ declare const _default: {
7
7
  '@atlaskit/design-system/ensure-icon-color': "error";
8
8
  '@atlaskit/design-system/icon-label': "warn";
9
9
  '@atlaskit/design-system/no-banned-imports': "error";
10
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
10
11
  '@atlaskit/design-system/no-css-tagged-template-expression': "error";
11
12
  '@atlaskit/design-system/no-custom-icons': "warn";
12
13
  '@atlaskit/design-system/no-dark-theme-vr-tests': "error";
@@ -5,6 +5,7 @@ declare const _default: {
5
5
  '@atlaskit/design-system/ensure-design-token-usage': "error";
6
6
  '@atlaskit/design-system/icon-label': "warn";
7
7
  '@atlaskit/design-system/no-banned-imports': "error";
8
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
8
9
  '@atlaskit/design-system/no-deprecated-apis': "error";
9
10
  '@atlaskit/design-system/no-deprecated-design-token-usage': "warn";
10
11
  '@atlaskit/design-system/no-deprecated-imports': "error";
@@ -5,6 +5,7 @@ declare const _default: {
5
5
  '@atlaskit/design-system/ensure-design-token-usage': "error";
6
6
  '@atlaskit/design-system/icon-label': "warn";
7
7
  '@atlaskit/design-system/no-banned-imports': "error";
8
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
8
9
  '@atlaskit/design-system/no-deprecated-apis': "error";
9
10
  '@atlaskit/design-system/no-deprecated-design-token-usage': "warn";
10
11
  '@atlaskit/design-system/no-deprecated-imports': "error";
@@ -5,6 +5,7 @@ export declare const rules: {
5
5
  'ensure-icon-color': import("eslint").Rule.RuleModule;
6
6
  'icon-label': import("eslint").Rule.RuleModule;
7
7
  'no-banned-imports': import("eslint").Rule.RuleModule;
8
+ 'no-boolean-autofocus-on-modal-dialog': import("eslint").Rule.RuleModule;
8
9
  'no-css-tagged-template-expression': import("eslint").Rule.RuleModule;
9
10
  'no-custom-icons': import("eslint").Rule.RuleModule;
10
11
  'no-dark-theme-vr-tests': import("eslint").Rule.RuleModule;
@@ -0,0 +1,5 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const message = "`autoFocus` should be set to a component's `ref` or left to resolve to the default value of `true`. It is recommended to leave it as is for a maximally accessible experience.";
3
+ export declare const ruleName: string;
4
+ declare const rule: Rule.RuleModule;
5
+ export default rule;
@@ -21,6 +21,7 @@ export declare const plugin: {
21
21
  'ensure-icon-color': import("eslint").Rule.RuleModule;
22
22
  'icon-label': import("eslint").Rule.RuleModule;
23
23
  'no-banned-imports': import("eslint").Rule.RuleModule;
24
+ 'no-boolean-autofocus-on-modal-dialog': import("eslint").Rule.RuleModule;
24
25
  'no-css-tagged-template-expression': import("eslint").Rule.RuleModule;
25
26
  'no-custom-icons': import("eslint").Rule.RuleModule;
26
27
  'no-dark-theme-vr-tests': import("eslint").Rule.RuleModule;
@@ -74,6 +75,7 @@ export declare const plugin: {
74
75
  '@atlaskit/design-system/ensure-icon-color': "error";
75
76
  '@atlaskit/design-system/icon-label': "warn";
76
77
  '@atlaskit/design-system/no-banned-imports': "error";
78
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
77
79
  '@atlaskit/design-system/no-css-tagged-template-expression': "error";
78
80
  '@atlaskit/design-system/no-custom-icons': "warn";
79
81
  '@atlaskit/design-system/no-dark-theme-vr-tests': "error";
@@ -131,6 +133,7 @@ export declare const plugin: {
131
133
  '@atlaskit/design-system/ensure-icon-color': "error";
132
134
  '@atlaskit/design-system/icon-label': "warn";
133
135
  '@atlaskit/design-system/no-banned-imports': "error";
136
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
134
137
  '@atlaskit/design-system/no-css-tagged-template-expression': "error";
135
138
  '@atlaskit/design-system/no-custom-icons': "warn";
136
139
  '@atlaskit/design-system/no-dark-theme-vr-tests': "error";
@@ -184,6 +187,7 @@ export declare const plugin: {
184
187
  '@atlaskit/design-system/ensure-design-token-usage': "error";
185
188
  '@atlaskit/design-system/icon-label': "warn";
186
189
  '@atlaskit/design-system/no-banned-imports': "error";
190
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
187
191
  '@atlaskit/design-system/no-deprecated-apis': "error";
188
192
  '@atlaskit/design-system/no-deprecated-design-token-usage': "warn";
189
193
  '@atlaskit/design-system/no-deprecated-imports': "error";
@@ -225,6 +229,7 @@ export declare const plugin: {
225
229
  '@atlaskit/design-system/ensure-design-token-usage': "error";
226
230
  '@atlaskit/design-system/icon-label': "warn";
227
231
  '@atlaskit/design-system/no-banned-imports': "error";
232
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
228
233
  '@atlaskit/design-system/no-deprecated-apis': "error";
229
234
  '@atlaskit/design-system/no-deprecated-design-token-usage': "warn";
230
235
  '@atlaskit/design-system/no-deprecated-imports': "error";
@@ -269,6 +274,7 @@ declare const configs: {
269
274
  '@atlaskit/design-system/ensure-icon-color': "error";
270
275
  '@atlaskit/design-system/icon-label': "warn";
271
276
  '@atlaskit/design-system/no-banned-imports': "error";
277
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
272
278
  '@atlaskit/design-system/no-css-tagged-template-expression': "error";
273
279
  '@atlaskit/design-system/no-custom-icons': "warn";
274
280
  '@atlaskit/design-system/no-dark-theme-vr-tests': "error";
@@ -326,6 +332,7 @@ declare const configs: {
326
332
  '@atlaskit/design-system/ensure-icon-color': "error";
327
333
  '@atlaskit/design-system/icon-label': "warn";
328
334
  '@atlaskit/design-system/no-banned-imports': "error";
335
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
329
336
  '@atlaskit/design-system/no-css-tagged-template-expression': "error";
330
337
  '@atlaskit/design-system/no-custom-icons': "warn";
331
338
  '@atlaskit/design-system/no-dark-theme-vr-tests': "error";
@@ -379,6 +386,7 @@ declare const configs: {
379
386
  '@atlaskit/design-system/ensure-design-token-usage': "error";
380
387
  '@atlaskit/design-system/icon-label': "warn";
381
388
  '@atlaskit/design-system/no-banned-imports': "error";
389
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
382
390
  '@atlaskit/design-system/no-deprecated-apis': "error";
383
391
  '@atlaskit/design-system/no-deprecated-design-token-usage': "warn";
384
392
  '@atlaskit/design-system/no-deprecated-imports': "error";
@@ -420,6 +428,7 @@ declare const configs: {
420
428
  '@atlaskit/design-system/ensure-design-token-usage': "error";
421
429
  '@atlaskit/design-system/icon-label': "warn";
422
430
  '@atlaskit/design-system/no-banned-imports': "error";
431
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
423
432
  '@atlaskit/design-system/no-deprecated-apis': "error";
424
433
  '@atlaskit/design-system/no-deprecated-design-token-usage': "warn";
425
434
  '@atlaskit/design-system/no-deprecated-imports': "error";
@@ -7,6 +7,7 @@ declare const _default: {
7
7
  '@atlaskit/design-system/ensure-icon-color': "error";
8
8
  '@atlaskit/design-system/icon-label': "warn";
9
9
  '@atlaskit/design-system/no-banned-imports': "error";
10
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
10
11
  '@atlaskit/design-system/no-css-tagged-template-expression': "error";
11
12
  '@atlaskit/design-system/no-custom-icons': "warn";
12
13
  '@atlaskit/design-system/no-dark-theme-vr-tests': "error";
@@ -7,6 +7,7 @@ declare const _default: {
7
7
  '@atlaskit/design-system/ensure-icon-color': "error";
8
8
  '@atlaskit/design-system/icon-label': "warn";
9
9
  '@atlaskit/design-system/no-banned-imports': "error";
10
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
10
11
  '@atlaskit/design-system/no-css-tagged-template-expression': "error";
11
12
  '@atlaskit/design-system/no-custom-icons': "warn";
12
13
  '@atlaskit/design-system/no-dark-theme-vr-tests': "error";
@@ -5,6 +5,7 @@ declare const _default: {
5
5
  '@atlaskit/design-system/ensure-design-token-usage': "error";
6
6
  '@atlaskit/design-system/icon-label': "warn";
7
7
  '@atlaskit/design-system/no-banned-imports': "error";
8
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
8
9
  '@atlaskit/design-system/no-deprecated-apis': "error";
9
10
  '@atlaskit/design-system/no-deprecated-design-token-usage': "warn";
10
11
  '@atlaskit/design-system/no-deprecated-imports': "error";
@@ -5,6 +5,7 @@ declare const _default: {
5
5
  '@atlaskit/design-system/ensure-design-token-usage': "error";
6
6
  '@atlaskit/design-system/icon-label': "warn";
7
7
  '@atlaskit/design-system/no-banned-imports': "error";
8
+ '@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': "warn";
8
9
  '@atlaskit/design-system/no-deprecated-apis': "error";
9
10
  '@atlaskit/design-system/no-deprecated-design-token-usage': "warn";
10
11
  '@atlaskit/design-system/no-deprecated-imports': "error";
@@ -5,6 +5,7 @@ export declare const rules: {
5
5
  'ensure-icon-color': import("eslint").Rule.RuleModule;
6
6
  'icon-label': import("eslint").Rule.RuleModule;
7
7
  'no-banned-imports': import("eslint").Rule.RuleModule;
8
+ 'no-boolean-autofocus-on-modal-dialog': import("eslint").Rule.RuleModule;
8
9
  'no-css-tagged-template-expression': import("eslint").Rule.RuleModule;
9
10
  'no-custom-icons': import("eslint").Rule.RuleModule;
10
11
  'no-dark-theme-vr-tests': import("eslint").Rule.RuleModule;
@@ -0,0 +1,5 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const message = "`autoFocus` should be set to a component's `ref` or left to resolve to the default value of `true`. It is recommended to leave it as is for a maximally accessible experience.";
3
+ export declare const ruleName: string;
4
+ declare const rule: Rule.RuleModule;
5
+ export default rule;
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": "13.1.2",
4
+ "version": "13.3.0",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {
@@ -44,8 +44,8 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@atlaskit/eslint-utils": "^2.0.0",
47
- "@atlaskit/icon": "^25.0.0",
48
- "@atlaskit/icon-lab": "^4.3.0",
47
+ "@atlaskit/icon": "^25.2.0",
48
+ "@atlaskit/icon-lab": "^4.5.0",
49
49
  "@atlaskit/tokens": "^4.5.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "@typescript-eslint/utils": "^7.1.0",