@atlaskit/eslint-plugin-design-system 13.21.2 → 13.22.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 +28 -39
- package/dist/cjs/index.codegen.js +1 -1
- package/dist/cjs/rules/no-deprecated-imports/handlers/icon.js +13 -2
- package/dist/cjs/rules/no-deprecated-imports/index.js +5 -1
- package/dist/es2019/index.codegen.js +1 -1
- package/dist/es2019/rules/no-deprecated-imports/handlers/icon.js +13 -2
- package/dist/es2019/rules/no-deprecated-imports/index.js +5 -1
- package/dist/esm/index.codegen.js +1 -1
- package/dist/esm/rules/no-deprecated-imports/handlers/icon.js +13 -2
- package/dist/esm/rules/no-deprecated-imports/index.js +5 -1
- package/dist/types/index.codegen.d.ts +2 -2
- package/dist/types-ts4.5/index.codegen.d.ts +2 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 13.22.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`4df3a43323a47`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4df3a43323a47) -
|
|
8
|
+
Added `turnOffAutoFixer` configuration option to the `no-deprecated-imports` rule, allowing users
|
|
9
|
+
to disable automatic code fixes while still reporting deprecated import violations.
|
|
10
|
+
|
|
11
|
+
## 13.21.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 13.21.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -1290,7 +1304,6 @@
|
|
|
1290
1304
|
- [#86321](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86321)
|
|
1291
1305
|
[`b353b26e22b6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b353b26e22b6) -
|
|
1292
1306
|
Improvements for `no-*-tagged-template-expression` rules:
|
|
1293
|
-
|
|
1294
1307
|
- Fixed a bug that could produce syntax errors when mixins were present in nested selectors.
|
|
1295
1308
|
- Disabled autofixing styled components usages with mixins in nested selectors, as there is no
|
|
1296
1309
|
general equivalent.
|
|
@@ -1334,7 +1347,6 @@
|
|
|
1334
1347
|
functions will no longer be required to end with "Styles".
|
|
1335
1348
|
|
|
1336
1349
|
[BREAKING] Some rule options have been changed:
|
|
1337
|
-
|
|
1338
1350
|
- `fixNamesOnly` and `autoFixNames` have been removed, as there is no longer an autofixer that
|
|
1339
1351
|
enforces variable names.
|
|
1340
1352
|
- If you use `fixNamesOnly: true`, we recommend switching to using `autoFix: false`.
|
|
@@ -1366,7 +1378,6 @@
|
|
|
1366
1378
|
- [#80662](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80662)
|
|
1367
1379
|
[`4833299b00d4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4833299b00d4) -
|
|
1368
1380
|
For `no-css-tagged-template-expression` and `no-styled-tagged-template-expression`:
|
|
1369
|
-
|
|
1370
1381
|
- When importing from Emotion, stop applying autofixer when the styles contain `!important`.
|
|
1371
1382
|
- When importing from any library, stop applying autofixer when a selector contains a tagged
|
|
1372
1383
|
template interpolation (previously only styled-components).
|
|
@@ -1551,7 +1562,6 @@
|
|
|
1551
1562
|
[`ec187f466e23`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ec187f466e23) -
|
|
1552
1563
|
Update `consistent-css-prop-usage` to incorporate some updates previously made to the
|
|
1553
1564
|
`@compiled/eslint-plugin` equivalent.
|
|
1554
|
-
|
|
1555
1565
|
1. Add autofixer to add the `css` function for the following scenario:
|
|
1556
1566
|
|
|
1557
1567
|
```
|
|
@@ -1563,25 +1573,20 @@
|
|
|
1563
1573
|
`{ height: makeTaller ? '5px' : '2px' }`), or if there are spread elements, template literals, and
|
|
1564
1574
|
other tricky-to-parse code. These continue to require fixing manually.
|
|
1565
1575
|
|
|
1566
|
-
(This rule would previously only autofix if the file was originally `<div css={{ ... }} />`)
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
end of existing style variables. For example, in
|
|
1581
|
-
`<div css={buttonComponent} />; const buttonComponent = css({ ... })`, `buttonComponent` will
|
|
1582
|
-
continue to be renamed to `buttonComponentStyles`. Autofixers that will be _disabled_ include
|
|
1583
|
-
hoisting the styles to the top-most scope, and adding the `css` function call around style
|
|
1584
|
-
objects.
|
|
1576
|
+
(This rule would previously only autofix if the file was originally `<div css={{ ... }} />`) 2.
|
|
1577
|
+
Add `import { css } from '@compiled/react'` (or `xcss`) automatically when fixing. The package
|
|
1578
|
+
from which to import the `css` function can be specified through the `importSource` option. 3. Add
|
|
1579
|
+
`excludeReactComponents` to exclude linting React components (i.e. components that start with
|
|
1580
|
+
uppercase). Sometimes it may not be desirable to have this rule apply to React components (e.g.
|
|
1581
|
+
`@atlaskit/button`), which could either use the Emotion or Compiled APIs when they expose a `css`
|
|
1582
|
+
prop. Passing a function from the wrong library can result in the styling erroneously not being
|
|
1583
|
+
applied. 4. Treat `{ ... } as const` statements the same way as `{ ... }` objects. 5. Add
|
|
1584
|
+
`fixNamesOnly` to disable all autofixers _except_ the autofixer that adds `styles` to the end of
|
|
1585
|
+
existing style variables. For example, in
|
|
1586
|
+
`<div css={buttonComponent} />; const buttonComponent = css({ ... })`, `buttonComponent` will
|
|
1587
|
+
continue to be renamed to `buttonComponentStyles`. Autofixers that will be _disabled_ include
|
|
1588
|
+
hoisting the styles to the top-most scope, and adding the `css` function call around style
|
|
1589
|
+
objects.
|
|
1585
1590
|
|
|
1586
1591
|
## 8.26.0
|
|
1587
1592
|
|
|
@@ -1592,7 +1597,6 @@
|
|
|
1592
1597
|
Add some ESLint rules from Compiled CSS-in-JS, and adapt them for the UI Styling Standard.
|
|
1593
1598
|
|
|
1594
1599
|
Rules added:
|
|
1595
|
-
|
|
1596
1600
|
- `no-empty-styled-expression`: ban `styled({})` usages
|
|
1597
1601
|
- `no-exported-css` and `no-exported-keyframes`: ban `css` and `keyframes` function calls that are
|
|
1598
1602
|
exported
|
|
@@ -1600,7 +1604,6 @@
|
|
|
1600
1604
|
not valid
|
|
1601
1605
|
|
|
1602
1606
|
Changes made:
|
|
1603
|
-
|
|
1604
1607
|
- Add them to monorepo, modify to use the existing utility functions
|
|
1605
1608
|
- Add support for CSS-in-JS libraries other than Compiled (styled-components, Emotion,
|
|
1606
1609
|
`@atlaskit/css`, etc.) and `xcss` where appropriate
|
|
@@ -1831,7 +1834,6 @@
|
|
|
1831
1834
|
[`0004d49c240`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0004d49c240) - Adds a
|
|
1832
1835
|
new argument `fallbackUsage` which replaces `shouldEnforceFallbacks`. This new argument is an enum
|
|
1833
1836
|
which represents the three possible states this rule can be configured with.
|
|
1834
|
-
|
|
1835
1837
|
- `forced`: Fallbacks must always been in use
|
|
1836
1838
|
- `none`: Fallbacks must never been in use. (Fixer will remove any value provided )
|
|
1837
1839
|
- `optional`: (new) Fallbacks are optional
|
|
@@ -2181,7 +2183,6 @@
|
|
|
2181
2183
|
This rule defaults to `error`.
|
|
2182
2184
|
|
|
2183
2185
|
To update to this version:
|
|
2184
|
-
|
|
2185
2186
|
- If you are using the `ensure-design-token-usage` rule, add the `domains` property with a value
|
|
2186
2187
|
of `['color']`:
|
|
2187
2188
|
|
|
@@ -2382,14 +2383,12 @@
|
|
|
2382
2383
|
- [#32576](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32576)
|
|
2383
2384
|
[`b910bbe6130`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b910bbe6130) - The
|
|
2384
2385
|
following rules are now included in the recommended preset as errors:
|
|
2385
|
-
|
|
2386
2386
|
- ensure-design-token-usage
|
|
2387
2387
|
- no-deprecated-apis
|
|
2388
2388
|
- no-deprecated-imports
|
|
2389
2389
|
- no-unsafe-design-token-usage
|
|
2390
2390
|
|
|
2391
2391
|
The following rules are now included in the recommended preset as warnings:
|
|
2392
|
-
|
|
2393
2392
|
- no-deprecated-design-token-usage
|
|
2394
2393
|
|
|
2395
2394
|
### Minor Changes
|
|
@@ -2886,7 +2885,6 @@
|
|
|
2886
2885
|
as hardcoded color usage. This affected Styled Components and Emotion CSS prop syntaxes.
|
|
2887
2886
|
|
|
2888
2887
|
These color types have been fixed:
|
|
2889
|
-
|
|
2890
2888
|
- rgb
|
|
2891
2889
|
- rgba
|
|
2892
2890
|
- hsl
|
|
@@ -2986,7 +2984,6 @@
|
|
|
2986
2984
|
This has now been split up into two separate rules:
|
|
2987
2985
|
|
|
2988
2986
|
`ensure-design-token-usage` now covers:
|
|
2989
|
-
|
|
2990
2987
|
- `legacyElevation` — warns about old usages of the elevation mixins or styles, which instead
|
|
2991
2988
|
should use the `card` or `overlay` tokens.
|
|
2992
2989
|
- `hardCodedColor` — warns about use of hard-coded colors such as `color: colors.B100`, which
|
|
@@ -2994,7 +2991,6 @@
|
|
|
2994
2991
|
codebases when first adopting tokens.
|
|
2995
2992
|
|
|
2996
2993
|
`no-unsafe-design-token-usage` (new) covers the remaining rules:
|
|
2997
|
-
|
|
2998
2994
|
- `directTokenUsage` — warns against using the CSS Custom Property name that is output in the
|
|
2999
2995
|
browser by the `token()` call. Eg. directly using `var(--ds-accent-subtleBlue)` is bad.
|
|
3000
2996
|
- `staticToken` — warns when tokens aren't used inline. Inlining the token usages helps with
|
|
@@ -3054,20 +3050,17 @@
|
|
|
3054
3050
|
- [#14319](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/14319)
|
|
3055
3051
|
[`b6a55ffa092`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b6a55ffa092) -
|
|
3056
3052
|
Introduces fixes for various edge-cases and false positives:
|
|
3057
|
-
|
|
3058
3053
|
- Objects that are not considered "style blocks" are now ignored. Style blocks are considered as
|
|
3059
3054
|
objects assigned to variables with names containing either "style", "css", or "theme" and type
|
|
3060
3055
|
annotations including "CSSProperties" or "CSSObject".
|
|
3061
3056
|
- Hexadecimal colors using the `0x` notation are now ignored
|
|
3062
3057
|
|
|
3063
3058
|
Increasing the linting surface-area:
|
|
3064
|
-
|
|
3065
3059
|
- Colors used in shorthand css property values will now be linted against. (ie
|
|
3066
3060
|
`border: solid 1px red`)
|
|
3067
3061
|
- Strings passed directly into JSX attributes (props) are now linted (ie `<Button color="red" />`)
|
|
3068
3062
|
|
|
3069
3063
|
General improvements:
|
|
3070
|
-
|
|
3071
3064
|
- Color names will now only match against "whole" words. Meaning strings that inadvertently
|
|
3072
3065
|
include color names like the "tan" in "standard" will no longer fail.
|
|
3073
3066
|
|
|
@@ -3144,11 +3137,9 @@
|
|
|
3144
3137
|
removes & renames tokens
|
|
3145
3138
|
|
|
3146
3139
|
Adds:
|
|
3147
|
-
|
|
3148
3140
|
- `color.backgroundSelect`
|
|
3149
3141
|
|
|
3150
3142
|
Renames:
|
|
3151
|
-
|
|
3152
3143
|
- `color.borderTextHighlighted` to `color.bordertextSelected`
|
|
3153
3144
|
- `elevation.base` to `evelation.backgroundDefault`
|
|
3154
3145
|
- `elevation.flatSecondary` to `elevation.backgroundSunken`
|
|
@@ -3159,11 +3150,9 @@
|
|
|
3159
3150
|
- `elevation.shadowOverlay` to `shadow.overlay`
|
|
3160
3151
|
|
|
3161
3152
|
Removes:
|
|
3162
|
-
|
|
3163
3153
|
- `elevation.boarderFlatPrimary`
|
|
3164
3154
|
|
|
3165
3155
|
Updates:
|
|
3166
|
-
|
|
3167
3156
|
- `elevation.shadowOverlay` value to `DN100`
|
|
3168
3157
|
- `color.textWarning` in light mode to `O800`
|
|
3169
3158
|
- `color.iconBorderWarning` in light mode to `O600`
|
|
@@ -20,7 +20,7 @@ var _index = require("./rules/index.codegen");
|
|
|
20
20
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
22
22
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
23
|
-
* @codegen <<SignedSource::
|
|
23
|
+
* @codegen <<SignedSource::095a43b3637f01bf6b70a07041528ef7>>
|
|
24
24
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
25
25
|
*/
|
|
26
26
|
// this uses require because not all node versions this package supports use the same import assertions/attributes
|
|
@@ -24,6 +24,12 @@ var getDeprecationIconHandler = exports.getDeprecationIconHandler = function get
|
|
|
24
24
|
var identifiers = new Map();
|
|
25
25
|
var importErrors = {};
|
|
26
26
|
var exportErrors = {};
|
|
27
|
+
var getConfigFlag = function getConfigFlag(key, defaultValue) {
|
|
28
|
+
if (context.options && context.options.length > 0 && context.options[0] && context.options[0].hasOwnProperty(key)) {
|
|
29
|
+
return context.options[0][key] === !defaultValue ? !defaultValue : defaultValue;
|
|
30
|
+
}
|
|
31
|
+
return defaultValue;
|
|
32
|
+
};
|
|
27
33
|
var getIconComponentName = function getIconComponentName(name) {
|
|
28
34
|
return name.split(/\W/).map(function (part) {
|
|
29
35
|
return "".concat(part[0].toUpperCase()).concat(part.slice(1));
|
|
@@ -63,6 +69,7 @@ var getDeprecationIconHandler = exports.getDeprecationIconHandler = function get
|
|
|
63
69
|
}
|
|
64
70
|
};
|
|
65
71
|
var throwErrors = function throwErrors() {
|
|
72
|
+
var shouldTurnOffAutoFixer = getConfigFlag('turnOffAutoFixer', false);
|
|
66
73
|
for (var _i = 0, _Object$entries = Object.entries(importErrors); _i < _Object$entries.length; _i++) {
|
|
67
74
|
var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),
|
|
68
75
|
importSource = _Object$entries$_i[0],
|
|
@@ -83,7 +90,9 @@ var getDeprecationIconHandler = exports.getDeprecationIconHandler = function get
|
|
|
83
90
|
var replacement = metadata === null || metadata === void 0 || (_metadata$deprecatedI = metadata[deprecatedIconName]) === null || _metadata$deprecatedI === void 0 ? void 0 : _metadata$deprecatedI.replacement;
|
|
84
91
|
if (replacement && ((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.unfixable) === 'false') {
|
|
85
92
|
var newIconName = getIconComponentName(replacement.name);
|
|
86
|
-
|
|
93
|
+
if (!shouldTurnOffAutoFixer) {
|
|
94
|
+
addAutoFix(error, importSource, "".concat(replacement.location, "/").concat(replacement.type, "/migration/").concat(replacement.name, "--").concat(legacyIconName), newIconName);
|
|
95
|
+
}
|
|
87
96
|
}
|
|
88
97
|
} else {
|
|
89
98
|
var _metadata2;
|
|
@@ -101,7 +110,9 @@ var getDeprecationIconHandler = exports.getDeprecationIconHandler = function get
|
|
|
101
110
|
var _replacement = (_metadata2 = _metadata) === null || _metadata2 === void 0 || (_metadata2 = _metadata2[_name]) === null || _metadata2 === void 0 ? void 0 : _metadata2.replacement;
|
|
102
111
|
if (_replacement) {
|
|
103
112
|
var _newIconName = getIconComponentName(_replacement.name);
|
|
104
|
-
|
|
113
|
+
if (!shouldTurnOffAutoFixer) {
|
|
114
|
+
addAutoFix(error, importSource, "".concat(_replacement.location, "/").concat(_replacement.type, "/").concat(_replacement.name), _newIconName);
|
|
115
|
+
}
|
|
105
116
|
}
|
|
106
117
|
}
|
|
107
118
|
context.report(error);
|
|
@@ -53,6 +53,9 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
53
53
|
schema: [{
|
|
54
54
|
type: 'object',
|
|
55
55
|
properties: {
|
|
56
|
+
turnOffAutoFixer: {
|
|
57
|
+
type: 'boolean'
|
|
58
|
+
},
|
|
56
59
|
deprecatedConfig: {
|
|
57
60
|
type: 'object',
|
|
58
61
|
properties: {
|
|
@@ -81,7 +84,8 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
}
|
|
84
|
-
}
|
|
87
|
+
},
|
|
88
|
+
additionalProperties: false
|
|
85
89
|
}]
|
|
86
90
|
},
|
|
87
91
|
create: function create(context) {
|
|
@@ -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::095a43b3637f01bf6b70a07041528ef7>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -13,6 +13,12 @@ export const getDeprecationIconHandler = context => {
|
|
|
13
13
|
const identifiers = new Map();
|
|
14
14
|
const importErrors = {};
|
|
15
15
|
const exportErrors = {};
|
|
16
|
+
const getConfigFlag = (key, defaultValue) => {
|
|
17
|
+
if (context.options && context.options.length > 0 && context.options[0] && context.options[0].hasOwnProperty(key)) {
|
|
18
|
+
return context.options[0][key] === !defaultValue ? !defaultValue : defaultValue;
|
|
19
|
+
}
|
|
20
|
+
return defaultValue;
|
|
21
|
+
};
|
|
16
22
|
const getIconComponentName = name => {
|
|
17
23
|
return name.split(/\W/).map(part => `${part[0].toUpperCase()}${part.slice(1)}`).join('').concat('Icon');
|
|
18
24
|
};
|
|
@@ -52,6 +58,7 @@ export const getDeprecationIconHandler = context => {
|
|
|
52
58
|
}
|
|
53
59
|
};
|
|
54
60
|
const throwErrors = () => {
|
|
61
|
+
const shouldTurnOffAutoFixer = getConfigFlag('turnOffAutoFixer', false);
|
|
55
62
|
for (const [importSource, error] of Object.entries(importErrors)) {
|
|
56
63
|
if (importSource.includes('/migration/')) {
|
|
57
64
|
var _metadata$deprecatedI, _error$data;
|
|
@@ -61,7 +68,9 @@ export const getDeprecationIconHandler = context => {
|
|
|
61
68
|
const replacement = metadata === null || metadata === void 0 ? void 0 : (_metadata$deprecatedI = metadata[deprecatedIconName]) === null || _metadata$deprecatedI === void 0 ? void 0 : _metadata$deprecatedI.replacement;
|
|
62
69
|
if (replacement && ((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.unfixable) === 'false') {
|
|
63
70
|
const newIconName = getIconComponentName(replacement.name);
|
|
64
|
-
|
|
71
|
+
if (!shouldTurnOffAutoFixer) {
|
|
72
|
+
addAutoFix(error, importSource, `${replacement.location}/${replacement.type}/migration/${replacement.name}--${legacyIconName}`, newIconName);
|
|
73
|
+
}
|
|
65
74
|
}
|
|
66
75
|
} else {
|
|
67
76
|
var _metadata, _metadata$name;
|
|
@@ -75,7 +84,9 @@ export const getDeprecationIconHandler = context => {
|
|
|
75
84
|
const replacement = (_metadata = metadata) === null || _metadata === void 0 ? void 0 : (_metadata$name = _metadata[name]) === null || _metadata$name === void 0 ? void 0 : _metadata$name.replacement;
|
|
76
85
|
if (replacement) {
|
|
77
86
|
const newIconName = getIconComponentName(replacement.name);
|
|
78
|
-
|
|
87
|
+
if (!shouldTurnOffAutoFixer) {
|
|
88
|
+
addAutoFix(error, importSource, `${replacement.location}/${replacement.type}/${replacement.name}`, newIconName);
|
|
89
|
+
}
|
|
79
90
|
}
|
|
80
91
|
}
|
|
81
92
|
context.report(error);
|
|
@@ -47,6 +47,9 @@ const rule = createLintRule({
|
|
|
47
47
|
schema: [{
|
|
48
48
|
type: 'object',
|
|
49
49
|
properties: {
|
|
50
|
+
turnOffAutoFixer: {
|
|
51
|
+
type: 'boolean'
|
|
52
|
+
},
|
|
50
53
|
deprecatedConfig: {
|
|
51
54
|
type: 'object',
|
|
52
55
|
properties: {
|
|
@@ -75,7 +78,8 @@ const rule = createLintRule({
|
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
|
-
}
|
|
81
|
+
},
|
|
82
|
+
additionalProperties: false
|
|
79
83
|
}]
|
|
80
84
|
},
|
|
81
85
|
create(context) {
|
|
@@ -3,7 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
/**
|
|
5
5
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::095a43b3637f01bf6b70a07041528ef7>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -17,6 +17,12 @@ export var getDeprecationIconHandler = function getDeprecationIconHandler(contex
|
|
|
17
17
|
var identifiers = new Map();
|
|
18
18
|
var importErrors = {};
|
|
19
19
|
var exportErrors = {};
|
|
20
|
+
var getConfigFlag = function getConfigFlag(key, defaultValue) {
|
|
21
|
+
if (context.options && context.options.length > 0 && context.options[0] && context.options[0].hasOwnProperty(key)) {
|
|
22
|
+
return context.options[0][key] === !defaultValue ? !defaultValue : defaultValue;
|
|
23
|
+
}
|
|
24
|
+
return defaultValue;
|
|
25
|
+
};
|
|
20
26
|
var getIconComponentName = function getIconComponentName(name) {
|
|
21
27
|
return name.split(/\W/).map(function (part) {
|
|
22
28
|
return "".concat(part[0].toUpperCase()).concat(part.slice(1));
|
|
@@ -56,6 +62,7 @@ export var getDeprecationIconHandler = function getDeprecationIconHandler(contex
|
|
|
56
62
|
}
|
|
57
63
|
};
|
|
58
64
|
var throwErrors = function throwErrors() {
|
|
65
|
+
var shouldTurnOffAutoFixer = getConfigFlag('turnOffAutoFixer', false);
|
|
59
66
|
for (var _i = 0, _Object$entries = Object.entries(importErrors); _i < _Object$entries.length; _i++) {
|
|
60
67
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
61
68
|
importSource = _Object$entries$_i[0],
|
|
@@ -76,7 +83,9 @@ export var getDeprecationIconHandler = function getDeprecationIconHandler(contex
|
|
|
76
83
|
var replacement = metadata === null || metadata === void 0 || (_metadata$deprecatedI = metadata[deprecatedIconName]) === null || _metadata$deprecatedI === void 0 ? void 0 : _metadata$deprecatedI.replacement;
|
|
77
84
|
if (replacement && ((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.unfixable) === 'false') {
|
|
78
85
|
var newIconName = getIconComponentName(replacement.name);
|
|
79
|
-
|
|
86
|
+
if (!shouldTurnOffAutoFixer) {
|
|
87
|
+
addAutoFix(error, importSource, "".concat(replacement.location, "/").concat(replacement.type, "/migration/").concat(replacement.name, "--").concat(legacyIconName), newIconName);
|
|
88
|
+
}
|
|
80
89
|
}
|
|
81
90
|
} else {
|
|
82
91
|
var _metadata2;
|
|
@@ -94,7 +103,9 @@ export var getDeprecationIconHandler = function getDeprecationIconHandler(contex
|
|
|
94
103
|
var _replacement = (_metadata2 = _metadata) === null || _metadata2 === void 0 || (_metadata2 = _metadata2[_name]) === null || _metadata2 === void 0 ? void 0 : _metadata2.replacement;
|
|
95
104
|
if (_replacement) {
|
|
96
105
|
var _newIconName = getIconComponentName(_replacement.name);
|
|
97
|
-
|
|
106
|
+
if (!shouldTurnOffAutoFixer) {
|
|
107
|
+
addAutoFix(error, importSource, "".concat(_replacement.location, "/").concat(_replacement.type, "/").concat(_replacement.name), _newIconName);
|
|
108
|
+
}
|
|
98
109
|
}
|
|
99
110
|
}
|
|
100
111
|
context.report(error);
|
|
@@ -47,6 +47,9 @@ var rule = createLintRule({
|
|
|
47
47
|
schema: [{
|
|
48
48
|
type: 'object',
|
|
49
49
|
properties: {
|
|
50
|
+
turnOffAutoFixer: {
|
|
51
|
+
type: 'boolean'
|
|
52
|
+
},
|
|
50
53
|
deprecatedConfig: {
|
|
51
54
|
type: 'object',
|
|
52
55
|
properties: {
|
|
@@ -75,7 +78,8 @@ var rule = createLintRule({
|
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
|
-
}
|
|
81
|
+
},
|
|
82
|
+
additionalProperties: false
|
|
79
83
|
}]
|
|
80
84
|
},
|
|
81
85
|
create: function create(context) {
|
|
@@ -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::095a43b3637f01bf6b70a07041528ef7>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { ESLint } from 'eslint';
|
|
@@ -10,6 +10,6 @@ declare const meta: {
|
|
|
10
10
|
version: string;
|
|
11
11
|
};
|
|
12
12
|
export declare const plugin: ESLint.Plugin;
|
|
13
|
-
declare const configs:
|
|
13
|
+
declare const configs: ESLint.Plugin['configs'];
|
|
14
14
|
export { configs, meta, rules };
|
|
15
15
|
export default plugin;
|
|
@@ -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::095a43b3637f01bf6b70a07041528ef7>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { ESLint } from 'eslint';
|
|
@@ -10,6 +10,6 @@ declare const meta: {
|
|
|
10
10
|
version: string;
|
|
11
11
|
};
|
|
12
12
|
export declare const plugin: ESLint.Plugin;
|
|
13
|
-
declare const configs:
|
|
13
|
+
declare const configs: ESLint.Plugin['configs'];
|
|
14
14
|
export { configs, meta, rules };
|
|
15
15
|
export default plugin;
|
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": "13.
|
|
4
|
+
"version": "13.22.0",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"publishConfig": {
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@atlaskit/eslint-utils": "^2.0.0",
|
|
42
|
-
"@atlaskit/icon": "^28.
|
|
43
|
-
"@atlaskit/icon-lab": "^5.
|
|
44
|
-
"@atlaskit/tokens": "^
|
|
42
|
+
"@atlaskit/icon": "^28.5.0",
|
|
43
|
+
"@atlaskit/icon-lab": "^5.10.0",
|
|
44
|
+
"@atlaskit/tokens": "^7.0.0",
|
|
45
45
|
"@babel/runtime": "^7.0.0",
|
|
46
46
|
"@typescript-eslint/utils": "^7.1.0",
|
|
47
47
|
"ajv": "^6.12.6",
|