You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The team I work on is migrating a Flow project to Typescript, and we are trying to keep our ESLint setup by using typescript-eslint, but things were not working out as expected.
After some debugging, we found out that the issue was within jsx-ast-utils, which didn't correctly handle JSX attributes in the form of atribute={value!} (where ! is a Typescript non-null assertion, i.e. it tells Typescript to assume that value is neither null or undefined). It crashed here, more specifically. The issue is that @typescript-eslint/typescript-estree exposes it as a TSNonNullExpression node with value's AST as node.expression.
The team I work on is migrating a Flow project to Typescript, and we are trying to keep our ESLint setup by using typescript-eslint, but things were not working out as expected.
After some debugging, we found out that the issue was within
jsx-ast-utils
, which didn't correctly handle JSX attributes in the form ofatribute={value!}
(where!
is a Typescript non-null assertion, i.e. it tells Typescript to assume thatvalue
is neithernull
orundefined
). It crashed here, more specifically. The issue is that@typescript-eslint/typescript-estree
exposes it as aTSNonNullExpression
node withvalue
's AST asnode.expression
.For our codebase, simply adding
before that check made everything work. It's a fairly large React codebase, so I guess it's fair to assume there would be little additional work.
I would be happy to come up with a PR if the project sees this as desirable. Thanks!
The text was updated successfully, but these errors were encountered: