@atlaskit/eslint-plugin-design-system 10.8.2 → 10.10.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 +17 -0
- package/README.md +1 -0
- package/constellation/consistent-css-prop-usage/usage.mdx +9 -0
- package/constellation/index/usage.mdx +1 -0
- package/constellation/no-custom-icons/usage.mdx +36 -0
- package/dist/cjs/presets/all.codegen.js +2 -1
- package/dist/cjs/rules/consistent-css-prop-usage/index.js +19 -2
- package/dist/cjs/rules/ensure-design-token-usage/index.js +199 -227
- package/dist/cjs/rules/index.codegen.js +3 -1
- package/dist/cjs/rules/no-custom-icons/checks/has-prop.js +12 -0
- package/dist/cjs/rules/no-custom-icons/checks/is-from-import-source.js +42 -0
- package/dist/cjs/rules/no-custom-icons/checks/is-imported-jsx-element.js +10 -0
- package/dist/cjs/rules/no-custom-icons/index.js +67 -0
- package/dist/cjs/rules/no-legacy-icons/index.js +11 -83
- package/dist/cjs/rules/use-tokens-typography/index.js +4 -8
- package/dist/cjs/rules/utils/error-boundary.js +58 -11
- package/dist/es2019/presets/all.codegen.js +2 -1
- package/dist/es2019/rules/consistent-css-prop-usage/index.js +19 -2
- package/dist/es2019/rules/ensure-design-token-usage/index.js +16 -30
- package/dist/es2019/rules/index.codegen.js +3 -1
- package/dist/es2019/rules/no-custom-icons/checks/has-prop.js +4 -0
- package/dist/es2019/rules/no-custom-icons/checks/is-from-import-source.js +23 -0
- package/dist/es2019/rules/no-custom-icons/checks/is-imported-jsx-element.js +4 -0
- package/dist/es2019/rules/no-custom-icons/index.js +61 -0
- package/dist/es2019/rules/no-legacy-icons/index.js +11 -65
- package/dist/es2019/rules/use-tokens-typography/index.js +3 -7
- package/dist/es2019/rules/utils/error-boundary.js +55 -11
- package/dist/esm/presets/all.codegen.js +2 -1
- package/dist/esm/rules/consistent-css-prop-usage/index.js +19 -2
- package/dist/esm/rules/ensure-design-token-usage/index.js +199 -227
- package/dist/esm/rules/index.codegen.js +3 -1
- package/dist/esm/rules/no-custom-icons/checks/has-prop.js +6 -0
- package/dist/esm/rules/no-custom-icons/checks/is-from-import-source.js +36 -0
- package/dist/esm/rules/no-custom-icons/checks/is-imported-jsx-element.js +4 -0
- package/dist/esm/rules/no-custom-icons/index.js +61 -0
- package/dist/esm/rules/no-legacy-icons/index.js +11 -83
- package/dist/esm/rules/use-tokens-typography/index.js +4 -8
- package/dist/esm/rules/utils/error-boundary.js +56 -10
- package/dist/types/index.codegen.d.ts +1 -0
- package/dist/types/presets/all.codegen.d.ts +2 -1
- package/dist/types/rules/consistent-css-prop-usage/types.d.ts +1 -0
- package/dist/types/rules/index.codegen.d.ts +1 -0
- package/dist/types/rules/no-custom-icons/checks/has-prop.d.ts +2 -0
- package/dist/types/rules/no-custom-icons/checks/is-from-import-source.d.ts +8 -0
- package/dist/types/rules/no-custom-icons/checks/is-imported-jsx-element.d.ts +8 -0
- package/dist/types/rules/no-custom-icons/index.d.ts +3 -0
- package/dist/types/rules/no-legacy-icons/index.d.ts +1 -2
- package/dist/types/rules/utils/error-boundary.d.ts +8 -5
- package/dist/types-ts4.5/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
- package/dist/types-ts4.5/rules/consistent-css-prop-usage/types.d.ts +1 -0
- package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/rules/no-custom-icons/checks/has-prop.d.ts +2 -0
- package/dist/types-ts4.5/rules/no-custom-icons/checks/is-from-import-source.d.ts +8 -0
- package/dist/types-ts4.5/rules/no-custom-icons/checks/is-imported-jsx-element.d.ts +8 -0
- package/dist/types-ts4.5/rules/no-custom-icons/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/no-legacy-icons/index.d.ts +1 -2
- package/dist/types-ts4.5/rules/utils/error-boundary.d.ts +8 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 10.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#116426](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116426)
|
|
8
|
+
[`29d6c074c76ea`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/29d6c074c76ea) -
|
|
9
|
+
Add lint rule to detect use of custom icons
|
|
10
|
+
|
|
11
|
+
## 10.9.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#116062](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116062)
|
|
16
|
+
[`2959497ccf910`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2959497ccf910) -
|
|
17
|
+
Adds `shouldAlwaysCheckXcss` config option to `consistent-css-prop-usage` to lint the `xcss` prop
|
|
18
|
+
even when `excludeReactComponents` is enabled.
|
|
19
|
+
|
|
3
20
|
## 10.8.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -55,6 +55,7 @@ module.exports = {
|
|
|
55
55
|
| <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 | |
|
|
56
56
|
| <a href="./src/rules/no-banned-imports/README.md">no-banned-imports</a> | Disallow importing banned modules. | Yes | | |
|
|
57
57
|
| <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 | |
|
|
58
|
+
| <a href="./src/rules/no-custom-icons/README.md">no-custom-icons</a> | Enforces custom glyph icons are used. | | | |
|
|
58
59
|
| <a href="./src/rules/no-deprecated-apis/README.md">no-deprecated-apis</a> | Disallow using deprecated APIs. | Yes | | |
|
|
59
60
|
| <a href="./src/rules/no-deprecated-design-token-usage/README.md">no-deprecated-design-token-usage</a> | Disallow using deprecated design tokens. | Yes | Yes | |
|
|
60
61
|
| <a href="./src/rules/no-deprecated-imports/README.md">no-deprecated-imports</a> | Disallow importing deprecated modules. | Yes | | |
|
|
@@ -193,6 +193,15 @@ assume that an element is a React component if its name starts with a capital le
|
|
|
193
193
|
|
|
194
194
|
This is `false` by default.
|
|
195
195
|
|
|
196
|
+
### shouldAlwaysCheckXcss
|
|
197
|
+
|
|
198
|
+
Overrides `excludeReactComponents` specifically for the `xcss` prop.
|
|
199
|
+
|
|
200
|
+
This means that even if `excludeReactComponents` is `true`, you can still lint the `xcss` prop by
|
|
201
|
+
setting `shouldAlwaysCheckXcss` to `true`.
|
|
202
|
+
|
|
203
|
+
This is `false` by default.
|
|
204
|
+
|
|
196
205
|
### autoFix
|
|
197
206
|
|
|
198
207
|
When set to `true`, this rule will turn on the autofixer. Set this to `false` if you do not want the
|
|
@@ -18,6 +18,7 @@ This plugin contains rules that should be used when working with the
|
|
|
18
18
|
| <a href="/components/eslint-plugin-design-system/icon-label/usage">icon-label</a> | Enforces accessible usage of icon labels when composed with Atlassian Design System components. | Yes | Yes | |
|
|
19
19
|
| <a href="/components/eslint-plugin-design-system/no-banned-imports/usage">no-banned-imports</a> | Disallow importing banned modules. | Yes | | |
|
|
20
20
|
| <a href="/components/eslint-plugin-design-system/no-css-tagged-template-expression/usage">no-css-tagged-template-expression</a> | Disallows any `css` tagged template expressions that originate from Emotion, Styled Components or Compiled | | Yes | |
|
|
21
|
+
| <a href="/components/eslint-plugin-design-system/no-custom-icons/usage">no-custom-icons</a> | Enforces custom glyph icons are used. | | | |
|
|
21
22
|
| <a href="/components/eslint-plugin-design-system/no-deprecated-apis/usage">no-deprecated-apis</a> | Disallow using deprecated APIs. | Yes | | |
|
|
22
23
|
| <a href="/components/eslint-plugin-design-system/no-deprecated-design-token-usage/usage">no-deprecated-design-token-usage</a> | Disallow using deprecated design tokens. | Yes | Yes | |
|
|
23
24
|
| <a href="/components/eslint-plugin-design-system/no-deprecated-imports/usage">no-deprecated-imports</a> | Disallow importing deprecated modules. | Yes | | |
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# no-custom-icons
|
|
2
|
+
|
|
3
|
+
Icons are being updated with new designs, a simplified set of available icons and sizes, as well as
|
|
4
|
+
more consistent padding and spacing.
|
|
5
|
+
|
|
6
|
+
The new icon components allows your components to align with the new visual language - either by
|
|
7
|
+
default, or when enabled via a feature flag.
|
|
8
|
+
|
|
9
|
+
Custom icons are no longer supported, and should either be replaced with an existing icon from the
|
|
10
|
+
`@atlaskit/icon` or `@atlassian/icon-lab` packages, or contributed to those packages.
|
|
11
|
+
|
|
12
|
+
During the migration process, any custom icons should be moved into a central location to disable
|
|
13
|
+
this error and allow the icon to be quickly replaced. What location to display in the error can be
|
|
14
|
+
configured via the legacyIconPackages option.
|
|
15
|
+
|
|
16
|
+
## Examples
|
|
17
|
+
|
|
18
|
+
This rule identifies usages of custom icons from `@atlaskit/icon` or `@atlaskit/icon/base`.
|
|
19
|
+
|
|
20
|
+
### Incorrect
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import Icon from '@atlaskit/icon';
|
|
24
|
+
^^^^^^^^^^^^^^^^^ custom icon import
|
|
25
|
+
|
|
26
|
+
<Icon label="Activity" glyph="...">
|
|
27
|
+
^^^^^^^^^^^^^^^^^^^^^^^ custom icon
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Correct
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import AddIcon from '@atlaskit/icon/core/add';
|
|
34
|
+
|
|
35
|
+
<AddIcon label="" />;
|
|
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::ab43b6e1a867d07b9a27eae78d48834a>>
|
|
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/icon-label': 'warn',
|
|
19
19
|
'@atlaskit/design-system/no-banned-imports': 'error',
|
|
20
20
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'error',
|
|
21
|
+
'@atlaskit/design-system/no-custom-icons': 'warn',
|
|
21
22
|
'@atlaskit/design-system/no-deprecated-apis': 'error',
|
|
22
23
|
'@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
|
|
23
24
|
'@atlaskit/design-system/no-deprecated-imports': 'error',
|
|
@@ -497,7 +497,8 @@ var defaultConfig = {
|
|
|
497
497
|
cssImportSource: _isSupportedImport.CSS_IN_JS_IMPORTS.compiled,
|
|
498
498
|
xcssImportSource: _isSupportedImport.CSS_IN_JS_IMPORTS.atlaskitPrimitives,
|
|
499
499
|
excludeReactComponents: false,
|
|
500
|
-
autoFix: true
|
|
500
|
+
autoFix: true,
|
|
501
|
+
shouldAlwaysCheckXcss: false
|
|
501
502
|
};
|
|
502
503
|
var rule = (0, _createRule.createLintRule)({
|
|
503
504
|
meta: {
|
|
@@ -540,6 +541,9 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
540
541
|
excludeReactComponents: {
|
|
541
542
|
type: 'boolean'
|
|
542
543
|
},
|
|
544
|
+
shouldAlwaysCheckXcss: {
|
|
545
|
+
type: 'boolean'
|
|
546
|
+
},
|
|
543
547
|
autoFix: {
|
|
544
548
|
type: 'boolean'
|
|
545
549
|
}
|
|
@@ -554,7 +558,20 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
554
558
|
var node = nodeOriginal;
|
|
555
559
|
var name = node.name,
|
|
556
560
|
value = node.value;
|
|
557
|
-
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* We skip linting `xcss` attributes if:
|
|
564
|
+
*
|
|
565
|
+
* - excludeReactComponents === true
|
|
566
|
+
* - shouldAlwaysCheckXcss === false
|
|
567
|
+
*
|
|
568
|
+
* In the future we may want to remove `shouldAlwaysCheckXcss`
|
|
569
|
+
* and just always lint `xcss`, regardless of `excludeReactComponents`
|
|
570
|
+
*/
|
|
571
|
+
if (mergedConfig.excludeReactComponents && name.name === 'xcss' && !mergedConfig.shouldAlwaysCheckXcss) {
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
if (mergedConfig.excludeReactComponents && node.parent.type === 'JSXOpeningElement' && name.name === 'css') {
|
|
558
575
|
// e.g. <item.before />
|
|
559
576
|
if (node.parent.name.type === 'JSXMemberExpression') {
|
|
560
577
|
return;
|