About disambiguation of .tsx files #6340
chibiricky
started this conversation in
General
Replies: 1 comment
-
Heuristics aren't a requirement (in most cases; see below1). Here, they're being used to identify obvious TSX and XML files before passing the file down to Linguist's classifier strategy—which is the least accurate of Linguist's identification strategies (as well as the most computationally expensive). In other words, Footnotes
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
According to this line of code in heuristics.yml, in order for a .tsx file to be classified as language TSX (=> TypeScript), it has to have a line that imports the react module.
However, according to this blog post that introduced React 17,
With the new transform, you can use JSX without importing React
.Also, a JSX (or TSX) file does not have to be a React file. I think we should not use the React import statement to identify TSX files.
Moreoever, when developing in next.js, there is even less chance that we need to import the React components, but the files are still TSX files.
Maybe in the .tsx section in the heuristics.yml file, we should put XML before TSX, and remove the pattern for TSX so that it can do a "catch-all" for all .tsx files that do not match the XML pattern?
Beta Was this translation helpful? Give feedback.
All reactions