@atlaskit/eslint-plugin-design-system 14.3.1 → 14.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +1 -0
- package/dist/cjs/ast-nodes/jsx-element.js +3 -1
- package/dist/cjs/presets/all-flat.codegen.js +2 -1
- package/dist/cjs/presets/all.codegen.js +2 -1
- package/dist/cjs/presets/recommended-flat.codegen.js +2 -1
- package/dist/cjs/presets/recommended.codegen.js +2 -1
- package/dist/cjs/rules/ensure-design-token-usage/index.js +2 -0
- package/dist/cjs/rules/index.codegen.js +3 -1
- package/dist/cjs/rules/lozenge-badge-tag-labelling-system-migration/index.js +6 -2
- package/dist/cjs/rules/no-boolean-autofocus-on-modal-dialog/index.js +2 -0
- package/dist/cjs/rules/no-emotion-primitives/index.js +2 -0
- package/dist/cjs/rules/no-unused-css-map/utils.js +2 -0
- package/dist/cjs/rules/use-heading-level-in-section-message/index.js +68 -0
- package/dist/cjs/rules/use-modal-dialog-close-button/index.js +2 -0
- package/dist/cjs/rules/use-primitives/config/index.js +2 -0
- package/dist/cjs/rules/use-textfield-autocomplete/index.js +2 -0
- package/dist/cjs/rules/use-visually-hidden/utils.js +2 -0
- package/dist/cjs/rules/utils/create-no-tagged-template-expression-rule/index.js +2 -0
- package/dist/cjs/rules/utils/is-node.js +4 -0
- package/dist/es2019/ast-nodes/jsx-element.js +2 -0
- package/dist/es2019/presets/all-flat.codegen.js +2 -1
- package/dist/es2019/presets/all.codegen.js +2 -1
- package/dist/es2019/presets/recommended-flat.codegen.js +2 -1
- package/dist/es2019/presets/recommended.codegen.js +2 -1
- package/dist/es2019/rules/ensure-design-token-usage/index.js +2 -0
- package/dist/es2019/rules/index.codegen.js +3 -1
- package/dist/es2019/rules/lozenge-badge-tag-labelling-system-migration/index.js +6 -2
- package/dist/es2019/rules/no-boolean-autofocus-on-modal-dialog/index.js +2 -0
- package/dist/es2019/rules/no-emotion-primitives/index.js +2 -0
- package/dist/es2019/rules/no-unused-css-map/utils.js +2 -0
- package/dist/es2019/rules/use-heading-level-in-section-message/index.js +54 -0
- package/dist/es2019/rules/use-modal-dialog-close-button/index.js +2 -0
- package/dist/es2019/rules/use-primitives/config/index.js +2 -0
- package/dist/es2019/rules/use-textfield-autocomplete/index.js +2 -0
- package/dist/es2019/rules/use-visually-hidden/utils.js +2 -0
- package/dist/es2019/rules/utils/create-no-tagged-template-expression-rule/index.js +2 -0
- package/dist/es2019/rules/utils/is-node.js +4 -0
- package/dist/esm/ast-nodes/jsx-element.js +2 -0
- package/dist/esm/presets/all-flat.codegen.js +2 -1
- package/dist/esm/presets/all.codegen.js +2 -1
- package/dist/esm/presets/recommended-flat.codegen.js +2 -1
- package/dist/esm/presets/recommended.codegen.js +2 -1
- package/dist/esm/rules/ensure-design-token-usage/index.js +2 -0
- package/dist/esm/rules/index.codegen.js +3 -1
- package/dist/esm/rules/lozenge-badge-tag-labelling-system-migration/index.js +6 -2
- package/dist/esm/rules/no-boolean-autofocus-on-modal-dialog/index.js +2 -0
- package/dist/esm/rules/no-emotion-primitives/index.js +2 -0
- package/dist/esm/rules/no-unused-css-map/utils.js +2 -0
- package/dist/esm/rules/use-heading-level-in-section-message/index.js +62 -0
- package/dist/esm/rules/use-modal-dialog-close-button/index.js +2 -0
- package/dist/esm/rules/use-primitives/config/index.js +2 -0
- package/dist/esm/rules/use-textfield-autocomplete/index.js +2 -0
- package/dist/esm/rules/use-visually-hidden/utils.js +2 -0
- package/dist/esm/rules/utils/create-no-tagged-template-expression-rule/index.js +2 -0
- package/dist/esm/rules/utils/is-node.js +4 -0
- package/dist/types/presets/all-flat.codegen.d.ts +1 -1
- package/dist/types/presets/all.codegen.d.ts +1 -1
- package/dist/types/presets/recommended-flat.codegen.d.ts +1 -1
- package/dist/types/presets/recommended.codegen.d.ts +1 -1
- package/dist/types/rules/index.codegen.d.ts +1 -1
- package/dist/types/rules/use-heading-level-in-section-message/index.d.ts +4 -0
- package/dist/types-ts4.5/presets/all-flat.codegen.d.ts +1 -1
- package/dist/types-ts4.5/presets/all.codegen.d.ts +1 -1
- package/dist/types-ts4.5/presets/recommended-flat.codegen.d.ts +1 -1
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +1 -1
- package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-heading-level-in-section-message/index.d.ts +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 14.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`9e3507590f1b4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9e3507590f1b4) -
|
|
8
|
+
Add rule to encourage use of `headingLevel` in section message component.
|
|
9
|
+
|
|
10
|
+
## 14.3.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`7affa87ae5857`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7affa87ae5857) -
|
|
15
|
+
Add ESLint v9/v10 RuleContext compatibility for platform ESLint packages consumed by Jira.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 14.3.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -106,6 +106,7 @@ module.exports = {
|
|
|
106
106
|
| <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 |
|
|
107
107
|
| <a href="./src/rules/use-field-message-wrapper/README.md">use-field-message-wrapper</a> | Encourage use of message wrapper component when using form message components. | Yes | | Yes |
|
|
108
108
|
| <a href="./src/rules/use-heading/README.md">use-heading</a> | Encourage the usage of heading components. | Yes | Yes | Yes |
|
|
109
|
+
| <a href="./src/rules/use-heading-level-in-section-message/README.md">use-heading-level-in-section-message</a> | The `SectionMessage` component in `@atlaskit/section-message` needs to be the correct level within the document flow. This is not something that can be automated and requires contextual knowledge of what is present in the experience. | Yes | Yes | |
|
|
109
110
|
| <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 | |
|
|
110
111
|
| <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 |
|
|
111
112
|
| <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 | |
|
|
@@ -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::4cd2dfd73ed3cdd152ee6481087c49ee>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -70,6 +70,7 @@ var rules = {
|
|
|
70
70
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
71
71
|
'@atlaskit/design-system/use-field-message-wrapper': 'warn',
|
|
72
72
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
73
|
+
'@atlaskit/design-system/use-heading-level-in-section-message': 'warn',
|
|
73
74
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
74
75
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
75
76
|
'@atlaskit/design-system/use-latest-xcss-syntax': '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::8efae2c2e169f84381b978b4bc47433d>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -69,6 +69,7 @@ var rules = {
|
|
|
69
69
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
70
70
|
'@atlaskit/design-system/use-field-message-wrapper': 'warn',
|
|
71
71
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
72
|
+
'@atlaskit/design-system/use-heading-level-in-section-message': 'warn',
|
|
72
73
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
73
74
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
74
75
|
'@atlaskit/design-system/use-latest-xcss-syntax': '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::80b81104d52bdf5ca1b99e6265b83cef>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -55,6 +55,7 @@ var rules = {
|
|
|
55
55
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
56
56
|
'@atlaskit/design-system/use-field-message-wrapper': 'warn',
|
|
57
57
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
58
|
+
'@atlaskit/design-system/use-heading-level-in-section-message': 'warn',
|
|
58
59
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
59
60
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
60
61
|
'@atlaskit/design-system/use-latest-xcss-syntax': '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::c7aa5d4ccdf62d54c12e1d5344a38fb8>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -54,6 +54,7 @@ var rules = {
|
|
|
54
54
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
55
55
|
'@atlaskit/design-system/use-field-message-wrapper': 'warn',
|
|
56
56
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
57
|
+
'@atlaskit/design-system/use-heading-level-in-section-message': 'warn',
|
|
57
58
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
58
59
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
59
60
|
'@atlaskit/design-system/use-latest-xcss-syntax': 'error',
|
|
@@ -62,6 +62,7 @@ var _useDatetimePickerCalendarButton = _interopRequireDefault(require("./use-dat
|
|
|
62
62
|
var _useDrawerLabel = _interopRequireDefault(require("./use-drawer-label"));
|
|
63
63
|
var _useFieldMessageWrapper = _interopRequireDefault(require("./use-field-message-wrapper"));
|
|
64
64
|
var _useHeading = _interopRequireDefault(require("./use-heading"));
|
|
65
|
+
var _useHeadingLevelInSectionMessage = _interopRequireDefault(require("./use-heading-level-in-section-message"));
|
|
65
66
|
var _useHeadingLevelInSpotlightCard = _interopRequireDefault(require("./use-heading-level-in-spotlight-card"));
|
|
66
67
|
var _useHrefInLinkItem = _interopRequireDefault(require("./use-href-in-link-item"));
|
|
67
68
|
var _useLatestXcssSyntax = _interopRequireDefault(require("./use-latest-xcss-syntax"));
|
|
@@ -84,7 +85,7 @@ var _useTokensTypography = _interopRequireDefault(require("./use-tokens-typograp
|
|
|
84
85
|
var _useVisuallyHidden = _interopRequireDefault(require("./use-visually-hidden"));
|
|
85
86
|
/**
|
|
86
87
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
87
|
-
* @codegen <<SignedSource::
|
|
88
|
+
* @codegen <<SignedSource::b90bcf0b2fb6429faae59c7a454e3260>>
|
|
88
89
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
89
90
|
*/
|
|
90
91
|
|
|
@@ -146,6 +147,7 @@ var rules = exports.rules = {
|
|
|
146
147
|
'use-drawer-label': _useDrawerLabel.default,
|
|
147
148
|
'use-field-message-wrapper': _useFieldMessageWrapper.default,
|
|
148
149
|
'use-heading': _useHeading.default,
|
|
150
|
+
'use-heading-level-in-section-message': _useHeadingLevelInSectionMessage.default,
|
|
149
151
|
'use-heading-level-in-spotlight-card': _useHeadingLevelInSpotlightCard.default,
|
|
150
152
|
'use-href-in-link-item': _useHrefInLinkItem.default,
|
|
151
153
|
'use-latest-xcss-syntax': _useLatestXcssSyntax.default,
|
|
@@ -272,8 +272,10 @@ var rule = (0, _createLintRule.createLintRule)({
|
|
|
272
272
|
* Handles both regular Tag and avatarTag migrations
|
|
273
273
|
*/
|
|
274
274
|
function generateTagReplacement(node) {
|
|
275
|
+
var _context$sourceCode;
|
|
275
276
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
276
|
-
|
|
277
|
+
// @ts-ignore - Jira's ESLint v10 types expose sourceCode, platform still checks with ESLint v9.
|
|
278
|
+
var sourceCode = (_context$sourceCode = context.sourceCode) !== null && _context$sourceCode !== void 0 ? _context$sourceCode : context.getSourceCode();
|
|
277
279
|
var attributes = node.openingElement.attributes;
|
|
278
280
|
|
|
279
281
|
// Build new attributes array
|
|
@@ -550,7 +552,9 @@ var rule = (0, _createLintRule.createLintRule)({
|
|
|
550
552
|
var _tagImportInfo$node7;
|
|
551
553
|
var importNode = (_tagImportInfo$node7 = tagImportInfo.node) === null || _tagImportInfo$node7 === void 0 ? void 0 : _tagImportInfo$node7.parent;
|
|
552
554
|
if (importNode) {
|
|
553
|
-
var
|
|
555
|
+
var _context$sourceCode2;
|
|
556
|
+
// @ts-ignore - Jira's ESLint v10 types expose sourceCode, platform still checks with ESLint v9.
|
|
557
|
+
var sourceCode = (_context$sourceCode2 = context.sourceCode) !== null && _context$sourceCode2 !== void 0 ? _context$sourceCode2 : context.getSourceCode();
|
|
554
558
|
var mainModuleSource = '@atlaskit/tag';
|
|
555
559
|
|
|
556
560
|
// Get all other specifiers that are not SimpleTag or RemovableTag
|
|
@@ -25,6 +25,8 @@ var getCssMapObject = exports.getCssMapObject = function getCssMapObject(node) {
|
|
|
25
25
|
}
|
|
26
26
|
return node.arguments[0];
|
|
27
27
|
};
|
|
28
|
+
|
|
29
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
28
30
|
var UnusedCssMapChecker = exports.UnusedCssMapChecker = /*#__PURE__*/function () {
|
|
29
31
|
function UnusedCssMapChecker(cssMapObject, context, cssMapCallNode) {
|
|
30
32
|
(0, _classCallCheck2.default)(this, UnusedCssMapChecker);
|
|
@@ -0,0 +1,68 @@
|
|
|
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 _createLintRule = require("../utils/create-lint-rule");
|
|
9
|
+
var headingLevelRequiredSuggestionText = exports.headingLevelRequiredSuggestionText = 'Add a `headingLevel` that is of a contextually relevant level.';
|
|
10
|
+
var rule = (0, _createLintRule.createLintRule)({
|
|
11
|
+
meta: {
|
|
12
|
+
name: 'use-heading-level-in-section-message',
|
|
13
|
+
type: 'suggestion',
|
|
14
|
+
fixable: 'code',
|
|
15
|
+
docs: {
|
|
16
|
+
description: 'The `SectionMessage` component in `@atlaskit/section-message` needs to be the correct level within the document flow. This is not something that can be automated and requires contextual knowledge of what is present in the experience.',
|
|
17
|
+
recommended: true,
|
|
18
|
+
severity: 'warn'
|
|
19
|
+
},
|
|
20
|
+
messages: {
|
|
21
|
+
headingLevelRequired: headingLevelRequiredSuggestionText
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
create: function create(context) {
|
|
25
|
+
var sectionMessageImportName;
|
|
26
|
+
return {
|
|
27
|
+
ImportDeclaration: function ImportDeclaration(node) {
|
|
28
|
+
if (node.source.value !== '@atlaskit/section-message') {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
node.specifiers.forEach(function (spec) {
|
|
32
|
+
if ((0, _eslintCodemodUtils.isNodeOfType)(spec, 'ImportDefaultSpecifier')) {
|
|
33
|
+
sectionMessageImportName = spec.local.name;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
JSXElement: function JSXElement(node) {
|
|
38
|
+
if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'JSXElement')) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (!(0, _eslintCodemodUtils.isNodeOfType)(node.openingElement.name, 'JSXIdentifier')) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (node.openingElement.name.name === sectionMessageImportName) {
|
|
45
|
+
// and if `title` exists and `headingLevel` prop does not exist
|
|
46
|
+
var sectionMessageProps = node.openingElement.attributes.filter(function (attr) {
|
|
47
|
+
return (0, _eslintCodemodUtils.isNodeOfType)(attr, 'JSXAttribute');
|
|
48
|
+
}).filter(function (attr) {
|
|
49
|
+
return attr.name.type === 'JSXIdentifier';
|
|
50
|
+
});
|
|
51
|
+
var title = sectionMessageProps.find(function (attr) {
|
|
52
|
+
return attr.name.name === 'title';
|
|
53
|
+
});
|
|
54
|
+
var headingLevel = sectionMessageProps.find(function (attr) {
|
|
55
|
+
return attr.name.name === 'headingLevel';
|
|
56
|
+
});
|
|
57
|
+
if (title && !headingLevel) {
|
|
58
|
+
context.report({
|
|
59
|
+
node: node,
|
|
60
|
+
messageId: 'headingLevelRequired'
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
var _default = exports.default = rule;
|
|
@@ -47,6 +47,8 @@ var VALID_PATTERNS = exports.VALID_PATTERNS = [
|
|
|
47
47
|
var defaults = {
|
|
48
48
|
patterns: ['compiled-css-function']
|
|
49
49
|
};
|
|
50
|
+
|
|
51
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
50
52
|
var getConfig = exports.getConfig = function getConfig(overrides) {
|
|
51
53
|
return Object.assign({}, defaults, overrides);
|
|
52
54
|
};
|
|
@@ -40,6 +40,8 @@ var getObjectLikeness = exports.getObjectLikeness = function getObjectLikeness(n
|
|
|
40
40
|
});
|
|
41
41
|
return countMatchingKeyValues(styleEntries);
|
|
42
42
|
};
|
|
43
|
+
|
|
44
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
43
45
|
var countMatchingKeyValues = exports.countMatchingKeyValues = function countMatchingKeyValues(styleEntries) {
|
|
44
46
|
var matchingStyleEntries = styleEntries.filter(function (entry) {
|
|
45
47
|
return entry.key in referenceObject;
|
|
@@ -34,6 +34,8 @@ var noTaggedTemplateExpressionRuleSchema = exports.noTaggedTemplateExpressionRul
|
|
|
34
34
|
* but it would add a lot of complexity.
|
|
35
35
|
*/
|
|
36
36
|
var shouldSkipMultilineComments = false;
|
|
37
|
+
|
|
38
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
37
39
|
var createNoTaggedTemplateExpressionRule = exports.createNoTaggedTemplateExpressionRule = function createNoTaggedTemplateExpressionRule(isUsage, messageId) {
|
|
38
40
|
return function (context) {
|
|
39
41
|
var importSources = (0, _isSupportedImport.getImportSources)(context);
|
|
@@ -16,9 +16,13 @@ var cssInJsCallees = ['css', 'styled', 'styled2'];
|
|
|
16
16
|
var isCssInJsCallNode = exports.isCssInJsCallNode = function isCssInJsCallNode(node) {
|
|
17
17
|
return (node === null || node === void 0 ? void 0 : node.type) === 'CallExpression' && node.callee.type === 'Identifier' && cssInJsCallees.includes(node.callee.name);
|
|
18
18
|
};
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
19
21
|
var isCssInJsObjectNode = exports.isCssInJsObjectNode = function isCssInJsObjectNode(node) {
|
|
20
22
|
return (node === null || node === void 0 ? void 0 : node.type) === 'CallExpression' && node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier' && cssInJsCallees.includes(node.callee.object.name);
|
|
21
23
|
};
|
|
24
|
+
|
|
25
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
22
26
|
var _isDecendantOfStyleBlock = exports.isDecendantOfStyleBlock = function isDecendantOfStyleBlock(node) {
|
|
23
27
|
if (node.type === 'VariableDeclarator') {
|
|
24
28
|
if (node.id.type !== 'Identifier') {
|
|
@@ -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::4cd2dfd73ed3cdd152ee6481087c49ee>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -64,6 +64,7 @@ const rules = {
|
|
|
64
64
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
65
65
|
'@atlaskit/design-system/use-field-message-wrapper': 'warn',
|
|
66
66
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
67
|
+
'@atlaskit/design-system/use-heading-level-in-section-message': 'warn',
|
|
67
68
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
68
69
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
69
70
|
'@atlaskit/design-system/use-latest-xcss-syntax': '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::8efae2c2e169f84381b978b4bc47433d>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -63,6 +63,7 @@ const rules = {
|
|
|
63
63
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
64
64
|
'@atlaskit/design-system/use-field-message-wrapper': 'warn',
|
|
65
65
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
66
|
+
'@atlaskit/design-system/use-heading-level-in-section-message': 'warn',
|
|
66
67
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
67
68
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
68
69
|
'@atlaskit/design-system/use-latest-xcss-syntax': '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::80b81104d52bdf5ca1b99e6265b83cef>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -49,6 +49,7 @@ const rules = {
|
|
|
49
49
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
50
50
|
'@atlaskit/design-system/use-field-message-wrapper': 'warn',
|
|
51
51
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
52
|
+
'@atlaskit/design-system/use-heading-level-in-section-message': 'warn',
|
|
52
53
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
53
54
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
54
55
|
'@atlaskit/design-system/use-latest-xcss-syntax': '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::c7aa5d4ccdf62d54c12e1d5344a38fb8>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -48,6 +48,7 @@ const rules = {
|
|
|
48
48
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
49
49
|
'@atlaskit/design-system/use-field-message-wrapper': 'warn',
|
|
50
50
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
51
|
+
'@atlaskit/design-system/use-heading-level-in-section-message': 'warn',
|
|
51
52
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
52
53
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
53
54
|
'@atlaskit/design-system/use-latest-xcss-syntax': '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::b90bcf0b2fb6429faae59c7a454e3260>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -61,6 +61,7 @@ import useDatetimePickerCalendarButton from './use-datetime-picker-calendar-butt
|
|
|
61
61
|
import useDrawerLabel from './use-drawer-label';
|
|
62
62
|
import useFieldMessageWrapper from './use-field-message-wrapper';
|
|
63
63
|
import useHeading from './use-heading';
|
|
64
|
+
import useHeadingLevelInSectionMessage from './use-heading-level-in-section-message';
|
|
64
65
|
import useHeadingLevelInSpotlightCard from './use-heading-level-in-spotlight-card';
|
|
65
66
|
import useHrefInLinkItem from './use-href-in-link-item';
|
|
66
67
|
import useLatestXcssSyntax from './use-latest-xcss-syntax';
|
|
@@ -139,6 +140,7 @@ export const rules = {
|
|
|
139
140
|
'use-drawer-label': useDrawerLabel,
|
|
140
141
|
'use-field-message-wrapper': useFieldMessageWrapper,
|
|
141
142
|
'use-heading': useHeading,
|
|
143
|
+
'use-heading-level-in-section-message': useHeadingLevelInSectionMessage,
|
|
142
144
|
'use-heading-level-in-spotlight-card': useHeadingLevelInSpotlightCard,
|
|
143
145
|
'use-href-in-link-item': useHrefInLinkItem,
|
|
144
146
|
'use-latest-xcss-syntax': useLatestXcssSyntax,
|
|
@@ -262,7 +262,9 @@ const rule = createLintRule({
|
|
|
262
262
|
* Handles both regular Tag and avatarTag migrations
|
|
263
263
|
*/
|
|
264
264
|
function generateTagReplacement(node, options = {}) {
|
|
265
|
-
|
|
265
|
+
var _context$sourceCode;
|
|
266
|
+
// @ts-ignore - Jira's ESLint v10 types expose sourceCode, platform still checks with ESLint v9.
|
|
267
|
+
const sourceCode = (_context$sourceCode = context.sourceCode) !== null && _context$sourceCode !== void 0 ? _context$sourceCode : context.getSourceCode();
|
|
266
268
|
const attributes = node.openingElement.attributes;
|
|
267
269
|
|
|
268
270
|
// Build new attributes array
|
|
@@ -544,7 +546,9 @@ const rule = createLintRule({
|
|
|
544
546
|
var _tagImportInfo$node7;
|
|
545
547
|
const importNode = (_tagImportInfo$node7 = tagImportInfo.node) === null || _tagImportInfo$node7 === void 0 ? void 0 : _tagImportInfo$node7.parent;
|
|
546
548
|
if (importNode) {
|
|
547
|
-
|
|
549
|
+
var _context$sourceCode2;
|
|
550
|
+
// @ts-ignore - Jira's ESLint v10 types expose sourceCode, platform still checks with ESLint v9.
|
|
551
|
+
const sourceCode = (_context$sourceCode2 = context.sourceCode) !== null && _context$sourceCode2 !== void 0 ? _context$sourceCode2 : context.getSourceCode();
|
|
548
552
|
const mainModuleSource = '@atlaskit/tag';
|
|
549
553
|
|
|
550
554
|
// Get all other specifiers that are not SimpleTag or RemovableTag
|
|
@@ -12,6 +12,8 @@ export const getCssMapObject = node => {
|
|
|
12
12
|
}
|
|
13
13
|
return node.arguments[0];
|
|
14
14
|
};
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
15
17
|
export class UnusedCssMapChecker {
|
|
16
18
|
constructor(cssMapObject, context, cssMapCallNode) {
|
|
17
19
|
this.cssMapObject = cssMapObject;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
+
import { createLintRule } from '../utils/create-lint-rule';
|
|
3
|
+
export const headingLevelRequiredSuggestionText = 'Add a `headingLevel` that is of a contextually relevant level.';
|
|
4
|
+
const rule = createLintRule({
|
|
5
|
+
meta: {
|
|
6
|
+
name: 'use-heading-level-in-section-message',
|
|
7
|
+
type: 'suggestion',
|
|
8
|
+
fixable: 'code',
|
|
9
|
+
docs: {
|
|
10
|
+
description: 'The `SectionMessage` component in `@atlaskit/section-message` needs to be the correct level within the document flow. This is not something that can be automated and requires contextual knowledge of what is present in the experience.',
|
|
11
|
+
recommended: true,
|
|
12
|
+
severity: 'warn'
|
|
13
|
+
},
|
|
14
|
+
messages: {
|
|
15
|
+
headingLevelRequired: headingLevelRequiredSuggestionText
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
create(context) {
|
|
19
|
+
let sectionMessageImportName;
|
|
20
|
+
return {
|
|
21
|
+
ImportDeclaration(node) {
|
|
22
|
+
if (node.source.value !== '@atlaskit/section-message') {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
node.specifiers.forEach(spec => {
|
|
26
|
+
if (isNodeOfType(spec, 'ImportDefaultSpecifier')) {
|
|
27
|
+
sectionMessageImportName = spec.local.name;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
JSXElement(node) {
|
|
32
|
+
if (!isNodeOfType(node, 'JSXElement')) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (!isNodeOfType(node.openingElement.name, 'JSXIdentifier')) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (node.openingElement.name.name === sectionMessageImportName) {
|
|
39
|
+
// and if `title` exists and `headingLevel` prop does not exist
|
|
40
|
+
const sectionMessageProps = node.openingElement.attributes.filter(attr => isNodeOfType(attr, 'JSXAttribute')).filter(attr => attr.name.type === 'JSXIdentifier');
|
|
41
|
+
const title = sectionMessageProps.find(attr => attr.name.name === 'title');
|
|
42
|
+
const headingLevel = sectionMessageProps.find(attr => attr.name.name === 'headingLevel');
|
|
43
|
+
if (title && !headingLevel) {
|
|
44
|
+
context.report({
|
|
45
|
+
node: node,
|
|
46
|
+
messageId: 'headingLevelRequired'
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
export default rule;
|
|
@@ -41,6 +41,8 @@ export const VALID_PATTERNS = [
|
|
|
41
41
|
const defaults = {
|
|
42
42
|
patterns: ['compiled-css-function']
|
|
43
43
|
};
|
|
44
|
+
|
|
45
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
44
46
|
export const getConfig = overrides => {
|
|
45
47
|
return Object.assign({}, defaults, overrides);
|
|
46
48
|
};
|
|
@@ -31,6 +31,8 @@ export const getObjectLikeness = node => {
|
|
|
31
31
|
}).filter(node => Boolean(node));
|
|
32
32
|
return countMatchingKeyValues(styleEntries);
|
|
33
33
|
};
|
|
34
|
+
|
|
35
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
34
36
|
export const countMatchingKeyValues = styleEntries => {
|
|
35
37
|
const matchingStyleEntries = styleEntries.filter(entry => {
|
|
36
38
|
return entry.key in referenceObject;
|
|
@@ -26,6 +26,8 @@ export const noTaggedTemplateExpressionRuleSchema = [{
|
|
|
26
26
|
* but it would add a lot of complexity.
|
|
27
27
|
*/
|
|
28
28
|
const shouldSkipMultilineComments = false;
|
|
29
|
+
|
|
30
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
29
31
|
export const createNoTaggedTemplateExpressionRule = (isUsage, messageId) => context => {
|
|
30
32
|
const importSources = getImportSources(context);
|
|
31
33
|
return {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { isCssInJsTemplateNode } from './is-css-in-js-template-node';
|
|
2
2
|
const cssInJsCallees = ['css', 'styled', 'styled2'];
|
|
3
3
|
export const isCssInJsCallNode = node => (node === null || node === void 0 ? void 0 : node.type) === 'CallExpression' && node.callee.type === 'Identifier' && cssInJsCallees.includes(node.callee.name);
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
4
6
|
export const isCssInJsObjectNode = node => (node === null || node === void 0 ? void 0 : node.type) === 'CallExpression' && node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier' && cssInJsCallees.includes(node.callee.object.name);
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
5
9
|
export const isDecendantOfStyleBlock = node => {
|
|
6
10
|
if (node.type === 'VariableDeclarator') {
|
|
7
11
|
if (node.id.type !== 'Identifier') {
|
|
@@ -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::4cd2dfd73ed3cdd152ee6481087c49ee>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -64,6 +64,7 @@ var rules = {
|
|
|
64
64
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
65
65
|
'@atlaskit/design-system/use-field-message-wrapper': 'warn',
|
|
66
66
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
67
|
+
'@atlaskit/design-system/use-heading-level-in-section-message': 'warn',
|
|
67
68
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
68
69
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
69
70
|
'@atlaskit/design-system/use-latest-xcss-syntax': '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::8efae2c2e169f84381b978b4bc47433d>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -63,6 +63,7 @@ var rules = {
|
|
|
63
63
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
64
64
|
'@atlaskit/design-system/use-field-message-wrapper': 'warn',
|
|
65
65
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
66
|
+
'@atlaskit/design-system/use-heading-level-in-section-message': 'warn',
|
|
66
67
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
67
68
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
68
69
|
'@atlaskit/design-system/use-latest-xcss-syntax': '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::80b81104d52bdf5ca1b99e6265b83cef>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -49,6 +49,7 @@ var rules = {
|
|
|
49
49
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
50
50
|
'@atlaskit/design-system/use-field-message-wrapper': 'warn',
|
|
51
51
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
52
|
+
'@atlaskit/design-system/use-heading-level-in-section-message': 'warn',
|
|
52
53
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
53
54
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
54
55
|
'@atlaskit/design-system/use-latest-xcss-syntax': '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::c7aa5d4ccdf62d54c12e1d5344a38fb8>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -48,6 +48,7 @@ var rules = {
|
|
|
48
48
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
49
49
|
'@atlaskit/design-system/use-field-message-wrapper': 'warn',
|
|
50
50
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
51
|
+
'@atlaskit/design-system/use-heading-level-in-section-message': 'warn',
|
|
51
52
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
52
53
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
53
54
|
'@atlaskit/design-system/use-latest-xcss-syntax': '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::b90bcf0b2fb6429faae59c7a454e3260>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -61,6 +61,7 @@ import useDatetimePickerCalendarButton from './use-datetime-picker-calendar-butt
|
|
|
61
61
|
import useDrawerLabel from './use-drawer-label';
|
|
62
62
|
import useFieldMessageWrapper from './use-field-message-wrapper';
|
|
63
63
|
import useHeading from './use-heading';
|
|
64
|
+
import useHeadingLevelInSectionMessage from './use-heading-level-in-section-message';
|
|
64
65
|
import useHeadingLevelInSpotlightCard from './use-heading-level-in-spotlight-card';
|
|
65
66
|
import useHrefInLinkItem from './use-href-in-link-item';
|
|
66
67
|
import useLatestXcssSyntax from './use-latest-xcss-syntax';
|
|
@@ -139,6 +140,7 @@ export var rules = {
|
|
|
139
140
|
'use-drawer-label': useDrawerLabel,
|
|
140
141
|
'use-field-message-wrapper': useFieldMessageWrapper,
|
|
141
142
|
'use-heading': useHeading,
|
|
143
|
+
'use-heading-level-in-section-message': useHeadingLevelInSectionMessage,
|
|
142
144
|
'use-heading-level-in-spotlight-card': useHeadingLevelInSpotlightCard,
|
|
143
145
|
'use-href-in-link-item': useHrefInLinkItem,
|
|
144
146
|
'use-latest-xcss-syntax': useLatestXcssSyntax,
|
|
@@ -265,8 +265,10 @@ var rule = createLintRule({
|
|
|
265
265
|
* Handles both regular Tag and avatarTag migrations
|
|
266
266
|
*/
|
|
267
267
|
function generateTagReplacement(node) {
|
|
268
|
+
var _context$sourceCode;
|
|
268
269
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
269
|
-
|
|
270
|
+
// @ts-ignore - Jira's ESLint v10 types expose sourceCode, platform still checks with ESLint v9.
|
|
271
|
+
var sourceCode = (_context$sourceCode = context.sourceCode) !== null && _context$sourceCode !== void 0 ? _context$sourceCode : context.getSourceCode();
|
|
270
272
|
var attributes = node.openingElement.attributes;
|
|
271
273
|
|
|
272
274
|
// Build new attributes array
|
|
@@ -543,7 +545,9 @@ var rule = createLintRule({
|
|
|
543
545
|
var _tagImportInfo$node7;
|
|
544
546
|
var importNode = (_tagImportInfo$node7 = tagImportInfo.node) === null || _tagImportInfo$node7 === void 0 ? void 0 : _tagImportInfo$node7.parent;
|
|
545
547
|
if (importNode) {
|
|
546
|
-
var
|
|
548
|
+
var _context$sourceCode2;
|
|
549
|
+
// @ts-ignore - Jira's ESLint v10 types expose sourceCode, platform still checks with ESLint v9.
|
|
550
|
+
var sourceCode = (_context$sourceCode2 = context.sourceCode) !== null && _context$sourceCode2 !== void 0 ? _context$sourceCode2 : context.getSourceCode();
|
|
547
551
|
var mainModuleSource = '@atlaskit/tag';
|
|
548
552
|
|
|
549
553
|
// Get all other specifiers that are not SimpleTag or RemovableTag
|
|
@@ -18,6 +18,8 @@ export var getCssMapObject = function getCssMapObject(node) {
|
|
|
18
18
|
}
|
|
19
19
|
return node.arguments[0];
|
|
20
20
|
};
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
21
23
|
export var UnusedCssMapChecker = /*#__PURE__*/function () {
|
|
22
24
|
function UnusedCssMapChecker(cssMapObject, context, cssMapCallNode) {
|
|
23
25
|
_classCallCheck(this, UnusedCssMapChecker);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
+
import { createLintRule } from '../utils/create-lint-rule';
|
|
3
|
+
export var headingLevelRequiredSuggestionText = 'Add a `headingLevel` that is of a contextually relevant level.';
|
|
4
|
+
var rule = createLintRule({
|
|
5
|
+
meta: {
|
|
6
|
+
name: 'use-heading-level-in-section-message',
|
|
7
|
+
type: 'suggestion',
|
|
8
|
+
fixable: 'code',
|
|
9
|
+
docs: {
|
|
10
|
+
description: 'The `SectionMessage` component in `@atlaskit/section-message` needs to be the correct level within the document flow. This is not something that can be automated and requires contextual knowledge of what is present in the experience.',
|
|
11
|
+
recommended: true,
|
|
12
|
+
severity: 'warn'
|
|
13
|
+
},
|
|
14
|
+
messages: {
|
|
15
|
+
headingLevelRequired: headingLevelRequiredSuggestionText
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
create: function create(context) {
|
|
19
|
+
var sectionMessageImportName;
|
|
20
|
+
return {
|
|
21
|
+
ImportDeclaration: function ImportDeclaration(node) {
|
|
22
|
+
if (node.source.value !== '@atlaskit/section-message') {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
node.specifiers.forEach(function (spec) {
|
|
26
|
+
if (isNodeOfType(spec, 'ImportDefaultSpecifier')) {
|
|
27
|
+
sectionMessageImportName = spec.local.name;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
JSXElement: function JSXElement(node) {
|
|
32
|
+
if (!isNodeOfType(node, 'JSXElement')) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (!isNodeOfType(node.openingElement.name, 'JSXIdentifier')) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (node.openingElement.name.name === sectionMessageImportName) {
|
|
39
|
+
// and if `title` exists and `headingLevel` prop does not exist
|
|
40
|
+
var sectionMessageProps = node.openingElement.attributes.filter(function (attr) {
|
|
41
|
+
return isNodeOfType(attr, 'JSXAttribute');
|
|
42
|
+
}).filter(function (attr) {
|
|
43
|
+
return attr.name.type === 'JSXIdentifier';
|
|
44
|
+
});
|
|
45
|
+
var title = sectionMessageProps.find(function (attr) {
|
|
46
|
+
return attr.name.name === 'title';
|
|
47
|
+
});
|
|
48
|
+
var headingLevel = sectionMessageProps.find(function (attr) {
|
|
49
|
+
return attr.name.name === 'headingLevel';
|
|
50
|
+
});
|
|
51
|
+
if (title && !headingLevel) {
|
|
52
|
+
context.report({
|
|
53
|
+
node: node,
|
|
54
|
+
messageId: 'headingLevelRequired'
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
export default rule;
|
|
@@ -41,6 +41,8 @@ export var VALID_PATTERNS = [
|
|
|
41
41
|
var defaults = {
|
|
42
42
|
patterns: ['compiled-css-function']
|
|
43
43
|
};
|
|
44
|
+
|
|
45
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
44
46
|
export var getConfig = function getConfig(overrides) {
|
|
45
47
|
return Object.assign({}, defaults, overrides);
|
|
46
48
|
};
|
|
@@ -34,6 +34,8 @@ export var getObjectLikeness = function getObjectLikeness(node) {
|
|
|
34
34
|
});
|
|
35
35
|
return countMatchingKeyValues(styleEntries);
|
|
36
36
|
};
|
|
37
|
+
|
|
38
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
37
39
|
export var countMatchingKeyValues = function countMatchingKeyValues(styleEntries) {
|
|
38
40
|
var matchingStyleEntries = styleEntries.filter(function (entry) {
|
|
39
41
|
return entry.key in referenceObject;
|
|
@@ -27,6 +27,8 @@ export var noTaggedTemplateExpressionRuleSchema = [{
|
|
|
27
27
|
* but it would add a lot of complexity.
|
|
28
28
|
*/
|
|
29
29
|
var shouldSkipMultilineComments = false;
|
|
30
|
+
|
|
31
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
30
32
|
export var createNoTaggedTemplateExpressionRule = function createNoTaggedTemplateExpressionRule(isUsage, messageId) {
|
|
31
33
|
return function (context) {
|
|
32
34
|
var importSources = getImportSources(context);
|
|
@@ -3,9 +3,13 @@ var cssInJsCallees = ['css', 'styled', 'styled2'];
|
|
|
3
3
|
export var isCssInJsCallNode = function isCssInJsCallNode(node) {
|
|
4
4
|
return (node === null || node === void 0 ? void 0 : node.type) === 'CallExpression' && node.callee.type === 'Identifier' && cssInJsCallees.includes(node.callee.name);
|
|
5
5
|
};
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
6
8
|
export var isCssInJsObjectNode = function isCssInJsObjectNode(node) {
|
|
7
9
|
return (node === null || node === void 0 ? void 0 : node.type) === 'CallExpression' && node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier' && cssInJsCallees.includes(node.callee.object.name);
|
|
8
10
|
};
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
9
13
|
var _isDecendantOfStyleBlock = function isDecendantOfStyleBlock(node) {
|
|
10
14
|
if (node.type === 'VariableDeclarator') {
|
|
11
15
|
if (node.id.type !== 'Identifier') {
|
|
@@ -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::4cd2dfd73ed3cdd152ee6481087c49ee>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { Linter } from 'eslint';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::8efae2c2e169f84381b978b4bc47433d>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { ESLint } from 'eslint';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::80b81104d52bdf5ca1b99e6265b83cef>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { Linter } from 'eslint';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::c7aa5d4ccdf62d54c12e1d5344a38fb8>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { ESLint } from 'eslint';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::b90bcf0b2fb6429faae59c7a454e3260>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { Rule } from 'eslint';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::4cd2dfd73ed3cdd152ee6481087c49ee>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { Linter } from 'eslint';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::8efae2c2e169f84381b978b4bc47433d>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { ESLint } from 'eslint';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::80b81104d52bdf5ca1b99e6265b83cef>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { Linter } from 'eslint';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::c7aa5d4ccdf62d54c12e1d5344a38fb8>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { ESLint } from 'eslint';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::b90bcf0b2fb6429faae59c7a454e3260>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { Rule } from 'eslint';
|
package/package.json
CHANGED