0

this is question is basically a variant of dependencies vs. devDependencies, I am looking through some source code these days, most of monorepo project will have a eslint-config to do lint

what confuses me is that they all put the eslint-plugin into dependencies not devDependencies for example, a eslint config package called eslint-config, here's package.json

"dependencies": {
    "@typescript-eslint/eslint-plugin": "^5.15.0",
    "@typescript-eslint/parser": "^5.15.0",
    "eslint-config-standard": "17.0.0-1",
    "eslint-plugin-eslint-comments": "^3.2.0",
    "eslint-plugin-html": "^6.2.0",
    "eslint-plugin-import": "^2.25.4",
    "eslint-plugin-jsonc": "^2.2.1",
    "eslint-plugin-n": "^15.0.1",
    "eslint-plugin-promise": "^6.0.0",
    "eslint-plugin-unicorn": "^41.0.1",
    "eslint-plugin-vue": "^8.5.0",
    "eslint-plugin-yml": "^0.14.0",
    "jsonc-eslint-parser": "^2.1.0",
    "yaml-eslint-parser": "^0.5.0"
  },
  "devDependencies": {
    "eslint": "^8.11.0"
  },

we of course use it by npm i eslint-config -D, so I wonder if the eslint config get removed after bundled(I think it's 100% get removed), but I want to know the behand philosophy

homy
  • 311
  • 2
  • 7
  • You don't install the development dependencies of your dependencies. So if this package is intended to be installed, whether or not as a development dependency, by other packages, the transitive dependencies need to be regular (or peer) dependencies. – jonrsharpe Mar 22 '22 at 09:53
  • yes, the main thing I want to ensure is why they put eslint thing in `dependencies` – homy Mar 22 '22 at 11:37
  • Then ask the package maintainers, we can't tell you their intentions. – jonrsharpe Mar 22 '22 at 11:38

1 Answers1

0

According to the npm and yarn documentation, in addition to another answer with a similar question, devDependencies do not impact the bundle size as they are utilized in development mode.

Two related GitHub issue comments discuss the reasoning behind your question, specifically dependencies included at runtime:

TechSolomon
  • 425
  • 5
  • 12
  • `npm` and `yarn` only use a few lines words to describe it which is far more enough, I like [@ljharb](https://github.com/facebook/create-react-app/issues/3209#issuecomment-336602578)'s answer, put eslint like thing into `dependencies` is really confusing me, and I have tested locally myself, it works well when they are `devDependencies` – homy Mar 22 '22 at 11:29