Skip to content

Commit e70b975

Browse files
committed
Fix new errors from ESTree spec changes
1 parent 25233a7 commit e70b975

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/eslint-plugin/src/rules/import-from-emotion.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,20 @@ export default createRule<never[], keyof typeof messages>({
4242
node.specifiers[0].type ===
4343
AST_NODE_TYPES.ImportDefaultSpecifier
4444
) {
45+
type ImportSpecifierWithIdentifier =
46+
TSESTree.ImportSpecifier & {
47+
imported: TSESTree.Identifier
48+
}
49+
4550
return fixer.replaceText(
4651
node,
4752
`import ${
4853
node.specifiers[0].local.name
4954
} from '@emotion/styled';\nimport { ${node.specifiers
5055
.filter(
51-
(x): x is TSESTree.ImportSpecifier =>
52-
x.type === AST_NODE_TYPES.ImportSpecifier
56+
(x): x is ImportSpecifierWithIdentifier =>
57+
x.type === AST_NODE_TYPES.ImportSpecifier &&
58+
x.imported.type === AST_NODE_TYPES.Identifier
5359
)
5460
.map(x =>
5561
x.local.name === x.imported.name

packages/eslint-plugin/src/rules/jsx-import.ts

+2
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ export default createRule<RuleOptions, keyof typeof messages>({
160160
let jsxSpecifier = x.specifiers.find(
161161
x =>
162162
x.type === AST_NODE_TYPES.ImportSpecifier &&
163+
x.imported.type === AST_NODE_TYPES.Identifier &&
163164
x.imported.name === 'jsx'
164165
)
165166
if (jsxSpecifier) {
@@ -253,6 +254,7 @@ export default createRule<RuleOptions, keyof typeof messages>({
253254
let cssSpecifier = specifiers.find(
254255
x =>
255256
x.type === AST_NODE_TYPES.ImportSpecifier &&
257+
x.imported.type === AST_NODE_TYPES.Identifier &&
256258
x.imported.name === 'css'
257259
)
258260

0 commit comments

Comments
 (0)