@atlaskit/eslint-plugin-design-system 15.1.2 → 15.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.
- package/CHANGELOG.md +15 -0
- package/README.md +0 -1
- package/compass.yml +38 -0
- package/configs/deprecated.json +14 -2
- package/dist/cjs/presets/all-flat.codegen.js +1 -2
- package/dist/cjs/presets/all.codegen.js +1 -2
- package/dist/cjs/presets/recommended-flat.codegen.js +1 -2
- package/dist/cjs/presets/recommended.codegen.js +1 -2
- package/dist/cjs/rules/index.codegen.js +1 -3
- package/dist/configs/deprecated.json +14 -2
- package/dist/es2019/presets/all-flat.codegen.js +1 -2
- package/dist/es2019/presets/all.codegen.js +1 -2
- package/dist/es2019/presets/recommended-flat.codegen.js +1 -2
- package/dist/es2019/presets/recommended.codegen.js +1 -2
- package/dist/es2019/rules/index.codegen.js +1 -3
- package/dist/esm/presets/all-flat.codegen.js +1 -2
- package/dist/esm/presets/all.codegen.js +1 -2
- package/dist/esm/presets/recommended-flat.codegen.js +1 -2
- package/dist/esm/presets/recommended.codegen.js +1 -2
- package/dist/esm/rules/index.codegen.js +1 -3
- package/dist/types/presets/all-flat.codegen.d.ts +1 -1
- package/dist/types/presets/all.codegen.d.ts +1 -1
- package/dist/types/presets/recommended-flat.codegen.d.ts +1 -1
- package/dist/types/presets/recommended.codegen.d.ts +1 -1
- package/dist/types/rules/index.codegen.d.ts +1 -1
- package/package.json +5 -5
- package/dist/cjs/rules/no-boolean-autofocus-on-modal-dialog/index.js +0 -82
- package/dist/es2019/rules/no-boolean-autofocus-on-modal-dialog/index.js +0 -76
- package/dist/esm/rules/no-boolean-autofocus-on-modal-dialog/index.js +0 -76
- package/dist/types/rules/no-boolean-autofocus-on-modal-dialog/index.d.ts +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 15.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c012f03a95a5a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c012f03a95a5a) -
|
|
8
|
+
Remove modal `autoFocus` rule because type has been updated to remove unwanted case.
|
|
9
|
+
|
|
10
|
+
## 15.2.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`7c344654b5d24`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7c344654b5d24) -
|
|
15
|
+
Deprecates FocusRing, useFocusRing, and their entrypoints. Use `Focusable` from
|
|
16
|
+
`@atlaskit/primitives/compiled/focusable` instead.
|
|
17
|
+
|
|
3
18
|
## 15.1.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -59,7 +59,6 @@ module.exports = {
|
|
|
59
59
|
| <a href="./src/rules/icon-label/README.md">icon-label</a> | Enforces accessible usage of icon labels when composed with Atlassian Design System components. | Yes | Yes | |
|
|
60
60
|
| <a href="./src/rules/lozenge-badge-tag-labelling-system-migration/README.md">lozenge-badge-tag-labelling-system-migration</a> | Helps migrate Lozenge isBold prop, Badge appearance values, and SimpleTag/RemovableTag components as part of the Labelling System Phase 1 migration. | | Yes | |
|
|
61
61
|
| <a href="./src/rules/no-banned-imports/README.md">no-banned-imports</a> | Disallow importing banned modules. | Yes | | |
|
|
62
|
-
| <a href="./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 | | |
|
|
63
62
|
| <a href="./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 | |
|
|
64
63
|
| <a href="./src/rules/no-dark-theme-vr-tests/README.md">no-dark-theme-vr-tests</a> | Disallow using dark colorScheme in VR tests. | | Yes | |
|
|
65
64
|
| <a href="./src/rules/no-deprecated-apis/README.md">no-deprecated-apis</a> | Disallow using deprecated APIs. | Yes | | |
|
package/compass.yml
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
configVersion: 1
|
|
2
|
+
id: ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/edf84219-0964-4453-82d0-ce6989586011
|
|
3
|
+
name: '@atlaskit/eslint-plugin-design-system'
|
|
4
|
+
ownerId: ari:cloud:identity::team/og-7ea5b0e8-d37c-4003-aae2-0bb5c4b00147 # Design System Team
|
|
5
|
+
labels:
|
|
6
|
+
- platform-code
|
|
7
|
+
- platform-afm
|
|
8
|
+
typeId: OTHER
|
|
9
|
+
fields:
|
|
10
|
+
tier: 4
|
|
11
|
+
lifecycle: Active
|
|
12
|
+
isMonorepoProject: true
|
|
13
|
+
links:
|
|
14
|
+
- name: Root Repository
|
|
15
|
+
type: REPOSITORY
|
|
16
|
+
url: https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master
|
|
17
|
+
- name: Slack Channel
|
|
18
|
+
type: CHAT_CHANNEL
|
|
19
|
+
url: https://atlassian.enterprise.slack.com/archives/CFJ9DU39U # #help-design-system
|
|
20
|
+
- name: Eslint Plugin
|
|
21
|
+
type: REPOSITORY
|
|
22
|
+
url: https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/design-system/eslint-plugin
|
|
23
|
+
customFields:
|
|
24
|
+
- name: Department
|
|
25
|
+
type: text
|
|
26
|
+
value: Eng - Design System Fundamentals
|
|
27
|
+
- name: Technical Owner
|
|
28
|
+
type: user
|
|
29
|
+
value: ari:cloud:identity::user/557058:86a9b692-7997-49cb-9984-080801b1de91 # Jared Crowe
|
|
30
|
+
- name: Required Reviewers Opt In
|
|
31
|
+
type: boolean
|
|
32
|
+
value: true
|
|
33
|
+
- name: Reviewer Selection Mechanism
|
|
34
|
+
type: text
|
|
35
|
+
value: random(2)
|
|
36
|
+
- name: Required Reviewer Approvals
|
|
37
|
+
type: number
|
|
38
|
+
value: 1
|
package/configs/deprecated.json
CHANGED
|
@@ -64,6 +64,18 @@
|
|
|
64
64
|
"@atlaskit/field-text-area": {
|
|
65
65
|
"message": "field-text-area is deprecated. Please use '@atlaskit/textarea' instead."
|
|
66
66
|
},
|
|
67
|
+
"@atlaskit/focus-ring": {
|
|
68
|
+
"message": "FocusRing is deprecated. Use Focusable from @atlaskit/primitives/compiled/focusable instead."
|
|
69
|
+
},
|
|
70
|
+
"@atlaskit/focus-ring/focus-ring": {
|
|
71
|
+
"message": "FocusRing is deprecated. Use Focusable from @atlaskit/primitives/compiled/focusable instead."
|
|
72
|
+
},
|
|
73
|
+
"@atlaskit/focus-ring/use-focus-ring": {
|
|
74
|
+
"message": "useFocusRing is deprecated with FocusRing. Use Focusable from @atlaskit/primitives/compiled/focusable instead."
|
|
75
|
+
},
|
|
76
|
+
"@atlaskit/focus-ring/types": {
|
|
77
|
+
"message": "FocusRing types are deprecated. Use Focusable from @atlaskit/primitives/compiled/focusable instead."
|
|
78
|
+
},
|
|
67
79
|
"@atlaskit/navigation": {
|
|
68
80
|
"message": "navigation is deprecated. Please use '@atlaskit/atlassian-navigation' instead."
|
|
69
81
|
},
|
|
@@ -124,7 +136,7 @@
|
|
|
124
136
|
},
|
|
125
137
|
{
|
|
126
138
|
"importName": "focusRing",
|
|
127
|
-
"message": "The focusRing mixin is deprecated.
|
|
139
|
+
"message": "The focusRing mixin is deprecated. Use Focusable from @atlaskit/primitives/compiled/focusable instead."
|
|
128
140
|
},
|
|
129
141
|
{
|
|
130
142
|
"importName": "gridSize",
|
|
@@ -247,7 +259,7 @@
|
|
|
247
259
|
},
|
|
248
260
|
{
|
|
249
261
|
"importName": "focusRing",
|
|
250
|
-
"message": "The focusRing mixin is deprecated.
|
|
262
|
+
"message": "The focusRing mixin is deprecated. Use Focusable from @atlaskit/primitives/compiled/focusable instead."
|
|
251
263
|
},
|
|
252
264
|
{
|
|
253
265
|
"importName": "gridSize",
|
|
@@ -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::
|
|
9
|
+
* @codegen <<SignedSource::5a52fa9f987063b4d0d9e825b02a6067>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -24,7 +24,6 @@ var rules = {
|
|
|
24
24
|
'@atlaskit/design-system/icon-label': 'warn',
|
|
25
25
|
'@atlaskit/design-system/lozenge-badge-tag-labelling-system-migration': 'warn',
|
|
26
26
|
'@atlaskit/design-system/no-banned-imports': 'error',
|
|
27
|
-
'@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
|
|
28
27
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'error',
|
|
29
28
|
'@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
|
|
30
29
|
'@atlaskit/design-system/no-deprecated-apis': '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::
|
|
9
|
+
* @codegen <<SignedSource::458994db7ee4b74c7fcbd2157dc4496e>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -23,7 +23,6 @@ var rules = {
|
|
|
23
23
|
'@atlaskit/design-system/icon-label': 'warn',
|
|
24
24
|
'@atlaskit/design-system/lozenge-badge-tag-labelling-system-migration': 'warn',
|
|
25
25
|
'@atlaskit/design-system/no-banned-imports': 'error',
|
|
26
|
-
'@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
|
|
27
26
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'error',
|
|
28
27
|
'@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
|
|
29
28
|
'@atlaskit/design-system/no-deprecated-apis': '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::
|
|
9
|
+
* @codegen <<SignedSource::753093c364736633c291ea7cd16fbb92>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -19,7 +19,6 @@ var rules = {
|
|
|
19
19
|
'@atlaskit/design-system/ensure-design-token-usage': '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',
|
|
23
22
|
'@atlaskit/design-system/no-deprecated-apis': 'error',
|
|
24
23
|
'@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
|
|
25
24
|
'@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::
|
|
9
|
+
* @codegen <<SignedSource::7cae0a4365766a3c1b06c8ab29cc7711>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -18,7 +18,6 @@ var rules = {
|
|
|
18
18
|
'@atlaskit/design-system/ensure-design-token-usage': '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',
|
|
22
21
|
'@atlaskit/design-system/no-deprecated-apis': 'error',
|
|
23
22
|
'@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
|
|
24
23
|
'@atlaskit/design-system/no-deprecated-imports': 'error',
|
|
@@ -15,7 +15,6 @@ var _ensureProperXcssUsage = _interopRequireDefault(require("./ensure-proper-xcs
|
|
|
15
15
|
var _iconLabel = _interopRequireDefault(require("./icon-label"));
|
|
16
16
|
var _lozengeBadgeTagLabellingSystemMigration = _interopRequireDefault(require("./lozenge-badge-tag-labelling-system-migration"));
|
|
17
17
|
var _noBannedImports = _interopRequireDefault(require("./no-banned-imports"));
|
|
18
|
-
var _noBooleanAutofocusOnModalDialog = _interopRequireDefault(require("./no-boolean-autofocus-on-modal-dialog"));
|
|
19
18
|
var _noCssTaggedTemplateExpression = _interopRequireDefault(require("./no-css-tagged-template-expression"));
|
|
20
19
|
var _noDarkThemeVrTests = _interopRequireDefault(require("./no-dark-theme-vr-tests"));
|
|
21
20
|
var _noDeprecatedApis = _interopRequireDefault(require("./no-deprecated-apis"));
|
|
@@ -86,7 +85,7 @@ var _useTokensTypography = _interopRequireDefault(require("./use-tokens-typograp
|
|
|
86
85
|
var _useVisuallyHidden = _interopRequireDefault(require("./use-visually-hidden"));
|
|
87
86
|
/**
|
|
88
87
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
89
|
-
* @codegen <<SignedSource::
|
|
88
|
+
* @codegen <<SignedSource::d527850500d4518cc654415fd5f4fbc0>>
|
|
90
89
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
91
90
|
*/
|
|
92
91
|
|
|
@@ -101,7 +100,6 @@ var rules = exports.rules = {
|
|
|
101
100
|
'icon-label': _iconLabel.default,
|
|
102
101
|
'lozenge-badge-tag-labelling-system-migration': _lozengeBadgeTagLabellingSystemMigration.default,
|
|
103
102
|
'no-banned-imports': _noBannedImports.default,
|
|
104
|
-
'no-boolean-autofocus-on-modal-dialog': _noBooleanAutofocusOnModalDialog.default,
|
|
105
103
|
'no-css-tagged-template-expression': _noCssTaggedTemplateExpression.default,
|
|
106
104
|
'no-dark-theme-vr-tests': _noDarkThemeVrTests.default,
|
|
107
105
|
'no-deprecated-apis': _noDeprecatedApis.default,
|
|
@@ -64,6 +64,18 @@
|
|
|
64
64
|
"@atlaskit/field-text-area": {
|
|
65
65
|
"message": "field-text-area is deprecated. Please use '@atlaskit/textarea' instead."
|
|
66
66
|
},
|
|
67
|
+
"@atlaskit/focus-ring": {
|
|
68
|
+
"message": "FocusRing is deprecated. Use Focusable from @atlaskit/primitives/compiled/focusable instead."
|
|
69
|
+
},
|
|
70
|
+
"@atlaskit/focus-ring/focus-ring": {
|
|
71
|
+
"message": "FocusRing is deprecated. Use Focusable from @atlaskit/primitives/compiled/focusable instead."
|
|
72
|
+
},
|
|
73
|
+
"@atlaskit/focus-ring/use-focus-ring": {
|
|
74
|
+
"message": "useFocusRing is deprecated with FocusRing. Use Focusable from @atlaskit/primitives/compiled/focusable instead."
|
|
75
|
+
},
|
|
76
|
+
"@atlaskit/focus-ring/types": {
|
|
77
|
+
"message": "FocusRing types are deprecated. Use Focusable from @atlaskit/primitives/compiled/focusable instead."
|
|
78
|
+
},
|
|
67
79
|
"@atlaskit/navigation": {
|
|
68
80
|
"message": "navigation is deprecated. Please use '@atlaskit/atlassian-navigation' instead."
|
|
69
81
|
},
|
|
@@ -124,7 +136,7 @@
|
|
|
124
136
|
},
|
|
125
137
|
{
|
|
126
138
|
"importName": "focusRing",
|
|
127
|
-
"message": "The focusRing mixin is deprecated.
|
|
139
|
+
"message": "The focusRing mixin is deprecated. Use Focusable from @atlaskit/primitives/compiled/focusable instead."
|
|
128
140
|
},
|
|
129
141
|
{
|
|
130
142
|
"importName": "gridSize",
|
|
@@ -247,7 +259,7 @@
|
|
|
247
259
|
},
|
|
248
260
|
{
|
|
249
261
|
"importName": "focusRing",
|
|
250
|
-
"message": "The focusRing mixin is deprecated.
|
|
262
|
+
"message": "The focusRing mixin is deprecated. Use Focusable from @atlaskit/primitives/compiled/focusable instead."
|
|
251
263
|
},
|
|
252
264
|
{
|
|
253
265
|
"importName": "gridSize",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::5a52fa9f987063b4d0d9e825b02a6067>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -18,7 +18,6 @@ const rules = {
|
|
|
18
18
|
'@atlaskit/design-system/icon-label': 'warn',
|
|
19
19
|
'@atlaskit/design-system/lozenge-badge-tag-labelling-system-migration': 'warn',
|
|
20
20
|
'@atlaskit/design-system/no-banned-imports': 'error',
|
|
21
|
-
'@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
|
|
22
21
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'error',
|
|
23
22
|
'@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
|
|
24
23
|
'@atlaskit/design-system/no-deprecated-apis': '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::
|
|
3
|
+
* @codegen <<SignedSource::458994db7ee4b74c7fcbd2157dc4496e>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -17,7 +17,6 @@ const rules = {
|
|
|
17
17
|
'@atlaskit/design-system/icon-label': 'warn',
|
|
18
18
|
'@atlaskit/design-system/lozenge-badge-tag-labelling-system-migration': 'warn',
|
|
19
19
|
'@atlaskit/design-system/no-banned-imports': 'error',
|
|
20
|
-
'@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
|
|
21
20
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'error',
|
|
22
21
|
'@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
|
|
23
22
|
'@atlaskit/design-system/no-deprecated-apis': '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::
|
|
3
|
+
* @codegen <<SignedSource::753093c364736633c291ea7cd16fbb92>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -13,7 +13,6 @@ const rules = {
|
|
|
13
13
|
'@atlaskit/design-system/ensure-design-token-usage': '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',
|
|
17
16
|
'@atlaskit/design-system/no-deprecated-apis': 'error',
|
|
18
17
|
'@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
|
|
19
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::
|
|
3
|
+
* @codegen <<SignedSource::7cae0a4365766a3c1b06c8ab29cc7711>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -12,7 +12,6 @@ const rules = {
|
|
|
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',
|
|
16
15
|
'@atlaskit/design-system/no-deprecated-apis': 'error',
|
|
17
16
|
'@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
|
|
18
17
|
'@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::
|
|
3
|
+
* @codegen <<SignedSource::d527850500d4518cc654415fd5f4fbc0>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -14,7 +14,6 @@ import ensureProperXcssUsage from './ensure-proper-xcss-usage';
|
|
|
14
14
|
import iconLabel from './icon-label';
|
|
15
15
|
import lozengeBadgeTagLabellingSystemMigration from './lozenge-badge-tag-labelling-system-migration';
|
|
16
16
|
import noBannedImports from './no-banned-imports';
|
|
17
|
-
import noBooleanAutofocusOnModalDialog from './no-boolean-autofocus-on-modal-dialog';
|
|
18
17
|
import noCssTaggedTemplateExpression from './no-css-tagged-template-expression';
|
|
19
18
|
import noDarkThemeVrTests from './no-dark-theme-vr-tests';
|
|
20
19
|
import noDeprecatedApis from './no-deprecated-apis';
|
|
@@ -94,7 +93,6 @@ export const rules = {
|
|
|
94
93
|
'icon-label': iconLabel,
|
|
95
94
|
'lozenge-badge-tag-labelling-system-migration': lozengeBadgeTagLabellingSystemMigration,
|
|
96
95
|
'no-banned-imports': noBannedImports,
|
|
97
|
-
'no-boolean-autofocus-on-modal-dialog': noBooleanAutofocusOnModalDialog,
|
|
98
96
|
'no-css-tagged-template-expression': noCssTaggedTemplateExpression,
|
|
99
97
|
'no-dark-theme-vr-tests': noDarkThemeVrTests,
|
|
100
98
|
'no-deprecated-apis': noDeprecatedApis,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::5a52fa9f987063b4d0d9e825b02a6067>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -18,7 +18,6 @@ var rules = {
|
|
|
18
18
|
'@atlaskit/design-system/icon-label': 'warn',
|
|
19
19
|
'@atlaskit/design-system/lozenge-badge-tag-labelling-system-migration': 'warn',
|
|
20
20
|
'@atlaskit/design-system/no-banned-imports': 'error',
|
|
21
|
-
'@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
|
|
22
21
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'error',
|
|
23
22
|
'@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
|
|
24
23
|
'@atlaskit/design-system/no-deprecated-apis': '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::
|
|
3
|
+
* @codegen <<SignedSource::458994db7ee4b74c7fcbd2157dc4496e>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -17,7 +17,6 @@ var rules = {
|
|
|
17
17
|
'@atlaskit/design-system/icon-label': 'warn',
|
|
18
18
|
'@atlaskit/design-system/lozenge-badge-tag-labelling-system-migration': 'warn',
|
|
19
19
|
'@atlaskit/design-system/no-banned-imports': 'error',
|
|
20
|
-
'@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
|
|
21
20
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'error',
|
|
22
21
|
'@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
|
|
23
22
|
'@atlaskit/design-system/no-deprecated-apis': '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::
|
|
3
|
+
* @codegen <<SignedSource::753093c364736633c291ea7cd16fbb92>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -13,7 +13,6 @@ var rules = {
|
|
|
13
13
|
'@atlaskit/design-system/ensure-design-token-usage': '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',
|
|
17
16
|
'@atlaskit/design-system/no-deprecated-apis': 'error',
|
|
18
17
|
'@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
|
|
19
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::
|
|
3
|
+
* @codegen <<SignedSource::7cae0a4365766a3c1b06c8ab29cc7711>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -12,7 +12,6 @@ var rules = {
|
|
|
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',
|
|
16
15
|
'@atlaskit/design-system/no-deprecated-apis': 'error',
|
|
17
16
|
'@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
|
|
18
17
|
'@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::
|
|
3
|
+
* @codegen <<SignedSource::d527850500d4518cc654415fd5f4fbc0>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -14,7 +14,6 @@ import ensureProperXcssUsage from './ensure-proper-xcss-usage';
|
|
|
14
14
|
import iconLabel from './icon-label';
|
|
15
15
|
import lozengeBadgeTagLabellingSystemMigration from './lozenge-badge-tag-labelling-system-migration';
|
|
16
16
|
import noBannedImports from './no-banned-imports';
|
|
17
|
-
import noBooleanAutofocusOnModalDialog from './no-boolean-autofocus-on-modal-dialog';
|
|
18
17
|
import noCssTaggedTemplateExpression from './no-css-tagged-template-expression';
|
|
19
18
|
import noDarkThemeVrTests from './no-dark-theme-vr-tests';
|
|
20
19
|
import noDeprecatedApis from './no-deprecated-apis';
|
|
@@ -94,7 +93,6 @@ export var rules = {
|
|
|
94
93
|
'icon-label': iconLabel,
|
|
95
94
|
'lozenge-badge-tag-labelling-system-migration': lozengeBadgeTagLabellingSystemMigration,
|
|
96
95
|
'no-banned-imports': noBannedImports,
|
|
97
|
-
'no-boolean-autofocus-on-modal-dialog': noBooleanAutofocusOnModalDialog,
|
|
98
96
|
'no-css-tagged-template-expression': noCssTaggedTemplateExpression,
|
|
99
97
|
'no-dark-theme-vr-tests': noDarkThemeVrTests,
|
|
100
98
|
'no-deprecated-apis': noDeprecatedApis,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::5a52fa9f987063b4d0d9e825b02a6067>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { Linter } from 'eslint';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::458994db7ee4b74c7fcbd2157dc4496e>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { ESLint } from 'eslint';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::753093c364736633c291ea7cd16fbb92>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { Linter } from 'eslint';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::7cae0a4365766a3c1b06c8ab29cc7711>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { ESLint } from 'eslint';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::d527850500d4518cc654415fd5f4fbc0>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { Rule } from 'eslint';
|
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": "15.
|
|
4
|
+
"version": "15.3.0",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"publishConfig": {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@atlaskit/eslint-utils": "^3.0.0",
|
|
34
|
-
"@atlaskit/icon": "^36.
|
|
35
|
-
"@atlaskit/icon-lab": "^7.
|
|
36
|
-
"@atlaskit/tokens": "^15.
|
|
34
|
+
"@atlaskit/icon": "^36.1.0",
|
|
35
|
+
"@atlaskit/icon-lab": "^7.2.0",
|
|
36
|
+
"@atlaskit/tokens": "^15.3.0",
|
|
37
37
|
"@babel/runtime": "^7.0.0",
|
|
38
38
|
"@typescript-eslint/utils": "^7.1.0",
|
|
39
39
|
"ajv": "^6.12.6",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@af/formatting": "workspace:^",
|
|
50
50
|
"@atlaskit/ds-lib": "^8.0.0",
|
|
51
|
-
"@atlaskit/theme": "^26.
|
|
51
|
+
"@atlaskit/theme": "^26.1.0",
|
|
52
52
|
"@atlassian/codegen": "^0.2.0",
|
|
53
53
|
"@atlassian/eslint-utils": "^0.5.0",
|
|
54
54
|
"@atlassian/ts-loader": "^0.1.0",
|
|
@@ -1,82 +0,0 @@
|
|
|
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 _jsxElementHelper = require("../../ast-nodes/jsx-element-helper");
|
|
10
|
-
var _createLintRule = require("../utils/create-lint-rule");
|
|
11
|
-
var PROP_NAME = 'autoFocus';
|
|
12
|
-
|
|
13
|
-
// Lint rule message
|
|
14
|
-
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.";
|
|
15
|
-
var ruleName = exports.ruleName = __dirname.split('/').slice(-1)[0];
|
|
16
|
-
var rule = (0, _createLintRule.createLintRule)({
|
|
17
|
-
meta: {
|
|
18
|
-
name: ruleName,
|
|
19
|
-
type: 'problem',
|
|
20
|
-
docs: {
|
|
21
|
-
description: "Encourages makers to not use boolean values for `autoFocus` on Atlassian Design System's modal dialog component.",
|
|
22
|
-
recommended: true,
|
|
23
|
-
severity: 'warn'
|
|
24
|
-
},
|
|
25
|
-
messages: {
|
|
26
|
-
noBooleanForAutoFocus: message
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
create: function create(context) {
|
|
30
|
-
// List of component's locally imported names that match
|
|
31
|
-
var defaultImportLocalName;
|
|
32
|
-
return {
|
|
33
|
-
// Only run rule in files where the package is imported
|
|
34
|
-
ImportDeclaration: function ImportDeclaration(node) {
|
|
35
|
-
// Ignore non-modal imports
|
|
36
|
-
if (node.source.value !== '@atlaskit/modal-dialog') {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
node.specifiers.filter(function (identifier) {
|
|
40
|
-
return (0, _eslintCodemodUtils.isNodeOfType)(identifier, 'ImportDefaultSpecifier');
|
|
41
|
-
}).forEach(function (identifier) {
|
|
42
|
-
defaultImportLocalName = identifier.local.name;
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
JSXElement: function JSXElement(node) {
|
|
46
|
-
if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'JSXElement')) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (!(0, _eslintCodemodUtils.isNodeOfType)(node.openingElement.name, 'JSXIdentifier')) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
var name = node.openingElement.name.name;
|
|
53
|
-
if (name !== defaultImportLocalName) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
var prop = _jsxElementHelper.JSXElementHelper.getAttributeByName(node, PROP_NAME);
|
|
57
|
-
|
|
58
|
-
// if no autoFocus attribute exists, skip
|
|
59
|
-
if (!prop) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
var attrValue = _jsxAttribute.JSXAttribute.getValue(prop);
|
|
63
|
-
if (!attrValue) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
var type = attrValue.type,
|
|
67
|
-
value = attrValue.value;
|
|
68
|
-
|
|
69
|
-
// If the value is a boolean with value `false`
|
|
70
|
-
if (type === 'ExpressionStatement Literal' && typeof value === 'boolean') {
|
|
71
|
-
return context.report({
|
|
72
|
-
node: node,
|
|
73
|
-
messageId: 'noBooleanForAutoFocus'
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
82
|
-
var _default = exports.default = rule;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
-
import { JSXAttribute } from '../../ast-nodes/jsx-attribute';
|
|
3
|
-
import { JSXElementHelper } from '../../ast-nodes/jsx-element-helper';
|
|
4
|
-
import { createLintRule } from '../utils/create-lint-rule';
|
|
5
|
-
const PROP_NAME = 'autoFocus';
|
|
6
|
-
|
|
7
|
-
// Lint rule message
|
|
8
|
-
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.";
|
|
9
|
-
export const ruleName = __dirname.split('/').slice(-1)[0];
|
|
10
|
-
const rule = createLintRule({
|
|
11
|
-
meta: {
|
|
12
|
-
name: ruleName,
|
|
13
|
-
type: 'problem',
|
|
14
|
-
docs: {
|
|
15
|
-
description: "Encourages makers to not use boolean values for `autoFocus` on Atlassian Design System's modal dialog component.",
|
|
16
|
-
recommended: true,
|
|
17
|
-
severity: 'warn'
|
|
18
|
-
},
|
|
19
|
-
messages: {
|
|
20
|
-
noBooleanForAutoFocus: message
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
create(context) {
|
|
24
|
-
// List of component's locally imported names that match
|
|
25
|
-
let defaultImportLocalName;
|
|
26
|
-
return {
|
|
27
|
-
// Only run rule in files where the package is imported
|
|
28
|
-
ImportDeclaration(node) {
|
|
29
|
-
// Ignore non-modal imports
|
|
30
|
-
if (node.source.value !== '@atlaskit/modal-dialog') {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
node.specifiers.filter(identifier => isNodeOfType(identifier, 'ImportDefaultSpecifier')).forEach(identifier => {
|
|
34
|
-
defaultImportLocalName = identifier.local.name;
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
JSXElement(node) {
|
|
38
|
-
if (!isNodeOfType(node, 'JSXElement')) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (!isNodeOfType(node.openingElement.name, 'JSXIdentifier')) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const name = node.openingElement.name.name;
|
|
45
|
-
if (name !== defaultImportLocalName) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const prop = JSXElementHelper.getAttributeByName(node, PROP_NAME);
|
|
49
|
-
|
|
50
|
-
// if no autoFocus attribute exists, skip
|
|
51
|
-
if (!prop) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const attrValue = JSXAttribute.getValue(prop);
|
|
55
|
-
if (!attrValue) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const {
|
|
59
|
-
type,
|
|
60
|
-
value
|
|
61
|
-
} = attrValue;
|
|
62
|
-
|
|
63
|
-
// If the value is a boolean with value `false`
|
|
64
|
-
if (type === 'ExpressionStatement Literal' && typeof value === 'boolean') {
|
|
65
|
-
return context.report({
|
|
66
|
-
node,
|
|
67
|
-
messageId: 'noBooleanForAutoFocus'
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
76
|
-
export default rule;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
-
import { JSXAttribute } from '../../ast-nodes/jsx-attribute';
|
|
3
|
-
import { JSXElementHelper } from '../../ast-nodes/jsx-element-helper';
|
|
4
|
-
import { createLintRule } from '../utils/create-lint-rule';
|
|
5
|
-
var PROP_NAME = 'autoFocus';
|
|
6
|
-
|
|
7
|
-
// Lint rule message
|
|
8
|
-
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.";
|
|
9
|
-
export var ruleName = __dirname.split('/').slice(-1)[0];
|
|
10
|
-
var rule = createLintRule({
|
|
11
|
-
meta: {
|
|
12
|
-
name: ruleName,
|
|
13
|
-
type: 'problem',
|
|
14
|
-
docs: {
|
|
15
|
-
description: "Encourages makers to not use boolean values for `autoFocus` on Atlassian Design System's modal dialog component.",
|
|
16
|
-
recommended: true,
|
|
17
|
-
severity: 'warn'
|
|
18
|
-
},
|
|
19
|
-
messages: {
|
|
20
|
-
noBooleanForAutoFocus: message
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
create: function create(context) {
|
|
24
|
-
// List of component's locally imported names that match
|
|
25
|
-
var defaultImportLocalName;
|
|
26
|
-
return {
|
|
27
|
-
// Only run rule in files where the package is imported
|
|
28
|
-
ImportDeclaration: function ImportDeclaration(node) {
|
|
29
|
-
// Ignore non-modal imports
|
|
30
|
-
if (node.source.value !== '@atlaskit/modal-dialog') {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
node.specifiers.filter(function (identifier) {
|
|
34
|
-
return isNodeOfType(identifier, 'ImportDefaultSpecifier');
|
|
35
|
-
}).forEach(function (identifier) {
|
|
36
|
-
defaultImportLocalName = identifier.local.name;
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
JSXElement: function JSXElement(node) {
|
|
40
|
-
if (!isNodeOfType(node, 'JSXElement')) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (!isNodeOfType(node.openingElement.name, 'JSXIdentifier')) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
var name = node.openingElement.name.name;
|
|
47
|
-
if (name !== defaultImportLocalName) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
var prop = JSXElementHelper.getAttributeByName(node, PROP_NAME);
|
|
51
|
-
|
|
52
|
-
// if no autoFocus attribute exists, skip
|
|
53
|
-
if (!prop) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
var attrValue = JSXAttribute.getValue(prop);
|
|
57
|
-
if (!attrValue) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
var type = attrValue.type,
|
|
61
|
-
value = attrValue.value;
|
|
62
|
-
|
|
63
|
-
// If the value is a boolean with value `false`
|
|
64
|
-
if (type === 'ExpressionStatement Literal' && typeof value === 'boolean') {
|
|
65
|
-
return context.report({
|
|
66
|
-
node: node,
|
|
67
|
-
messageId: 'noBooleanForAutoFocus'
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
76
|
-
export default rule;
|
|
@@ -1,5 +0,0 @@
|
|
|
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;
|