@atlaskit/eslint-plugin-design-system 13.6.0 → 13.8.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 +22 -0
- package/README.md +56 -54
- package/dist/cjs/presets/all-flat.codegen.js +3 -1
- package/dist/cjs/presets/all.codegen.js +3 -1
- package/dist/cjs/presets/recommended-flat.codegen.js +3 -1
- package/dist/cjs/presets/recommended.codegen.js +3 -1
- package/dist/cjs/rules/index.codegen.js +5 -1
- package/dist/cjs/rules/no-html-anchor/node-types/styled-component/index.js +2 -2
- package/dist/cjs/rules/no-html-button/node-types/styled-component/index.js +2 -2
- package/dist/cjs/rules/no-html-image/index.js +40 -0
- package/dist/cjs/rules/no-html-image/node-types/index.js +19 -0
- package/dist/cjs/rules/no-html-image/node-types/jsx-element/index.js +115 -0
- package/dist/cjs/rules/no-html-image/node-types/styled-component/index.js +42 -0
- package/dist/cjs/rules/no-html-image/node-types/supported.js +72 -0
- package/dist/cjs/rules/no-html-range/index.js +34 -0
- package/dist/cjs/rules/no-html-range/node-types/index.js +12 -0
- package/dist/cjs/rules/no-html-range/node-types/jsx-element/index.js +27 -0
- package/dist/cjs/rules/no-html-range/node-types/supported.js +70 -0
- package/dist/cjs/rules/utils/get-styled-component-call.js +1 -1
- package/dist/es2019/presets/all-flat.codegen.js +3 -1
- package/dist/es2019/presets/all.codegen.js +3 -1
- package/dist/es2019/presets/recommended-flat.codegen.js +3 -1
- package/dist/es2019/presets/recommended.codegen.js +3 -1
- package/dist/es2019/rules/index.codegen.js +5 -1
- package/dist/es2019/rules/no-html-anchor/node-types/styled-component/index.js +2 -2
- package/dist/es2019/rules/no-html-button/node-types/styled-component/index.js +2 -2
- package/dist/es2019/rules/no-html-image/index.js +34 -0
- package/dist/es2019/rules/no-html-image/node-types/index.js +2 -0
- package/dist/es2019/rules/no-html-image/node-types/jsx-element/index.js +80 -0
- package/dist/es2019/rules/no-html-image/node-types/styled-component/index.js +37 -0
- package/dist/es2019/rules/no-html-image/node-types/supported.js +62 -0
- package/dist/es2019/rules/no-html-range/index.js +28 -0
- package/dist/es2019/rules/no-html-range/node-types/index.js +1 -0
- package/dist/es2019/rules/no-html-range/node-types/jsx-element/index.js +19 -0
- package/dist/es2019/rules/no-html-range/node-types/supported.js +60 -0
- package/dist/es2019/rules/utils/get-styled-component-call.js +1 -1
- package/dist/esm/presets/all-flat.codegen.js +3 -1
- package/dist/esm/presets/all.codegen.js +3 -1
- package/dist/esm/presets/recommended-flat.codegen.js +3 -1
- package/dist/esm/presets/recommended.codegen.js +3 -1
- package/dist/esm/rules/index.codegen.js +5 -1
- package/dist/esm/rules/no-html-anchor/node-types/styled-component/index.js +2 -2
- package/dist/esm/rules/no-html-button/node-types/styled-component/index.js +2 -2
- package/dist/esm/rules/no-html-image/index.js +34 -0
- package/dist/esm/rules/no-html-image/node-types/index.js +2 -0
- package/dist/esm/rules/no-html-image/node-types/jsx-element/index.js +106 -0
- package/dist/esm/rules/no-html-image/node-types/styled-component/index.js +36 -0
- package/dist/esm/rules/no-html-image/node-types/supported.js +63 -0
- package/dist/esm/rules/no-html-range/index.js +28 -0
- package/dist/esm/rules/no-html-range/node-types/index.js +1 -0
- package/dist/esm/rules/no-html-range/node-types/jsx-element/index.js +18 -0
- package/dist/esm/rules/no-html-range/node-types/supported.js +61 -0
- package/dist/esm/rules/utils/get-styled-component-call.js +1 -1
- package/dist/types/index.codegen.d.ts +18 -0
- package/dist/types/presets/all-flat.codegen.d.ts +2 -0
- package/dist/types/presets/all.codegen.d.ts +2 -0
- package/dist/types/presets/recommended-flat.codegen.d.ts +2 -0
- package/dist/types/presets/recommended.codegen.d.ts +2 -0
- package/dist/types/rules/index.codegen.d.ts +2 -0
- package/dist/types/rules/no-html-image/index.d.ts +3 -0
- package/dist/types/rules/no-html-image/node-types/index.d.ts +2 -0
- package/dist/types/rules/no-html-image/node-types/jsx-element/index.d.ts +8 -0
- package/dist/types/rules/no-html-image/node-types/styled-component/index.d.ts +8 -0
- package/dist/types/rules/no-html-image/node-types/supported.d.ts +7 -0
- package/dist/types/rules/no-html-range/index.d.ts +3 -0
- package/dist/types/rules/no-html-range/node-types/index.d.ts +1 -0
- package/dist/types/rules/no-html-range/node-types/jsx-element/index.d.ts +8 -0
- package/dist/types/rules/no-html-range/node-types/supported.d.ts +7 -0
- package/dist/types-ts4.5/index.codegen.d.ts +18 -0
- package/dist/types-ts4.5/presets/all-flat.codegen.d.ts +2 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -0
- package/dist/types-ts4.5/presets/recommended-flat.codegen.d.ts +2 -0
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +2 -0
- package/dist/types-ts4.5/rules/index.codegen.d.ts +2 -0
- package/dist/types-ts4.5/rules/no-html-image/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/no-html-image/node-types/index.d.ts +2 -0
- package/dist/types-ts4.5/rules/no-html-image/node-types/jsx-element/index.d.ts +8 -0
- package/dist/types-ts4.5/rules/no-html-image/node-types/styled-component/index.d.ts +8 -0
- package/dist/types-ts4.5/rules/no-html-image/node-types/supported.d.ts +7 -0
- package/dist/types-ts4.5/rules/no-html-range/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/no-html-range/node-types/index.d.ts +1 -0
- package/dist/types-ts4.5/rules/no-html-range/node-types/jsx-element/index.d.ts +8 -0
- package/dist/types-ts4.5/rules/no-html-range/node-types/supported.d.ts +7 -0
- package/package.json +1 -1
- package/dist/cjs/rules/no-html-anchor/node-types/styled-component/get-styled-component-call.js +0 -47
- package/dist/cjs/rules/no-html-button/node-types/styled-component/get-styled-component-call.js +0 -47
- package/dist/cjs/rules/no-html-button/utils/get-jsx-element-by-name.js +0 -53
- package/dist/es2019/rules/no-html-anchor/node-types/styled-component/get-styled-component-call.js +0 -42
- package/dist/es2019/rules/no-html-button/node-types/styled-component/get-styled-component-call.js +0 -42
- package/dist/es2019/rules/no-html-button/utils/get-jsx-element-by-name.js +0 -39
- package/dist/esm/rules/no-html-anchor/node-types/styled-component/get-styled-component-call.js +0 -42
- package/dist/esm/rules/no-html-button/node-types/styled-component/get-styled-component-call.js +0 -42
- package/dist/esm/rules/no-html-button/utils/get-jsx-element-by-name.js +0 -47
- package/dist/types/rules/no-html-anchor/node-types/styled-component/get-styled-component-call.d.ts +0 -6
- package/dist/types/rules/no-html-anchor/utils/get-jsx-element-by-name.d.ts +0 -6
- package/dist/types/rules/no-html-button/node-types/styled-component/get-styled-component-call.d.ts +0 -6
- package/dist/types/rules/no-html-button/utils/get-jsx-element-by-name.d.ts +0 -6
- package/dist/types-ts4.5/rules/no-html-anchor/node-types/styled-component/get-styled-component-call.d.ts +0 -6
- package/dist/types-ts4.5/rules/no-html-button/node-types/styled-component/get-styled-component-call.d.ts +0 -6
- /package/dist/cjs/rules/{no-html-anchor → no-html-image}/utils/get-jsx-element-by-name.js +0 -0
- /package/dist/es2019/rules/{no-html-anchor → no-html-image}/utils/get-jsx-element-by-name.js +0 -0
- /package/dist/esm/rules/{no-html-anchor → no-html-image}/utils/get-jsx-element-by-name.js +0 -0
- /package/dist/{types-ts4.5/rules/no-html-button → types/rules/no-html-image}/utils/get-jsx-element-by-name.d.ts +0 -0
- /package/dist/types-ts4.5/rules/{no-html-anchor → no-html-image}/utils/get-jsx-element-by-name.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 13.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#145074](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/145074)
|
|
8
|
+
[`97a43bf0f52f6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/97a43bf0f52f6) -
|
|
9
|
+
Add rule to encourage the usage of ADS range over native range input elements.
|
|
10
|
+
|
|
11
|
+
## 13.7.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#145592](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/145592)
|
|
16
|
+
[`101d557dd9e1d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/101d557dd9e1d) -
|
|
17
|
+
Add rule for encouraging use of the image component over `img`.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#145048](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/145048)
|
|
22
|
+
[`4381ccf4b9460`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4381ccf4b9460) -
|
|
23
|
+
Refactor duplicated utilities into own reusable files.
|
|
24
|
+
|
|
3
25
|
## 13.6.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -47,59 +47,61 @@ module.exports = {
|
|
|
47
47
|
<!-- START_RULE_TABLE_CODEGEN -->
|
|
48
48
|
<!-- @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen -->
|
|
49
49
|
|
|
50
|
-
| Rule
|
|
51
|
-
|
|
|
52
|
-
| <a href="./
|
|
53
|
-
| <a href="./
|
|
54
|
-
| <a href="./
|
|
55
|
-
| <a href="./
|
|
56
|
-
| <a href="./
|
|
57
|
-
| <a href="./
|
|
58
|
-
| <a href="./
|
|
59
|
-
| <a href="./
|
|
60
|
-
| <a href="./
|
|
61
|
-
| <a href="./
|
|
62
|
-
| <a href="./
|
|
63
|
-
| <a href="./
|
|
64
|
-
| <a href="./
|
|
65
|
-
| <a href="./
|
|
66
|
-
| <a href="./
|
|
67
|
-
| <a href="./
|
|
68
|
-
| <a href="./
|
|
69
|
-
| <a href="./
|
|
70
|
-
| <a href="./
|
|
71
|
-
| <a href="./
|
|
72
|
-
| <a href="./
|
|
73
|
-
| <a href="./
|
|
74
|
-
| <a href="./
|
|
75
|
-
| <a href="./
|
|
76
|
-
| <a href="./
|
|
77
|
-
| <a href="./
|
|
78
|
-
| <a href="./
|
|
79
|
-
| <a href="./
|
|
80
|
-
| <a href="./
|
|
81
|
-
| <a href="./
|
|
82
|
-
| <a href="./
|
|
83
|
-
| <a href="./
|
|
84
|
-
| <a href="./
|
|
85
|
-
| <a href="./
|
|
86
|
-
| <a href="./
|
|
87
|
-
| <a href="./
|
|
88
|
-
| <a href="./
|
|
89
|
-
| <a href="./
|
|
90
|
-
| <a href="./
|
|
91
|
-
| <a href="./
|
|
92
|
-
| <a href="./
|
|
93
|
-
| <a href="./
|
|
94
|
-
| <a href="./
|
|
95
|
-
| <a href="./
|
|
96
|
-
| <a href="./
|
|
97
|
-
| <a href="./
|
|
98
|
-
| <a href="./
|
|
99
|
-
| <a href="./
|
|
100
|
-
| <a href="./
|
|
101
|
-
| <a href="./
|
|
102
|
-
| <a href="./
|
|
103
|
-
| <a href="./
|
|
50
|
+
| Rule | Description | Recommended | Fixable | Suggestions |
|
|
51
|
+
| --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | ------- | ----------- |
|
|
52
|
+
| <a href="./src/rules/consistent-css-prop-usage/README.md">consistent-css-prop-usage</a> | Ensures consistency with `css` and `xcss` prop usages | Yes | Yes | |
|
|
53
|
+
| <a href="./src/rules/ensure-design-token-usage/README.md">ensure-design-token-usage</a> | Enforces usage of design tokens rather than hard-coded values. | Yes | Yes | Yes |
|
|
54
|
+
| <a href="./src/rules/ensure-design-token-usage-preview/README.md">ensure-design-token-usage/preview</a> | Enforces usage of pre-release design tokens rather than hard-coded values. | | Yes | Yes |
|
|
55
|
+
| <a href="./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
|
+
| <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 | |
|
|
57
|
+
| <a href="./src/rules/no-banned-imports/README.md">no-banned-imports</a> | Disallow importing banned modules. | Yes | | |
|
|
58
|
+
| <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 | | |
|
|
59
|
+
| <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 | |
|
|
60
|
+
| <a href="./src/rules/no-custom-icons/README.md">no-custom-icons</a> | Enforces custom glyph icons are used. | | | |
|
|
61
|
+
| <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 | |
|
|
62
|
+
| <a href="./src/rules/no-deprecated-apis/README.md">no-deprecated-apis</a> | Disallow using deprecated APIs. | Yes | | |
|
|
63
|
+
| <a href="./src/rules/no-deprecated-design-token-usage/README.md">no-deprecated-design-token-usage</a> | Disallow using deprecated design tokens. | Yes | Yes | |
|
|
64
|
+
| <a href="./src/rules/no-deprecated-imports/README.md">no-deprecated-imports</a> | Disallow importing deprecated modules. | Yes | Yes | Yes |
|
|
65
|
+
| <a href="./src/rules/no-direct-use-of-web-platform-drag-and-drop/README.md">no-direct-use-of-web-platform-drag-and-drop</a> | Disallow using direct use of native drag and drop (please use Pragmatic drag and drop) | Yes | | |
|
|
66
|
+
| <a href="./src/rules/no-empty-styled-expression/README.md">no-empty-styled-expression</a> | Forbids any styled expression to be used when passing empty arguments to styled.div() (or other JSX elements). | | | |
|
|
67
|
+
| <a href="./src/rules/no-exported-css/README.md">no-exported-css</a> | Forbid exporting `css` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable. | | | |
|
|
68
|
+
| <a href="./src/rules/no-exported-keyframes/README.md">no-exported-keyframes</a> | Forbid exporting `keyframes` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable. | | | |
|
|
69
|
+
| <a href="./src/rules/no-html-anchor/README.md">no-html-anchor</a> | Discourage direct usage of HTML anchor elements in favor of Atlassian Design System link components. | Yes | | Yes |
|
|
70
|
+
| <a href="./src/rules/no-html-button/README.md">no-html-button</a> | Discourage direct usage of HTML button elements in favor of Atlassian Design System button components. | Yes | | |
|
|
71
|
+
| <a href="./src/rules/no-html-checkbox/README.md">no-html-checkbox</a> | Discourage direct usage of HTML checkbox elements in favor of the Atlassian Design System checkbox component. | Yes | | Yes |
|
|
72
|
+
| <a href="./src/rules/no-html-image/README.md">no-html-image</a> | Discourage direct usage of HTML image elements in favor of the Atlassian Design System image component. | Yes | | Yes |
|
|
73
|
+
| <a href="./src/rules/no-html-range/README.md">no-html-range</a> | Discourage direct usage of HTML range elements in favor of the Atlassian Design System range component. | Yes | | Yes |
|
|
74
|
+
| <a href="./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 | | |
|
|
75
|
+
| <a href="./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 | |
|
|
76
|
+
| <a href="./src/rules/no-legacy-icons/README.md">no-legacy-icons</a> | Enforces no legacy icons are used. | | Yes | Yes |
|
|
77
|
+
| <a href="./src/rules/no-margin/README.md">no-margin</a> | Disallow using the margin CSS property. | | | |
|
|
78
|
+
| <a href="./src/rules/no-nested-styles/README.md">no-nested-styles</a> | Disallows use of nested styles in `css` functions. | Yes | | |
|
|
79
|
+
| <a href="./src/rules/no-physical-properties/README.md">no-physical-properties</a> | Disallow physical properties and values in `css` function calls. | | Yes | |
|
|
80
|
+
| <a href="./src/rules/no-separator-with-list-elements/README.md">no-separator-with-list-elements</a> | Warn when the `separator` prop is used with `as="li"`, `as="ol"`, or `as="dl"` in the Inline component. | Yes | | |
|
|
81
|
+
| <a href="./src/rules/no-styled-tagged-template-expression/README.md">no-styled-tagged-template-expression</a> | Disallows any `styled` tagged template expressions that originate from Emotion, Styled Components or Compiled | | Yes | |
|
|
82
|
+
| <a href="./src/rules/no-unsafe-design-token-usage/README.md">no-unsafe-design-token-usage</a> | Enforces design token usage is statically and locally analyzable. | Yes | Yes | |
|
|
83
|
+
| <a href="./src/rules/no-unsafe-style-overrides/README.md">no-unsafe-style-overrides</a> | Discourage usage of unsafe style overrides used against the Atlassian Design System. | Yes | | |
|
|
84
|
+
| <a href="./src/rules/no-unsupported-drag-and-drop-libraries/README.md">no-unsupported-drag-and-drop-libraries</a> | Disallow importing unsupported drag and drop modules. | Yes | | |
|
|
85
|
+
| <a href="./src/rules/prefer-primitives/README.md">prefer-primitives</a> | Increase awareness of primitive components via code hints. Strictly used for education purposes and discoverability. To enforce usage please refer to the `use-primitives` rule. | | | |
|
|
86
|
+
| <a href="./src/rules/use-button-group-label/README.md">use-button-group-label</a> | Ensures button groups are described to assistive technology by a direct label or by another element. | Yes | | Yes |
|
|
87
|
+
| <a href="./src/rules/use-cx-function-in-xcss/README.md">use-cx-function-in-xcss</a> | Enforces cx function use to combine styles in xcss. | Yes | Yes | Yes |
|
|
88
|
+
| <a href="./src/rules/use-datetime-picker-calendar-button/README.md">use-datetime-picker-calendar-button</a> | Encourages makers to use calendar button in Atlassian Design System's date picker and datetime picker components. | Yes | Yes | Yes |
|
|
89
|
+
| <a href="./src/rules/use-drawer-label/README.md">use-drawer-label</a> | Encourages to provide accessible name for Atlassian Design System Drawer component. | Yes | | Yes |
|
|
90
|
+
| <a href="./src/rules/use-heading/README.md">use-heading</a> | Encourage the usage of heading components. | | Yes | Yes |
|
|
91
|
+
| <a href="./src/rules/use-heading-level-in-spotlight-card/README.md">use-heading-level-in-spotlight-card</a> | Inform developers of eventual requirement of `headingLevel` prop in `SpotlightCard` component. The heading level should be the appropriate level according to the surrounding context. | Yes | Yes | |
|
|
92
|
+
| <a href="./src/rules/use-href-in-link-item/README.md">use-href-in-link-item</a> | Inform developers of eventual requirement of `href` prop in `LinkItem` component. Elements with a `link` role require an `href` attribute for users to properly navigate, particularly those using assistive technologies. If no valid `href` is required for your use case, consider using a `ButtonItem` instead. | Yes | Yes | Yes |
|
|
93
|
+
| <a href="./src/rules/use-latest-xcss-syntax/README.md">use-latest-xcss-syntax</a> | Enforces usage of space design tokens rather than hard-coded values in xcss. | Yes | Yes | |
|
|
94
|
+
| <a href="./src/rules/use-latest-xcss-syntax-typography/README.md">use-latest-xcss-syntax-typography</a> | Prohibits use of unsafe styling properties in xcss. Please use Text/Heading primitives instead. | Yes | Yes | |
|
|
95
|
+
| <a href="./src/rules/use-menu-section-title/README.md">use-menu-section-title</a> | Encourages makers to provide accessible title for Atlassian Design System Menu Section component. | Yes | | Yes |
|
|
96
|
+
| <a href="./src/rules/use-modal-dialog-close-button/README.md">use-modal-dialog-close-button</a> | Encourages makers to use close button in Atlassian Design System's modal dialog component. | Yes | Yes | Yes |
|
|
97
|
+
| <a href="./src/rules/use-onboarding-spotlight-label/README.md">use-onboarding-spotlight-label</a> | Ensures onboarding spotlight dialogs are described to assistive technology by a direct label or by another element. | Yes | | Yes |
|
|
98
|
+
| <a href="./src/rules/use-popup-label/README.md">use-popup-label</a> | Encourages to provide accessible name for Atlassian Design System Popup component. | Yes | | Yes |
|
|
99
|
+
| <a href="./src/rules/use-primitives/README.md">use-primitives</a> | Encourage the usage of primitives components. | | Yes | Yes |
|
|
100
|
+
| <a href="./src/rules/use-primitives-text/README.md">use-primitives-text</a> | Encourage the usage of text components. | | Yes | Yes |
|
|
101
|
+
| <a href="./src/rules/use-should-render-to-parent/README.md">use-should-render-to-parent</a> | Encourages makers to use the `shouldRenderToParent` where possible in Atlassian Design System `Popup` and `DropdownMenu` components. | Yes | | Yes |
|
|
102
|
+
| <a href="./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 |
|
|
103
|
+
| <a href="./src/rules/use-tokens-space/README.md">use-tokens-space</a> | Enforces usage of space design tokens rather than hard-coded values. | | Yes | Yes |
|
|
104
|
+
| <a href="./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 |
|
|
105
|
+
| <a href="./src/rules/use-visually-hidden/README.md">use-visually-hidden</a> | Enforce usage of the visually hidden component. | Yes | Yes | |
|
|
104
106
|
|
|
105
107
|
<!-- END_RULE_TABLE_CODEGEN -->
|
|
@@ -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::cadedc68c5a8a92d8134b8aa5239937f>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
var _default = exports.default = {
|
|
@@ -30,6 +30,8 @@ var _default = exports.default = {
|
|
|
30
30
|
'@atlaskit/design-system/no-html-anchor': 'warn',
|
|
31
31
|
'@atlaskit/design-system/no-html-button': 'warn',
|
|
32
32
|
'@atlaskit/design-system/no-html-checkbox': 'warn',
|
|
33
|
+
'@atlaskit/design-system/no-html-image': 'warn',
|
|
34
|
+
'@atlaskit/design-system/no-html-range': 'warn',
|
|
33
35
|
'@atlaskit/design-system/no-invalid-css-map': ['error', {
|
|
34
36
|
allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
|
|
35
37
|
}],
|
|
@@ -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::340bf9f79ec1de1340a89df9d626b929>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
var _default = exports.default = {
|
|
@@ -29,6 +29,8 @@ var _default = exports.default = {
|
|
|
29
29
|
'@atlaskit/design-system/no-html-anchor': 'warn',
|
|
30
30
|
'@atlaskit/design-system/no-html-button': 'warn',
|
|
31
31
|
'@atlaskit/design-system/no-html-checkbox': 'warn',
|
|
32
|
+
'@atlaskit/design-system/no-html-image': 'warn',
|
|
33
|
+
'@atlaskit/design-system/no-html-range': 'warn',
|
|
32
34
|
'@atlaskit/design-system/no-invalid-css-map': ['error', {
|
|
33
35
|
allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
|
|
34
36
|
}],
|
|
@@ -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::c264ea60cc6348c4292744c1260543d8>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
var _default = exports.default = {
|
|
@@ -25,6 +25,8 @@ var _default = exports.default = {
|
|
|
25
25
|
'@atlaskit/design-system/no-html-anchor': 'warn',
|
|
26
26
|
'@atlaskit/design-system/no-html-button': 'warn',
|
|
27
27
|
'@atlaskit/design-system/no-html-checkbox': 'warn',
|
|
28
|
+
'@atlaskit/design-system/no-html-image': 'warn',
|
|
29
|
+
'@atlaskit/design-system/no-html-range': 'warn',
|
|
28
30
|
'@atlaskit/design-system/no-invalid-css-map': ['error', {
|
|
29
31
|
allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
|
|
30
32
|
}],
|
|
@@ -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::0158deb3db6cafbdeae2aeb18673ebc2>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
var _default = exports.default = {
|
|
@@ -24,6 +24,8 @@ var _default = exports.default = {
|
|
|
24
24
|
'@atlaskit/design-system/no-html-anchor': 'warn',
|
|
25
25
|
'@atlaskit/design-system/no-html-button': 'warn',
|
|
26
26
|
'@atlaskit/design-system/no-html-checkbox': 'warn',
|
|
27
|
+
'@atlaskit/design-system/no-html-image': 'warn',
|
|
28
|
+
'@atlaskit/design-system/no-html-range': 'warn',
|
|
27
29
|
'@atlaskit/design-system/no-invalid-css-map': ['error', {
|
|
28
30
|
allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
|
|
29
31
|
}],
|
|
@@ -25,6 +25,8 @@ var _noExportedKeyframes = _interopRequireDefault(require("./no-exported-keyfram
|
|
|
25
25
|
var _noHtmlAnchor = _interopRequireDefault(require("./no-html-anchor"));
|
|
26
26
|
var _noHtmlButton = _interopRequireDefault(require("./no-html-button"));
|
|
27
27
|
var _noHtmlCheckbox = _interopRequireDefault(require("./no-html-checkbox"));
|
|
28
|
+
var _noHtmlImage = _interopRequireDefault(require("./no-html-image"));
|
|
29
|
+
var _noHtmlRange = _interopRequireDefault(require("./no-html-range"));
|
|
28
30
|
var _noInvalidCssMap = _interopRequireDefault(require("./no-invalid-css-map"));
|
|
29
31
|
var _noKeyframesTaggedTemplateExpression = _interopRequireDefault(require("./no-keyframes-tagged-template-expression"));
|
|
30
32
|
var _noLegacyIcons = _interopRequireDefault(require("./no-legacy-icons"));
|
|
@@ -59,7 +61,7 @@ var _useTokensTypography = _interopRequireDefault(require("./use-tokens-typograp
|
|
|
59
61
|
var _useVisuallyHidden = _interopRequireDefault(require("./use-visually-hidden"));
|
|
60
62
|
/**
|
|
61
63
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
62
|
-
* @codegen <<SignedSource::
|
|
64
|
+
* @codegen <<SignedSource::5945e51ebc0b2c3553b51162f07dbd63>>
|
|
63
65
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
64
66
|
*/
|
|
65
67
|
|
|
@@ -84,6 +86,8 @@ var rules = exports.rules = {
|
|
|
84
86
|
'no-html-anchor': _noHtmlAnchor.default,
|
|
85
87
|
'no-html-button': _noHtmlButton.default,
|
|
86
88
|
'no-html-checkbox': _noHtmlCheckbox.default,
|
|
89
|
+
'no-html-image': _noHtmlImage.default,
|
|
90
|
+
'no-html-range': _noHtmlRange.default,
|
|
87
91
|
'no-invalid-css-map': _noInvalidCssMap.default,
|
|
88
92
|
'no-keyframes-tagged-template-expression': _noKeyframesTaggedTemplateExpression.default,
|
|
89
93
|
'no-legacy-icons': _noLegacyIcons.default,
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.StyledComponent = void 0;
|
|
7
7
|
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
8
8
|
var _contextCompat = require("@atlaskit/eslint-utils/context-compat");
|
|
9
|
-
var _getJsxElementByName2 = require("
|
|
9
|
+
var _getJsxElementByName2 = require("../../../utils/get-jsx-element-by-name");
|
|
10
|
+
var _getStyledComponentCall = require("../../../utils/get-styled-component-call");
|
|
10
11
|
var _supported = require("../supported");
|
|
11
|
-
var _getStyledComponentCall = require("./get-styled-component-call");
|
|
12
12
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
13
13
|
|
|
14
14
|
var StyledComponent = exports.StyledComponent = {
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.StyledComponent = void 0;
|
|
7
7
|
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
8
8
|
var _contextCompat = require("@atlaskit/eslint-utils/context-compat");
|
|
9
|
-
var _getJsxElementByName2 = require("
|
|
9
|
+
var _getJsxElementByName2 = require("../../../utils/get-jsx-element-by-name");
|
|
10
|
+
var _getStyledComponentCall = require("../../../utils/get-styled-component-call");
|
|
10
11
|
var _supported = require("../supported");
|
|
11
|
-
var _getStyledComponentCall = require("./get-styled-component-call");
|
|
12
12
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
13
13
|
|
|
14
14
|
var StyledComponent = exports.StyledComponent = {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _createRule = require("../utils/create-rule");
|
|
8
|
+
var _nodeTypes = require("./node-types");
|
|
9
|
+
var rule = (0, _createRule.createLintRule)({
|
|
10
|
+
meta: {
|
|
11
|
+
name: 'no-html-image',
|
|
12
|
+
type: 'suggestion',
|
|
13
|
+
hasSuggestions: true,
|
|
14
|
+
docs: {
|
|
15
|
+
description: 'Discourage direct usage of HTML image elements in favor of the Atlassian Design System image component.',
|
|
16
|
+
recommended: true,
|
|
17
|
+
severity: 'warn'
|
|
18
|
+
},
|
|
19
|
+
messages: {
|
|
20
|
+
noHtmlImage: "This <{{ name }}> should be replaced with the image component from the Atlassian Design System. ADS images ensure accessible implementations, and provide access to ADS styling features like design tokens."
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
create: function create(context) {
|
|
24
|
+
return {
|
|
25
|
+
// transforms styled.<anchor>(...) usages
|
|
26
|
+
CallExpression: function CallExpression(node) {
|
|
27
|
+
_nodeTypes.StyledComponent.lint(node, {
|
|
28
|
+
context: context
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
// transforms <anchor css={...}> usages
|
|
32
|
+
JSXElement: function JSXElement(node) {
|
|
33
|
+
_nodeTypes.JSXElement.lint(node, {
|
|
34
|
+
context: context
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
var _default = exports.default = rule;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "JSXElement", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _jsxElement.JSXElement;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "StyledComponent", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _styledComponent.StyledComponent;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _styledComponent = require("./styled-component");
|
|
19
|
+
var _jsxElement = require("./jsx-element");
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.JSXElement = void 0;
|
|
8
|
+
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
9
|
+
var _contextCompat = require("@atlaskit/eslint-utils/context-compat");
|
|
10
|
+
var ast = _interopRequireWildcard(require("../../../../ast-nodes"));
|
|
11
|
+
var _supported = require("../supported");
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
15
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
16
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
17
|
+
function isImportDeclaration(node) {
|
|
18
|
+
return node.type === 'ImportDeclaration';
|
|
19
|
+
}
|
|
20
|
+
var JSXElement = exports.JSXElement = {
|
|
21
|
+
lint: function lint(node, _ref) {
|
|
22
|
+
var context = _ref.context;
|
|
23
|
+
if (!(0, _supported.isSupportedForLint)(node)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
var nodeName = ast.JSXElement.getName(node);
|
|
27
|
+
var sourceCode = (0, _contextCompat.getSourceCode)(context);
|
|
28
|
+
var importDeclarations = sourceCode.ast.body.filter(isImportDeclaration);
|
|
29
|
+
var existingImageName = null;
|
|
30
|
+
var usedNames = new Set();
|
|
31
|
+
|
|
32
|
+
// Check for existing imports
|
|
33
|
+
var _iterator = _createForOfIteratorHelper(importDeclarations),
|
|
34
|
+
_step;
|
|
35
|
+
try {
|
|
36
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
37
|
+
var declaration = _step.value;
|
|
38
|
+
var _iterator2 = _createForOfIteratorHelper(declaration.specifiers),
|
|
39
|
+
_step2;
|
|
40
|
+
try {
|
|
41
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
42
|
+
var specifier = _step2.value;
|
|
43
|
+
usedNames.add(specifier.local.name);
|
|
44
|
+
}
|
|
45
|
+
} catch (err) {
|
|
46
|
+
_iterator2.e(err);
|
|
47
|
+
} finally {
|
|
48
|
+
_iterator2.f();
|
|
49
|
+
}
|
|
50
|
+
if (declaration.source.value === '@atlaskit/image') {
|
|
51
|
+
var defaultSpecifier = declaration.specifiers.find(function (specifier) {
|
|
52
|
+
return specifier.type === 'ImportDefaultSpecifier';
|
|
53
|
+
});
|
|
54
|
+
if (defaultSpecifier) {
|
|
55
|
+
existingImageName = defaultSpecifier.local.name;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
} catch (err) {
|
|
60
|
+
_iterator.e(err);
|
|
61
|
+
} finally {
|
|
62
|
+
_iterator.f();
|
|
63
|
+
}
|
|
64
|
+
var generateUniqueName = function generateUniqueName(baseName) {
|
|
65
|
+
var index = 1;
|
|
66
|
+
var newName = baseName;
|
|
67
|
+
while (usedNames.has(newName)) {
|
|
68
|
+
newName = "".concat(baseName).concat(index);
|
|
69
|
+
index++;
|
|
70
|
+
}
|
|
71
|
+
return newName;
|
|
72
|
+
};
|
|
73
|
+
var imageName = existingImageName || generateUniqueName('Image');
|
|
74
|
+
context.report({
|
|
75
|
+
node: node.openingElement,
|
|
76
|
+
messageId: 'noHtmlImage',
|
|
77
|
+
data: {
|
|
78
|
+
name: nodeName
|
|
79
|
+
},
|
|
80
|
+
suggest: [{
|
|
81
|
+
desc: 'Replace with Image component from @atlaskit/image',
|
|
82
|
+
fix: function fix(fixer) {
|
|
83
|
+
var _node$closingElement;
|
|
84
|
+
var openingTagRange = node.openingElement.range;
|
|
85
|
+
var closingTagRange = (_node$closingElement = node.closingElement) === null || _node$closingElement === void 0 ? void 0 : _node$closingElement.range;
|
|
86
|
+
var attributesText = node.openingElement.attributes.filter(function (attr) {
|
|
87
|
+
return !(0, _eslintCodemodUtils.isNodeOfType)(attr, 'JSXAttribute') || attr.name.name !== 'role';
|
|
88
|
+
}).map(function (attr) {
|
|
89
|
+
return sourceCode.getText(attr);
|
|
90
|
+
}).join(' ');
|
|
91
|
+
var fixers = [];
|
|
92
|
+
|
|
93
|
+
// Replace <img> with <Image> and retain attributes
|
|
94
|
+
if (openingTagRange) {
|
|
95
|
+
if (node.openingElement.selfClosing) {
|
|
96
|
+
fixers.push(fixer.replaceTextRange([openingTagRange[0] + 1, openingTagRange[1] - 1], "".concat(imageName).concat(attributesText ? " ".concat(attributesText) : '', " /")));
|
|
97
|
+
} else {
|
|
98
|
+
fixers.push(fixer.replaceTextRange([openingTagRange[0] + 1, openingTagRange[1] - 1], "".concat(imageName).concat(attributesText ? " ".concat(attributesText) : '')));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (closingTagRange && !node.openingElement.selfClosing) {
|
|
102
|
+
fixers.push(fixer.replaceTextRange([closingTagRange[0] + 2, closingTagRange[1] - 1], imageName));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Add import if not present
|
|
106
|
+
if (!existingImageName) {
|
|
107
|
+
var importStatement = "import ".concat(imageName, " from '@atlaskit/image';\n");
|
|
108
|
+
fixers.push(fixer.insertTextBefore(sourceCode.ast, importStatement));
|
|
109
|
+
}
|
|
110
|
+
return fixers;
|
|
111
|
+
}
|
|
112
|
+
}]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
};
|