Skip to content

Commit 1f05798

Browse files
committed
updated SublimeLinter-eslint workaround (closes #146)
1 parent c230cd5 commit 1f05798

File tree

1 file changed

+45
-3
lines changed

1 file changed

+45
-3
lines changed

README.md

+45-3
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,53 @@ settings:
413413
414414
## SublimeLinter-eslint
415415
416-
Recently, SublimeLinter-eslint introduced a change to support `.eslintignore` files
416+
SublimeLinter-eslint introduced a change to support `.eslintignore` files
417417
which altered the way file paths are passed to ESLint when linting during editing.
418+
This change sends a relative path instead of the absolute path to the file (as ESLint
419+
normally provides), which can make it impossible for this plugin to resolve dependencies
420+
on the filesystem.
418421

419-
See roadhump/SublimeLinter-eslint#58 for more details, but essentially, you may find
420-
you need to add the following to a `.sublimelinterrc` file:
422+
This workaround should no longer be necessary with the release of ESLint 2.0, when
423+
`.eslintignore` will be updated to work more like a `.gitignore`, which should
424+
support proper ignoring of absolute paths via `--stdin-filename`.
425+
426+
In the meantime, see [roadhump/SublimeLinter-eslint#58](https://github.com/roadhump/SublimeLinter-eslint/issues/58)
427+
for more details and discussion, but essentially, you may find you need to add the following
428+
`SublimeLinter` config to your Sublime project file:
429+
430+
```json
431+
{
432+
"folders":
433+
[
434+
{
435+
"path": "code"
436+
}
437+
],
438+
"SublimeLinter":
439+
{
440+
"linters":
441+
{
442+
"eslint":
443+
{
444+
"chdir": "${project}/code"
445+
}
446+
}
447+
}
448+
}
449+
```
450+
451+
Note that `${project}/code` matches the `code` provided at `folders[0].path`.
452+
453+
The purpose of the `chdir` setting, in this case, is to set the working directory
454+
from which ESLint is executed to be the same as the directory on which SublimeLinter-eslint
455+
bases the relative path it provides.
456+
457+
See the SublimeLinter docs on [`chdir`](http://www.sublimelinter.com/en/latest/linter_settings.html#chdir)
458+
for more information, in case this does not work with your project.
459+
460+
If you are not using `.eslintignore`, or don't have a Sublime project file, you can also
461+
do the following via a `.sublimelinterrc` file in some ancestor directory of your
462+
code:
421463

422464
```json
423465
{

0 commit comments

Comments
 (0)