Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 30, 2017

Conversation

dtinth
Copy link
Contributor

@dtinth dtinth commented Jun 30, 2017

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.

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
Copy link
Owner

cletusw commented Jun 30, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants