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 @@ -6,6 +6,7 @@ import { compare } from "compare-versions";
66import type { CamelCase } from "string-ts" ;
77
88import { createRule } from "../utils" ;
9+ import { isMatching } from "ts-pattern" ;
910
1011export const RULE_NAME = "no-use-context" ;
1112
@@ -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