File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
packages/plugins/eslint-plugin-react-x/src/rules Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { getSettingsFromContext } from "@eslint-react/shared";
44import { AST_NODE_TYPES as T } from "@typescript-eslint/types" ;
55import { compare } from "compare-versions" ;
66import type { CamelCase } from "string-ts" ;
7+ import { isMatching } from "ts-pattern" ;
78
89import { createRule } from "../utils" ;
910
@@ -67,13 +68,11 @@ export default createRule<[], MessageID>({
6768 if ( node . source . value !== settings . importSource ) {
6869 return ;
6970 }
70- let isUseImported = false ;
71+ const isUseImported = node . specifiers
72+ . some ( isMatching ( { local : { type : T . Identifier , name : "use" } } ) ) ;
7173 for ( const specifier of node . specifiers ) {
7274 if ( specifier . type !== T . ImportSpecifier ) continue ;
7375 if ( specifier . imported . type !== T . Identifier ) continue ;
74- if ( specifier . imported . name === "use" ) {
75- isUseImported = true ;
76- }
7776 if ( specifier . imported . name === "useContext" ) {
7877 if ( specifier . local . name !== "useContext" ) {
7978 useContextAlias . add ( specifier . local . name ) ;
You can’t perform that action at this time.
0 commit comments