Make react related packages optional peer dependencies for eslint-plugin-sonarjs

When installing the latest version of eslint-plugin-sonarjs, I noticed that several React and Vue-related packages, along with all of each of their dependencies, are being installed. This adds unnecessary time and bandwidth overhead during development and CI builds for projects that do not use React or Vue.

These are some of the packages that I believe are installed unnecessarily:

  • babel/preset-flow
  • babel/preset-react
  • eslint-plugin-jsx-a11y
  • eslint-plugin-react
  • jsx-ast-utils
  • vue-eslint-parser

By marking these dependencies as optional in the peerDependenciesMeta field, projects that don’t require React or Vue can avoid the installation of these packages. For example:

"peerDependenciesMeta": {
  "eslint-plugin-react": {
    "optional": true
  },
  "eslint-plugin-vue": {
    "optional": true
  }
}

This change would allow eslint-plugin-sonarjs to be used in non-React/Vue projects without the extra dependencies being installed, saving time and resources.

1 Like

Hello @manbearwiz,

Thanks for the proposal. We are considering this. I will forward you to the post where we already discussed this with some other users.

Cheers,
Victor