eslint-plugin-flowtype icon indicating copy to clipboard operation
eslint-plugin-flowtype copied to clipboard

Should `@babel/plugin-syntax-jsx` be a prod dependency instead of a peer dependency?

Open julienw opened this issue 4 years ago • 2 comments

Following #513 @babel/plugin-syntax-jsx is used. However in my project it's currently not installed, and as a result I get errors like:

  0:0  error  Parsing error: Cannot find module '@babel/plugin-syntax-jsx'

I wonder why it's a peer dependency instead of a prod dependency?

julienw avatar Nov 22 '21 14:11 julienw

BTW my project doesn't use JSX at all as it's a server project, that's why this dependency isn't present.

julienw avatar Nov 22 '21 14:11 julienw

I think peer dependency is correct. eslint plugins never ship pure dependencies because as a consumer you can choose a wide range of versions of the plugin you need that this plugin may also depend on.

Steps to solve should be

  • I install eslint-plugin-flowtype
  • I see peer dependency missing warning
  • I install it (or I get an error like you have and then get forced to install it)

fyi it's like how flow-typed doesn't have jsx either but it's forced to install @babel/plugin-transform-react-jsx

Brianzchen avatar Dec 07 '21 18:12 Brianzchen