0

I've got all my .editorconfig, .eslintrc, .babelrc, etc files in an npm package. These configurations need to be shared between different projects, and it's easy enough to point at the npm package when executing code.

On the other hand, my text editor has no clue these exist as they're not in the root of my project. I know this is able to be solved easily with a monorepo, but right now I'd like to avoid that direction.

Is there a simpler way to share these configs from the npm package with my outer repo?

The only solution I can think of is symlinking them and adding a script that executes when the package is installed. It will be OS-dependent and still may not work with my text editor.

Kevin Ghadyani
  • 6,829
  • 6
  • 44
  • 62
  • How about defining an NPM `postinstall` script for that tiny package which copies all these files to root directory? – Arpit Feb 21 '18 at 07:21
  • In that case, it sounds like if I update the package, then it updates the files right? Also, I'm seeing some arguments for why you'd want editable `.eslintrc` files if the project has some differences from the npm package. While this solves the problem of eslint, there are plenty of other configs such as `.editorconfig` and `.babelrc` which need to be addressed as well. There's gotta be a better way of doing this. – Kevin Ghadyani Feb 21 '18 at 08:16
  • you can put sort of checks in your npm package install scripts which can check if those files are already present or not and copy accordingly.. – Arpit Feb 21 '18 at 09:24

0 Answers0