@atlaskit/eslint-plugin-design-system 10.10.1 → 10.11.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/dist/cjs/rules/use-heading/config/index.js +2 -4
- package/dist/cjs/rules/use-heading/transformers/native-elements.js +15 -10
- package/dist/cjs/rules/use-latest-xcss-syntax/transformers/style-property/supported.js +3 -2
- package/dist/cjs/rules/use-primitives/config/index.js +0 -3
- package/dist/cjs/rules/use-primitives-text/config/index.js +2 -4
- package/dist/cjs/rules/use-primitives-text/transformers/emphasis-elements.js +14 -9
- package/dist/cjs/rules/use-primitives-text/transformers/paragraph-elements.js +28 -19
- package/dist/cjs/rules/use-primitives-text/transformers/span-elements.js +14 -9
- package/dist/cjs/rules/use-primitives-text/transformers/strong-elements.js +14 -9
- package/dist/cjs/rules/use-tokens-space/transformers/style-property/supported.js +3 -2
- package/dist/cjs/rules/use-tokens-typography/config/index.js +2 -4
- package/dist/cjs/rules/use-tokens-typography/transformers/style-object.js +12 -6
- package/dist/cjs/rules/use-visually-hidden/fix-jsx.js +4 -2
- package/dist/cjs/rules/use-visually-hidden/fix-vanilla.js +4 -2
- package/dist/es2019/rules/use-heading/config/index.js +2 -4
- package/dist/es2019/rules/use-heading/transformers/native-elements.js +12 -7
- package/dist/es2019/rules/use-latest-xcss-syntax/transformers/style-property/supported.js +3 -2
- package/dist/es2019/rules/use-primitives/config/index.js +0 -3
- package/dist/es2019/rules/use-primitives-text/config/index.js +2 -4
- package/dist/es2019/rules/use-primitives-text/transformers/emphasis-elements.js +12 -7
- package/dist/es2019/rules/use-primitives-text/transformers/paragraph-elements.js +25 -15
- package/dist/es2019/rules/use-primitives-text/transformers/span-elements.js +12 -7
- package/dist/es2019/rules/use-primitives-text/transformers/strong-elements.js +12 -7
- package/dist/es2019/rules/use-tokens-space/transformers/style-property/supported.js +3 -2
- package/dist/es2019/rules/use-tokens-typography/config/index.js +2 -4
- package/dist/es2019/rules/use-tokens-typography/transformers/style-object.js +9 -4
- package/dist/es2019/rules/use-visually-hidden/fix-jsx.js +3 -2
- package/dist/es2019/rules/use-visually-hidden/fix-vanilla.js +3 -2
- package/dist/esm/rules/use-heading/config/index.js +2 -4
- package/dist/esm/rules/use-heading/transformers/native-elements.js +15 -8
- package/dist/esm/rules/use-latest-xcss-syntax/transformers/style-property/supported.js +3 -2
- package/dist/esm/rules/use-primitives/config/index.js +0 -3
- package/dist/esm/rules/use-primitives-text/config/index.js +2 -4
- package/dist/esm/rules/use-primitives-text/transformers/emphasis-elements.js +14 -7
- package/dist/esm/rules/use-primitives-text/transformers/paragraph-elements.js +28 -17
- package/dist/esm/rules/use-primitives-text/transformers/span-elements.js +14 -7
- package/dist/esm/rules/use-primitives-text/transformers/strong-elements.js +14 -7
- package/dist/esm/rules/use-tokens-space/transformers/style-property/supported.js +3 -2
- package/dist/esm/rules/use-tokens-typography/config/index.js +2 -4
- package/dist/esm/rules/use-tokens-typography/transformers/style-object.js +11 -4
- package/dist/esm/rules/use-visually-hidden/fix-jsx.js +3 -2
- package/dist/esm/rules/use-visually-hidden/fix-vanilla.js +3 -2
- package/dist/types/rules/use-heading/config/index.d.ts +2 -1
- package/dist/types/rules/use-latest-xcss-syntax/transformers/style-property/supported.d.ts +2 -2
- package/dist/types/rules/use-primitives/config/index.d.ts +1 -1
- package/dist/types/rules/use-primitives-text/config/index.d.ts +2 -1
- package/dist/types/rules/use-tokens-space/transformers/style-property/supported.d.ts +2 -2
- package/dist/types/rules/use-tokens-typography/config/index.d.ts +4 -3
- package/dist/types/rules/use-visually-hidden/fix-jsx.d.ts +2 -2
- package/dist/types/rules/use-visually-hidden/fix-vanilla.d.ts +2 -2
- package/dist/types-ts4.5/rules/use-heading/config/index.d.ts +2 -1
- package/dist/types-ts4.5/rules/use-latest-xcss-syntax/transformers/style-property/supported.d.ts +2 -2
- package/dist/types-ts4.5/rules/use-primitives/config/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-primitives-text/config/index.d.ts +2 -1
- package/dist/types-ts4.5/rules/use-tokens-space/transformers/style-property/supported.d.ts +2 -2
- package/dist/types-ts4.5/rules/use-tokens-typography/config/index.d.ts +4 -3
- package/dist/types-ts4.5/rules/use-visually-hidden/fix-jsx.d.ts +2 -2
- package/dist/types-ts4.5/rules/use-visually-hidden/fix-vanilla.d.ts +2 -2
- package/package.json +2 -2
|
@@ -19,16 +19,21 @@ export const SpanElements = {
|
|
|
19
19
|
})) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
+
const fix = SpanElements._fix(node, {
|
|
23
|
+
context,
|
|
24
|
+
config
|
|
25
|
+
});
|
|
22
26
|
context.report({
|
|
23
27
|
node: node.openingElement,
|
|
24
28
|
messageId: 'preferPrimitivesText',
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
...(config.enableUnsafeAutofix ? {
|
|
30
|
+
fix
|
|
31
|
+
} : {
|
|
32
|
+
suggest: [{
|
|
33
|
+
desc: `Convert to Text`,
|
|
34
|
+
fix
|
|
35
|
+
}]
|
|
36
|
+
})
|
|
32
37
|
});
|
|
33
38
|
},
|
|
34
39
|
_check(node, {
|
|
@@ -19,16 +19,21 @@ export const StrongElements = {
|
|
|
19
19
|
})) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
+
const fix = StrongElements._fix(node, {
|
|
23
|
+
context,
|
|
24
|
+
config
|
|
25
|
+
});
|
|
22
26
|
context.report({
|
|
23
27
|
node: node.openingElement,
|
|
24
28
|
messageId: 'preferPrimitivesText',
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
...(config.enableUnsafeAutofix ? {
|
|
30
|
+
fix
|
|
31
|
+
} : {
|
|
32
|
+
suggest: [{
|
|
33
|
+
desc: `Convert to Text`,
|
|
34
|
+
fix
|
|
35
|
+
}]
|
|
36
|
+
})
|
|
32
37
|
});
|
|
33
38
|
},
|
|
34
39
|
_check(node, {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
const supported = {
|
|
2
2
|
values: {
|
|
3
3
|
ignore: ['auto', 'initial', 'inherit', 'unset', 'revert', 'revert-layer', 'none',
|
|
4
4
|
// outline-offset can be set to none
|
|
5
5
|
// Currently the DST opinion is that 0 is valid. It doesn't need to be converted to `space.0`
|
|
6
6
|
0, '0', '0px', '0em', '0rem']
|
|
7
7
|
}
|
|
8
|
-
};
|
|
8
|
+
};
|
|
9
|
+
export default supported;
|
|
@@ -14,11 +14,9 @@ export const ruleSchema = {
|
|
|
14
14
|
};
|
|
15
15
|
const defaultConfig = {
|
|
16
16
|
failSilently: false,
|
|
17
|
-
shouldEnforceFallbacks: true
|
|
17
|
+
shouldEnforceFallbacks: true,
|
|
18
|
+
enableUnsafeAutofix: false
|
|
18
19
|
};
|
|
19
20
|
export const getConfig = overrides => {
|
|
20
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
21
|
-
// start with an empty object, then merge in the defaults, then merge in overrides.
|
|
22
|
-
// The empty object is returned, as well as modified in place
|
|
23
21
|
return Object.assign({}, defaultConfig, overrides);
|
|
24
22
|
};
|
|
@@ -146,16 +146,21 @@ export const StyleObject = {
|
|
|
146
146
|
fontFamilyReplacement,
|
|
147
147
|
fontStyleReplacement
|
|
148
148
|
};
|
|
149
|
+
const fix = StyleObject._fix(fixerRefs, context);
|
|
149
150
|
context.report({
|
|
150
151
|
node: fontSizeNode,
|
|
151
152
|
messageId: 'noRawTypographyValues',
|
|
152
153
|
data: {
|
|
153
154
|
payload: `fontSize:${fontSizeRaw}`
|
|
154
155
|
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
...(config.enableUnsafeAutofix ? {
|
|
157
|
+
fix
|
|
158
|
+
} : {
|
|
159
|
+
suggest: [{
|
|
160
|
+
desc: `Convert to font token`,
|
|
161
|
+
fix
|
|
162
|
+
}]
|
|
163
|
+
})
|
|
159
164
|
});
|
|
160
165
|
} else if (!matchingTokens.length) {
|
|
161
166
|
context.report({
|
|
@@ -4,7 +4,7 @@ import { closestOfType } from 'eslint-codemod-utils';
|
|
|
4
4
|
import { getImportedNodeBySource } from '../utils/get-import-node-by-source';
|
|
5
5
|
import { IMPORT_NAME, VISUALLY_HIDDEN_IMPORT, VISUALLY_HIDDEN_SOURCE } from './constants';
|
|
6
6
|
import { getFirstImport } from './utils';
|
|
7
|
-
|
|
7
|
+
const fixJsx = (source, node) => fixer => {
|
|
8
8
|
const fixes = [];
|
|
9
9
|
const importedNode = getFirstImport(source);
|
|
10
10
|
const visuallyHiddenNode = getImportedNodeBySource(source, VISUALLY_HIDDEN_SOURCE);
|
|
@@ -19,4 +19,5 @@ export default ((source, node) => fixer => {
|
|
|
19
19
|
fixes.push(fixer.replaceText(jsxOpeningElement, `<${IMPORT_NAME} />`));
|
|
20
20
|
}
|
|
21
21
|
return fixes;
|
|
22
|
-
}
|
|
22
|
+
};
|
|
23
|
+
export default fixJsx;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { getImportedNodeBySource } from '../utils/get-import-node-by-source';
|
|
4
4
|
import { IMPORT_NAME, VISUALLY_HIDDEN_IMPORT, VISUALLY_HIDDEN_SOURCE } from './constants';
|
|
5
5
|
import { getFirstImport } from './utils';
|
|
6
|
-
|
|
6
|
+
const fixVanilla = (source, node) => fixer => {
|
|
7
7
|
const fixes = [];
|
|
8
8
|
const importedNode = getFirstImport(source);
|
|
9
9
|
const visuallyHiddenNode = getImportedNodeBySource(source, VISUALLY_HIDDEN_SOURCE);
|
|
@@ -17,4 +17,5 @@ export default ((source, node) => fixer => {
|
|
|
17
17
|
fixes.push(fixer.replaceText(node, IMPORT_NAME));
|
|
18
18
|
}
|
|
19
19
|
return fixes;
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
|
+
export default fixVanilla;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
var defaults = {
|
|
2
|
-
patterns: ['native-elements']
|
|
2
|
+
patterns: ['native-elements'],
|
|
3
|
+
enableUnsafeAutofix: false
|
|
3
4
|
};
|
|
4
5
|
export var getConfig = function getConfig(overrides) {
|
|
5
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
6
|
-
// start with an empty object, then merge in the defaults, then merge in overrides.
|
|
7
|
-
// The empty object is returned, as well as modified in place
|
|
8
6
|
return Object.assign({}, defaults, overrides);
|
|
9
7
|
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
2
5
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
3
6
|
|
|
4
7
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
@@ -23,17 +26,21 @@ export var NativeElements = {
|
|
|
23
26
|
})) {
|
|
24
27
|
return;
|
|
25
28
|
}
|
|
26
|
-
|
|
29
|
+
var fix = NativeElements._fix(node, {
|
|
30
|
+
context: context,
|
|
31
|
+
config: config
|
|
32
|
+
});
|
|
33
|
+
context.report(_objectSpread({
|
|
27
34
|
node: node,
|
|
28
|
-
messageId: 'preferHeading'
|
|
35
|
+
messageId: 'preferHeading'
|
|
36
|
+
}, config.enableUnsafeAutofix ? {
|
|
37
|
+
fix: fix
|
|
38
|
+
} : {
|
|
29
39
|
suggest: [{
|
|
30
|
-
desc:
|
|
31
|
-
fix:
|
|
32
|
-
context: context,
|
|
33
|
-
config: config
|
|
34
|
-
})
|
|
40
|
+
desc: "Convert to Heading",
|
|
41
|
+
fix: fix
|
|
35
42
|
}]
|
|
36
|
-
});
|
|
43
|
+
}));
|
|
37
44
|
},
|
|
38
45
|
_check: function _check(node, _ref2) {
|
|
39
46
|
var config = _ref2.config;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
var supported = {
|
|
2
2
|
values: {
|
|
3
3
|
ignore: ['auto', 'initial', 'inherit', 'unset', 'revert', 'revert-layer',
|
|
4
4
|
// Currently the DST opinion is that 0 is valid. It doesn't need to be converted to `space.0`
|
|
5
5
|
'0', '0 auto', 'space.negative.025', 'space.negative.050', 'space.negative.075', 'space.negative.100', 'space.negative.150', 'space.negative.200', 'space.negative.250', 'space.negative.300', 'space.negative.400', 'space.0', 'space.025', 'space.050', 'space.075', 'space.100', 'space.150', 'space.200', 'space.250', 'space.300', 'space.400', 'space.500', 'space.600', 'space.800', 'space.1000']
|
|
6
6
|
}
|
|
7
|
-
};
|
|
7
|
+
};
|
|
8
|
+
export default supported;
|
|
@@ -2,8 +2,5 @@ var defaults = {
|
|
|
2
2
|
patterns: ['compiled-css-function']
|
|
3
3
|
};
|
|
4
4
|
export var getConfig = function getConfig(overrides) {
|
|
5
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
6
|
-
// start with an empty object, then merge in the defaults, then merge in overrides.
|
|
7
|
-
// The empty object is returned, as well as modified in place
|
|
8
5
|
return Object.assign({}, defaults, overrides);
|
|
9
6
|
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
var defaults = {
|
|
2
2
|
patterns: ['paragraph-elements', 'span-elements', 'strong-elements', 'emphasis-elements'],
|
|
3
|
-
inheritColor: false
|
|
3
|
+
inheritColor: false,
|
|
4
|
+
enableUnsafeAutofix: false
|
|
4
5
|
};
|
|
5
6
|
export var getConfig = function getConfig(overrides) {
|
|
6
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
7
|
-
// start with an empty object, then merge in the defaults, then merge in overrides.
|
|
8
|
-
// The empty object is returned, as well as modified in place
|
|
9
7
|
return Object.assign({}, defaults, overrides);
|
|
10
8
|
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
2
5
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
3
6
|
|
|
4
7
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
@@ -19,17 +22,21 @@ export var EmphasisElements = {
|
|
|
19
22
|
})) {
|
|
20
23
|
return;
|
|
21
24
|
}
|
|
22
|
-
|
|
25
|
+
var fix = EmphasisElements._fix(node, {
|
|
26
|
+
context: context,
|
|
27
|
+
config: config
|
|
28
|
+
});
|
|
29
|
+
context.report(_objectSpread({
|
|
23
30
|
node: node.openingElement,
|
|
24
|
-
messageId: 'preferPrimitivesText'
|
|
31
|
+
messageId: 'preferPrimitivesText'
|
|
32
|
+
}, config.enableUnsafeAutofix ? {
|
|
33
|
+
fix: fix
|
|
34
|
+
} : {
|
|
25
35
|
suggest: [{
|
|
26
36
|
desc: "Convert to Text",
|
|
27
|
-
fix:
|
|
28
|
-
context: context,
|
|
29
|
-
config: config
|
|
30
|
-
})
|
|
37
|
+
fix: fix
|
|
31
38
|
}]
|
|
32
|
-
});
|
|
39
|
+
}));
|
|
33
40
|
},
|
|
34
41
|
_check: function _check(node, _ref2) {
|
|
35
42
|
var context = _ref2.context,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
2
5
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
3
6
|
|
|
4
7
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
@@ -31,34 +34,42 @@ export var ParagraphElements = {
|
|
|
31
34
|
*/
|
|
32
35
|
var startLoc = (_refs$siblings$0$loc = refs.siblings[0].loc) === null || _refs$siblings$0$loc === void 0 ? void 0 : _refs$siblings$0$loc.start;
|
|
33
36
|
var endLoc = (_refs$siblings$loc = refs.siblings[refs.siblings.length - 1].loc) === null || _refs$siblings$loc === void 0 ? void 0 : _refs$siblings$loc.end;
|
|
34
|
-
|
|
37
|
+
var fix = ParagraphElements._fixMultiple(node, {
|
|
38
|
+
context: context,
|
|
39
|
+
config: config,
|
|
40
|
+
refs: refs
|
|
41
|
+
});
|
|
42
|
+
context.report(_objectSpread({
|
|
35
43
|
loc: startLoc && endLoc && {
|
|
36
44
|
start: startLoc,
|
|
37
45
|
end: endLoc
|
|
38
46
|
},
|
|
39
47
|
node: node.openingElement,
|
|
40
|
-
messageId: 'preferPrimitivesStackedText'
|
|
48
|
+
messageId: 'preferPrimitivesStackedText'
|
|
49
|
+
}, config.enableUnsafeAutofix ? {
|
|
50
|
+
fix: fix
|
|
51
|
+
} : {
|
|
41
52
|
suggest: [{
|
|
42
|
-
desc:
|
|
43
|
-
fix:
|
|
44
|
-
context: context,
|
|
45
|
-
config: config,
|
|
46
|
-
refs: refs
|
|
47
|
-
})
|
|
53
|
+
desc: "Convert to Text and Stack",
|
|
54
|
+
fix: fix
|
|
48
55
|
}]
|
|
49
|
-
});
|
|
56
|
+
}));
|
|
50
57
|
} else {
|
|
51
|
-
|
|
58
|
+
var _fix = ParagraphElements._fixSingle(node, {
|
|
59
|
+
context: context,
|
|
60
|
+
config: config
|
|
61
|
+
});
|
|
62
|
+
context.report(_objectSpread({
|
|
52
63
|
node: node,
|
|
53
|
-
messageId: 'preferPrimitivesText'
|
|
64
|
+
messageId: 'preferPrimitivesText'
|
|
65
|
+
}, config.enableUnsafeAutofix ? {
|
|
66
|
+
fix: _fix
|
|
67
|
+
} : {
|
|
54
68
|
suggest: [{
|
|
55
|
-
desc:
|
|
56
|
-
fix:
|
|
57
|
-
context: context,
|
|
58
|
-
config: config
|
|
59
|
-
})
|
|
69
|
+
desc: "Convert to Text",
|
|
70
|
+
fix: _fix
|
|
60
71
|
}]
|
|
61
|
-
});
|
|
72
|
+
}));
|
|
62
73
|
}
|
|
63
74
|
},
|
|
64
75
|
_check: function _check(node, _ref2) {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
2
5
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
3
6
|
|
|
4
7
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
@@ -19,17 +22,21 @@ export var SpanElements = {
|
|
|
19
22
|
})) {
|
|
20
23
|
return;
|
|
21
24
|
}
|
|
22
|
-
|
|
25
|
+
var fix = SpanElements._fix(node, {
|
|
26
|
+
context: context,
|
|
27
|
+
config: config
|
|
28
|
+
});
|
|
29
|
+
context.report(_objectSpread({
|
|
23
30
|
node: node.openingElement,
|
|
24
|
-
messageId: 'preferPrimitivesText'
|
|
31
|
+
messageId: 'preferPrimitivesText'
|
|
32
|
+
}, config.enableUnsafeAutofix ? {
|
|
33
|
+
fix: fix
|
|
34
|
+
} : {
|
|
25
35
|
suggest: [{
|
|
26
36
|
desc: "Convert to Text",
|
|
27
|
-
fix:
|
|
28
|
-
context: context,
|
|
29
|
-
config: config
|
|
30
|
-
})
|
|
37
|
+
fix: fix
|
|
31
38
|
}]
|
|
32
|
-
});
|
|
39
|
+
}));
|
|
33
40
|
},
|
|
34
41
|
_check: function _check(node, _ref2) {
|
|
35
42
|
var context = _ref2.context,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
2
5
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
3
6
|
|
|
4
7
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
@@ -19,17 +22,21 @@ export var StrongElements = {
|
|
|
19
22
|
})) {
|
|
20
23
|
return;
|
|
21
24
|
}
|
|
22
|
-
|
|
25
|
+
var fix = StrongElements._fix(node, {
|
|
26
|
+
context: context,
|
|
27
|
+
config: config
|
|
28
|
+
});
|
|
29
|
+
context.report(_objectSpread({
|
|
23
30
|
node: node.openingElement,
|
|
24
|
-
messageId: 'preferPrimitivesText'
|
|
31
|
+
messageId: 'preferPrimitivesText'
|
|
32
|
+
}, config.enableUnsafeAutofix ? {
|
|
33
|
+
fix: fix
|
|
34
|
+
} : {
|
|
25
35
|
suggest: [{
|
|
26
36
|
desc: "Convert to Text",
|
|
27
|
-
fix:
|
|
28
|
-
context: context,
|
|
29
|
-
config: config
|
|
30
|
-
})
|
|
37
|
+
fix: fix
|
|
31
38
|
}]
|
|
32
|
-
});
|
|
39
|
+
}));
|
|
33
40
|
},
|
|
34
41
|
_check: function _check(node, _ref2) {
|
|
35
42
|
var context = _ref2.context,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
var supported = {
|
|
2
2
|
values: {
|
|
3
3
|
ignore: ['auto', 'initial', 'inherit', 'unset', 'revert', 'revert-layer', 'none',
|
|
4
4
|
// outline-offset can be set to none
|
|
5
5
|
// Currently the DST opinion is that 0 is valid. It doesn't need to be converted to `space.0`
|
|
6
6
|
0, '0', '0px', '0em', '0rem']
|
|
7
7
|
}
|
|
8
|
-
};
|
|
8
|
+
};
|
|
9
|
+
export default supported;
|
|
@@ -14,11 +14,9 @@ export var ruleSchema = {
|
|
|
14
14
|
};
|
|
15
15
|
var defaultConfig = {
|
|
16
16
|
failSilently: false,
|
|
17
|
-
shouldEnforceFallbacks: true
|
|
17
|
+
shouldEnforceFallbacks: true,
|
|
18
|
+
enableUnsafeAutofix: false
|
|
18
19
|
};
|
|
19
20
|
export var getConfig = function getConfig(overrides) {
|
|
20
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
21
|
-
// start with an empty object, then merge in the defaults, then merge in overrides.
|
|
22
|
-
// The empty object is returned, as well as modified in place
|
|
23
21
|
return Object.assign({}, defaultConfig, overrides);
|
|
24
22
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
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; }
|
|
1
4
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
5
|
|
|
3
6
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
@@ -146,17 +149,21 @@ export var StyleObject = {
|
|
|
146
149
|
fontFamilyReplacement: fontFamilyReplacement,
|
|
147
150
|
fontStyleReplacement: fontStyleReplacement
|
|
148
151
|
};
|
|
149
|
-
|
|
152
|
+
var fix = StyleObject._fix(fixerRefs, context);
|
|
153
|
+
context.report(_objectSpread({
|
|
150
154
|
node: fontSizeNode,
|
|
151
155
|
messageId: 'noRawTypographyValues',
|
|
152
156
|
data: {
|
|
153
157
|
payload: "fontSize:".concat(fontSizeRaw)
|
|
154
|
-
}
|
|
158
|
+
}
|
|
159
|
+
}, config.enableUnsafeAutofix ? {
|
|
160
|
+
fix: fix
|
|
161
|
+
} : {
|
|
155
162
|
suggest: [{
|
|
156
163
|
desc: "Convert to font token",
|
|
157
|
-
fix:
|
|
164
|
+
fix: fix
|
|
158
165
|
}]
|
|
159
|
-
});
|
|
166
|
+
}));
|
|
160
167
|
} else if (!matchingTokens.length) {
|
|
161
168
|
context.report({
|
|
162
169
|
node: fontSizeNode,
|
|
@@ -4,7 +4,7 @@ import { closestOfType } from 'eslint-codemod-utils';
|
|
|
4
4
|
import { getImportedNodeBySource } from '../utils/get-import-node-by-source';
|
|
5
5
|
import { IMPORT_NAME, VISUALLY_HIDDEN_IMPORT, VISUALLY_HIDDEN_SOURCE } from './constants';
|
|
6
6
|
import { getFirstImport } from './utils';
|
|
7
|
-
|
|
7
|
+
var fixJsx = function fixJsx(source, node) {
|
|
8
8
|
return function (fixer) {
|
|
9
9
|
var fixes = [];
|
|
10
10
|
var importedNode = getFirstImport(source);
|
|
@@ -21,4 +21,5 @@ export default (function (source, node) {
|
|
|
21
21
|
}
|
|
22
22
|
return fixes;
|
|
23
23
|
};
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
|
+
export default fixJsx;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { getImportedNodeBySource } from '../utils/get-import-node-by-source';
|
|
4
4
|
import { IMPORT_NAME, VISUALLY_HIDDEN_IMPORT, VISUALLY_HIDDEN_SOURCE } from './constants';
|
|
5
5
|
import { getFirstImport } from './utils';
|
|
6
|
-
|
|
6
|
+
var fixVanilla = function fixVanilla(source, node) {
|
|
7
7
|
return function (fixer) {
|
|
8
8
|
var fixes = [];
|
|
9
9
|
var importedNode = getFirstImport(source);
|
|
@@ -19,4 +19,5 @@ export default (function (source, node) {
|
|
|
19
19
|
}
|
|
20
20
|
return fixes;
|
|
21
21
|
};
|
|
22
|
-
}
|
|
22
|
+
};
|
|
23
|
+
export default fixVanilla;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type Pattern = 'native-elements';
|
|
2
2
|
export interface RuleConfig {
|
|
3
3
|
patterns: Pattern[];
|
|
4
|
+
enableUnsafeAutofix: false;
|
|
4
5
|
}
|
|
5
|
-
export declare const getConfig: (overrides: Partial<RuleConfig>) =>
|
|
6
|
+
export declare const getConfig: (overrides: Partial<RuleConfig>) => RuleConfig;
|
|
6
7
|
export {};
|
|
@@ -2,5 +2,5 @@ type Pattern = 'compiled-css-function' | 'compiled-styled-object' | 'css-templat
|
|
|
2
2
|
export interface RuleConfig {
|
|
3
3
|
patterns: Pattern[];
|
|
4
4
|
}
|
|
5
|
-
export declare const getConfig: (overrides: Partial<RuleConfig>) =>
|
|
5
|
+
export declare const getConfig: (overrides: Partial<RuleConfig>) => RuleConfig;
|
|
6
6
|
export {};
|
|
@@ -2,6 +2,7 @@ type Pattern = 'paragraph-elements' | 'span-elements' | 'strong-elements' | 'emp
|
|
|
2
2
|
export interface RuleConfig {
|
|
3
3
|
patterns: Pattern[];
|
|
4
4
|
inheritColor: boolean;
|
|
5
|
+
enableUnsafeAutofix: boolean;
|
|
5
6
|
}
|
|
6
|
-
export declare const getConfig: (overrides: Partial<RuleConfig>) =>
|
|
7
|
+
export declare const getConfig: (overrides: Partial<RuleConfig>) => RuleConfig;
|
|
7
8
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type JSONSchema4 } from '@typescript-eslint/utils/dist/json-schema';
|
|
2
2
|
export type RuleConfig = {
|
|
3
|
-
failSilently
|
|
4
|
-
shouldEnforceFallbacks
|
|
3
|
+
failSilently: boolean;
|
|
4
|
+
shouldEnforceFallbacks: boolean;
|
|
5
|
+
enableUnsafeAutofix: boolean;
|
|
5
6
|
};
|
|
6
7
|
export declare const ruleSchema: JSONSchema4;
|
|
7
|
-
export declare const getConfig: (overrides: RuleConfig) => RuleConfig;
|
|
8
|
+
export declare const getConfig: (overrides: Partial<RuleConfig>) => RuleConfig;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Rule, SourceCode } from 'eslint';
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const fixJsx: (source: SourceCode, node: Rule.Node) => (fixer: Rule.RuleFixer) => Rule.Fix[];
|
|
3
|
+
export default fixJsx;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Rule, SourceCode } from 'eslint';
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const fixVanilla: (source: SourceCode, node: Rule.Node) => (fixer: Rule.RuleFixer) => Rule.Fix[];
|
|
3
|
+
export default fixVanilla;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type Pattern = 'native-elements';
|
|
2
2
|
export interface RuleConfig {
|
|
3
3
|
patterns: Pattern[];
|
|
4
|
+
enableUnsafeAutofix: false;
|
|
4
5
|
}
|
|
5
|
-
export declare const getConfig: (overrides: Partial<RuleConfig>) =>
|
|
6
|
+
export declare const getConfig: (overrides: Partial<RuleConfig>) => RuleConfig;
|
|
6
7
|
export {};
|
|
@@ -2,5 +2,5 @@ type Pattern = 'compiled-css-function' | 'compiled-styled-object' | 'css-templat
|
|
|
2
2
|
export interface RuleConfig {
|
|
3
3
|
patterns: Pattern[];
|
|
4
4
|
}
|
|
5
|
-
export declare const getConfig: (overrides: Partial<RuleConfig>) =>
|
|
5
|
+
export declare const getConfig: (overrides: Partial<RuleConfig>) => RuleConfig;
|
|
6
6
|
export {};
|
|
@@ -2,6 +2,7 @@ type Pattern = 'paragraph-elements' | 'span-elements' | 'strong-elements' | 'emp
|
|
|
2
2
|
export interface RuleConfig {
|
|
3
3
|
patterns: Pattern[];
|
|
4
4
|
inheritColor: boolean;
|
|
5
|
+
enableUnsafeAutofix: boolean;
|
|
5
6
|
}
|
|
6
|
-
export declare const getConfig: (overrides: Partial<RuleConfig>) =>
|
|
7
|
+
export declare const getConfig: (overrides: Partial<RuleConfig>) => RuleConfig;
|
|
7
8
|
export {};
|