You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-8Lines changed: 24 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
SublimeLinter-eslint
2
2
=========================
3
3
4
-
This linter plugin for [SublimeLinter](https://github.com/SublimeLinter/SublimeLinter) provides an interface to [ESLint](https://github.com/nzakas/eslint). It will be used with files that have the "JavaScript" or "HTML 5" syntax dependent on your installed syntax highlighting package.
4
+
This linter plugin for [SublimeLinter](https://github.com/SublimeLinter/SublimeLinter) provides an interface to [ESLint](https://github.com/nzakas/eslint). It will be used with "JavaScript" files, but since `eslint` is pluggable, it can actually lint a variety of other files as well.
5
5
6
6
## Installation
7
7
SublimeLinter 3 must be installed in order to use this plugin.
@@ -20,16 +20,21 @@ npm install -g eslint
20
20
21
21
- Or install `eslint` locally in your project folder (**you must have a `package.json` file there**):
22
22
```
23
-
npm install eslint
23
+
npm install -S eslint
24
24
```
25
25
26
26
## Using eslint with plugins (e.g. vue)
27
27
28
-
If you're using plugins for eslint so that it can lint files other than `.js`,
29
-
you need to tell SublimeLinter it's ok to lint those files too.
30
-
For this you can change the `"selector"` setting to include the scope
31
-
of the other syntax. Its default value is `source.js - meta.attribute-with-value`,
32
-
make sure to include that in the configuration.
28
+
SublimeLinter will detect _some_ installed **local** plugins, and thus it should work automatically for e.g. `.vue` or `.ts` files. If it works on the command line, there is a chance it works in Sublime without further ado.
29
+
30
+
- Make sure the plugins are installed **locally** colocated to `eslint` itself. T.i., technically, both `eslint` and its plugins are described in the very same `package.json`.
31
+
- Configuration of the plugins is out-of-scope of this README. Be sure to read _their_ README's as well. (If you just installed a plugin, without proper configuration, `eslint` will probably show error messages or wrong lint results, and SublimeLinter will just pass them to you.)
32
+
33
+
Out-of-the-box SublimeLinter detects typescript, vue, svelte, html, and json. Please open a PR for important other plugins.
34
+
35
+
In any case, if you want to control which files SublimeLinter sends to `eslint`, you can always manually change the `"selector"` setting to just include the scopes you explicitly want. The default value for "JavaScript" is `source.js - meta.attribute-with-value`, make sure to include that in the configuration.
36
+
37
+
### Examples
33
38
34
39
For [Typescript](https://www.typescriptlang.org/)`.ts` files it would be:
35
40
@@ -40,7 +45,6 @@ For [Typescript](https://www.typescriptlang.org/) `.ts` files it would be:
40
45
}
41
46
}
42
47
```
43
-
It would also need the appropriate [eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin) setup.
44
48
45
49
For [Vue.js](https://vuejs.org/)`.vue` files it would be:
46
50
@@ -74,6 +78,18 @@ You can configure `eslint` options in the way you would from the command line, w
74
78
75
79
## FAQ and Troubleshooting
76
80
81
+
### `eslint` doesn't lint my HTML files anymore.
82
+
83
+
Starting with v4.2 of this plugin, `eslint` will only lint '*.js' files for standard, vanilla configurations without further plugins. You can restore the old behavior by setting `selector` to its old value:
### I've got 'SublimeLinter: ERROR: eslint cannot locate 'eslint' in ST console when I try to use locally installed `eslint`.
78
94
79
95
You **must** have a `package.json` file if you've installed `eslint` locally. Also, restart the project or Sublime Text itself after to make sure SublimeLinter uses the correct `eslint` instance.
0 commit comments