@atlaskit/eslint-plugin-ui-styling-standard 0.16.1 → 0.16.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 +16 -0
- package/dist/cjs/rules/no-array-arguments/index.js +3 -3
- package/dist/cjs/rules/no-dynamic-styles/index.js +2 -2
- package/dist/cjs/rules/no-imported-style-values/index.js +3 -12
- package/dist/cjs/rules/no-unsafe-values/index.js +2 -2
- package/dist/es2019/rules/no-array-arguments/index.js +2 -2
- package/dist/es2019/rules/no-dynamic-styles/index.js +1 -1
- package/dist/es2019/rules/no-imported-style-values/index.js +2 -11
- package/dist/es2019/rules/no-unsafe-values/index.js +1 -1
- package/dist/esm/rules/no-array-arguments/index.js +3 -3
- package/dist/esm/rules/no-dynamic-styles/index.js +2 -2
- package/dist/esm/rules/no-imported-style-values/index.js +3 -12
- package/dist/esm/rules/no-unsafe-values/index.js +2 -2
- package/package.json +70 -70
- package/src/rules/no-array-arguments/index.tsx +2 -2
- package/src/rules/no-dynamic-styles/index.tsx +1 -1
- package/src/rules/no-imported-style-values/__tests__/rule.test.tsx +19 -1
- package/src/rules/no-imported-style-values/index.tsx +8 -17
- package/src/rules/no-unsafe-values/index.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-ui-styling-standard
|
|
2
2
|
|
|
3
|
+
## 0.16.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#110284](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110284)
|
|
8
|
+
[`34021a2db424f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/34021a2db424f) -
|
|
9
|
+
Internal refactoring to improve backwards compatibility with ESLint versions lower than 8
|
|
10
|
+
|
|
11
|
+
## 0.16.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#109764](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109764)
|
|
16
|
+
[`5ceaeae2bef25`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5ceaeae2bef25) -
|
|
17
|
+
Fixes `no-imported-style-values` to ignore imported values that exist in the type level
|
|
18
|
+
|
|
3
19
|
## 0.16.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -40,8 +40,8 @@ var rule = exports.rule = (0, _createRule.createLintRule)({
|
|
|
40
40
|
var importSources = (0, _isSupportedImport.getImportSources)(context);
|
|
41
41
|
return {
|
|
42
42
|
CallExpression: function CallExpression(node) {
|
|
43
|
-
var _context$
|
|
44
|
-
references = _context$
|
|
43
|
+
var _context$getScope = context.getScope(),
|
|
44
|
+
references = _context$getScope.references;
|
|
45
45
|
if (!(0, _isSupportedImport.hasStyleObjectArguments)(node.callee, references, importSources)) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
@@ -70,7 +70,7 @@ var rule = exports.rule = (0, _createRule.createLintRule)({
|
|
|
70
70
|
var items = argument.elements.filter(function (value) {
|
|
71
71
|
return value !== null;
|
|
72
72
|
}).map(function (element) {
|
|
73
|
-
return context.
|
|
73
|
+
return context.getSourceCode().getText(element);
|
|
74
74
|
});
|
|
75
75
|
return fixer.replaceText(argument, items.join(', '));
|
|
76
76
|
}
|
|
@@ -41,8 +41,8 @@ var rule = exports.rule = (0, _createRule.createLintRule)({
|
|
|
41
41
|
var importSources = (0, _isSupportedImport.getImportSources)(context);
|
|
42
42
|
return {
|
|
43
43
|
CallExpression: function CallExpression(node) {
|
|
44
|
-
var _context$
|
|
45
|
-
references = _context$
|
|
44
|
+
var _context$getScope = context.getScope(),
|
|
45
|
+
references = _context$getScope.references;
|
|
46
46
|
if (!(0, _isSupportedImport.hasStyleObjectArguments)(node.callee, references, importSources)) {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
@@ -120,23 +120,14 @@ var rule = exports.rule = (0, _createRule.createLintRule)({
|
|
|
120
120
|
return {
|
|
121
121
|
// Checking css/cssMap/keyframes/styled/xcss calls
|
|
122
122
|
CallExpression: function CallExpression(node) {
|
|
123
|
-
var _context$
|
|
124
|
-
references = _context$
|
|
123
|
+
var _context$getScope = context.getScope(),
|
|
124
|
+
references = _context$getScope.references;
|
|
125
125
|
if (!(0, _isSupportedImport.hasStyleObjectArguments)(node.callee, references, importSources)) {
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
node.arguments.forEach(checkForIdentifiers);
|
|
129
129
|
},
|
|
130
|
-
'JSXAttribute[name.name
|
|
131
|
-
if (node.type !== 'Identifier') {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
checkIdentifier(node, context, functionAllowList, keysAllowList);
|
|
135
|
-
},
|
|
136
|
-
'JSXAttribute[name.name="style"] Identifier': function JSXAttributeNameNameStyleIdentifier(node) {
|
|
137
|
-
if (node.type !== 'Identifier') {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
130
|
+
'JSXAttribute[name.name=/^style|css$/] Identifier:not(TSTypeReference Identifier)': function JSXAttributeNameNameStyleCss$IdentifierNotTSTypeReferenceIdentifier(node) {
|
|
140
131
|
checkIdentifier(node, context, functionAllowList, keysAllowList);
|
|
141
132
|
}
|
|
142
133
|
};
|
|
@@ -65,8 +65,8 @@ var rule = exports.rule = (0, _createRule.createLintRule)({
|
|
|
65
65
|
var importSources = (0, _isSupportedImport.getImportSources)(context);
|
|
66
66
|
return {
|
|
67
67
|
CallExpression: function CallExpression(node) {
|
|
68
|
-
var _context$
|
|
69
|
-
references = _context$
|
|
68
|
+
var _context$getScope = context.getScope(),
|
|
69
|
+
references = _context$getScope.references;
|
|
70
70
|
if (!(0, _isSupportedImport.isCss)(node.callee, references, importSources) && !(0, _isSupportedImport.isStyled)(node.callee, references, importSources) && !(0, _isSupportedImport.isKeyframes)(node.callee, references, importSources) && !(0, _isSupportedImport.isCssMap)(node.callee, references, importSources) && !(0, _isSupportedImport.isXcss)(node.callee, references, importSources)) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
@@ -33,7 +33,7 @@ export const rule = createLintRule({
|
|
|
33
33
|
CallExpression(node) {
|
|
34
34
|
const {
|
|
35
35
|
references
|
|
36
|
-
} = context.
|
|
36
|
+
} = context.getScope();
|
|
37
37
|
if (!hasStyleObjectArguments(node.callee, references, importSources)) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
@@ -55,7 +55,7 @@ export const rule = createLintRule({
|
|
|
55
55
|
*/
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
58
|
-
const items = argument.elements.filter(value => value !== null).map(element => context.
|
|
58
|
+
const items = argument.elements.filter(value => value !== null).map(element => context.getSourceCode().getText(element));
|
|
59
59
|
return fixer.replaceText(argument, items.join(', '));
|
|
60
60
|
}
|
|
61
61
|
});
|
|
@@ -101,22 +101,13 @@ export const rule = createLintRule({
|
|
|
101
101
|
CallExpression(node) {
|
|
102
102
|
const {
|
|
103
103
|
references
|
|
104
|
-
} = context.
|
|
104
|
+
} = context.getScope();
|
|
105
105
|
if (!hasStyleObjectArguments(node.callee, references, importSources)) {
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
node.arguments.forEach(checkForIdentifiers);
|
|
109
109
|
},
|
|
110
|
-
'JSXAttribute[name.name
|
|
111
|
-
if (node.type !== 'Identifier') {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
checkIdentifier(node, context, functionAllowList, keysAllowList);
|
|
115
|
-
},
|
|
116
|
-
'JSXAttribute[name.name="style"] Identifier': node => {
|
|
117
|
-
if (node.type !== 'Identifier') {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
110
|
+
'JSXAttribute[name.name=/^style|css$/] Identifier:not(TSTypeReference Identifier)'(node) {
|
|
120
111
|
checkIdentifier(node, context, functionAllowList, keysAllowList);
|
|
121
112
|
}
|
|
122
113
|
};
|
|
@@ -61,7 +61,7 @@ export const rule = createLintRule({
|
|
|
61
61
|
CallExpression(node) {
|
|
62
62
|
const {
|
|
63
63
|
references
|
|
64
|
-
} = context.
|
|
64
|
+
} = context.getScope();
|
|
65
65
|
if (!isCss(node.callee, references, importSources) && !isStyled(node.callee, references, importSources) && !isKeyframes(node.callee, references, importSources) && !isCssMap(node.callee, references, importSources) && !isXcss(node.callee, references, importSources)) {
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
@@ -34,8 +34,8 @@ export var rule = createLintRule({
|
|
|
34
34
|
var importSources = getImportSources(context);
|
|
35
35
|
return {
|
|
36
36
|
CallExpression: function CallExpression(node) {
|
|
37
|
-
var _context$
|
|
38
|
-
references = _context$
|
|
37
|
+
var _context$getScope = context.getScope(),
|
|
38
|
+
references = _context$getScope.references;
|
|
39
39
|
if (!hasStyleObjectArguments(node.callee, references, importSources)) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
@@ -64,7 +64,7 @@ export var rule = createLintRule({
|
|
|
64
64
|
var items = argument.elements.filter(function (value) {
|
|
65
65
|
return value !== null;
|
|
66
66
|
}).map(function (element) {
|
|
67
|
-
return context.
|
|
67
|
+
return context.getSourceCode().getText(element);
|
|
68
68
|
});
|
|
69
69
|
return fixer.replaceText(argument, items.join(', '));
|
|
70
70
|
}
|
|
@@ -34,8 +34,8 @@ export var rule = createLintRule({
|
|
|
34
34
|
var importSources = getImportSources(context);
|
|
35
35
|
return {
|
|
36
36
|
CallExpression: function CallExpression(node) {
|
|
37
|
-
var _context$
|
|
38
|
-
references = _context$
|
|
37
|
+
var _context$getScope = context.getScope(),
|
|
38
|
+
references = _context$getScope.references;
|
|
39
39
|
if (!hasStyleObjectArguments(node.callee, references, importSources)) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
@@ -113,23 +113,14 @@ export var rule = createLintRule({
|
|
|
113
113
|
return {
|
|
114
114
|
// Checking css/cssMap/keyframes/styled/xcss calls
|
|
115
115
|
CallExpression: function CallExpression(node) {
|
|
116
|
-
var _context$
|
|
117
|
-
references = _context$
|
|
116
|
+
var _context$getScope = context.getScope(),
|
|
117
|
+
references = _context$getScope.references;
|
|
118
118
|
if (!hasStyleObjectArguments(node.callee, references, importSources)) {
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
node.arguments.forEach(checkForIdentifiers);
|
|
122
122
|
},
|
|
123
|
-
'JSXAttribute[name.name
|
|
124
|
-
if (node.type !== 'Identifier') {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
checkIdentifier(node, context, functionAllowList, keysAllowList);
|
|
128
|
-
},
|
|
129
|
-
'JSXAttribute[name.name="style"] Identifier': function JSXAttributeNameNameStyleIdentifier(node) {
|
|
130
|
-
if (node.type !== 'Identifier') {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
123
|
+
'JSXAttribute[name.name=/^style|css$/] Identifier:not(TSTypeReference Identifier)': function JSXAttributeNameNameStyleCss$IdentifierNotTSTypeReferenceIdentifier(node) {
|
|
133
124
|
checkIdentifier(node, context, functionAllowList, keysAllowList);
|
|
134
125
|
}
|
|
135
126
|
};
|
|
@@ -59,8 +59,8 @@ export var rule = createLintRule({
|
|
|
59
59
|
var importSources = getImportSources(context);
|
|
60
60
|
return {
|
|
61
61
|
CallExpression: function CallExpression(node) {
|
|
62
|
-
var _context$
|
|
63
|
-
references = _context$
|
|
62
|
+
var _context$getScope = context.getScope(),
|
|
63
|
+
references = _context$getScope.references;
|
|
64
64
|
if (!isCss(node.callee, references, importSources) && !isStyled(node.callee, references, importSources) && !isKeyframes(node.callee, references, importSources) && !isCssMap(node.callee, references, importSources) && !isXcss(node.callee, references, importSources)) {
|
|
65
65
|
return;
|
|
66
66
|
}
|
package/package.json
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
2
|
+
"name": "@atlaskit/eslint-plugin-ui-styling-standard",
|
|
3
|
+
"version": "0.16.3",
|
|
4
|
+
"author": "Atlassian Pty Ltd",
|
|
5
|
+
"description": "The eslint plugin to enforce and educate on Atlassian's UI Styling Standard",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"atlassian": {
|
|
8
|
+
"team": "Design System Team",
|
|
9
|
+
"inPublicMirror": true,
|
|
10
|
+
"releaseModel": "continuous",
|
|
11
|
+
"website": {
|
|
12
|
+
"name": "UI Styling Standard",
|
|
13
|
+
"category": "Tooling"
|
|
14
|
+
},
|
|
15
|
+
"productPushConsumption": [
|
|
16
|
+
"jira"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"registry": "https://registry.npmjs.org/"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://atlassian.design/components/eslint-plugin-ui-styling-standard",
|
|
23
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
24
|
+
"main": "dist/cjs/index.js",
|
|
25
|
+
"module": "dist/esm/index.js",
|
|
26
|
+
"module:es2019": "dist/es2019/index.js",
|
|
27
|
+
"types": "dist/types/index.d.ts",
|
|
28
|
+
"typesVersions": {
|
|
29
|
+
">=4.5 <4.9": {
|
|
30
|
+
"*": [
|
|
31
|
+
"dist/types-ts4.5/*",
|
|
32
|
+
"dist/types-ts4.5/index.d.ts"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"sideEffects": false,
|
|
37
|
+
"atlaskit:src": "src/index.tsx",
|
|
38
|
+
"af:exports": {
|
|
39
|
+
".": "./src/index.tsx"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@atlaskit/eslint-utils": "^1.6.0",
|
|
43
|
+
"@babel/runtime": "^7.0.0",
|
|
44
|
+
"@typescript-eslint/utils": "^5.48.1",
|
|
45
|
+
"ajv": "^6.12.6",
|
|
46
|
+
"eslint-codemod-utils": "^1.8.6",
|
|
47
|
+
"eslint-scope": "^8.0.0",
|
|
48
|
+
"esquery": "^1.5.0",
|
|
49
|
+
"estraverse": "^5.3.0",
|
|
50
|
+
"json-schema-to-ts": "^3.1.0",
|
|
51
|
+
"outdent": "^0.5.0",
|
|
52
|
+
"postcss-selector-parser": "^6.0.16"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@af/formatting": "*",
|
|
56
|
+
"@atlaskit/ds-lib": "^2.3.0",
|
|
57
|
+
"@atlaskit/eslint-plugin-design-system": "^10.7.0",
|
|
58
|
+
"@atlassian/codegen": "*",
|
|
59
|
+
"@compiled/eslint-plugin": "^0.13.6",
|
|
60
|
+
"@types/eslint": "^8.56.6",
|
|
61
|
+
"@types/estraverse": "^5.1.7",
|
|
62
|
+
"eslint": "^8.49.0",
|
|
63
|
+
"lodash": "^4.17.21",
|
|
64
|
+
"ts-node": "^10.9.1",
|
|
65
|
+
"tsconfig-paths": "^4.2.0",
|
|
66
|
+
"typescript": "~5.4.2"
|
|
67
|
+
},
|
|
68
|
+
"scripts": {
|
|
69
|
+
"codegen": "ts-node -r tsconfig-paths/register ./scripts/codegen.tsx"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -40,7 +40,7 @@ export const rule = createLintRule({
|
|
|
40
40
|
const importSources = getImportSources(context);
|
|
41
41
|
return {
|
|
42
42
|
CallExpression(node) {
|
|
43
|
-
const { references } = context.
|
|
43
|
+
const { references } = context.getScope();
|
|
44
44
|
|
|
45
45
|
if (!hasStyleObjectArguments(node.callee, references, importSources)) {
|
|
46
46
|
return;
|
|
@@ -71,7 +71,7 @@ export const rule = createLintRule({
|
|
|
71
71
|
value: SpreadElement | Expression | null,
|
|
72
72
|
): value is SpreadElement | Expression => value !== null,
|
|
73
73
|
)
|
|
74
|
-
.map((element) => context.
|
|
74
|
+
.map((element) => context.getSourceCode().getText(element));
|
|
75
75
|
|
|
76
76
|
return fixer.replaceText(argument, items.join(', '));
|
|
77
77
|
},
|
|
@@ -41,7 +41,7 @@ export const rule = createLintRule({
|
|
|
41
41
|
|
|
42
42
|
return {
|
|
43
43
|
CallExpression(node) {
|
|
44
|
-
const { references } = context.
|
|
44
|
+
const { references } = context.getScope();
|
|
45
45
|
|
|
46
46
|
if (!hasStyleObjectArguments(node.callee, references, importSources)) {
|
|
47
47
|
return;
|
|
@@ -123,6 +123,24 @@ typescriptEslintTester.run(
|
|
|
123
123
|
},
|
|
124
124
|
],
|
|
125
125
|
},
|
|
126
|
+
{
|
|
127
|
+
name: 'Ignores type casts',
|
|
128
|
+
code: `
|
|
129
|
+
import type { CSSProperties } from 'react';
|
|
130
|
+
import { css } from '@compiled/react';
|
|
131
|
+
|
|
132
|
+
const Component = () => (
|
|
133
|
+
<div
|
|
134
|
+
style={
|
|
135
|
+
{
|
|
136
|
+
'--my-var': 'red',
|
|
137
|
+
} as CSSProperties
|
|
138
|
+
}
|
|
139
|
+
/>
|
|
140
|
+
);
|
|
141
|
+
`,
|
|
142
|
+
options: [],
|
|
143
|
+
},
|
|
126
144
|
],
|
|
127
145
|
invalid: [
|
|
128
146
|
{
|
|
@@ -253,7 +271,7 @@ typescriptEslintTester.run(
|
|
|
253
271
|
code: `
|
|
254
272
|
import { hello } from 'package';
|
|
255
273
|
import { css } from '@compiled/react';
|
|
256
|
-
|
|
274
|
+
|
|
257
275
|
const styles = css({
|
|
258
276
|
color: hello.world,
|
|
259
277
|
});
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
getAllowedFunctionCalls,
|
|
13
13
|
isAllowListedVariable,
|
|
14
14
|
} from '@atlaskit/eslint-utils/allowed-function-calls';
|
|
15
|
-
import type
|
|
15
|
+
import type * as ESTree from 'eslint-codemod-utils';
|
|
16
16
|
import esquery from 'esquery';
|
|
17
17
|
|
|
18
18
|
const schema: JSONSchema4 = [
|
|
@@ -49,7 +49,7 @@ const schema: JSONSchema4 = [
|
|
|
49
49
|
];
|
|
50
50
|
|
|
51
51
|
const isIdentifierImported = (
|
|
52
|
-
identifier: Identifier,
|
|
52
|
+
identifier: ESTree.Identifier,
|
|
53
53
|
context: Rule.RuleContext,
|
|
54
54
|
functionAllowList: AllowList,
|
|
55
55
|
keysAllowList: AllowList,
|
|
@@ -76,7 +76,7 @@ const isIdentifierImported = (
|
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
const checkIdentifier = (
|
|
79
|
-
identifier: Identifier,
|
|
79
|
+
identifier: ESTree.Identifier,
|
|
80
80
|
context: Rule.RuleContext,
|
|
81
81
|
functionAllowList: AllowList,
|
|
82
82
|
keysAllowList: AllowList,
|
|
@@ -109,7 +109,7 @@ export const rule = createLintRule({
|
|
|
109
109
|
const functionAllowList = getAllowedFunctionCalls(context.options);
|
|
110
110
|
const keysAllowList = getAllowedDynamicKeys(context.options);
|
|
111
111
|
|
|
112
|
-
const checkForIdentifiers = (node: Node) => {
|
|
112
|
+
const checkForIdentifiers = (node: ESTree.Node) => {
|
|
113
113
|
const matches = esquery(node, 'Identifier');
|
|
114
114
|
|
|
115
115
|
for (const match of matches) {
|
|
@@ -122,25 +122,16 @@ export const rule = createLintRule({
|
|
|
122
122
|
return {
|
|
123
123
|
// Checking css/cssMap/keyframes/styled/xcss calls
|
|
124
124
|
CallExpression(node) {
|
|
125
|
-
const { references } = context.
|
|
125
|
+
const { references } = context.getScope();
|
|
126
126
|
|
|
127
127
|
if (!hasStyleObjectArguments(node.callee, references, importSources)) {
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
130
|
node.arguments.forEach(checkForIdentifiers);
|
|
131
131
|
},
|
|
132
|
-
'JSXAttribute[name.name
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
checkIdentifier(node, context, functionAllowList, keysAllowList);
|
|
138
|
-
},
|
|
139
|
-
'JSXAttribute[name.name="style"] Identifier': (node: Node) => {
|
|
140
|
-
if (node.type !== 'Identifier') {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
|
|
132
|
+
'JSXAttribute[name.name=/^style|css$/] Identifier:not(TSTypeReference Identifier)'(
|
|
133
|
+
node: ESTree.Identifier,
|
|
134
|
+
) {
|
|
144
135
|
checkIdentifier(node, context, functionAllowList, keysAllowList);
|
|
145
136
|
},
|
|
146
137
|
};
|