@atlaskit/eslint-plugin-design-system 13.3.0 → 13.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +1 -0
- package/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 +1 -0
- package/dist/cjs/rules/index.codegen.js +3 -1
- package/dist/cjs/rules/no-custom-icons/index.js +2 -0
- package/dist/cjs/rules/no-deprecated-apis/index.js +3 -1
- package/dist/cjs/rules/no-deprecated-imports/checks.js +3 -1
- package/dist/cjs/rules/no-legacy-icons/helpers.js +3 -1
- package/dist/cjs/rules/no-unsafe-design-token-usage/index.js +1 -0
- package/dist/cjs/rules/use-cx-function-in-xcss/index.js +97 -0
- package/dist/cjs/rules/use-heading/index.js +1 -0
- package/dist/cjs/rules/use-latest-xcss-syntax-typography/index.js +1 -0
- package/dist/cjs/rules/use-modal-dialog-close-button/index.js +24 -12
- package/dist/cjs/rules/use-primitives/index.js +1 -0
- package/dist/cjs/rules/use-primitives-text/index.js +1 -0
- package/dist/cjs/rules/use-tokens-typography/index.js +1 -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 +1 -0
- package/dist/es2019/rules/index.codegen.js +3 -1
- package/dist/es2019/rules/no-custom-icons/index.js +2 -0
- package/dist/es2019/rules/no-deprecated-apis/index.js +3 -1
- package/dist/es2019/rules/no-deprecated-imports/checks.js +3 -1
- package/dist/es2019/rules/no-legacy-icons/helpers.js +3 -1
- package/dist/es2019/rules/no-unsafe-design-token-usage/index.js +1 -0
- package/dist/es2019/rules/use-cx-function-in-xcss/index.js +70 -0
- package/dist/es2019/rules/use-heading/index.js +1 -0
- package/dist/es2019/rules/use-latest-xcss-syntax-typography/index.js +1 -0
- package/dist/es2019/rules/use-modal-dialog-close-button/index.js +24 -12
- package/dist/es2019/rules/use-primitives/index.js +1 -0
- package/dist/es2019/rules/use-primitives-text/index.js +1 -0
- package/dist/es2019/rules/use-tokens-typography/index.js +1 -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 +1 -0
- package/dist/esm/rules/index.codegen.js +3 -1
- package/dist/esm/rules/no-custom-icons/index.js +2 -0
- package/dist/esm/rules/no-deprecated-apis/index.js +3 -1
- package/dist/esm/rules/no-deprecated-imports/checks.js +3 -1
- package/dist/esm/rules/no-legacy-icons/helpers.js +3 -1
- package/dist/esm/rules/no-unsafe-design-token-usage/index.js +1 -0
- package/dist/esm/rules/use-cx-function-in-xcss/index.js +91 -0
- package/dist/esm/rules/use-heading/index.js +1 -0
- package/dist/esm/rules/use-latest-xcss-syntax-typography/index.js +1 -0
- package/dist/esm/rules/use-modal-dialog-close-button/index.js +24 -12
- package/dist/esm/rules/use-primitives/index.js +1 -0
- package/dist/esm/rules/use-primitives-text/index.js +1 -0
- package/dist/esm/rules/use-tokens-typography/index.js +1 -0
- package/dist/types/index.codegen.d.ts +9 -0
- package/dist/types/presets/all-flat.codegen.d.ts +1 -0
- package/dist/types/presets/all.codegen.d.ts +1 -0
- package/dist/types/presets/recommended-flat.codegen.d.ts +1 -0
- package/dist/types/presets/recommended.codegen.d.ts +1 -0
- package/dist/types/rules/index.codegen.d.ts +1 -0
- package/dist/types/rules/no-legacy-icons/helpers.d.ts +1 -1
- package/dist/types/rules/use-cx-function-in-xcss/index.d.ts +3 -0
- package/dist/types-ts4.5/index.codegen.d.ts +9 -0
- package/dist/types-ts4.5/presets/all-flat.codegen.d.ts +1 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +1 -0
- package/dist/types-ts4.5/presets/recommended-flat.codegen.d.ts +1 -0
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +1 -0
- package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-cx-function-in-xcss/index.d.ts +3 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 13.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#136299](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/136299)
|
|
8
|
+
[`4da98e435c8da`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4da98e435c8da) -
|
|
9
|
+
Add better logic to `use-modal-dialog-close-button` rule.
|
|
10
|
+
|
|
11
|
+
## 13.4.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#133012](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/133012)
|
|
16
|
+
[`767ec60923d2e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/767ec60923d2e) -
|
|
17
|
+
Adds a new eslint rule to ensure that the cx function is used properly in xcss props. This is
|
|
18
|
+
required for smooth primitives migration onto compiled styles from emotion.
|
|
19
|
+
|
|
3
20
|
## 13.3.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -81,6 +81,7 @@ module.exports = {
|
|
|
81
81
|
| <a href="./packages/design-system/eslint-plugin/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 | | |
|
|
82
82
|
| <a href="./packages/design-system/eslint-plugin/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. | | | |
|
|
83
83
|
| <a href="./packages/design-system/eslint-plugin/src/rules/use-button-group-label/README.md">use-button-group-label</a> | Ensures button groups are described to assistive technology by a direct label or by another element. | Yes | | Yes |
|
|
84
|
+
| <a href="./packages/design-system/eslint-plugin/src/rules/use-cx-function-in-xcss/README.md">use-cx-function-in-xcss</a> | Enforces cx function use to combine styles in xcss. | Yes | Yes | Yes |
|
|
84
85
|
| <a href="./packages/design-system/eslint-plugin/src/rules/use-datetime-picker-calendar-button/README.md">use-datetime-picker-calendar-button</a> | Encourages makers to use calendar button in Atlassian Design System's date picker and datetime picker components. | Yes | Yes | Yes |
|
|
85
86
|
| <a href="./packages/design-system/eslint-plugin/src/rules/use-drawer-label/README.md">use-drawer-label</a> | Encourages to provide accessible name for Atlassian Design System Drawer component. | Yes | | Yes |
|
|
86
87
|
| <a href="./packages/design-system/eslint-plugin/src/rules/use-heading/README.md">use-heading</a> | Encourage the usage of heading components. | | 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::9b616276b6c3b9db3c1d886bf8de4fc4>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
var _default = exports.default = {
|
|
@@ -44,6 +44,7 @@ var _default = exports.default = {
|
|
|
44
44
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
|
|
45
45
|
'@atlaskit/design-system/prefer-primitives': 'warn',
|
|
46
46
|
'@atlaskit/design-system/use-button-group-label': 'warn',
|
|
47
|
+
'@atlaskit/design-system/use-cx-function-in-xcss': 'error',
|
|
47
48
|
'@atlaskit/design-system/use-datetime-picker-calendar-button': 'warn',
|
|
48
49
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
49
50
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
@@ -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::96ec2e315f96de68a6448317cce334ce>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
var _default = exports.default = {
|
|
@@ -43,6 +43,7 @@ var _default = exports.default = {
|
|
|
43
43
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
|
|
44
44
|
'@atlaskit/design-system/prefer-primitives': 'warn',
|
|
45
45
|
'@atlaskit/design-system/use-button-group-label': 'warn',
|
|
46
|
+
'@atlaskit/design-system/use-cx-function-in-xcss': 'error',
|
|
46
47
|
'@atlaskit/design-system/use-datetime-picker-calendar-button': 'warn',
|
|
47
48
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
48
49
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
@@ -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::4f6ee2ae56e1c0534f0f8e3fde314cc7>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
var _default = exports.default = {
|
|
@@ -33,6 +33,7 @@ var _default = exports.default = {
|
|
|
33
33
|
'@atlaskit/design-system/no-unsafe-style-overrides': 'warn',
|
|
34
34
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
|
|
35
35
|
'@atlaskit/design-system/use-button-group-label': 'warn',
|
|
36
|
+
'@atlaskit/design-system/use-cx-function-in-xcss': 'error',
|
|
36
37
|
'@atlaskit/design-system/use-datetime-picker-calendar-button': 'warn',
|
|
37
38
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
38
39
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
@@ -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::85c1f4ada9dac0f66e87e3734a36cb6b>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
var _default = exports.default = {
|
|
@@ -32,6 +32,7 @@ var _default = exports.default = {
|
|
|
32
32
|
'@atlaskit/design-system/no-unsafe-style-overrides': 'warn',
|
|
33
33
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
|
|
34
34
|
'@atlaskit/design-system/use-button-group-label': 'warn',
|
|
35
|
+
'@atlaskit/design-system/use-cx-function-in-xcss': 'error',
|
|
35
36
|
'@atlaskit/design-system/use-datetime-picker-calendar-button': 'warn',
|
|
36
37
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
37
38
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
@@ -27,6 +27,7 @@ var defaultConfig = {
|
|
|
27
27
|
};
|
|
28
28
|
var createWithConfig = exports.createWithConfig = function createWithConfig(initialConfig) {
|
|
29
29
|
return function (context) {
|
|
30
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
30
31
|
var userConfig = context.options[0];
|
|
31
32
|
// merge configs
|
|
32
33
|
var config = {
|
|
@@ -37,6 +37,7 @@ var _noUnsafeStyleOverrides = _interopRequireDefault(require("./no-unsafe-style-
|
|
|
37
37
|
var _noUnsupportedDragAndDropLibraries = _interopRequireDefault(require("./no-unsupported-drag-and-drop-libraries"));
|
|
38
38
|
var _preferPrimitives = _interopRequireDefault(require("./prefer-primitives"));
|
|
39
39
|
var _useButtonGroupLabel = _interopRequireDefault(require("./use-button-group-label"));
|
|
40
|
+
var _useCxFunctionInXcss = _interopRequireDefault(require("./use-cx-function-in-xcss"));
|
|
40
41
|
var _useDatetimePickerCalendarButton = _interopRequireDefault(require("./use-datetime-picker-calendar-button"));
|
|
41
42
|
var _useDrawerLabel = _interopRequireDefault(require("./use-drawer-label"));
|
|
42
43
|
var _useHeading = _interopRequireDefault(require("./use-heading"));
|
|
@@ -56,7 +57,7 @@ var _useTokensTypography = _interopRequireDefault(require("./use-tokens-typograp
|
|
|
56
57
|
var _useVisuallyHidden = _interopRequireDefault(require("./use-visually-hidden"));
|
|
57
58
|
/**
|
|
58
59
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
59
|
-
* @codegen <<SignedSource::
|
|
60
|
+
* @codegen <<SignedSource::66749852497ab0f2dc3214dd47aaf598>>
|
|
60
61
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
61
62
|
*/
|
|
62
63
|
|
|
@@ -93,6 +94,7 @@ var rules = exports.rules = {
|
|
|
93
94
|
'no-unsupported-drag-and-drop-libraries': _noUnsupportedDragAndDropLibraries.default,
|
|
94
95
|
'prefer-primitives': _preferPrimitives.default,
|
|
95
96
|
'use-button-group-label': _useButtonGroupLabel.default,
|
|
97
|
+
'use-cx-function-in-xcss': _useCxFunctionInXcss.default,
|
|
96
98
|
'use-datetime-picker-calendar-button': _useDatetimePickerCalendarButton.default,
|
|
97
99
|
'use-drawer-label': _useDrawerLabel.default,
|
|
98
100
|
'use-heading': _useHeading.default,
|
|
@@ -38,6 +38,8 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
38
38
|
create: function create(context) {
|
|
39
39
|
var _context$options$;
|
|
40
40
|
var isIconBase = (0, _isFromImportSource.createIsFromImportSourceFor)('@atlaskit/icon', '@atlaskit/icon/base');
|
|
41
|
+
|
|
42
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
41
43
|
var _ref = (_context$options$ = context.options[0]) !== null && _context$options$ !== void 0 ? _context$options$ : {},
|
|
42
44
|
_ref$centralLocation = _ref.centralLocation,
|
|
43
45
|
centralLocation = _ref$centralLocation === void 0 ? '' : _ref$centralLocation,
|
|
@@ -73,7 +73,9 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
73
73
|
var _context$options$;
|
|
74
74
|
// Get the rule configuration specified otherwise use default config.
|
|
75
75
|
// A bit confusing as it seems that the default options have precedence over the user specified options.
|
|
76
|
-
var deprecatedConfig =
|
|
76
|
+
var deprecatedConfig =
|
|
77
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
78
|
+
((_context$options$ = context.options[0]) === null || _context$options$ === void 0 ? void 0 : _context$options$.deprecatedConfig) || (0, _getDeprecatedConfig.getConfig)('jsxAttributes');
|
|
77
79
|
return {
|
|
78
80
|
// find JSX attribute - find name of attribute - get source and find relevant identifiers.
|
|
79
81
|
JSXAttribute: function JSXAttribute(node) {
|
|
@@ -38,7 +38,9 @@ var createChecks = exports.createChecks = function createChecks(context) {
|
|
|
38
38
|
type = _ref.type,
|
|
39
39
|
node = _ref.node,
|
|
40
40
|
importNames = _ref.importNames;
|
|
41
|
-
var restrictedPathMessages =
|
|
41
|
+
var restrictedPathMessages =
|
|
42
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
43
|
+
((_context$options$ = context.options[0]) === null || _context$options$ === void 0 ? void 0 : _context$options$.deprecatedConfig) || (0, _getDeprecatedConfig.getConfig)('imports');
|
|
42
44
|
if (!(0, _types.isDeprecatedImportConfig)(restrictedPathMessages)) {
|
|
43
45
|
throw new Error('Config is invalid for deprecated imports');
|
|
44
46
|
}
|
|
@@ -321,7 +321,9 @@ var getLiteralStringValue = function getLiteralStringValue(value) {
|
|
|
321
321
|
}
|
|
322
322
|
return;
|
|
323
323
|
};
|
|
324
|
-
var createHelpers = exports.createHelpers = function createHelpers(
|
|
324
|
+
var createHelpers = exports.createHelpers = function createHelpers(ctx) {
|
|
325
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
326
|
+
var context = ctx;
|
|
325
327
|
/**
|
|
326
328
|
* Extracts the token name of a token() call from a JSXExpressionContainer
|
|
327
329
|
* @param value The JSXExpressionContainer to extract the token call from
|
|
@@ -54,6 +54,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
54
54
|
}]
|
|
55
55
|
},
|
|
56
56
|
create: function create(context) {
|
|
57
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
57
58
|
var config = _objectSpread({}, context.options[0]);
|
|
58
59
|
if (!config.fallbackUsage) {
|
|
59
60
|
config.fallbackUsage = config.shouldEnforceFallbacks ? 'forced' : 'none';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
8
|
+
var _createRule = require("../utils/create-rule");
|
|
9
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
10
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12
|
+
var rule = (0, _createRule.createLintRule)({
|
|
13
|
+
meta: {
|
|
14
|
+
name: 'use-cx-function-in-xcss',
|
|
15
|
+
fixable: 'code',
|
|
16
|
+
hasSuggestions: true,
|
|
17
|
+
type: 'problem',
|
|
18
|
+
docs: {
|
|
19
|
+
description: 'Enforces cx function use to combine styles in xcss.',
|
|
20
|
+
recommended: true,
|
|
21
|
+
severity: 'error'
|
|
22
|
+
},
|
|
23
|
+
messages: {
|
|
24
|
+
useCxFunc: "Use the cx function when combining styles in the xcss prop."
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
create: function create(context) {
|
|
28
|
+
var importStatement = null;
|
|
29
|
+
var primitiveNames = new Set();
|
|
30
|
+
return {
|
|
31
|
+
"ImportDeclaration[source.value='@atlaskit/css']": function ImportDeclarationSourceValueAtlaskit_css(node) {
|
|
32
|
+
importStatement = {
|
|
33
|
+
node: node
|
|
34
|
+
};
|
|
35
|
+
var _iterator = _createForOfIteratorHelper(node.specifiers),
|
|
36
|
+
_step;
|
|
37
|
+
try {
|
|
38
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
39
|
+
var specifier = _step.value;
|
|
40
|
+
if (specifier.type === 'ImportSpecifier' && specifier.imported.name === 'cx') {
|
|
41
|
+
importStatement.cxFuncLocalName = specifier.local.name;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
} catch (err) {
|
|
45
|
+
_iterator.e(err);
|
|
46
|
+
} finally {
|
|
47
|
+
_iterator.f();
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
'ImportDeclaration[source.value="@atlaskit/primitives/compiled"]': function ImportDeclarationSourceValueAtlaskit_primitives_compiled(node) {
|
|
51
|
+
var _iterator2 = _createForOfIteratorHelper(node.specifiers),
|
|
52
|
+
_step2;
|
|
53
|
+
try {
|
|
54
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
55
|
+
var specifier = _step2.value;
|
|
56
|
+
primitiveNames.add(specifier.local.name);
|
|
57
|
+
}
|
|
58
|
+
} catch (err) {
|
|
59
|
+
_iterator2.e(err);
|
|
60
|
+
} finally {
|
|
61
|
+
_iterator2.f();
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
'JSXAttribute > JSXIdentifier[name=/[xX]css$/]': function JSXAttribute__JSXIdentifierName_XXCss$_(node) {
|
|
65
|
+
var xcssValue = node.parent && (0, _eslintCodemodUtils.isNodeOfType)(node.parent, 'JSXAttribute') && node.parent.value && (0, _eslintCodemodUtils.isNodeOfType)(node.parent.value, 'JSXExpressionContainer') ? node.parent.value : undefined;
|
|
66
|
+
if (!xcssValue) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
var jsxElementName = node.parent.parent && (0, _eslintCodemodUtils.isNodeOfType)(node.parent.parent, 'JSXOpeningElement') && node.parent.parent.name && (0, _eslintCodemodUtils.isNodeOfType)(node.parent.parent.name, 'JSXIdentifier') ? node.parent.parent.name.name : undefined;
|
|
70
|
+
if (!jsxElementName) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
// check if this JSX element is from the primitives entry point and if prop value is an array
|
|
74
|
+
if (primitiveNames.has(jsxElementName) && xcssValue.expression.type === 'ArrayExpression') {
|
|
75
|
+
context.report({
|
|
76
|
+
node: xcssValue,
|
|
77
|
+
messageId: 'useCxFunc',
|
|
78
|
+
fix: function fix(fixer) {
|
|
79
|
+
var fixes = [];
|
|
80
|
+
var sourceCode = context.sourceCode;
|
|
81
|
+
var styles = sourceCode.getText(xcssValue.expression);
|
|
82
|
+
fixes.push(fixer.replaceText(xcssValue, (importStatement && importStatement.cxFuncLocalName ? "{".concat(importStatement.cxFuncLocalName) : "{cx") + "(".concat(styles.replace(/^\[/, '').replace(/\]$/, ''), ")}")));
|
|
83
|
+
if (!importStatement) {
|
|
84
|
+
fixes.push(fixer.insertTextBeforeRange([0, 0], "import { cx } from '@atlaskit/css';\n"));
|
|
85
|
+
} else if (!importStatement.cxFuncLocalName) {
|
|
86
|
+
var importText = sourceCode.getText(importStatement.node);
|
|
87
|
+
fixes.push(fixer.replaceText(importStatement.node, importText.includes('{') ? importText.replace(/import(.*) {\s?/, "import$1 { cx, ") : importText.replace(/ from /, ", { cx } from ")));
|
|
88
|
+
}
|
|
89
|
+
return fixes;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
var _default = exports.default = rule;
|
|
@@ -37,6 +37,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
create: function create(context) {
|
|
40
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
40
41
|
var config = (0, _config.getConfig)(context.options[0]);
|
|
41
42
|
return (0, _errorBoundary.errorBoundary)({
|
|
42
43
|
// transforms <h1>...</h1> usages
|
|
@@ -46,6 +46,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
create: function create(context) {
|
|
49
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
49
50
|
var config = (0, _config.getConfig)(context.options[0]);
|
|
50
51
|
return (0, _errorBoundary.errorBoundary)({
|
|
51
52
|
'CallExpression[callee.name="xcss"] ObjectExpression > Property > Identifier[name=/(fontSize|lineHeight|fontWeight|letterSpacing)/]': function CallExpressionCalleeNameXcss_ObjectExpression__Property__IdentifierName_FontSizeLineHeightFontWeightLetterSpacing_(node) {
|
|
@@ -72,7 +72,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
var name = node.openingElement.name.name;
|
|
75
|
-
if (name
|
|
75
|
+
if (![defaultImportLocalName, modalHeaderLocalName].includes(name)) {
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
var modalHeaderNode = null;
|
|
@@ -136,13 +136,31 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
136
136
|
_iterator.f();
|
|
137
137
|
}
|
|
138
138
|
};
|
|
139
|
-
|
|
139
|
+
if (name === defaultImportLocalName) {
|
|
140
|
+
searchNode(node);
|
|
141
|
+
|
|
142
|
+
// If there is a close button, skip the rest, as this satisfies the
|
|
143
|
+
// rule. If there is a modal header, it will be recognized in later
|
|
144
|
+
// scans, so don't add duplicate errors
|
|
145
|
+
if (closeButtonNode || modalHeaderNode) {
|
|
146
|
+
return;
|
|
147
|
+
// No close button or modal header exists
|
|
148
|
+
} else {
|
|
149
|
+
return context.report({
|
|
150
|
+
node: node,
|
|
151
|
+
messageId: 'noCloseButtonExists'
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
} else if (name === modalHeaderLocalName) {
|
|
155
|
+
modalHeaderNode = node;
|
|
156
|
+
searchNode(node);
|
|
157
|
+
|
|
158
|
+
// If there is a close button, skip the rest, as this satisfies the rule.
|
|
159
|
+
if (closeButtonNode) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
140
162
|
|
|
141
|
-
// If there is a close button, skip the rest, as this satisfies the rule.
|
|
142
|
-
if (closeButtonNode) {
|
|
143
|
-
return;
|
|
144
163
|
// No close button exists, so check the modal header
|
|
145
|
-
} else if (modalHeaderNode !== null) {
|
|
146
164
|
var prop = _jsxElement.JSXElementHelper.getAttributeByName(modalHeaderNode, PROP_NAME);
|
|
147
165
|
|
|
148
166
|
// If the prop exists
|
|
@@ -175,12 +193,6 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
175
193
|
}]
|
|
176
194
|
});
|
|
177
195
|
}
|
|
178
|
-
// No close button or modal header exists
|
|
179
|
-
} else {
|
|
180
|
-
return context.report({
|
|
181
|
-
node: node,
|
|
182
|
-
messageId: 'noCloseButtonExists'
|
|
183
|
-
});
|
|
184
196
|
}
|
|
185
197
|
}
|
|
186
198
|
};
|
|
@@ -38,6 +38,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
create: function create(context) {
|
|
41
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
41
42
|
var config = (0, _config.getConfig)(context.options[0]);
|
|
42
43
|
return {
|
|
43
44
|
// transforms styled.<html>(...) usages
|
|
@@ -53,6 +53,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
create: function create(context) {
|
|
56
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
56
57
|
var config = (0, _config.getConfig)(context.options[0]);
|
|
57
58
|
return (0, _errorBoundary.errorBoundary)({
|
|
58
59
|
'JSXElement[openingElement.name.name=span]': function JSXElementOpeningElementNameNameSpan(node) {
|
|
@@ -14,6 +14,7 @@ var _restrictedCapitalisation = require("./transformers/restricted-capitalisatio
|
|
|
14
14
|
var _styleObject = require("./transformers/style-object");
|
|
15
15
|
var _untokenizedProperties = require("./transformers/untokenized-properties");
|
|
16
16
|
var create = function create(context) {
|
|
17
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
17
18
|
var config = (0, _config.getConfig)(context.options[0]);
|
|
18
19
|
return (0, _errorBoundary.errorBoundary)({
|
|
19
20
|
// const styles = css({ fontSize: '14px', ... }), styled.div({ fontSize: 14, ... })
|
|
@@ -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::9b616276b6c3b9db3c1d886bf8de4fc4>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -39,6 +39,7 @@ export default {
|
|
|
39
39
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
|
|
40
40
|
'@atlaskit/design-system/prefer-primitives': 'warn',
|
|
41
41
|
'@atlaskit/design-system/use-button-group-label': 'warn',
|
|
42
|
+
'@atlaskit/design-system/use-cx-function-in-xcss': 'error',
|
|
42
43
|
'@atlaskit/design-system/use-datetime-picker-calendar-button': 'warn',
|
|
43
44
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
44
45
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
@@ -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::96ec2e315f96de68a6448317cce334ce>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -38,6 +38,7 @@ export default {
|
|
|
38
38
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
|
|
39
39
|
'@atlaskit/design-system/prefer-primitives': 'warn',
|
|
40
40
|
'@atlaskit/design-system/use-button-group-label': 'warn',
|
|
41
|
+
'@atlaskit/design-system/use-cx-function-in-xcss': 'error',
|
|
41
42
|
'@atlaskit/design-system/use-datetime-picker-calendar-button': 'warn',
|
|
42
43
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
43
44
|
'@atlaskit/design-system/use-heading': 'warn',
|
|
@@ -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::4f6ee2ae56e1c0534f0f8e3fde314cc7>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -28,6 +28,7 @@ export default {
|
|
|
28
28
|
'@atlaskit/design-system/no-unsafe-style-overrides': 'warn',
|
|
29
29
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
|
|
30
30
|
'@atlaskit/design-system/use-button-group-label': 'warn',
|
|
31
|
+
'@atlaskit/design-system/use-cx-function-in-xcss': 'error',
|
|
31
32
|
'@atlaskit/design-system/use-datetime-picker-calendar-button': 'warn',
|
|
32
33
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
33
34
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
@@ -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::85c1f4ada9dac0f66e87e3734a36cb6b>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -27,6 +27,7 @@ export default {
|
|
|
27
27
|
'@atlaskit/design-system/no-unsafe-style-overrides': 'warn',
|
|
28
28
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
|
|
29
29
|
'@atlaskit/design-system/use-button-group-label': 'warn',
|
|
30
|
+
'@atlaskit/design-system/use-cx-function-in-xcss': 'error',
|
|
30
31
|
'@atlaskit/design-system/use-datetime-picker-calendar-button': 'warn',
|
|
31
32
|
'@atlaskit/design-system/use-drawer-label': 'warn',
|
|
32
33
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
@@ -18,6 +18,7 @@ const defaultConfig = {
|
|
|
18
18
|
failSilently: false
|
|
19
19
|
};
|
|
20
20
|
const createWithConfig = initialConfig => context => {
|
|
21
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
21
22
|
const userConfig = context.options[0];
|
|
22
23
|
// merge configs
|
|
23
24
|
const config = {
|
|
@@ -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::66749852497ab0f2dc3214dd47aaf598>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import consistentCssPropUsage from './consistent-css-prop-usage';
|
|
@@ -35,6 +35,7 @@ import noUnsafeStyleOverrides from './no-unsafe-style-overrides';
|
|
|
35
35
|
import noUnsupportedDragAndDropLibraries from './no-unsupported-drag-and-drop-libraries';
|
|
36
36
|
import preferPrimitives from './prefer-primitives';
|
|
37
37
|
import useButtonGroupLabel from './use-button-group-label';
|
|
38
|
+
import useCxFunctionInXcss from './use-cx-function-in-xcss';
|
|
38
39
|
import useDatetimePickerCalendarButton from './use-datetime-picker-calendar-button';
|
|
39
40
|
import useDrawerLabel from './use-drawer-label';
|
|
40
41
|
import useHeading from './use-heading';
|
|
@@ -85,6 +86,7 @@ export const rules = {
|
|
|
85
86
|
'no-unsupported-drag-and-drop-libraries': noUnsupportedDragAndDropLibraries,
|
|
86
87
|
'prefer-primitives': preferPrimitives,
|
|
87
88
|
'use-button-group-label': useButtonGroupLabel,
|
|
89
|
+
'use-cx-function-in-xcss': useCxFunctionInXcss,
|
|
88
90
|
'use-datetime-picker-calendar-button': useDatetimePickerCalendarButton,
|
|
89
91
|
'use-drawer-label': useDrawerLabel,
|
|
90
92
|
'use-heading': useHeading,
|
|
@@ -33,6 +33,8 @@ const rule = createLintRule({
|
|
|
33
33
|
create(context) {
|
|
34
34
|
var _context$options$;
|
|
35
35
|
const isIconBase = createIsFromImportSourceFor('@atlaskit/icon', '@atlaskit/icon/base');
|
|
36
|
+
|
|
37
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
36
38
|
const {
|
|
37
39
|
centralLocation = '',
|
|
38
40
|
failSilently = false
|
|
@@ -67,7 +67,9 @@ const rule = createLintRule({
|
|
|
67
67
|
var _context$options$;
|
|
68
68
|
// Get the rule configuration specified otherwise use default config.
|
|
69
69
|
// A bit confusing as it seems that the default options have precedence over the user specified options.
|
|
70
|
-
const deprecatedConfig =
|
|
70
|
+
const deprecatedConfig =
|
|
71
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
72
|
+
((_context$options$ = context.options[0]) === null || _context$options$ === void 0 ? void 0 : _context$options$.deprecatedConfig) || getConfig('jsxAttributes');
|
|
71
73
|
return {
|
|
72
74
|
// find JSX attribute - find name of attribute - get source and find relevant identifiers.
|
|
73
75
|
JSXAttribute(node) {
|
|
@@ -30,7 +30,9 @@ export const createChecks = context => {
|
|
|
30
30
|
importNames
|
|
31
31
|
}) {
|
|
32
32
|
var _context$options$;
|
|
33
|
-
const restrictedPathMessages =
|
|
33
|
+
const restrictedPathMessages =
|
|
34
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
35
|
+
((_context$options$ = context.options[0]) === null || _context$options$ === void 0 ? void 0 : _context$options$.deprecatedConfig) || getConfig('imports');
|
|
34
36
|
if (!isDeprecatedImportConfig(restrictedPathMessages)) {
|
|
35
37
|
throw new Error('Config is invalid for deprecated imports');
|
|
36
38
|
}
|
|
@@ -300,7 +300,9 @@ const getLiteralStringValue = value => {
|
|
|
300
300
|
}
|
|
301
301
|
return;
|
|
302
302
|
};
|
|
303
|
-
export const createHelpers =
|
|
303
|
+
export const createHelpers = ctx => {
|
|
304
|
+
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
305
|
+
const context = ctx;
|
|
304
306
|
/**
|
|
305
307
|
* Extracts the token name of a token() call from a JSXExpressionContainer
|
|
306
308
|
* @param value The JSXExpressionContainer to extract the token call from
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
+
import { createLintRule } from '../utils/create-rule';
|
|
3
|
+
const rule = createLintRule({
|
|
4
|
+
meta: {
|
|
5
|
+
name: 'use-cx-function-in-xcss',
|
|
6
|
+
fixable: 'code',
|
|
7
|
+
hasSuggestions: true,
|
|
8
|
+
type: 'problem',
|
|
9
|
+
docs: {
|
|
10
|
+
description: 'Enforces cx function use to combine styles in xcss.',
|
|
11
|
+
recommended: true,
|
|
12
|
+
severity: 'error'
|
|
13
|
+
},
|
|
14
|
+
messages: {
|
|
15
|
+
useCxFunc: `Use the cx function when combining styles in the xcss prop.`
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
create(context) {
|
|
19
|
+
let importStatement = null;
|
|
20
|
+
const primitiveNames = new Set();
|
|
21
|
+
return {
|
|
22
|
+
"ImportDeclaration[source.value='@atlaskit/css']"(node) {
|
|
23
|
+
importStatement = {
|
|
24
|
+
node
|
|
25
|
+
};
|
|
26
|
+
for (const specifier of node.specifiers) {
|
|
27
|
+
if (specifier.type === 'ImportSpecifier' && specifier.imported.name === 'cx') {
|
|
28
|
+
importStatement.cxFuncLocalName = specifier.local.name;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
'ImportDeclaration[source.value="@atlaskit/primitives/compiled"]'(node) {
|
|
33
|
+
for (const specifier of node.specifiers) {
|
|
34
|
+
primitiveNames.add(specifier.local.name);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
'JSXAttribute > JSXIdentifier[name=/[xX]css$/]'(node) {
|
|
38
|
+
const xcssValue = node.parent && isNodeOfType(node.parent, 'JSXAttribute') && node.parent.value && isNodeOfType(node.parent.value, 'JSXExpressionContainer') ? node.parent.value : undefined;
|
|
39
|
+
if (!xcssValue) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const jsxElementName = node.parent.parent && isNodeOfType(node.parent.parent, 'JSXOpeningElement') && node.parent.parent.name && isNodeOfType(node.parent.parent.name, 'JSXIdentifier') ? node.parent.parent.name.name : undefined;
|
|
43
|
+
if (!jsxElementName) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
// check if this JSX element is from the primitives entry point and if prop value is an array
|
|
47
|
+
if (primitiveNames.has(jsxElementName) && xcssValue.expression.type === 'ArrayExpression') {
|
|
48
|
+
context.report({
|
|
49
|
+
node: xcssValue,
|
|
50
|
+
messageId: 'useCxFunc',
|
|
51
|
+
fix: fixer => {
|
|
52
|
+
const fixes = [];
|
|
53
|
+
const sourceCode = context.sourceCode;
|
|
54
|
+
const styles = sourceCode.getText(xcssValue.expression);
|
|
55
|
+
fixes.push(fixer.replaceText(xcssValue, (importStatement && importStatement.cxFuncLocalName ? `{${importStatement.cxFuncLocalName}` : `{cx`) + `(${styles.replace(/^\[/, '').replace(/\]$/, '')})}`));
|
|
56
|
+
if (!importStatement) {
|
|
57
|
+
fixes.push(fixer.insertTextBeforeRange([0, 0], `import { cx } from '@atlaskit/css';\n`));
|
|
58
|
+
} else if (!importStatement.cxFuncLocalName) {
|
|
59
|
+
const importText = sourceCode.getText(importStatement.node);
|
|
60
|
+
fixes.push(fixer.replaceText(importStatement.node, importText.includes('{') ? importText.replace(/import(.*) {\s?/, `import$1 { cx, `) : importText.replace(/ from /, `, { cx } from `)));
|
|
61
|
+
}
|
|
62
|
+
return fixes;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
export default rule;
|