@atlaskit/eslint-plugin-design-system 8.17.0 → 8.18.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 +6 -0
- package/README.md +1 -0
- package/constellation/index/usage.mdx +22 -0
- package/dist/cjs/presets/all.codegen.js +2 -1
- package/dist/cjs/presets/recommended.codegen.js +2 -1
- package/dist/cjs/rules/index.codegen.js +3 -1
- package/dist/cjs/rules/use-heading-level-in-spotlight-card/index.js +63 -0
- package/dist/cjs/rules/use-href-in-link-item/index.js +2 -1
- package/dist/cjs/rules/use-href-in-link-item/utils.js +1 -25
- package/dist/cjs/rules/utils/get-import-name.js +30 -0
- package/dist/es2019/presets/all.codegen.js +2 -1
- package/dist/es2019/presets/recommended.codegen.js +2 -1
- package/dist/es2019/rules/index.codegen.js +3 -1
- package/dist/es2019/rules/use-heading-level-in-spotlight-card/index.js +49 -0
- package/dist/es2019/rules/use-href-in-link-item/index.js +3 -2
- package/dist/es2019/rules/use-href-in-link-item/utils.js +0 -24
- package/dist/es2019/rules/utils/get-import-name.js +24 -0
- package/dist/esm/presets/all.codegen.js +2 -1
- package/dist/esm/presets/recommended.codegen.js +2 -1
- package/dist/esm/rules/index.codegen.js +3 -1
- package/dist/esm/rules/use-heading-level-in-spotlight-card/index.js +57 -0
- package/dist/esm/rules/use-href-in-link-item/index.js +3 -2
- package/dist/esm/rules/use-href-in-link-item/utils.js +0 -24
- package/dist/esm/rules/utils/get-import-name.js +24 -0
- package/dist/types/index.codegen.d.ts +2 -0
- package/dist/types/presets/all.codegen.d.ts +2 -1
- package/dist/types/presets/recommended.codegen.d.ts +2 -1
- package/dist/types/rules/index.codegen.d.ts +1 -0
- package/dist/types/rules/use-heading-level-in-spotlight-card/index.d.ts +4 -0
- package/dist/types/rules/use-href-in-link-item/utils.d.ts +0 -1
- package/dist/types/rules/utils/get-import-name.d.ts +2 -0
- package/dist/types-ts4.5/index.codegen.d.ts +2 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +2 -1
- package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-heading-level-in-spotlight-card/index.d.ts +4 -0
- package/dist/types-ts4.5/rules/use-href-in-link-item/utils.d.ts +0 -1
- package/dist/types-ts4.5/rules/utils/get-import-name.d.ts +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 8.18.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#65123](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/65123) [`f3b62a2c6bdd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f3b62a2c6bdd) - Add new rule to warn of rollout of required `headingLevel` prop in the `SpotlightCard` component of the onboarding package.
|
|
8
|
+
|
|
3
9
|
## 8.17.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -65,6 +65,7 @@ module.exports = {
|
|
|
65
65
|
| <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 | | |
|
|
66
66
|
| <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. | | | |
|
|
67
67
|
| <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 |
|
|
68
|
+
| <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 | |
|
|
68
69
|
| <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 |
|
|
69
70
|
| <a href="./src/rules/use-primitives/README.md">use-primitives</a> | Encourage the usage of primitives components. | | Yes | Yes |
|
|
70
71
|
| <a href="./src/rules/use-visually-hidden/README.md">use-visually-hidden</a> | Enforce usage of the visually hidden component. | Yes | Yes | |
|
|
@@ -29,6 +29,7 @@ This plugin contains rules that should be used when working with the [Atlassian
|
|
|
29
29
|
| <a href="#no-unsupported-drag-and-drop-libraries">no-unsupported-drag-and-drop-libraries</a> | Disallow importing unsupported drag and drop modules. | Yes | | |
|
|
30
30
|
| <a href="#prefer-primitives">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. | | | |
|
|
31
31
|
| <a href="#use-drawer-label">use-drawer-label</a> | Encourages to provide accessible name for Atlassian Design System Drawer component. | Yes | | Yes |
|
|
32
|
+
| <a href="#use-heading-level-in-spotlight-card">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 | |
|
|
32
33
|
| <a href="#use-href-in-link-item">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 |
|
|
33
34
|
| <a href="#use-primitives">use-primitives</a> | Encourage the usage of primitives components. | | Yes | Yes |
|
|
34
35
|
| <a href="#use-visually-hidden">use-visually-hidden</a> | Enforce usage of the visually hidden component. | Yes | Yes | |
|
|
@@ -769,6 +770,27 @@ This rule will indicate user with warning to strongly recommend usage of either
|
|
|
769
770
|
</Drawer>
|
|
770
771
|
```
|
|
771
772
|
|
|
773
|
+
## use-heading-level-in-spotlight-card
|
|
774
|
+
|
|
775
|
+
The `SpotlightCard` component in `@atlaskit/onboarding` will be requiring the `headingLevel` prop in future releases.
|
|
776
|
+
|
|
777
|
+
<h3>Examples</h3>
|
|
778
|
+
|
|
779
|
+
#### Incorrect
|
|
780
|
+
|
|
781
|
+
```tsx
|
|
782
|
+
<SpotlightCard heading="Heading">Spotlight card contents</SpotlightCard>
|
|
783
|
+
^^^^^^^^^^^^^
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
#### Correct
|
|
787
|
+
|
|
788
|
+
```tsx
|
|
789
|
+
<SpotlightCard heading="Heading" headingLevel={2}>
|
|
790
|
+
Spotlight card contents
|
|
791
|
+
</SpotlightCard>
|
|
792
|
+
```
|
|
793
|
+
|
|
772
794
|
## use-href-in-link-item
|
|
773
795
|
|
|
774
796
|
The `LinkItem` component in `@atlaskit/menu` will be requiring the `href` prop in future releases. If no valid `href` prop is required, consider using the `ButtonItem` component.
|
|
@@ -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::37a857efd0971ab26170d5f1f526279b>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
var _default = exports.default = {
|
|
@@ -28,6 +28,7 @@ var _default = exports.default = {
|
|
|
28
28
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
|
|
29
29
|
'@atlaskit/design-system/prefer-primitives': 'warn',
|
|
30
30
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
31
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
31
32
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
32
33
|
'@atlaskit/design-system/use-primitives': 'warn',
|
|
33
34
|
'@atlaskit/design-system/use-visually-hidden': '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::b3bce8efb2db1fed84370af608ca0d4c>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
var _default = exports.default = {
|
|
@@ -23,6 +23,7 @@ var _default = exports.default = {
|
|
|
23
23
|
'@atlaskit/design-system/no-unsafe-design-token-usage': 'error',
|
|
24
24
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
|
|
25
25
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
26
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
26
27
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
27
28
|
'@atlaskit/design-system/use-visually-hidden': 'error'
|
|
28
29
|
}
|
|
@@ -21,12 +21,13 @@ var _noUnsafeDesignTokenUsage = _interopRequireDefault(require("./no-unsafe-desi
|
|
|
21
21
|
var _noUnsupportedDragAndDropLibraries = _interopRequireDefault(require("./no-unsupported-drag-and-drop-libraries"));
|
|
22
22
|
var _preferPrimitives = _interopRequireDefault(require("./prefer-primitives"));
|
|
23
23
|
var _useDrawerLabel = _interopRequireDefault(require("./use-drawer-label"));
|
|
24
|
+
var _useHeadingLevelInSpotlightCard = _interopRequireDefault(require("./use-heading-level-in-spotlight-card"));
|
|
24
25
|
var _useHrefInLinkItem = _interopRequireDefault(require("./use-href-in-link-item"));
|
|
25
26
|
var _usePrimitives = _interopRequireDefault(require("./use-primitives"));
|
|
26
27
|
var _useVisuallyHidden = _interopRequireDefault(require("./use-visually-hidden"));
|
|
27
28
|
/**
|
|
28
29
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
29
|
-
* @codegen <<SignedSource::
|
|
30
|
+
* @codegen <<SignedSource::e2cc357c90120dbbd89b2928dba968c0>>
|
|
30
31
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
31
32
|
*/
|
|
32
33
|
var _default = exports.default = {
|
|
@@ -46,6 +47,7 @@ var _default = exports.default = {
|
|
|
46
47
|
'no-unsupported-drag-and-drop-libraries': _noUnsupportedDragAndDropLibraries.default,
|
|
47
48
|
'prefer-primitives': _preferPrimitives.default,
|
|
48
49
|
'use-drawer-label': _useDrawerLabel.default,
|
|
50
|
+
'use-heading-level-in-spotlight-card': _useHeadingLevelInSpotlightCard.default,
|
|
49
51
|
'use-href-in-link-item': _useHrefInLinkItem.default,
|
|
50
52
|
'use-primitives': _usePrimitives.default,
|
|
51
53
|
'use-visually-hidden': _useVisuallyHidden.default
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.headingLevelRequiredSuggestionText = exports.default = void 0;
|
|
7
|
+
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
8
|
+
var _createRule = require("../utils/create-rule");
|
|
9
|
+
var _getImportName = require("../utils/get-import-name");
|
|
10
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
11
|
+
|
|
12
|
+
var headingLevelRequiredSuggestionText = exports.headingLevelRequiredSuggestionText = 'Add a `headingLevel` that is of a contextually relevant level.';
|
|
13
|
+
var rule = (0, _createRule.createLintRule)({
|
|
14
|
+
meta: {
|
|
15
|
+
name: 'use-heading-level-in-spotlight-card',
|
|
16
|
+
type: 'suggestion',
|
|
17
|
+
fixable: 'code',
|
|
18
|
+
docs: {
|
|
19
|
+
description: 'Inform developers of eventual requirement of `headingLevel` prop in `SpotlightCard` component. The heading level should be the appropriate level according to the surrounding context.',
|
|
20
|
+
recommended: true,
|
|
21
|
+
severity: 'warn'
|
|
22
|
+
},
|
|
23
|
+
messages: {
|
|
24
|
+
headingLevelRequired: headingLevelRequiredSuggestionText
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
create: function create(context) {
|
|
28
|
+
return {
|
|
29
|
+
JSXElement: function JSXElement(node) {
|
|
30
|
+
if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'JSXElement')) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (!(0, _eslintCodemodUtils.isNodeOfType)(node.openingElement.name, 'JSXIdentifier')) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Get the name of the SpotlightCard import
|
|
38
|
+
var spotlightCardImportName = (0, _getImportName.getImportName)(context.getScope(), '@atlaskit/onboarding', 'SpotlightCard');
|
|
39
|
+
if (node.openingElement.name.name === spotlightCardImportName) {
|
|
40
|
+
// and if `heading` exists and `headingLevel` prop does not exist
|
|
41
|
+
var spotlightCardProps = node.openingElement.attributes.filter(function (attr) {
|
|
42
|
+
return (0, _eslintCodemodUtils.isNodeOfType)(attr, 'JSXAttribute');
|
|
43
|
+
}).filter(function (attr) {
|
|
44
|
+
return attr.name.type === 'JSXIdentifier';
|
|
45
|
+
});
|
|
46
|
+
var heading = spotlightCardProps.find(function (attr) {
|
|
47
|
+
return attr.name.name === 'heading';
|
|
48
|
+
});
|
|
49
|
+
var headingLevel = spotlightCardProps.find(function (attr) {
|
|
50
|
+
return attr.name.name === 'headingLevel';
|
|
51
|
+
});
|
|
52
|
+
if (heading && !headingLevel) {
|
|
53
|
+
context.report({
|
|
54
|
+
node: node,
|
|
55
|
+
messageId: 'headingLevelRequired'
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
var _default = exports.default = rule;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.hrefRequiredSuggestionText = exports.default = void 0;
|
|
7
7
|
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
8
8
|
var _createRule = require("../utils/create-rule");
|
|
9
|
+
var _getImportName = require("../utils/get-import-name");
|
|
9
10
|
var _utils = require("./utils");
|
|
10
11
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
11
12
|
|
|
@@ -52,7 +53,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
// Get the name of the LinkItem import
|
|
55
|
-
var linkItemImportName = customDefaultLinkItemSpecifier || (0,
|
|
56
|
+
var linkItemImportName = customDefaultLinkItemSpecifier || (0, _getImportName.getImportName)(context.getScope(), '@atlaskit/menu', 'LinkItem');
|
|
56
57
|
if (node.openingElement.name.name === linkItemImportName) {
|
|
57
58
|
// and if href prop does not exist
|
|
58
59
|
var linkProps = node.openingElement.attributes.filter(function (attr) {
|
|
@@ -3,35 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.insertButtonItemImport = exports.insertButtonItemDefaultImport = exports.hrefHasInvalidValue = exports.hasImportOfName = exports.getUniqueButtonItemName =
|
|
6
|
+
exports.insertButtonItemImport = exports.insertButtonItemDefaultImport = exports.hrefHasInvalidValue = exports.hasImportOfName = exports.getUniqueButtonItemName = void 0;
|
|
7
7
|
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
8
8
|
var _findInParent = require("../utils/find-in-parent");
|
|
9
9
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
10
10
|
|
|
11
|
-
var getLinkItemImportName = exports.getLinkItemImportName = function getLinkItemImportName(scope) {
|
|
12
|
-
var traversingScope = scope;
|
|
13
|
-
var matchedVariable;
|
|
14
|
-
while (traversingScope && traversingScope.type !== 'global') {
|
|
15
|
-
matchedVariable = traversingScope.variables.find(function (variable) {
|
|
16
|
-
var _variable$defs;
|
|
17
|
-
var def = (_variable$defs = variable.defs) === null || _variable$defs === void 0 ? void 0 : _variable$defs[0];
|
|
18
|
-
if (!def || !(def !== null && def !== void 0 && def.node) || !(0, _eslintCodemodUtils.isNodeOfType)(def.node, 'ImportSpecifier') || !def.parent || !(0, _eslintCodemodUtils.isNodeOfType)(def.parent, 'ImportDeclaration')) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
return def.parent.source.value === '@atlaskit/menu' && def.node.imported.name === 'LinkItem';
|
|
22
|
-
});
|
|
23
|
-
if (matchedVariable) {
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
traversingScope = traversingScope.upper;
|
|
27
|
-
}
|
|
28
|
-
if (!matchedVariable) {
|
|
29
|
-
return null;
|
|
30
|
-
} else {
|
|
31
|
-
var _matchedVariable$defs;
|
|
32
|
-
return (_matchedVariable$defs = matchedVariable.defs) === null || _matchedVariable$defs === void 0 ? void 0 : _matchedVariable$defs[0].node.local.name;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
11
|
var invalidHrefValues = ['', '#', null, undefined];
|
|
36
12
|
var hrefHasInvalidValue = exports.hrefHasInvalidValue = function hrefHasInvalidValue(scope, href) {
|
|
37
13
|
// If doesn't exist,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getImportName = void 0;
|
|
7
|
+
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
8
|
+
var getImportName = exports.getImportName = function getImportName(scope, packageName, componentName) {
|
|
9
|
+
var traversingScope = scope;
|
|
10
|
+
var matchedVariable;
|
|
11
|
+
while (traversingScope && traversingScope.type !== 'global') {
|
|
12
|
+
matchedVariable = traversingScope.variables.find(function (variable) {
|
|
13
|
+
var _variable$defs;
|
|
14
|
+
var def = (_variable$defs = variable.defs) === null || _variable$defs === void 0 ? void 0 : _variable$defs[0];
|
|
15
|
+
if (!def || !def.node || !(0, _eslintCodemodUtils.isNodeOfType)(def.node, 'ImportSpecifier') || !def.parent || !(0, _eslintCodemodUtils.isNodeOfType)(def.parent, 'ImportDeclaration')) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
return def.parent.source.value === packageName && def.node.imported.name === componentName;
|
|
19
|
+
});
|
|
20
|
+
if (matchedVariable) {
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
traversingScope = traversingScope.upper;
|
|
24
|
+
}
|
|
25
|
+
if (!matchedVariable) {
|
|
26
|
+
return null;
|
|
27
|
+
} else {
|
|
28
|
+
return matchedVariable.defs[0].node.local.name;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -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::37a857efd0971ab26170d5f1f526279b>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -22,6 +22,7 @@ export default {
|
|
|
22
22
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
|
|
23
23
|
'@atlaskit/design-system/prefer-primitives': 'warn',
|
|
24
24
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
25
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
25
26
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
26
27
|
'@atlaskit/design-system/use-primitives': 'warn',
|
|
27
28
|
'@atlaskit/design-system/use-visually-hidden': '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::b3bce8efb2db1fed84370af608ca0d4c>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -17,6 +17,7 @@ export default {
|
|
|
17
17
|
'@atlaskit/design-system/no-unsafe-design-token-usage': 'error',
|
|
18
18
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
|
|
19
19
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
20
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
20
21
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
21
22
|
'@atlaskit/design-system/use-visually-hidden': 'error'
|
|
22
23
|
}
|
|
@@ -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::e2cc357c90120dbbd89b2928dba968c0>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import consistentCssPropUsage from './consistent-css-prop-usage';
|
|
@@ -19,6 +19,7 @@ import noUnsafeDesignTokenUsage from './no-unsafe-design-token-usage';
|
|
|
19
19
|
import noUnsupportedDragAndDropLibraries from './no-unsupported-drag-and-drop-libraries';
|
|
20
20
|
import preferPrimitives from './prefer-primitives';
|
|
21
21
|
import useDrawerLabel from './use-drawer-label';
|
|
22
|
+
import useHeadingLevelInSpotlightCard from './use-heading-level-in-spotlight-card';
|
|
22
23
|
import useHrefInLinkItem from './use-href-in-link-item';
|
|
23
24
|
import usePrimitives from './use-primitives';
|
|
24
25
|
import useVisuallyHidden from './use-visually-hidden';
|
|
@@ -39,6 +40,7 @@ export default {
|
|
|
39
40
|
'no-unsupported-drag-and-drop-libraries': noUnsupportedDragAndDropLibraries,
|
|
40
41
|
'prefer-primitives': preferPrimitives,
|
|
41
42
|
'use-drawer-label': useDrawerLabel,
|
|
43
|
+
'use-heading-level-in-spotlight-card': useHeadingLevelInSpotlightCard,
|
|
42
44
|
'use-href-in-link-item': useHrefInLinkItem,
|
|
43
45
|
'use-primitives': usePrimitives,
|
|
44
46
|
'use-visually-hidden': useVisuallyHidden
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
+
|
|
3
|
+
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { createLintRule } from '../utils/create-rule';
|
|
5
|
+
import { getImportName } from '../utils/get-import-name';
|
|
6
|
+
export const headingLevelRequiredSuggestionText = 'Add a `headingLevel` that is of a contextually relevant level.';
|
|
7
|
+
const rule = createLintRule({
|
|
8
|
+
meta: {
|
|
9
|
+
name: 'use-heading-level-in-spotlight-card',
|
|
10
|
+
type: 'suggestion',
|
|
11
|
+
fixable: 'code',
|
|
12
|
+
docs: {
|
|
13
|
+
description: 'Inform developers of eventual requirement of `headingLevel` prop in `SpotlightCard` component. The heading level should be the appropriate level according to the surrounding context.',
|
|
14
|
+
recommended: true,
|
|
15
|
+
severity: 'warn'
|
|
16
|
+
},
|
|
17
|
+
messages: {
|
|
18
|
+
headingLevelRequired: headingLevelRequiredSuggestionText
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
create(context) {
|
|
22
|
+
return {
|
|
23
|
+
JSXElement(node) {
|
|
24
|
+
if (!isNodeOfType(node, 'JSXElement')) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!isNodeOfType(node.openingElement.name, 'JSXIdentifier')) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Get the name of the SpotlightCard import
|
|
32
|
+
const spotlightCardImportName = getImportName(context.getScope(), '@atlaskit/onboarding', 'SpotlightCard');
|
|
33
|
+
if (node.openingElement.name.name === spotlightCardImportName) {
|
|
34
|
+
// and if `heading` exists and `headingLevel` prop does not exist
|
|
35
|
+
const spotlightCardProps = node.openingElement.attributes.filter(attr => isNodeOfType(attr, 'JSXAttribute')).filter(attr => attr.name.type === 'JSXIdentifier');
|
|
36
|
+
const heading = spotlightCardProps.find(attr => attr.name.name === 'heading');
|
|
37
|
+
const headingLevel = spotlightCardProps.find(attr => attr.name.name === 'headingLevel');
|
|
38
|
+
if (heading && !headingLevel) {
|
|
39
|
+
context.report({
|
|
40
|
+
node: node,
|
|
41
|
+
messageId: 'headingLevelRequired'
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
export default rule;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
4
|
import { createLintRule } from '../utils/create-rule';
|
|
5
|
-
import {
|
|
5
|
+
import { getImportName } from '../utils/get-import-name';
|
|
6
|
+
import { getUniqueButtonItemName, hasImportOfName, hrefHasInvalidValue, insertButtonItemDefaultImport, insertButtonItemImport } from './utils';
|
|
6
7
|
export const hrefRequiredSuggestionText = 'Convert LinkItem to ButtonItem';
|
|
7
8
|
const rule = createLintRule({
|
|
8
9
|
meta: {
|
|
@@ -46,7 +47,7 @@ const rule = createLintRule({
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
// Get the name of the LinkItem import
|
|
49
|
-
const linkItemImportName = customDefaultLinkItemSpecifier ||
|
|
50
|
+
const linkItemImportName = customDefaultLinkItemSpecifier || getImportName(context.getScope(), '@atlaskit/menu', 'LinkItem');
|
|
50
51
|
if (node.openingElement.name.name === linkItemImportName) {
|
|
51
52
|
// and if href prop does not exist
|
|
52
53
|
const linkProps = node.openingElement.attributes.filter(attr => isNodeOfType(attr, 'JSXAttribute')).filter(attr => attr.name.type === 'JSXIdentifier');
|
|
@@ -2,30 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
4
|
import { findIdentifierInParentScope } from '../utils/find-in-parent';
|
|
5
|
-
export const getLinkItemImportName = scope => {
|
|
6
|
-
let traversingScope = scope;
|
|
7
|
-
let matchedVariable;
|
|
8
|
-
while (traversingScope && traversingScope.type !== 'global') {
|
|
9
|
-
matchedVariable = traversingScope.variables.find(variable => {
|
|
10
|
-
var _variable$defs;
|
|
11
|
-
const def = (_variable$defs = variable.defs) === null || _variable$defs === void 0 ? void 0 : _variable$defs[0];
|
|
12
|
-
if (!def || !(def !== null && def !== void 0 && def.node) || !isNodeOfType(def.node, 'ImportSpecifier') || !def.parent || !isNodeOfType(def.parent, 'ImportDeclaration')) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
return def.parent.source.value === '@atlaskit/menu' && def.node.imported.name === 'LinkItem';
|
|
16
|
-
});
|
|
17
|
-
if (matchedVariable) {
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
traversingScope = traversingScope.upper;
|
|
21
|
-
}
|
|
22
|
-
if (!matchedVariable) {
|
|
23
|
-
return null;
|
|
24
|
-
} else {
|
|
25
|
-
var _matchedVariable$defs;
|
|
26
|
-
return (_matchedVariable$defs = matchedVariable.defs) === null || _matchedVariable$defs === void 0 ? void 0 : _matchedVariable$defs[0].node.local.name;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
5
|
const invalidHrefValues = ['', '#', null, undefined];
|
|
30
6
|
export const hrefHasInvalidValue = (scope, href) => {
|
|
31
7
|
// If doesn't exist,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
+
export const getImportName = (scope, packageName, componentName) => {
|
|
3
|
+
let traversingScope = scope;
|
|
4
|
+
let matchedVariable;
|
|
5
|
+
while (traversingScope && traversingScope.type !== 'global') {
|
|
6
|
+
matchedVariable = traversingScope.variables.find(variable => {
|
|
7
|
+
var _variable$defs;
|
|
8
|
+
const def = (_variable$defs = variable.defs) === null || _variable$defs === void 0 ? void 0 : _variable$defs[0];
|
|
9
|
+
if (!def || !def.node || !isNodeOfType(def.node, 'ImportSpecifier') || !def.parent || !isNodeOfType(def.parent, 'ImportDeclaration')) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
return def.parent.source.value === packageName && def.node.imported.name === componentName;
|
|
13
|
+
});
|
|
14
|
+
if (matchedVariable) {
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
traversingScope = traversingScope.upper;
|
|
18
|
+
}
|
|
19
|
+
if (!matchedVariable) {
|
|
20
|
+
return null;
|
|
21
|
+
} else {
|
|
22
|
+
return matchedVariable.defs[0].node.local.name;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -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::37a857efd0971ab26170d5f1f526279b>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -22,6 +22,7 @@ export default {
|
|
|
22
22
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
|
|
23
23
|
'@atlaskit/design-system/prefer-primitives': 'warn',
|
|
24
24
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
25
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
25
26
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
26
27
|
'@atlaskit/design-system/use-primitives': 'warn',
|
|
27
28
|
'@atlaskit/design-system/use-visually-hidden': '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::b3bce8efb2db1fed84370af608ca0d4c>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -17,6 +17,7 @@ export default {
|
|
|
17
17
|
'@atlaskit/design-system/no-unsafe-design-token-usage': 'error',
|
|
18
18
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
|
|
19
19
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
20
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
20
21
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
21
22
|
'@atlaskit/design-system/use-visually-hidden': 'error'
|
|
22
23
|
}
|
|
@@ -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::e2cc357c90120dbbd89b2928dba968c0>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import consistentCssPropUsage from './consistent-css-prop-usage';
|
|
@@ -19,6 +19,7 @@ import noUnsafeDesignTokenUsage from './no-unsafe-design-token-usage';
|
|
|
19
19
|
import noUnsupportedDragAndDropLibraries from './no-unsupported-drag-and-drop-libraries';
|
|
20
20
|
import preferPrimitives from './prefer-primitives';
|
|
21
21
|
import useDrawerLabel from './use-drawer-label';
|
|
22
|
+
import useHeadingLevelInSpotlightCard from './use-heading-level-in-spotlight-card';
|
|
22
23
|
import useHrefInLinkItem from './use-href-in-link-item';
|
|
23
24
|
import usePrimitives from './use-primitives';
|
|
24
25
|
import useVisuallyHidden from './use-visually-hidden';
|
|
@@ -39,6 +40,7 @@ export default {
|
|
|
39
40
|
'no-unsupported-drag-and-drop-libraries': noUnsupportedDragAndDropLibraries,
|
|
40
41
|
'prefer-primitives': preferPrimitives,
|
|
41
42
|
'use-drawer-label': useDrawerLabel,
|
|
43
|
+
'use-heading-level-in-spotlight-card': useHeadingLevelInSpotlightCard,
|
|
42
44
|
'use-href-in-link-item': useHrefInLinkItem,
|
|
43
45
|
'use-primitives': usePrimitives,
|
|
44
46
|
'use-visually-hidden': useVisuallyHidden
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
+
|
|
3
|
+
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { createLintRule } from '../utils/create-rule';
|
|
5
|
+
import { getImportName } from '../utils/get-import-name';
|
|
6
|
+
export var headingLevelRequiredSuggestionText = 'Add a `headingLevel` that is of a contextually relevant level.';
|
|
7
|
+
var rule = createLintRule({
|
|
8
|
+
meta: {
|
|
9
|
+
name: 'use-heading-level-in-spotlight-card',
|
|
10
|
+
type: 'suggestion',
|
|
11
|
+
fixable: 'code',
|
|
12
|
+
docs: {
|
|
13
|
+
description: 'Inform developers of eventual requirement of `headingLevel` prop in `SpotlightCard` component. The heading level should be the appropriate level according to the surrounding context.',
|
|
14
|
+
recommended: true,
|
|
15
|
+
severity: 'warn'
|
|
16
|
+
},
|
|
17
|
+
messages: {
|
|
18
|
+
headingLevelRequired: headingLevelRequiredSuggestionText
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
create: function create(context) {
|
|
22
|
+
return {
|
|
23
|
+
JSXElement: function JSXElement(node) {
|
|
24
|
+
if (!isNodeOfType(node, 'JSXElement')) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!isNodeOfType(node.openingElement.name, 'JSXIdentifier')) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Get the name of the SpotlightCard import
|
|
32
|
+
var spotlightCardImportName = getImportName(context.getScope(), '@atlaskit/onboarding', 'SpotlightCard');
|
|
33
|
+
if (node.openingElement.name.name === spotlightCardImportName) {
|
|
34
|
+
// and if `heading` exists and `headingLevel` prop does not exist
|
|
35
|
+
var spotlightCardProps = node.openingElement.attributes.filter(function (attr) {
|
|
36
|
+
return isNodeOfType(attr, 'JSXAttribute');
|
|
37
|
+
}).filter(function (attr) {
|
|
38
|
+
return attr.name.type === 'JSXIdentifier';
|
|
39
|
+
});
|
|
40
|
+
var heading = spotlightCardProps.find(function (attr) {
|
|
41
|
+
return attr.name.name === 'heading';
|
|
42
|
+
});
|
|
43
|
+
var headingLevel = spotlightCardProps.find(function (attr) {
|
|
44
|
+
return attr.name.name === 'headingLevel';
|
|
45
|
+
});
|
|
46
|
+
if (heading && !headingLevel) {
|
|
47
|
+
context.report({
|
|
48
|
+
node: node,
|
|
49
|
+
messageId: 'headingLevelRequired'
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
export default rule;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
4
|
import { createLintRule } from '../utils/create-rule';
|
|
5
|
-
import {
|
|
5
|
+
import { getImportName } from '../utils/get-import-name';
|
|
6
|
+
import { getUniqueButtonItemName, hasImportOfName, hrefHasInvalidValue, insertButtonItemDefaultImport, insertButtonItemImport } from './utils';
|
|
6
7
|
export var hrefRequiredSuggestionText = 'Convert LinkItem to ButtonItem';
|
|
7
8
|
var rule = createLintRule({
|
|
8
9
|
meta: {
|
|
@@ -46,7 +47,7 @@ var rule = createLintRule({
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
// Get the name of the LinkItem import
|
|
49
|
-
var linkItemImportName = customDefaultLinkItemSpecifier ||
|
|
50
|
+
var linkItemImportName = customDefaultLinkItemSpecifier || getImportName(context.getScope(), '@atlaskit/menu', 'LinkItem');
|
|
50
51
|
if (node.openingElement.name.name === linkItemImportName) {
|
|
51
52
|
// and if href prop does not exist
|
|
52
53
|
var linkProps = node.openingElement.attributes.filter(function (attr) {
|
|
@@ -2,30 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
4
|
import { findIdentifierInParentScope } from '../utils/find-in-parent';
|
|
5
|
-
export var getLinkItemImportName = function getLinkItemImportName(scope) {
|
|
6
|
-
var traversingScope = scope;
|
|
7
|
-
var matchedVariable;
|
|
8
|
-
while (traversingScope && traversingScope.type !== 'global') {
|
|
9
|
-
matchedVariable = traversingScope.variables.find(function (variable) {
|
|
10
|
-
var _variable$defs;
|
|
11
|
-
var def = (_variable$defs = variable.defs) === null || _variable$defs === void 0 ? void 0 : _variable$defs[0];
|
|
12
|
-
if (!def || !(def !== null && def !== void 0 && def.node) || !isNodeOfType(def.node, 'ImportSpecifier') || !def.parent || !isNodeOfType(def.parent, 'ImportDeclaration')) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
return def.parent.source.value === '@atlaskit/menu' && def.node.imported.name === 'LinkItem';
|
|
16
|
-
});
|
|
17
|
-
if (matchedVariable) {
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
traversingScope = traversingScope.upper;
|
|
21
|
-
}
|
|
22
|
-
if (!matchedVariable) {
|
|
23
|
-
return null;
|
|
24
|
-
} else {
|
|
25
|
-
var _matchedVariable$defs;
|
|
26
|
-
return (_matchedVariable$defs = matchedVariable.defs) === null || _matchedVariable$defs === void 0 ? void 0 : _matchedVariable$defs[0].node.local.name;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
5
|
var invalidHrefValues = ['', '#', null, undefined];
|
|
30
6
|
export var hrefHasInvalidValue = function hrefHasInvalidValue(scope, href) {
|
|
31
7
|
// If doesn't exist,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
+
export var getImportName = function getImportName(scope, packageName, componentName) {
|
|
3
|
+
var traversingScope = scope;
|
|
4
|
+
var matchedVariable;
|
|
5
|
+
while (traversingScope && traversingScope.type !== 'global') {
|
|
6
|
+
matchedVariable = traversingScope.variables.find(function (variable) {
|
|
7
|
+
var _variable$defs;
|
|
8
|
+
var def = (_variable$defs = variable.defs) === null || _variable$defs === void 0 ? void 0 : _variable$defs[0];
|
|
9
|
+
if (!def || !def.node || !isNodeOfType(def.node, 'ImportSpecifier') || !def.parent || !isNodeOfType(def.parent, 'ImportDeclaration')) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
return def.parent.source.value === packageName && def.node.imported.name === componentName;
|
|
13
|
+
});
|
|
14
|
+
if (matchedVariable) {
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
traversingScope = traversingScope.upper;
|
|
18
|
+
}
|
|
19
|
+
if (!matchedVariable) {
|
|
20
|
+
return null;
|
|
21
|
+
} else {
|
|
22
|
+
return matchedVariable.defs[0].node.local.name;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -19,6 +19,7 @@ export declare const configs: {
|
|
|
19
19
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': string;
|
|
20
20
|
'@atlaskit/design-system/prefer-primitives': string;
|
|
21
21
|
'@atlaskit/design-system/use-drawer-label': string;
|
|
22
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
22
23
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
23
24
|
'@atlaskit/design-system/use-primitives': string;
|
|
24
25
|
'@atlaskit/design-system/use-visually-hidden': string;
|
|
@@ -38,6 +39,7 @@ export declare const configs: {
|
|
|
38
39
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
39
40
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': string;
|
|
40
41
|
'@atlaskit/design-system/use-drawer-label': string;
|
|
42
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
41
43
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
42
44
|
'@atlaskit/design-system/use-visually-hidden': string;
|
|
43
45
|
};
|
|
@@ -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::37a857efd0971ab26170d5f1f526279b>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -22,6 +22,7 @@ declare const _default: {
|
|
|
22
22
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': string;
|
|
23
23
|
'@atlaskit/design-system/prefer-primitives': string;
|
|
24
24
|
'@atlaskit/design-system/use-drawer-label': string;
|
|
25
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
25
26
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
26
27
|
'@atlaskit/design-system/use-primitives': string;
|
|
27
28
|
'@atlaskit/design-system/use-visually-hidden': string;
|
|
@@ -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::b3bce8efb2db1fed84370af608ca0d4c>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -17,6 +17,7 @@ declare const _default: {
|
|
|
17
17
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
18
18
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': string;
|
|
19
19
|
'@atlaskit/design-system/use-drawer-label': string;
|
|
20
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
20
21
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
21
22
|
'@atlaskit/design-system/use-visually-hidden': string;
|
|
22
23
|
};
|
|
@@ -19,6 +19,7 @@ declare const _default: {
|
|
|
19
19
|
'no-unsupported-drag-and-drop-libraries': import("eslint").Rule.RuleModule;
|
|
20
20
|
'prefer-primitives': import("eslint").Rule.RuleModule;
|
|
21
21
|
'use-drawer-label': import("eslint").Rule.RuleModule;
|
|
22
|
+
'use-heading-level-in-spotlight-card': import("eslint").Rule.RuleModule;
|
|
22
23
|
'use-href-in-link-item': import("eslint").Rule.RuleModule;
|
|
23
24
|
'use-primitives': import("eslint").Rule.RuleModule;
|
|
24
25
|
'use-visually-hidden': import("eslint").Rule.RuleModule;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Rule, Scope } from 'eslint';
|
|
2
2
|
import { ImportDeclaration, JSXAttribute } from 'eslint-codemod-utils';
|
|
3
|
-
export declare const getLinkItemImportName: (scope: Scope.Scope) => string | null;
|
|
4
3
|
export declare const hrefHasInvalidValue: (scope: Scope.Scope, href: JSXAttribute | undefined) => boolean;
|
|
5
4
|
export declare const hasImportOfName: (node: ImportDeclaration, name: string) => boolean;
|
|
6
5
|
export declare const insertButtonItemDefaultImport: (fixer: Rule.RuleFixer, node: ImportDeclaration) => Rule.Fix;
|
|
@@ -19,6 +19,7 @@ export declare const configs: {
|
|
|
19
19
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': string;
|
|
20
20
|
'@atlaskit/design-system/prefer-primitives': string;
|
|
21
21
|
'@atlaskit/design-system/use-drawer-label': string;
|
|
22
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
22
23
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
23
24
|
'@atlaskit/design-system/use-primitives': string;
|
|
24
25
|
'@atlaskit/design-system/use-visually-hidden': string;
|
|
@@ -38,6 +39,7 @@ export declare const configs: {
|
|
|
38
39
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
39
40
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': string;
|
|
40
41
|
'@atlaskit/design-system/use-drawer-label': string;
|
|
42
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
41
43
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
42
44
|
'@atlaskit/design-system/use-visually-hidden': string;
|
|
43
45
|
};
|
|
@@ -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::37a857efd0971ab26170d5f1f526279b>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -22,6 +22,7 @@ declare const _default: {
|
|
|
22
22
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': string;
|
|
23
23
|
'@atlaskit/design-system/prefer-primitives': string;
|
|
24
24
|
'@atlaskit/design-system/use-drawer-label': string;
|
|
25
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
25
26
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
26
27
|
'@atlaskit/design-system/use-primitives': string;
|
|
27
28
|
'@atlaskit/design-system/use-visually-hidden': string;
|
|
@@ -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::b3bce8efb2db1fed84370af608ca0d4c>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -17,6 +17,7 @@ declare const _default: {
|
|
|
17
17
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
18
18
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': string;
|
|
19
19
|
'@atlaskit/design-system/use-drawer-label': string;
|
|
20
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
20
21
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
21
22
|
'@atlaskit/design-system/use-visually-hidden': string;
|
|
22
23
|
};
|
|
@@ -23,6 +23,7 @@ declare const _default: {
|
|
|
23
23
|
'no-unsupported-drag-and-drop-libraries': import("eslint").Rule.RuleModule;
|
|
24
24
|
'prefer-primitives': import("eslint").Rule.RuleModule;
|
|
25
25
|
'use-drawer-label': import("eslint").Rule.RuleModule;
|
|
26
|
+
'use-heading-level-in-spotlight-card': import("eslint").Rule.RuleModule;
|
|
26
27
|
'use-href-in-link-item': import("eslint").Rule.RuleModule;
|
|
27
28
|
'use-primitives': import("eslint").Rule.RuleModule;
|
|
28
29
|
'use-visually-hidden': import("eslint").Rule.RuleModule;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Rule, Scope } from 'eslint';
|
|
2
2
|
import { ImportDeclaration, JSXAttribute } from 'eslint-codemod-utils';
|
|
3
|
-
export declare const getLinkItemImportName: (scope: Scope.Scope) => string | null;
|
|
4
3
|
export declare const hrefHasInvalidValue: (scope: Scope.Scope, href: JSXAttribute | undefined) => boolean;
|
|
5
4
|
export declare const hasImportOfName: (node: ImportDeclaration, name: string) => boolean;
|
|
6
5
|
export declare const insertButtonItemDefaultImport: (fixer: Rule.RuleFixer, node: ImportDeclaration) => Rule.Fix;
|
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": "8.
|
|
4
|
+
"version": "8.18.0",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"registry": "https://registry.npmjs.org/"
|