@atlaskit/eslint-plugin-design-system 8.4.2 → 8.4.3
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 +6 -0
- package/dist/cjs/rules/prefer-primitives/index.js +2 -2
- package/dist/cjs/rules/use-primitives/utils.js +2 -3
- package/dist/es2019/rules/prefer-primitives/index.js +2 -2
- package/dist/es2019/rules/use-primitives/utils.js +2 -3
- package/dist/esm/rules/prefer-primitives/index.js +2 -2
- package/dist/esm/rules/use-primitives/utils.js +2 -3
- package/dist/types/rules/use-primitives/utils.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-primitives/utils.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 8.4.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`96e35ec4b9d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/96e35ec4b9d) - Tweak `use-primitives` and `prefer-primitives` logic to stop false positives for component names that contain HTML element names.
|
|
8
|
+
|
|
3
9
|
## 8.4.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -53,7 +53,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
53
53
|
|
|
54
54
|
// styled.div``
|
|
55
55
|
if ((0, _eslintCodemodUtils.isNodeOfType)(node.property, 'Identifier')) {
|
|
56
|
-
if (_utils.validPrimitiveElements.
|
|
56
|
+
if (_utils.validPrimitiveElements.has(node.property.name)) {
|
|
57
57
|
var styledIdentifier = node.object.name;
|
|
58
58
|
var elementName = node.property.name;
|
|
59
59
|
|
|
@@ -80,7 +80,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
80
80
|
if ((0, _eslintCodemodUtils.isNodeOfType)(node.arguments[0], 'Literal')) {
|
|
81
81
|
var argValue = node.arguments[0].raw;
|
|
82
82
|
if (typeof argValue === 'string') {
|
|
83
|
-
var suggest = _utils.validPrimitiveElements.
|
|
83
|
+
var suggest = _utils.validPrimitiveElements.has(argValue.replaceAll("'", '') // argValue will have '' around the element name, strip it out for this test
|
|
84
84
|
);
|
|
85
85
|
|
|
86
86
|
if (suggest) {
|
|
@@ -322,11 +322,10 @@ var getCSSPropStyleObject = function getCSSPropStyleObject(node, context) {
|
|
|
322
322
|
}
|
|
323
323
|
return styleObj;
|
|
324
324
|
};
|
|
325
|
-
var validPrimitiveElements =
|
|
325
|
+
var validPrimitiveElements = new Set(['div', 'span', 'article', 'aside', 'dialog', 'footer', 'header', 'li', 'main', 'nav', 'ol', 'section', 'ul']);
|
|
326
326
|
exports.validPrimitiveElements = validPrimitiveElements;
|
|
327
327
|
var isValidPrimitiveElement = function isValidPrimitiveElement(node) {
|
|
328
|
-
|
|
329
|
-
return validPrimitiveElements.test(node.openingElement.name.name);
|
|
328
|
+
return validPrimitiveElements.has(node.openingElement.name.name.toLowerCase());
|
|
330
329
|
};
|
|
331
330
|
exports.isValidPrimitiveElement = isValidPrimitiveElement;
|
|
332
331
|
var hasInlineCompatibleStyles = function hasInlineCompatibleStyles(cssStyleObject) {
|
|
@@ -48,7 +48,7 @@ const rule = createLintRule({
|
|
|
48
48
|
|
|
49
49
|
// styled.div``
|
|
50
50
|
if (isNodeOfType(node.property, 'Identifier')) {
|
|
51
|
-
if (validPrimitiveElements.
|
|
51
|
+
if (validPrimitiveElements.has(node.property.name)) {
|
|
52
52
|
const styledIdentifier = node.object.name;
|
|
53
53
|
const elementName = node.property.name;
|
|
54
54
|
|
|
@@ -75,7 +75,7 @@ const rule = createLintRule({
|
|
|
75
75
|
if (isNodeOfType(node.arguments[0], 'Literal')) {
|
|
76
76
|
const argValue = node.arguments[0].raw;
|
|
77
77
|
if (typeof argValue === 'string') {
|
|
78
|
-
const suggest = validPrimitiveElements.
|
|
78
|
+
const suggest = validPrimitiveElements.has(argValue.replaceAll(`'`, '') // argValue will have '' around the element name, strip it out for this test
|
|
79
79
|
);
|
|
80
80
|
|
|
81
81
|
if (suggest) {
|
|
@@ -303,10 +303,9 @@ const getCSSPropStyleObject = (node, context) => {
|
|
|
303
303
|
}
|
|
304
304
|
return styleObj;
|
|
305
305
|
};
|
|
306
|
-
export const validPrimitiveElements =
|
|
306
|
+
export const validPrimitiveElements = new Set(['div', 'span', 'article', 'aside', 'dialog', 'footer', 'header', 'li', 'main', 'nav', 'ol', 'section', 'ul']);
|
|
307
307
|
export const isValidPrimitiveElement = node => {
|
|
308
|
-
|
|
309
|
-
return validPrimitiveElements.test(node.openingElement.name.name);
|
|
308
|
+
return validPrimitiveElements.has(node.openingElement.name.name.toLowerCase());
|
|
310
309
|
};
|
|
311
310
|
const hasInlineCompatibleStyles = cssStyleObject => {
|
|
312
311
|
if (!['flex', 'inline-flex'].includes(cssStyleObject['display'])) {
|
|
@@ -47,7 +47,7 @@ var rule = createLintRule({
|
|
|
47
47
|
|
|
48
48
|
// styled.div``
|
|
49
49
|
if (isNodeOfType(node.property, 'Identifier')) {
|
|
50
|
-
if (validPrimitiveElements.
|
|
50
|
+
if (validPrimitiveElements.has(node.property.name)) {
|
|
51
51
|
var styledIdentifier = node.object.name;
|
|
52
52
|
var elementName = node.property.name;
|
|
53
53
|
|
|
@@ -74,7 +74,7 @@ var rule = createLintRule({
|
|
|
74
74
|
if (isNodeOfType(node.arguments[0], 'Literal')) {
|
|
75
75
|
var argValue = node.arguments[0].raw;
|
|
76
76
|
if (typeof argValue === 'string') {
|
|
77
|
-
var suggest = validPrimitiveElements.
|
|
77
|
+
var suggest = validPrimitiveElements.has(argValue.replaceAll("'", '') // argValue will have '' around the element name, strip it out for this test
|
|
78
78
|
);
|
|
79
79
|
|
|
80
80
|
if (suggest) {
|
|
@@ -309,10 +309,9 @@ var getCSSPropStyleObject = function getCSSPropStyleObject(node, context) {
|
|
|
309
309
|
}
|
|
310
310
|
return styleObj;
|
|
311
311
|
};
|
|
312
|
-
export var validPrimitiveElements =
|
|
312
|
+
export var validPrimitiveElements = new Set(['div', 'span', 'article', 'aside', 'dialog', 'footer', 'header', 'li', 'main', 'nav', 'ol', 'section', 'ul']);
|
|
313
313
|
export var isValidPrimitiveElement = function isValidPrimitiveElement(node) {
|
|
314
|
-
|
|
315
|
-
return validPrimitiveElements.test(node.openingElement.name.name);
|
|
314
|
+
return validPrimitiveElements.has(node.openingElement.name.name.toLowerCase());
|
|
316
315
|
};
|
|
317
316
|
var hasInlineCompatibleStyles = function hasInlineCompatibleStyles(cssStyleObject) {
|
|
318
317
|
if (!['flex', 'inline-flex'].includes(cssStyleObject['display'])) {
|
|
@@ -8,6 +8,6 @@ export declare const primitiveFixer: (node: EslintNode, nodeName: string, contex
|
|
|
8
8
|
export declare const isWhiteSpace: (value: string) => boolean;
|
|
9
9
|
type JSXChild = 'JSXElement' | 'JSXExpressionContainer' | 'JSXFragment' | 'JSXText' | 'JSXSpreadChild'[];
|
|
10
10
|
export declare const getChildrenByType: (node: JSXElement, types: JSXChild[]) => (JSXElement | JSXExpressionContainer | import("estree-jsx").JSXFragment | JSXText | import("estree-jsx").JSXSpreadChild)[];
|
|
11
|
-
export declare const validPrimitiveElements:
|
|
11
|
+
export declare const validPrimitiveElements: Set<string>;
|
|
12
12
|
export declare const isValidPrimitiveElement: (node: JSXElement) => boolean;
|
|
13
13
|
export {};
|
|
@@ -8,6 +8,6 @@ export declare const primitiveFixer: (node: EslintNode, nodeName: string, contex
|
|
|
8
8
|
export declare const isWhiteSpace: (value: string) => boolean;
|
|
9
9
|
type JSXChild = 'JSXElement' | 'JSXExpressionContainer' | 'JSXFragment' | 'JSXText' | 'JSXSpreadChild'[];
|
|
10
10
|
export declare const getChildrenByType: (node: JSXElement, types: JSXChild[]) => (JSXElement | JSXExpressionContainer | import("estree-jsx").JSXFragment | JSXText | import("estree-jsx").JSXSpreadChild)[];
|
|
11
|
-
export declare const validPrimitiveElements:
|
|
11
|
+
export declare const validPrimitiveElements: Set<string>;
|
|
12
12
|
export declare const isValidPrimitiveElement: (node: JSXElement) => boolean;
|
|
13
13
|
export {};
|
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": "8.4.
|
|
4
|
+
"version": "8.4.3",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"registry": "https://registry.npmjs.org/"
|