Search code examples
eslintsast

run eslint in multi repository project


let's say, I have following project structure:

back/package.json
back/lib/Content/*.js
front/package.json
slices/budget/back/package.json
slices/budget/back/lib/Content/*.js
slices/budget/front/package.json
slices/accounting/back/package.json
slices/accounting/back/lib/Content/*.js
slices/accounting/front/package.json

how do I?

cd back && eslint ./lib/**/*.js ../slices/**/lib/Content/*.js

specifically, I want to

  • install eslint one time as devDependencies
  • somewhere in /back of root module
  • config eslint one time somewhere in /back/package.json:eslint key of root module
  • add eslint config in /back/package.json of root module just one time
  • eslint entire tree of modules
  • not in each slice seperatly
  • run from ci cd
  • so I need a way to run from /back
  • and later - maybe someway to respect eslint config hierarchy
  • not change project directory structure at all

what I receive

cd back && npm run lint

> [email protected] lint
> eslint ../


Oops! Something went wrong! :(

ESLint: 8.23.1

ESLint couldn't find a configuration file

reason: https://eslint.org/docs/latest/user-guide/configuring/configuration-files#using-configuration-files


Solution

  • no real answer, except to create .eslintignore, .eslintrc, package.json at project root