Reputation: 12139
I would like to make sure that JavaScript files (with js
extension) in VS Code contain valid JavaScript syntax only.
Is it possible to disallow JSX syntax for .js
files in VS Code?
Ideally of course I would like to still allow the JSX syntax for .jsx
files.
Upvotes: 0
Views: 108
Reputation: 318638
You can use the react/jsx-filename-extension
rule of eslint-plugin-react
.
By default it only allows JSX inside *.jsx
files so you will have an error/warning (depending on how you configure it) when it detects JSX in a file where it shouldn't be.
Upvotes: 1