Closed abstractpoint closed 5 years ago
The plugin is intended to be installed inside ./node_modules/eslint-plugin-local
. It uses ../..
to get back to the project root.
Thanks for answering. I'm having an interesting issue with this failing when modules are installed in another node_modules directory outside the project. This can happen when installing globally or when using lerna tool for example.
Maybe utilising this could be better? https://www.npmjs.com/package/app-root-path I'd be happy to go a PR.
Actually I realised that isn't going to solve my problem , as it still gives the module location and not the path where config is. Thanks, I will keep thinking.
Sorry, I forgot to answer.
We also do monorepos here. We install ESLint+eslint-plugin-local at our repo root. It’s possible to have .eslintrc.js
in repo root in turn require rules in specific project... e.g.
exports.rules = {
...require('./project1/eslint-rules'),
...require('./project2/eslint-rules'),
...require('./project3/eslint-rules'),
}
We don’t install tools like ESLint globally, since it makes dealing with paths harder.
Not working with pnpm
I had the same issue as @dtinth as we use a monorepo and it wasn't working. But it turns out that NX does support that very well in a testable way too and it's all well typed with typescript in case anyone else struggle on a monorepo.
Wondering about this because I am running eslint in the root of my project, so it's not possible to go up 2 dirs.