@atlaskit/eslint-plugin-design-system 13.44.1 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +0 -1
- package/dist/cjs/presets/all-flat.codegen.js +1 -2
- package/dist/cjs/presets/all.codegen.js +1 -2
- package/dist/cjs/rules/ensure-icon-color/index.js +1 -1
- package/dist/cjs/rules/index.codegen.js +1 -3
- package/dist/cjs/rules/no-icon-spacing-prop/index.js +1 -1
- package/dist/cjs/rules/use-primitives-text/config/index.js +2 -4
- package/dist/cjs/rules/use-primitives-text/index.js +1 -8
- package/dist/cjs/rules/use-primitives-text/transformers/index.js +1 -8
- package/dist/es2019/presets/all-flat.codegen.js +1 -2
- package/dist/es2019/presets/all.codegen.js +1 -2
- package/dist/es2019/rules/ensure-icon-color/index.js +1 -1
- package/dist/es2019/rules/index.codegen.js +1 -3
- package/dist/es2019/rules/no-icon-spacing-prop/index.js +1 -1
- package/dist/es2019/rules/use-primitives-text/config/index.js +2 -4
- package/dist/es2019/rules/use-primitives-text/index.js +2 -9
- package/dist/es2019/rules/use-primitives-text/transformers/index.js +1 -2
- package/dist/esm/presets/all-flat.codegen.js +1 -2
- package/dist/esm/presets/all.codegen.js +1 -2
- package/dist/esm/rules/ensure-icon-color/index.js +1 -1
- package/dist/esm/rules/index.codegen.js +1 -3
- package/dist/esm/rules/no-icon-spacing-prop/index.js +1 -1
- package/dist/esm/rules/use-primitives-text/config/index.js +2 -4
- package/dist/esm/rules/use-primitives-text/index.js +2 -9
- package/dist/esm/rules/use-primitives-text/transformers/index.js +1 -2
- package/dist/types/presets/all-flat.codegen.d.ts +1 -1
- package/dist/types/presets/all.codegen.d.ts +1 -1
- package/dist/types/rules/index.codegen.d.ts +1 -1
- package/dist/types/rules/use-primitives-text/transformers/index.d.ts +0 -1
- 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/rules/index.codegen.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/index.d.ts +0 -1
- package/package.json +2 -2
- package/dist/cjs/rules/no-custom-icons/checks/has-prop.js +0 -12
- package/dist/cjs/rules/no-custom-icons/index.js +0 -79
- package/dist/cjs/rules/use-primitives-text/transformers/unsafe-small-text.js +0 -61
- package/dist/es2019/rules/no-custom-icons/checks/has-prop.js +0 -4
- package/dist/es2019/rules/no-custom-icons/index.js +0 -73
- package/dist/es2019/rules/use-primitives-text/transformers/unsafe-small-text.js +0 -55
- package/dist/esm/rules/no-custom-icons/checks/has-prop.js +0 -6
- package/dist/esm/rules/no-custom-icons/index.js +0 -73
- package/dist/esm/rules/use-primitives-text/transformers/unsafe-small-text.js +0 -53
- package/dist/types/rules/no-custom-icons/checks/has-prop.d.ts +0 -2
- package/dist/types/rules/no-custom-icons/index.d.ts +0 -3
- package/dist/types/rules/use-primitives-text/transformers/unsafe-small-text.d.ts +0 -8
- package/dist/types-ts4.5/rules/no-custom-icons/checks/has-prop.d.ts +0 -2
- package/dist/types-ts4.5/rules/no-custom-icons/index.d.ts +0 -3
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/unsafe-small-text.d.ts +0 -8
- /package/dist/cjs/{rules/no-custom-icons/checks → common}/is-from-import-source.js +0 -0
- /package/dist/cjs/{rules/no-custom-icons/checks → common}/is-imported-jsx-element.js +0 -0
- /package/dist/es2019/{rules/no-custom-icons/checks → common}/is-from-import-source.js +0 -0
- /package/dist/es2019/{rules/no-custom-icons/checks → common}/is-imported-jsx-element.js +0 -0
- /package/dist/esm/{rules/no-custom-icons/checks → common}/is-from-import-source.js +0 -0
- /package/dist/esm/{rules/no-custom-icons/checks → common}/is-imported-jsx-element.js +0 -0
- /package/dist/types/{rules/no-custom-icons/checks → common}/is-from-import-source.d.ts +0 -0
- /package/dist/types/{rules/no-custom-icons/checks → common}/is-imported-jsx-element.d.ts +0 -0
- /package/dist/types-ts4.5/{rules/no-custom-icons/checks → common}/is-from-import-source.d.ts +0 -0
- /package/dist/types-ts4.5/{rules/no-custom-icons/checks → common}/is-imported-jsx-element.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 14.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`b1e060ffdd070`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b1e060ffdd070) -
|
|
8
|
+
Remove no-custom-icons ESLint rule
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 13.44.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 13.44.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -61,7 +61,6 @@ module.exports = {
|
|
|
61
61
|
| <a href="./packages/design-system/eslint-plugin/src/rules/no-banned-imports/README.md">no-banned-imports</a> | Disallow importing banned modules. | Yes | | |
|
|
62
62
|
| <a href="./packages/design-system/eslint-plugin/src/rules/no-boolean-autofocus-on-modal-dialog/README.md">no-boolean-autofocus-on-modal-dialog</a> | Encourages makers to not use boolean values for `autoFocus` on Atlassian Design System's modal dialog component. | Yes | | |
|
|
63
63
|
| <a href="./packages/design-system/eslint-plugin/src/rules/no-css-tagged-template-expression/README.md">no-css-tagged-template-expression</a> | Disallows any `css` tagged template expressions that originate from Emotion, Styled Components or Compiled | | Yes | |
|
|
64
|
-
| <a href="./packages/design-system/eslint-plugin/src/rules/no-custom-icons/README.md">no-custom-icons</a> | Enforces custom glyph icons are used. | | | |
|
|
65
64
|
| <a href="./packages/design-system/eslint-plugin/src/rules/no-dark-theme-vr-tests/README.md">no-dark-theme-vr-tests</a> | Disallow using dark colorScheme in VR tests. | | Yes | |
|
|
66
65
|
| <a href="./packages/design-system/eslint-plugin/src/rules/no-deprecated-apis/README.md">no-deprecated-apis</a> | Disallow using deprecated APIs. | Yes | | |
|
|
67
66
|
| <a href="./packages/design-system/eslint-plugin/src/rules/no-deprecated-design-token-usage/README.md">no-deprecated-design-token-usage</a> | Disallow using deprecated design tokens. | 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::1fe99d63747ac78f0ea9e747af54bc76>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -26,7 +26,6 @@ var rules = {
|
|
|
26
26
|
'@atlaskit/design-system/no-banned-imports': 'error',
|
|
27
27
|
'@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
|
|
28
28
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'error',
|
|
29
|
-
'@atlaskit/design-system/no-custom-icons': 'warn',
|
|
30
29
|
'@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
|
|
31
30
|
'@atlaskit/design-system/no-deprecated-apis': 'error',
|
|
32
31
|
'@atlaskit/design-system/no-deprecated-design-token-usage': '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::4a4e27095e18b4c1f42c12cbc9f4af5e>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -25,7 +25,6 @@ var rules = {
|
|
|
25
25
|
'@atlaskit/design-system/no-banned-imports': 'error',
|
|
26
26
|
'@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
|
|
27
27
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'error',
|
|
28
|
-
'@atlaskit/design-system/no-custom-icons': 'warn',
|
|
29
28
|
'@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
|
|
30
29
|
'@atlaskit/design-system/no-deprecated-apis': 'error',
|
|
31
30
|
'@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
8
|
-
var _isFromImportSource = require("
|
|
8
|
+
var _isFromImportSource = require("../../common/is-from-import-source");
|
|
9
9
|
var _createRule = require("../utils/create-rule");
|
|
10
10
|
var _errorBoundary = require("../utils/error-boundary");
|
|
11
11
|
/**
|
|
@@ -17,7 +17,6 @@ var _lozengeBadgeTagLabellingSystemMigration = _interopRequireDefault(require(".
|
|
|
17
17
|
var _noBannedImports = _interopRequireDefault(require("./no-banned-imports"));
|
|
18
18
|
var _noBooleanAutofocusOnModalDialog = _interopRequireDefault(require("./no-boolean-autofocus-on-modal-dialog"));
|
|
19
19
|
var _noCssTaggedTemplateExpression = _interopRequireDefault(require("./no-css-tagged-template-expression"));
|
|
20
|
-
var _noCustomIcons = _interopRequireDefault(require("./no-custom-icons"));
|
|
21
20
|
var _noDarkThemeVrTests = _interopRequireDefault(require("./no-dark-theme-vr-tests"));
|
|
22
21
|
var _noDeprecatedApis = _interopRequireDefault(require("./no-deprecated-apis"));
|
|
23
22
|
var _noDeprecatedDesignTokenUsage = _interopRequireDefault(require("./no-deprecated-design-token-usage"));
|
|
@@ -84,7 +83,7 @@ var _useTokensTypography = _interopRequireDefault(require("./use-tokens-typograp
|
|
|
84
83
|
var _useVisuallyHidden = _interopRequireDefault(require("./use-visually-hidden"));
|
|
85
84
|
/**
|
|
86
85
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
87
|
-
* @codegen <<SignedSource::
|
|
86
|
+
* @codegen <<SignedSource::9b32672dde773f9e75f0e548609ecb58>>
|
|
88
87
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
89
88
|
*/
|
|
90
89
|
|
|
@@ -101,7 +100,6 @@ var rules = exports.rules = {
|
|
|
101
100
|
'no-banned-imports': _noBannedImports.default,
|
|
102
101
|
'no-boolean-autofocus-on-modal-dialog': _noBooleanAutofocusOnModalDialog.default,
|
|
103
102
|
'no-css-tagged-template-expression': _noCssTaggedTemplateExpression.default,
|
|
104
|
-
'no-custom-icons': _noCustomIcons.default,
|
|
105
103
|
'no-dark-theme-vr-tests': _noDarkThemeVrTests.default,
|
|
106
104
|
'no-deprecated-apis': _noDeprecatedApis.default,
|
|
107
105
|
'no-deprecated-design-token-usage': _noDeprecatedDesignTokenUsage.default,
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _isFromImportSource = require("
|
|
7
|
+
var _isFromImportSource = require("../../common/is-from-import-source");
|
|
8
8
|
var _createRule = require("../utils/create-rule");
|
|
9
9
|
var _errorBoundary = require("../utils/error-boundary");
|
|
10
10
|
var _helpers = require("./helpers");
|
|
@@ -12,12 +12,10 @@ var PATTERNS = exports.PATTERNS = [
|
|
|
12
12
|
// <strong>text</strong>
|
|
13
13
|
'strong-elements',
|
|
14
14
|
// <em>text</em>
|
|
15
|
-
'emphasis-elements'
|
|
16
|
-
// <Text size="UNSAFE_small">text</Text>
|
|
17
|
-
'unsafe-small-text'];
|
|
15
|
+
'emphasis-elements'];
|
|
18
16
|
var defaults = {
|
|
19
17
|
failSilently: false,
|
|
20
|
-
patterns: ['paragraph-elements', 'span-elements', 'strong-elements', 'emphasis-elements'
|
|
18
|
+
patterns: ['paragraph-elements', 'span-elements', 'strong-elements', 'emphasis-elements'],
|
|
21
19
|
inheritColor: false,
|
|
22
20
|
enableUnsafeAutofix: false,
|
|
23
21
|
enableUnsafeReport: true
|
|
@@ -49,8 +49,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
49
49
|
},
|
|
50
50
|
messages: {
|
|
51
51
|
preferPrimitivesText: "This element can be replaced with a \"Text\" primitive. See ".concat(textDocsUrl, " for additional guidance."),
|
|
52
|
-
preferPrimitivesStackedText: "These paragraphs can be replaced with a \"Text\" and \"Stack\" primitives. See ".concat(textDocsUrl, " for additional guidance.")
|
|
53
|
-
noUnsafeSmallText: "Text size prop can be replaced with \"small\"."
|
|
52
|
+
preferPrimitivesStackedText: "These paragraphs can be replaced with a \"Text\" and \"Stack\" primitives. See ".concat(textDocsUrl, " for additional guidance.")
|
|
54
53
|
}
|
|
55
54
|
},
|
|
56
55
|
create: function create(context) {
|
|
@@ -80,12 +79,6 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
80
79
|
context: context,
|
|
81
80
|
config: config
|
|
82
81
|
});
|
|
83
|
-
},
|
|
84
|
-
'JSXElement[openingElement.name.name=Text]': function JSXElementOpeningElementNameNameText(node) {
|
|
85
|
-
return _transformers.UnsafeSmallText.lint(node, {
|
|
86
|
-
context: context,
|
|
87
|
-
config: config
|
|
88
|
-
});
|
|
89
82
|
}
|
|
90
83
|
}, config);
|
|
91
84
|
}
|
|
@@ -27,14 +27,7 @@ Object.defineProperty(exports, "StrongElements", {
|
|
|
27
27
|
return _strongElements.StrongElements;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
Object.defineProperty(exports, "UnsafeSmallText", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _unsafeSmallText.UnsafeSmallText;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
30
|
var _emphasisElements = require("./emphasis-elements");
|
|
37
31
|
var _spanElements = require("./span-elements");
|
|
38
32
|
var _strongElements = require("./strong-elements");
|
|
39
|
-
var _paragraphElements = require("./paragraph-elements");
|
|
40
|
-
var _unsafeSmallText = require("./unsafe-small-text");
|
|
33
|
+
var _paragraphElements = require("./paragraph-elements");
|
|
@@ -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::1fe99d63747ac78f0ea9e747af54bc76>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -20,7 +20,6 @@ const rules = {
|
|
|
20
20
|
'@atlaskit/design-system/no-banned-imports': 'error',
|
|
21
21
|
'@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
|
|
22
22
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'error',
|
|
23
|
-
'@atlaskit/design-system/no-custom-icons': 'warn',
|
|
24
23
|
'@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
|
|
25
24
|
'@atlaskit/design-system/no-deprecated-apis': 'error',
|
|
26
25
|
'@atlaskit/design-system/no-deprecated-design-token-usage': '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::4a4e27095e18b4c1f42c12cbc9f4af5e>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -19,7 +19,6 @@ const rules = {
|
|
|
19
19
|
'@atlaskit/design-system/no-banned-imports': 'error',
|
|
20
20
|
'@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
|
|
21
21
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'error',
|
|
22
|
-
'@atlaskit/design-system/no-custom-icons': 'warn',
|
|
23
22
|
'@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
|
|
24
23
|
'@atlaskit/design-system/no-deprecated-apis': 'error',
|
|
25
24
|
'@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
-
import { createIsFromImportSourceFor } from '
|
|
2
|
+
import { createIsFromImportSourceFor } from '../../common/is-from-import-source';
|
|
3
3
|
import { createLintRule } from '../utils/create-rule';
|
|
4
4
|
import { errorBoundary } from '../utils/error-boundary';
|
|
5
5
|
|
|
@@ -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::9b32672dde773f9e75f0e548609ecb58>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -16,7 +16,6 @@ import lozengeBadgeTagLabellingSystemMigration from './lozenge-badge-tag-labelli
|
|
|
16
16
|
import noBannedImports from './no-banned-imports';
|
|
17
17
|
import noBooleanAutofocusOnModalDialog from './no-boolean-autofocus-on-modal-dialog';
|
|
18
18
|
import noCssTaggedTemplateExpression from './no-css-tagged-template-expression';
|
|
19
|
-
import noCustomIcons from './no-custom-icons';
|
|
20
19
|
import noDarkThemeVrTests from './no-dark-theme-vr-tests';
|
|
21
20
|
import noDeprecatedApis from './no-deprecated-apis';
|
|
22
21
|
import noDeprecatedDesignTokenUsage from './no-deprecated-design-token-usage';
|
|
@@ -94,7 +93,6 @@ export const rules = {
|
|
|
94
93
|
'no-banned-imports': noBannedImports,
|
|
95
94
|
'no-boolean-autofocus-on-modal-dialog': noBooleanAutofocusOnModalDialog,
|
|
96
95
|
'no-css-tagged-template-expression': noCssTaggedTemplateExpression,
|
|
97
|
-
'no-custom-icons': noCustomIcons,
|
|
98
96
|
'no-dark-theme-vr-tests': noDarkThemeVrTests,
|
|
99
97
|
'no-deprecated-apis': noDeprecatedApis,
|
|
100
98
|
'no-deprecated-design-token-usage': noDeprecatedDesignTokenUsage,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createIsFromImportSourceFor } from '
|
|
1
|
+
import { createIsFromImportSourceFor } from '../../common/is-from-import-source';
|
|
2
2
|
import { createLintRule } from '../utils/create-rule';
|
|
3
3
|
import { errorBoundary } from '../utils/error-boundary';
|
|
4
4
|
import { CSSMAP_VARIABLE_NAME, getCssMapKey, getIconSize, getSpacingAttribute, getStaticAttributeValue, hasSpreadProps, SPACING_TO_PADDING, upsertCssMapImport, upsertCssMapVariable, upsertFlexImport, upsertTokenImport } from './helpers';
|
|
@@ -6,12 +6,10 @@ export const PATTERNS = [
|
|
|
6
6
|
// <strong>text</strong>
|
|
7
7
|
'strong-elements',
|
|
8
8
|
// <em>text</em>
|
|
9
|
-
'emphasis-elements'
|
|
10
|
-
// <Text size="UNSAFE_small">text</Text>
|
|
11
|
-
'unsafe-small-text'];
|
|
9
|
+
'emphasis-elements'];
|
|
12
10
|
const defaults = {
|
|
13
11
|
failSilently: false,
|
|
14
|
-
patterns: ['paragraph-elements', 'span-elements', 'strong-elements', 'emphasis-elements'
|
|
12
|
+
patterns: ['paragraph-elements', 'span-elements', 'strong-elements', 'emphasis-elements'],
|
|
15
13
|
inheritColor: false,
|
|
16
14
|
enableUnsafeAutofix: false,
|
|
17
15
|
enableUnsafeReport: true
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLintRule } from '../utils/create-rule';
|
|
2
2
|
import { errorBoundary } from '../utils/error-boundary';
|
|
3
3
|
import { getConfig, PATTERNS } from './config';
|
|
4
|
-
import { EmphasisElements, ParagraphElements, SpanElements, StrongElements
|
|
4
|
+
import { EmphasisElements, ParagraphElements, SpanElements, StrongElements } from './transformers';
|
|
5
5
|
const textDocsUrl = 'https://atlassian.design/components/primitives/text';
|
|
6
6
|
const rule = createLintRule({
|
|
7
7
|
meta: {
|
|
@@ -43,8 +43,7 @@ const rule = createLintRule({
|
|
|
43
43
|
},
|
|
44
44
|
messages: {
|
|
45
45
|
preferPrimitivesText: `This element can be replaced with a "Text" primitive. See ${textDocsUrl} for additional guidance.`,
|
|
46
|
-
preferPrimitivesStackedText: `These paragraphs can be replaced with a "Text" and "Stack" primitives. See ${textDocsUrl} for additional guidance
|
|
47
|
-
noUnsafeSmallText: `Text size prop can be replaced with "small".`
|
|
46
|
+
preferPrimitivesStackedText: `These paragraphs can be replaced with a "Text" and "Stack" primitives. See ${textDocsUrl} for additional guidance.`
|
|
48
47
|
}
|
|
49
48
|
},
|
|
50
49
|
create(context) {
|
|
@@ -74,12 +73,6 @@ const rule = createLintRule({
|
|
|
74
73
|
context,
|
|
75
74
|
config
|
|
76
75
|
});
|
|
77
|
-
},
|
|
78
|
-
'JSXElement[openingElement.name.name=Text]': node => {
|
|
79
|
-
return UnsafeSmallText.lint(node, {
|
|
80
|
-
context,
|
|
81
|
-
config
|
|
82
|
-
});
|
|
83
76
|
}
|
|
84
77
|
}, config);
|
|
85
78
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { EmphasisElements } from './emphasis-elements';
|
|
2
2
|
export { SpanElements } from './span-elements';
|
|
3
3
|
export { StrongElements } from './strong-elements';
|
|
4
|
-
export { ParagraphElements } from './paragraph-elements';
|
|
5
|
-
export { UnsafeSmallText } from './unsafe-small-text';
|
|
4
|
+
export { ParagraphElements } from './paragraph-elements';
|
|
@@ -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::1fe99d63747ac78f0ea9e747af54bc76>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -20,7 +20,6 @@ var rules = {
|
|
|
20
20
|
'@atlaskit/design-system/no-banned-imports': 'error',
|
|
21
21
|
'@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
|
|
22
22
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'error',
|
|
23
|
-
'@atlaskit/design-system/no-custom-icons': 'warn',
|
|
24
23
|
'@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
|
|
25
24
|
'@atlaskit/design-system/no-deprecated-apis': 'error',
|
|
26
25
|
'@atlaskit/design-system/no-deprecated-design-token-usage': '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::4a4e27095e18b4c1f42c12cbc9f4af5e>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -19,7 +19,6 @@ var rules = {
|
|
|
19
19
|
'@atlaskit/design-system/no-banned-imports': 'error',
|
|
20
20
|
'@atlaskit/design-system/no-boolean-autofocus-on-modal-dialog': 'warn',
|
|
21
21
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'error',
|
|
22
|
-
'@atlaskit/design-system/no-custom-icons': 'warn',
|
|
23
22
|
'@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
|
|
24
23
|
'@atlaskit/design-system/no-deprecated-apis': 'error',
|
|
25
24
|
'@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
-
import { createIsFromImportSourceFor } from '
|
|
2
|
+
import { createIsFromImportSourceFor } from '../../common/is-from-import-source';
|
|
3
3
|
import { createLintRule } from '../utils/create-rule';
|
|
4
4
|
import { errorBoundary } from '../utils/error-boundary';
|
|
5
5
|
|
|
@@ -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::9b32672dde773f9e75f0e548609ecb58>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -16,7 +16,6 @@ import lozengeBadgeTagLabellingSystemMigration from './lozenge-badge-tag-labelli
|
|
|
16
16
|
import noBannedImports from './no-banned-imports';
|
|
17
17
|
import noBooleanAutofocusOnModalDialog from './no-boolean-autofocus-on-modal-dialog';
|
|
18
18
|
import noCssTaggedTemplateExpression from './no-css-tagged-template-expression';
|
|
19
|
-
import noCustomIcons from './no-custom-icons';
|
|
20
19
|
import noDarkThemeVrTests from './no-dark-theme-vr-tests';
|
|
21
20
|
import noDeprecatedApis from './no-deprecated-apis';
|
|
22
21
|
import noDeprecatedDesignTokenUsage from './no-deprecated-design-token-usage';
|
|
@@ -94,7 +93,6 @@ export var rules = {
|
|
|
94
93
|
'no-banned-imports': noBannedImports,
|
|
95
94
|
'no-boolean-autofocus-on-modal-dialog': noBooleanAutofocusOnModalDialog,
|
|
96
95
|
'no-css-tagged-template-expression': noCssTaggedTemplateExpression,
|
|
97
|
-
'no-custom-icons': noCustomIcons,
|
|
98
96
|
'no-dark-theme-vr-tests': noDarkThemeVrTests,
|
|
99
97
|
'no-deprecated-apis': noDeprecatedApis,
|
|
100
98
|
'no-deprecated-design-token-usage': noDeprecatedDesignTokenUsage,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createIsFromImportSourceFor } from '
|
|
1
|
+
import { createIsFromImportSourceFor } from '../../common/is-from-import-source';
|
|
2
2
|
import { createLintRule } from '../utils/create-rule';
|
|
3
3
|
import { errorBoundary } from '../utils/error-boundary';
|
|
4
4
|
import { CSSMAP_VARIABLE_NAME, getCssMapKey, getIconSize, getSpacingAttribute, getStaticAttributeValue, hasSpreadProps, SPACING_TO_PADDING, upsertCssMapImport, upsertCssMapVariable, upsertFlexImport, upsertTokenImport } from './helpers';
|
|
@@ -6,12 +6,10 @@ export var PATTERNS = [
|
|
|
6
6
|
// <strong>text</strong>
|
|
7
7
|
'strong-elements',
|
|
8
8
|
// <em>text</em>
|
|
9
|
-
'emphasis-elements'
|
|
10
|
-
// <Text size="UNSAFE_small">text</Text>
|
|
11
|
-
'unsafe-small-text'];
|
|
9
|
+
'emphasis-elements'];
|
|
12
10
|
var defaults = {
|
|
13
11
|
failSilently: false,
|
|
14
|
-
patterns: ['paragraph-elements', 'span-elements', 'strong-elements', 'emphasis-elements'
|
|
12
|
+
patterns: ['paragraph-elements', 'span-elements', 'strong-elements', 'emphasis-elements'],
|
|
15
13
|
inheritColor: false,
|
|
16
14
|
enableUnsafeAutofix: false,
|
|
17
15
|
enableUnsafeReport: true
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLintRule } from '../utils/create-rule';
|
|
2
2
|
import { errorBoundary } from '../utils/error-boundary';
|
|
3
3
|
import { getConfig, PATTERNS } from './config';
|
|
4
|
-
import { EmphasisElements, ParagraphElements, SpanElements, StrongElements
|
|
4
|
+
import { EmphasisElements, ParagraphElements, SpanElements, StrongElements } from './transformers';
|
|
5
5
|
var textDocsUrl = 'https://atlassian.design/components/primitives/text';
|
|
6
6
|
var rule = createLintRule({
|
|
7
7
|
meta: {
|
|
@@ -43,8 +43,7 @@ var rule = createLintRule({
|
|
|
43
43
|
},
|
|
44
44
|
messages: {
|
|
45
45
|
preferPrimitivesText: "This element can be replaced with a \"Text\" primitive. See ".concat(textDocsUrl, " for additional guidance."),
|
|
46
|
-
preferPrimitivesStackedText: "These paragraphs can be replaced with a \"Text\" and \"Stack\" primitives. See ".concat(textDocsUrl, " for additional guidance.")
|
|
47
|
-
noUnsafeSmallText: "Text size prop can be replaced with \"small\"."
|
|
46
|
+
preferPrimitivesStackedText: "These paragraphs can be replaced with a \"Text\" and \"Stack\" primitives. See ".concat(textDocsUrl, " for additional guidance.")
|
|
48
47
|
}
|
|
49
48
|
},
|
|
50
49
|
create: function create(context) {
|
|
@@ -74,12 +73,6 @@ var rule = createLintRule({
|
|
|
74
73
|
context: context,
|
|
75
74
|
config: config
|
|
76
75
|
});
|
|
77
|
-
},
|
|
78
|
-
'JSXElement[openingElement.name.name=Text]': function JSXElementOpeningElementNameNameText(node) {
|
|
79
|
-
return UnsafeSmallText.lint(node, {
|
|
80
|
-
context: context,
|
|
81
|
-
config: config
|
|
82
|
-
});
|
|
83
76
|
}
|
|
84
77
|
}, config);
|
|
85
78
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { EmphasisElements } from './emphasis-elements';
|
|
2
2
|
export { SpanElements } from './span-elements';
|
|
3
3
|
export { StrongElements } from './strong-elements';
|
|
4
|
-
export { ParagraphElements } from './paragraph-elements';
|
|
5
|
-
export { UnsafeSmallText } from './unsafe-small-text';
|
|
4
|
+
export { ParagraphElements } from './paragraph-elements';
|
|
@@ -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::1fe99d63747ac78f0ea9e747af54bc76>>
|
|
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::4a4e27095e18b4c1f42c12cbc9f4af5e>>
|
|
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::9b32672dde773f9e75f0e548609ecb58>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { Rule } from 'eslint';
|
|
@@ -2,4 +2,3 @@ export { EmphasisElements } from './emphasis-elements';
|
|
|
2
2
|
export { SpanElements } from './span-elements';
|
|
3
3
|
export { StrongElements } from './strong-elements';
|
|
4
4
|
export { ParagraphElements } from './paragraph-elements';
|
|
5
|
-
export { UnsafeSmallText } from './unsafe-small-text';
|
|
@@ -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::1fe99d63747ac78f0ea9e747af54bc76>>
|
|
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::4a4e27095e18b4c1f42c12cbc9f4af5e>>
|
|
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::9b32672dde773f9e75f0e548609ecb58>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { Rule } from 'eslint';
|
|
@@ -2,4 +2,3 @@ export { EmphasisElements } from './emphasis-elements';
|
|
|
2
2
|
export { SpanElements } from './span-elements';
|
|
3
3
|
export { StrongElements } from './strong-elements';
|
|
4
4
|
export { ParagraphElements } from './paragraph-elements';
|
|
5
|
-
export { UnsafeSmallText } from './unsafe-small-text';
|
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": "
|
|
4
|
+
"version": "14.0.0",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"publishConfig": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@atlaskit/eslint-utils": "^2.0.0",
|
|
42
42
|
"@atlaskit/icon": "^34.0.0",
|
|
43
43
|
"@atlaskit/icon-lab": "^6.4.0",
|
|
44
|
-
"@atlaskit/tokens": "^
|
|
44
|
+
"@atlaskit/tokens": "^13.0.0",
|
|
45
45
|
"@babel/runtime": "^7.0.0",
|
|
46
46
|
"@typescript-eslint/utils": "^7.1.0",
|
|
47
47
|
"ajv": "^6.12.6",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.hasProp = hasProp;
|
|
7
|
-
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
8
|
-
function hasProp(node, propName) {
|
|
9
|
-
return (0, _eslintCodemodUtils.isNodeOfType)(node.openingElement, 'JSXOpeningElement') && node.openingElement.attributes.some(function (a) {
|
|
10
|
-
return a.type === 'JSXAttribute' && a.name.name === propName;
|
|
11
|
-
});
|
|
12
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _createRule = require("../utils/create-rule");
|
|
8
|
-
var _errorBoundary = require("../utils/error-boundary");
|
|
9
|
-
var _hasProp = require("./checks/has-prop");
|
|
10
|
-
var _isFromImportSource = require("./checks/is-from-import-source");
|
|
11
|
-
var rule = (0, _createRule.createLintRule)({
|
|
12
|
-
meta: {
|
|
13
|
-
name: 'no-custom-icons',
|
|
14
|
-
type: 'problem',
|
|
15
|
-
docs: {
|
|
16
|
-
description: 'Enforces custom glyph icons are used.',
|
|
17
|
-
recommended: false,
|
|
18
|
-
severity: 'warn'
|
|
19
|
-
},
|
|
20
|
-
schema: [{
|
|
21
|
-
type: 'object',
|
|
22
|
-
properties: {
|
|
23
|
-
centralLocation: {
|
|
24
|
-
type: 'string'
|
|
25
|
-
},
|
|
26
|
-
failSilently: {
|
|
27
|
-
type: 'boolean'
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
additionalProperties: false
|
|
31
|
-
}],
|
|
32
|
-
messages: {
|
|
33
|
-
noCustomIcons: "Custom icons/svgs from {{importSource}} are no longer supported. Migrate to an icon from '@atlaskit/(icon-labs|icon/core|icon/utility)'{{locationMessage}}.\n[Migration guide](https://hello.atlassian.net/wiki/spaces/DST/pages/3748692796/New+ADS+iconography+-+Code+migration+guide)."
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
create: function create(context) {
|
|
37
|
-
var _context$options$;
|
|
38
|
-
var isIconSvg = (0, _isFromImportSource.createIsFromImportSourceFor)('@atlaskit/icon/svg');
|
|
39
|
-
var isIconBase = (0, _isFromImportSource.createIsFromImportSourceFor)('@atlaskit/icon', '@atlaskit/icon/base');
|
|
40
|
-
|
|
41
|
-
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
42
|
-
var _ref = (_context$options$ = context.options[0]) !== null && _context$options$ !== void 0 ? _context$options$ : {},
|
|
43
|
-
_ref$centralLocation = _ref.centralLocation,
|
|
44
|
-
centralLocation = _ref$centralLocation === void 0 ? '' : _ref$centralLocation,
|
|
45
|
-
_ref$failSilently = _ref.failSilently,
|
|
46
|
-
failSilently = _ref$failSilently === void 0 ? false : _ref$failSilently;
|
|
47
|
-
function checkNode(node) {
|
|
48
|
-
isIconBase.importDeclarationHook(node);
|
|
49
|
-
isIconSvg.importDeclarationHook(node);
|
|
50
|
-
}
|
|
51
|
-
var locationMessage = centralLocation ? ", move the icon to '".concat(centralLocation, "', or, if it's a third party logo, migrate to a standard <svg> element with a `label`.") : '';
|
|
52
|
-
return (0, _errorBoundary.errorBoundary)({
|
|
53
|
-
JSXElement: function JSXElement(node) {
|
|
54
|
-
var isSvg = isIconSvg(node);
|
|
55
|
-
var isBase = isIconBase(node);
|
|
56
|
-
// Not an icon import
|
|
57
|
-
if (!isSvg && (!isBase || !(0, _hasProp.hasProp)(node, 'glyph'))) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
var importSource = '';
|
|
61
|
-
if (isSvg) {
|
|
62
|
-
importSource = isIconSvg.getImportSource(node);
|
|
63
|
-
} else if (isBase) {
|
|
64
|
-
importSource = isIconBase.getImportSource(node);
|
|
65
|
-
}
|
|
66
|
-
context.report({
|
|
67
|
-
node: node.openingElement,
|
|
68
|
-
messageId: 'noCustomIcons',
|
|
69
|
-
data: {
|
|
70
|
-
importSource: importSource,
|
|
71
|
-
locationMessage: locationMessage
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
ImportDeclaration: checkNode
|
|
76
|
-
}, failSilently);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
var _default = exports.default = rule;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.UnsafeSmallText = void 0;
|
|
8
|
-
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
9
|
-
var ast = _interopRequireWildcard(require("../../../ast-nodes"));
|
|
10
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
11
|
-
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
12
|
-
|
|
13
|
-
var UnsafeSmallText = exports.UnsafeSmallText = {
|
|
14
|
-
lint: function lint(node, _ref) {
|
|
15
|
-
var context = _ref.context,
|
|
16
|
-
config = _ref.config;
|
|
17
|
-
if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'JSXElement')) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Check whether all criteria needed to make a transformation are met
|
|
22
|
-
var success = UnsafeSmallText._check(node, {
|
|
23
|
-
context: context,
|
|
24
|
-
config: config
|
|
25
|
-
});
|
|
26
|
-
if (success) {
|
|
27
|
-
var fix = UnsafeSmallText._fix(node);
|
|
28
|
-
context.report({
|
|
29
|
-
node: node.openingElement,
|
|
30
|
-
messageId: 'noUnsafeSmallText',
|
|
31
|
-
fix: fix
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
_check: function _check(node, _ref2) {
|
|
36
|
-
var config = _ref2.config;
|
|
37
|
-
if (!config.patterns.includes('unsafe-small-text')) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
var elementName = ast.JSXElement.getName(node);
|
|
41
|
-
if (elementName !== 'Text') {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
var sizeAttribute = ast.JSXElement.getAttributeByName(node, 'size');
|
|
45
|
-
if (sizeAttribute !== null && sizeAttribute !== void 0 && sizeAttribute.value && (0, _eslintCodemodUtils.isNodeOfType)(sizeAttribute.value, 'Literal')) {
|
|
46
|
-
return sizeAttribute.value.value === 'UNSAFE_small';
|
|
47
|
-
}
|
|
48
|
-
return false;
|
|
49
|
-
},
|
|
50
|
-
_fix: function _fix(node) {
|
|
51
|
-
return function (fixer) {
|
|
52
|
-
var sizeAttribute = ast.JSXElement.getAttributeByName(node, 'size');
|
|
53
|
-
if (sizeAttribute !== null && sizeAttribute !== void 0 && sizeAttribute.value && (0, _eslintCodemodUtils.isNodeOfType)(sizeAttribute.value, 'Literal')) {
|
|
54
|
-
var valueNode = sizeAttribute.value;
|
|
55
|
-
var valueFix = fixer.replaceText(valueNode, "\"small\"");
|
|
56
|
-
return [valueFix];
|
|
57
|
-
}
|
|
58
|
-
return [];
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { createLintRule } from '../utils/create-rule';
|
|
2
|
-
import { errorBoundary } from '../utils/error-boundary';
|
|
3
|
-
import { hasProp } from './checks/has-prop';
|
|
4
|
-
import { createIsFromImportSourceFor } from './checks/is-from-import-source';
|
|
5
|
-
const rule = createLintRule({
|
|
6
|
-
meta: {
|
|
7
|
-
name: 'no-custom-icons',
|
|
8
|
-
type: 'problem',
|
|
9
|
-
docs: {
|
|
10
|
-
description: 'Enforces custom glyph icons are used.',
|
|
11
|
-
recommended: false,
|
|
12
|
-
severity: 'warn'
|
|
13
|
-
},
|
|
14
|
-
schema: [{
|
|
15
|
-
type: 'object',
|
|
16
|
-
properties: {
|
|
17
|
-
centralLocation: {
|
|
18
|
-
type: 'string'
|
|
19
|
-
},
|
|
20
|
-
failSilently: {
|
|
21
|
-
type: 'boolean'
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
additionalProperties: false
|
|
25
|
-
}],
|
|
26
|
-
messages: {
|
|
27
|
-
noCustomIcons: `Custom icons/svgs from {{importSource}} are no longer supported. Migrate to an icon from '@atlaskit/(icon-labs|icon/core|icon/utility)'{{locationMessage}}.
|
|
28
|
-
[Migration guide](https://hello.atlassian.net/wiki/spaces/DST/pages/3748692796/New+ADS+iconography+-+Code+migration+guide).`
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
create(context) {
|
|
32
|
-
var _context$options$;
|
|
33
|
-
const isIconSvg = createIsFromImportSourceFor('@atlaskit/icon/svg');
|
|
34
|
-
const isIconBase = createIsFromImportSourceFor('@atlaskit/icon', '@atlaskit/icon/base');
|
|
35
|
-
|
|
36
|
-
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
37
|
-
const {
|
|
38
|
-
centralLocation = '',
|
|
39
|
-
failSilently = false
|
|
40
|
-
} = (_context$options$ = context.options[0]) !== null && _context$options$ !== void 0 ? _context$options$ : {};
|
|
41
|
-
function checkNode(node) {
|
|
42
|
-
isIconBase.importDeclarationHook(node);
|
|
43
|
-
isIconSvg.importDeclarationHook(node);
|
|
44
|
-
}
|
|
45
|
-
const locationMessage = centralLocation ? `, move the icon to '${centralLocation}', or, if it's a third party logo, migrate to a standard <svg> element with a \`label\`.` : '';
|
|
46
|
-
return errorBoundary({
|
|
47
|
-
JSXElement(node) {
|
|
48
|
-
const isSvg = isIconSvg(node);
|
|
49
|
-
const isBase = isIconBase(node);
|
|
50
|
-
// Not an icon import
|
|
51
|
-
if (!isSvg && (!isBase || !hasProp(node, 'glyph'))) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
let importSource = '';
|
|
55
|
-
if (isSvg) {
|
|
56
|
-
importSource = isIconSvg.getImportSource(node);
|
|
57
|
-
} else if (isBase) {
|
|
58
|
-
importSource = isIconBase.getImportSource(node);
|
|
59
|
-
}
|
|
60
|
-
context.report({
|
|
61
|
-
node: node.openingElement,
|
|
62
|
-
messageId: 'noCustomIcons',
|
|
63
|
-
data: {
|
|
64
|
-
importSource,
|
|
65
|
-
locationMessage
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
},
|
|
69
|
-
ImportDeclaration: checkNode
|
|
70
|
-
}, failSilently);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
export default rule;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
|
-
|
|
3
|
-
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
-
import * as ast from '../../../ast-nodes';
|
|
5
|
-
export const UnsafeSmallText = {
|
|
6
|
-
lint(node, {
|
|
7
|
-
context,
|
|
8
|
-
config
|
|
9
|
-
}) {
|
|
10
|
-
if (!isNodeOfType(node, 'JSXElement')) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Check whether all criteria needed to make a transformation are met
|
|
15
|
-
const success = UnsafeSmallText._check(node, {
|
|
16
|
-
context,
|
|
17
|
-
config
|
|
18
|
-
});
|
|
19
|
-
if (success) {
|
|
20
|
-
const fix = UnsafeSmallText._fix(node);
|
|
21
|
-
context.report({
|
|
22
|
-
node: node.openingElement,
|
|
23
|
-
messageId: 'noUnsafeSmallText',
|
|
24
|
-
fix
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
_check(node, {
|
|
29
|
-
config
|
|
30
|
-
}) {
|
|
31
|
-
if (!config.patterns.includes('unsafe-small-text')) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
const elementName = ast.JSXElement.getName(node);
|
|
35
|
-
if (elementName !== 'Text') {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
const sizeAttribute = ast.JSXElement.getAttributeByName(node, 'size');
|
|
39
|
-
if (sizeAttribute !== null && sizeAttribute !== void 0 && sizeAttribute.value && isNodeOfType(sizeAttribute.value, 'Literal')) {
|
|
40
|
-
return sizeAttribute.value.value === 'UNSAFE_small';
|
|
41
|
-
}
|
|
42
|
-
return false;
|
|
43
|
-
},
|
|
44
|
-
_fix(node) {
|
|
45
|
-
return fixer => {
|
|
46
|
-
const sizeAttribute = ast.JSXElement.getAttributeByName(node, 'size');
|
|
47
|
-
if (sizeAttribute !== null && sizeAttribute !== void 0 && sizeAttribute.value && isNodeOfType(sizeAttribute.value, 'Literal')) {
|
|
48
|
-
const valueNode = sizeAttribute.value;
|
|
49
|
-
const valueFix = fixer.replaceText(valueNode, `"small"`);
|
|
50
|
-
return [valueFix];
|
|
51
|
-
}
|
|
52
|
-
return [];
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
-
export function hasProp(node, propName) {
|
|
3
|
-
return isNodeOfType(node.openingElement, 'JSXOpeningElement') && node.openingElement.attributes.some(function (a) {
|
|
4
|
-
return a.type === 'JSXAttribute' && a.name.name === propName;
|
|
5
|
-
});
|
|
6
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { createLintRule } from '../utils/create-rule';
|
|
2
|
-
import { errorBoundary } from '../utils/error-boundary';
|
|
3
|
-
import { hasProp } from './checks/has-prop';
|
|
4
|
-
import { createIsFromImportSourceFor } from './checks/is-from-import-source';
|
|
5
|
-
var rule = createLintRule({
|
|
6
|
-
meta: {
|
|
7
|
-
name: 'no-custom-icons',
|
|
8
|
-
type: 'problem',
|
|
9
|
-
docs: {
|
|
10
|
-
description: 'Enforces custom glyph icons are used.',
|
|
11
|
-
recommended: false,
|
|
12
|
-
severity: 'warn'
|
|
13
|
-
},
|
|
14
|
-
schema: [{
|
|
15
|
-
type: 'object',
|
|
16
|
-
properties: {
|
|
17
|
-
centralLocation: {
|
|
18
|
-
type: 'string'
|
|
19
|
-
},
|
|
20
|
-
failSilently: {
|
|
21
|
-
type: 'boolean'
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
additionalProperties: false
|
|
25
|
-
}],
|
|
26
|
-
messages: {
|
|
27
|
-
noCustomIcons: "Custom icons/svgs from {{importSource}} are no longer supported. Migrate to an icon from '@atlaskit/(icon-labs|icon/core|icon/utility)'{{locationMessage}}.\n[Migration guide](https://hello.atlassian.net/wiki/spaces/DST/pages/3748692796/New+ADS+iconography+-+Code+migration+guide)."
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
create: function create(context) {
|
|
31
|
-
var _context$options$;
|
|
32
|
-
var isIconSvg = createIsFromImportSourceFor('@atlaskit/icon/svg');
|
|
33
|
-
var isIconBase = createIsFromImportSourceFor('@atlaskit/icon', '@atlaskit/icon/base');
|
|
34
|
-
|
|
35
|
-
// TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
|
|
36
|
-
var _ref = (_context$options$ = context.options[0]) !== null && _context$options$ !== void 0 ? _context$options$ : {},
|
|
37
|
-
_ref$centralLocation = _ref.centralLocation,
|
|
38
|
-
centralLocation = _ref$centralLocation === void 0 ? '' : _ref$centralLocation,
|
|
39
|
-
_ref$failSilently = _ref.failSilently,
|
|
40
|
-
failSilently = _ref$failSilently === void 0 ? false : _ref$failSilently;
|
|
41
|
-
function checkNode(node) {
|
|
42
|
-
isIconBase.importDeclarationHook(node);
|
|
43
|
-
isIconSvg.importDeclarationHook(node);
|
|
44
|
-
}
|
|
45
|
-
var locationMessage = centralLocation ? ", move the icon to '".concat(centralLocation, "', or, if it's a third party logo, migrate to a standard <svg> element with a `label`.") : '';
|
|
46
|
-
return errorBoundary({
|
|
47
|
-
JSXElement: function JSXElement(node) {
|
|
48
|
-
var isSvg = isIconSvg(node);
|
|
49
|
-
var isBase = isIconBase(node);
|
|
50
|
-
// Not an icon import
|
|
51
|
-
if (!isSvg && (!isBase || !hasProp(node, 'glyph'))) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
var importSource = '';
|
|
55
|
-
if (isSvg) {
|
|
56
|
-
importSource = isIconSvg.getImportSource(node);
|
|
57
|
-
} else if (isBase) {
|
|
58
|
-
importSource = isIconBase.getImportSource(node);
|
|
59
|
-
}
|
|
60
|
-
context.report({
|
|
61
|
-
node: node.openingElement,
|
|
62
|
-
messageId: 'noCustomIcons',
|
|
63
|
-
data: {
|
|
64
|
-
importSource: importSource,
|
|
65
|
-
locationMessage: locationMessage
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
},
|
|
69
|
-
ImportDeclaration: checkNode
|
|
70
|
-
}, failSilently);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
export default rule;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
|
-
|
|
3
|
-
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
-
import * as ast from '../../../ast-nodes';
|
|
5
|
-
export var UnsafeSmallText = {
|
|
6
|
-
lint: function lint(node, _ref) {
|
|
7
|
-
var context = _ref.context,
|
|
8
|
-
config = _ref.config;
|
|
9
|
-
if (!isNodeOfType(node, 'JSXElement')) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Check whether all criteria needed to make a transformation are met
|
|
14
|
-
var success = UnsafeSmallText._check(node, {
|
|
15
|
-
context: context,
|
|
16
|
-
config: config
|
|
17
|
-
});
|
|
18
|
-
if (success) {
|
|
19
|
-
var fix = UnsafeSmallText._fix(node);
|
|
20
|
-
context.report({
|
|
21
|
-
node: node.openingElement,
|
|
22
|
-
messageId: 'noUnsafeSmallText',
|
|
23
|
-
fix: fix
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
_check: function _check(node, _ref2) {
|
|
28
|
-
var config = _ref2.config;
|
|
29
|
-
if (!config.patterns.includes('unsafe-small-text')) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
var elementName = ast.JSXElement.getName(node);
|
|
33
|
-
if (elementName !== 'Text') {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
var sizeAttribute = ast.JSXElement.getAttributeByName(node, 'size');
|
|
37
|
-
if (sizeAttribute !== null && sizeAttribute !== void 0 && sizeAttribute.value && isNodeOfType(sizeAttribute.value, 'Literal')) {
|
|
38
|
-
return sizeAttribute.value.value === 'UNSAFE_small';
|
|
39
|
-
}
|
|
40
|
-
return false;
|
|
41
|
-
},
|
|
42
|
-
_fix: function _fix(node) {
|
|
43
|
-
return function (fixer) {
|
|
44
|
-
var sizeAttribute = ast.JSXElement.getAttributeByName(node, 'size');
|
|
45
|
-
if (sizeAttribute !== null && sizeAttribute !== void 0 && sizeAttribute.value && isNodeOfType(sizeAttribute.value, 'Literal')) {
|
|
46
|
-
var valueNode = sizeAttribute.value;
|
|
47
|
-
var valueFix = fixer.replaceText(valueNode, "\"small\"");
|
|
48
|
-
return [valueFix];
|
|
49
|
-
}
|
|
50
|
-
return [];
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Rule } from 'eslint';
|
|
2
|
-
import { type JSXElement } from 'eslint-codemod-utils';
|
|
3
|
-
import type { MetaData } from './common';
|
|
4
|
-
export declare const UnsafeSmallText: {
|
|
5
|
-
lint(node: Rule.Node, { context, config }: MetaData): void;
|
|
6
|
-
_check(node: JSXElement, { config }: MetaData): boolean;
|
|
7
|
-
_fix(node: JSXElement): Rule.ReportFixer;
|
|
8
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Rule } from 'eslint';
|
|
2
|
-
import { type JSXElement } from 'eslint-codemod-utils';
|
|
3
|
-
import type { MetaData } from './common';
|
|
4
|
-
export declare const UnsafeSmallText: {
|
|
5
|
-
lint(node: Rule.Node, { context, config }: MetaData): void;
|
|
6
|
-
_check(node: JSXElement, { config }: MetaData): boolean;
|
|
7
|
-
_fix(node: JSXElement): Rule.ReportFixer;
|
|
8
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/types-ts4.5/{rules/no-custom-icons/checks → common}/is-from-import-source.d.ts
RENAMED
|
File without changes
|
/package/dist/types-ts4.5/{rules/no-custom-icons/checks → common}/is-imported-jsx-element.d.ts
RENAMED
|
File without changes
|