cletusw / eslint-plugin-local-rules

A plugin for ESLint that allows you to use project-specific rules
MIT License
158 stars 9 forks source link

Fix VS Code integration when ESLint project outside VS Code project #1

Closed dtinth closed 7 years ago

dtinth commented 7 years ago

When an ESLint project is not in the root directory, e.g.

+ our-project
|--+ client
|  |--- src/
|  |--- package.json
|  |--- eslint-local-rules.js
|--+ server
|  |--- stuff

Some editor plugins does not cd into client directory when invoking ESLint. Therefore process.cwd() is "our-project", which means requireUp will not find our "eslint-local-rules.js".

This problem is fixed by making this plugin require from __dirname instead of process.cwd(). Intuitively, the behavior of the plugin should not depend on where it is run.

This commit also makes eslint-plugin-local-rules fail loudly if the rules file is not found.

cletusw commented 7 years ago

Awesome, thanks! And your https://github.com/taskworld/eslint-plugin-local looks pretty sweet!