@atlaskit/eslint-plugin-ui-styling-standard 0.14.1 → 0.14.2
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 +9 -0
- package/dist/cjs/rules/atlaskit-theme/index.js +10 -4
- package/dist/es2019/rules/atlaskit-theme/index.js +10 -4
- package/dist/esm/rules/atlaskit-theme/index.js +10 -4
- package/package.json +1 -1
- package/src/rules/atlaskit-theme/__tests__/test.ts +11 -0
- package/src/rules/atlaskit-theme/index.ts +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-ui-styling-standard
|
|
2
2
|
|
|
3
|
+
## 0.14.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#101063](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101063)
|
|
8
|
+
[`d135d014f1ae`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d135d014f1ae) -
|
|
9
|
+
The `atlaskit-theme` rule no longer reports on the `fontFallback` import from
|
|
10
|
+
`@atlaskit/theme/typography`
|
|
11
|
+
|
|
3
12
|
## 0.14.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -72,8 +72,11 @@ var rule = exports.rule = (0, _createRule.createLintRule)({
|
|
|
72
72
|
if (ancestors.some(function (ancestor) {
|
|
73
73
|
return ancestor.type === 'CallExpression' && ancestor.callee && (0, _isSupportedImport.isCompiled)(ancestor.callee, references, importSources);
|
|
74
74
|
})) {
|
|
75
|
-
//
|
|
76
|
-
|
|
75
|
+
// Ignore the fontFallback object as it contains strings to be used as token fallbacks
|
|
76
|
+
if ('name' in node && node.name !== 'fontFallback') {
|
|
77
|
+
// Check identifier for violations
|
|
78
|
+
checkIdentifier(node, context, references);
|
|
79
|
+
}
|
|
77
80
|
}
|
|
78
81
|
},
|
|
79
82
|
'TaggedTemplateExpression Identifier': function TaggedTemplateExpressionIdentifier(node) {
|
|
@@ -85,8 +88,11 @@ var rule = exports.rule = (0, _createRule.createLintRule)({
|
|
|
85
88
|
if (ancestors.some(function (ancestor) {
|
|
86
89
|
return ancestor.type === 'TaggedTemplateExpression' && ancestor.tag && (0, _isSupportedImport.isCompiled)(ancestor.tag, references, importSources);
|
|
87
90
|
})) {
|
|
88
|
-
//
|
|
89
|
-
|
|
91
|
+
// Ignore the fontFallback object as it contains strings to be used as token fallbacks
|
|
92
|
+
if ('name' in node && node.name !== 'fontFallback') {
|
|
93
|
+
// Check identifier for violations
|
|
94
|
+
checkIdentifier(node, context, references);
|
|
95
|
+
}
|
|
90
96
|
}
|
|
91
97
|
}
|
|
92
98
|
};
|
|
@@ -63,8 +63,11 @@ export const rule = createLintRule({
|
|
|
63
63
|
|
|
64
64
|
// Check if ancestor node is a call expression to Compiled
|
|
65
65
|
if (ancestors.some(ancestor => ancestor.type === 'CallExpression' && ancestor.callee && isCompiled(ancestor.callee, references, importSources))) {
|
|
66
|
-
//
|
|
67
|
-
|
|
66
|
+
// Ignore the fontFallback object as it contains strings to be used as token fallbacks
|
|
67
|
+
if ('name' in node && node.name !== 'fontFallback') {
|
|
68
|
+
// Check identifier for violations
|
|
69
|
+
checkIdentifier(node, context, references);
|
|
70
|
+
}
|
|
68
71
|
}
|
|
69
72
|
},
|
|
70
73
|
'TaggedTemplateExpression Identifier': node => {
|
|
@@ -75,8 +78,11 @@ export const rule = createLintRule({
|
|
|
75
78
|
|
|
76
79
|
// Check if ancestor node is a tagged template expression to Compiled
|
|
77
80
|
if (ancestors.some(ancestor => ancestor.type === 'TaggedTemplateExpression' && ancestor.tag && isCompiled(ancestor.tag, references, importSources))) {
|
|
78
|
-
//
|
|
79
|
-
|
|
81
|
+
// Ignore the fontFallback object as it contains strings to be used as token fallbacks
|
|
82
|
+
if ('name' in node && node.name !== 'fontFallback') {
|
|
83
|
+
// Check identifier for violations
|
|
84
|
+
checkIdentifier(node, context, references);
|
|
85
|
+
}
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
88
|
};
|
|
@@ -66,8 +66,11 @@ export var rule = createLintRule({
|
|
|
66
66
|
if (ancestors.some(function (ancestor) {
|
|
67
67
|
return ancestor.type === 'CallExpression' && ancestor.callee && isCompiled(ancestor.callee, references, importSources);
|
|
68
68
|
})) {
|
|
69
|
-
//
|
|
70
|
-
|
|
69
|
+
// Ignore the fontFallback object as it contains strings to be used as token fallbacks
|
|
70
|
+
if ('name' in node && node.name !== 'fontFallback') {
|
|
71
|
+
// Check identifier for violations
|
|
72
|
+
checkIdentifier(node, context, references);
|
|
73
|
+
}
|
|
71
74
|
}
|
|
72
75
|
},
|
|
73
76
|
'TaggedTemplateExpression Identifier': function TaggedTemplateExpressionIdentifier(node) {
|
|
@@ -79,8 +82,11 @@ export var rule = createLintRule({
|
|
|
79
82
|
if (ancestors.some(function (ancestor) {
|
|
80
83
|
return ancestor.type === 'TaggedTemplateExpression' && ancestor.tag && isCompiled(ancestor.tag, references, importSources);
|
|
81
84
|
})) {
|
|
82
|
-
//
|
|
83
|
-
|
|
85
|
+
// Ignore the fontFallback object as it contains strings to be used as token fallbacks
|
|
86
|
+
if ('name' in node && node.name !== 'fontFallback') {
|
|
87
|
+
// Check identifier for violations
|
|
88
|
+
checkIdentifier(node, context, references);
|
|
89
|
+
}
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
92
|
};
|
package/package.json
CHANGED
|
@@ -13,6 +13,17 @@ const valid = [
|
|
|
13
13
|
\`;
|
|
14
14
|
`,
|
|
15
15
|
},
|
|
16
|
+
{
|
|
17
|
+
name: 'Valid typography use in compiled (fontFallback)',
|
|
18
|
+
code: outdent`
|
|
19
|
+
import { styled } from '@compiled/react';
|
|
20
|
+
import { fontFallback } from '@atlaskit/theme/typography';
|
|
21
|
+
import { token } from '@atlaskit/tokens';
|
|
22
|
+
export const HeadingComponent = styled.h2\`
|
|
23
|
+
font: \${token('font.body', fontFallback.body.medium)}
|
|
24
|
+
\`;
|
|
25
|
+
`,
|
|
26
|
+
},
|
|
16
27
|
{
|
|
17
28
|
name: 'Valid elevation use in styled-components',
|
|
18
29
|
code: outdent`
|
|
@@ -107,8 +107,11 @@ export const rule = createLintRule({
|
|
|
107
107
|
isCompiled(ancestor.callee, references, importSources),
|
|
108
108
|
)
|
|
109
109
|
) {
|
|
110
|
-
//
|
|
111
|
-
|
|
110
|
+
// Ignore the fontFallback object as it contains strings to be used as token fallbacks
|
|
111
|
+
if ('name' in node && node.name !== 'fontFallback') {
|
|
112
|
+
// Check identifier for violations
|
|
113
|
+
checkIdentifier(node, context, references);
|
|
114
|
+
}
|
|
112
115
|
}
|
|
113
116
|
},
|
|
114
117
|
|
|
@@ -125,8 +128,11 @@ export const rule = createLintRule({
|
|
|
125
128
|
isCompiled(ancestor.tag, references, importSources),
|
|
126
129
|
)
|
|
127
130
|
) {
|
|
128
|
-
//
|
|
129
|
-
|
|
131
|
+
// Ignore the fontFallback object as it contains strings to be used as token fallbacks
|
|
132
|
+
if ('name' in node && node.name !== 'fontFallback') {
|
|
133
|
+
// Check identifier for violations
|
|
134
|
+
checkIdentifier(node, context, references);
|
|
135
|
+
}
|
|
130
136
|
}
|
|
131
137
|
},
|
|
132
138
|
};
|