@backstage/eslint-plugin 0.1.9 → 0.1.10-next.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
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/eslint-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10-next.0",
|
|
4
4
|
"description": "Backstage ESLint plugin",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"minimatch": "^9.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@backstage/cli": "
|
|
25
|
+
"@backstage/cli": "0.28.0-next.1",
|
|
26
26
|
"@types/estree": "^1.0.5",
|
|
27
27
|
"eslint": "^8.33.0"
|
|
28
28
|
}
|
|
@@ -80,11 +80,14 @@ const KNOWN_STYLES = [
|
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
82
|
* filter function to keep only ImportSpecifier nodes
|
|
83
|
-
* @param {import('estree').ImportSpecifier | import('estree').ImportDefaultSpecifier| import('estree').ImportNamespaceSpecifier} specifier
|
|
83
|
+
* @param {import('estree').ImportSpecifier | import('estree').ImportDefaultSpecifier | import('estree').ImportNamespaceSpecifier} specifier
|
|
84
84
|
* @returns {specifier is import('estree').ImportSpecifier}
|
|
85
85
|
*/
|
|
86
86
|
function importSpecifiersFilter(specifier) {
|
|
87
|
-
return
|
|
87
|
+
return (
|
|
88
|
+
specifier.type === 'ImportSpecifier' &&
|
|
89
|
+
specifier.imported.type !== 'Literal'
|
|
90
|
+
);
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
/**
|
|
@@ -146,12 +149,16 @@ module.exports = {
|
|
|
146
149
|
|
|
147
150
|
const specifiers = node.specifiers.filter(importSpecifiersFilter);
|
|
148
151
|
|
|
149
|
-
const specifiersMap = specifiers.
|
|
152
|
+
const specifiersMap = specifiers.flatMap(
|
|
150
153
|
/**
|
|
151
154
|
* transform ImportSpecifier to FixerValues to have a simpler object to work with
|
|
152
|
-
* @returns {FixerValues}
|
|
155
|
+
* @returns {FixerValues[]}
|
|
153
156
|
*/
|
|
154
157
|
s => {
|
|
158
|
+
if (s.imported.type === 'Literal') {
|
|
159
|
+
return [];
|
|
160
|
+
}
|
|
161
|
+
|
|
155
162
|
const value = s.imported.name;
|
|
156
163
|
const alias = s.local.name === value ? undefined : s.local.name;
|
|
157
164
|
|
|
@@ -165,19 +172,24 @@ module.exports = {
|
|
|
165
172
|
const emitComponent = !emitProp;
|
|
166
173
|
const emitComponentAndProp =
|
|
167
174
|
emitProp &&
|
|
168
|
-
specifiers.find(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
175
|
+
specifiers.find(
|
|
176
|
+
s =>
|
|
177
|
+
s.imported.type !== 'Literal' &&
|
|
178
|
+
s.imported.name === propsMatch[1],
|
|
179
|
+
)?.local.name;
|
|
180
|
+
|
|
181
|
+
return [
|
|
182
|
+
{
|
|
183
|
+
emitComponent: emitComponent || Boolean(emitComponentAndProp),
|
|
184
|
+
emitProp,
|
|
185
|
+
value,
|
|
186
|
+
componentValue: propsMatch ? propsMatch[1] : undefined,
|
|
187
|
+
componentAlias: emitComponentAndProp
|
|
188
|
+
? emitComponentAndProp
|
|
189
|
+
: undefined,
|
|
190
|
+
alias,
|
|
191
|
+
},
|
|
192
|
+
];
|
|
181
193
|
},
|
|
182
194
|
);
|
|
183
195
|
|