• Stars
    star
    865
  • Rank 52,730 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 11 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This linter plugin for SublimeLinter provides an interface to ESLint

SublimeLinter-eslint

This linter plugin for SublimeLinter provides an interface to ESLint. It will be used with "JavaScript" files, but since eslint is pluggable, it can actually lint a variety of other files as well.

Installation

SublimeLinter must be installed in order to use this plugin.

Please install via Package Control.

Before using this plugin, ensure that eslint is installed on your system. To install eslint, do the following:

  • Install Node.js (and npm on Linux).

  • Install eslint globally by typing the following in a terminal:

npm install -g eslint
  • Or install eslint locally in your project folder (you must have a package.json file there):
npm install -D eslint

Using eslint with plugins (e.g. vue)

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.

  • 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.
  • 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.)

Out-of-the-box SublimeLinter detects typescript, vue, svelte, html, and json. Please open a PR for important other plugins. Note, however, that when you configure the executable manually, you also opt-out of the automatic plugin detection and fallback to linting "Javscript" only.

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.

Examples

For Typescript .ts files it would be:

"linters": {
    "eslint": {
        "selector": "source.ts, source.js - meta.attribute-with-value"
    }
}

For Vue.js .vue files it would be:

"linters": {
    "eslint": {
        "selector": "text.html.vue, source.js - meta.attribute-with-value"
    }
}

For Svelte .svelte files, using eslint-plugin-svelte3 and Svelte syntax highlighting, it would be:

"linters": {
    "eslint": {
        "selector": "text.html.svelte, source.js - meta.attribute-with-value"
    }
}

To find the selector value for a particular file type, place the cursor at the start of the file and use the command Tools ➑️ Developer ➑️ Show Scope Name.

Using eslint_d

This plugin will automatically prefer a eslint_d installation if present. You can change this behavior by setting prefer_eslint_d to false either globally or per project. E.g. for the global setting:

"linters": {
    "eslint": {
        "prefer_eslint_d": false
    }
}

Settings

You can configure eslint options in the way you would from the command line, with .eslintrc files. For more information, see the eslint docs.

FAQ and Troubleshooting

eslint doesn't lint my HTML files anymore.

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:

"linters": {
    "eslint": {
        "selector": "source.js - meta.attribute-with-value"
    }
}

I've got 'SublimeLinter: ERROR: eslint cannot locate 'eslint' in ST console when I try to use locally installed eslint.

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.

npm init -f
npm install eslint

I've got 'SublimeLinter: eslint ERROR: ESLint couldn't find a configuration file' when I'm editing a JavaScript file.

If you're using SublimeLinter 4, the linter is trying to always lint the current view, even if there's no ESLint setup for the project or file. You can easily fix this error by creating an empty .eslintrc file in your home directory. This file will be picked up by the linter when there is no locally-defined ESLint configuration.

Use your editor of choice and create this config file, or do this on a terminal:

cd $HOME # or cd %HOMEPATH% on Windows
touch .eslintrc
echo '{ "rules": {} }' > .eslintrc

I use eslint_d and the linter suddently stopped working

If you use eslint_d and the linter suddently stopped working with an error message like "Error: ENOENT: no such file or directory, open /../eslint/node_modules/globals/index.js", a restart of eslint_d might resolve the problem:

eslint_d restart

More Repositories

1

SublimeLinter

The code linting framework for Sublime Text
Python
2,011
star
2

SublimeLinter-jshint

SublimeLinter plugin for JavaScript, using jshint.
Python
460
star
3

SublimeLinter-shellcheck

This linter plugin for SublimeLinter provides an interface to shellcheck.
Python
210
star
4

SublimeLinter-php

SublimeLinter 3 plugin for PHP, using php -l.
Python
209
star
5

SublimeLinter-jscs

Deprecated SublimeLinter 3 plugin for jscs
Python
199
star
6

SublimeLinter-flake8

SublimeLinter plugin for python, using flake8.
Python
184
star
7

SublimeLinter-csslint

SublimeLinter plugin for CSS, using csslint.
Python
172
star
8

SublimeLinter-rubocop

SublimeLinter 3 plugin for Ruby, using rubocop.
Python
159
star
9

SublimeLinter-html-tidy

SublimeLinter 3 plugin for html tidy.
Python
126
star
10

SublimeLinter-flow

SublimeLinter plugin for JavaScript static type checking, using flow.
Python
117
star
11

SublimeLinter-pylint

SublimeLinter plugin for python, using pylint.
Python
116
star
12

SublimeLinter-jsxhint

Deprecated SublimeLinter 3 plugin for JSX - use ESLint instead
Python
116
star
13

SublimeLinter-pep8

Deprecated SublimeLinter plugin for pep8, use pycodestyle instead
Python
107
star
14

SublimeLinter-annotations

SublimeLinter plugin that marks annotations such as TODO, FIXME, etc.
Python
106
star
15

SublimeLinter-json

SublimeLinter plugin for JSON.
Python
83
star
16

SublimeLinter-phplint

SublimeLinter plugin for PHP, using phplint.
Python
73
star
17

SublimeLinter-tslint

tslint plugin for SublimeLinter. Lint your typescript code.
Python
72
star
18

SublimeLinter-phpcs

SublimeLinter plugin for PHP, using phpcs.
Python
71
star
19

SublimeLinter-ruby

SublimeLinter plugin for ruby, using ruby -wc.
Python
60
star
20

SublimeLinter-mypy

mypy static type checking for python
Python
54
star
21

SublimeLinter-pycodestyle

SublimeLinter plugin for python, using pycodestyle.
Python
44
star
22

SublimeLinter-pyflakes

SublimeLinter plugin for python, using pyflakes.
Python
43
star
23

SublimeLinter-javac

SublimeLinter 3 plugin for Java, using javac -Xlint.
Python
39
star
24

SublimeLinter-coffeelint

SublimeLinter plugin for CoffeeScript, using coffeelint.
Python
38
star
25

SublimeLinter-stylelint

This linter plugin for SublimeLinter provides an interface to stylelint.
Python
31
star
26

SublimeLinter-golangcilint

This linter plugin for SublimeLinter provides an interface to golangci-lint.
Python
31
star
27

SublimeLinter-xmllint

SublimeLinter 3 plugin for XML, using xmllint.
Python
29
star
28

SublimeLinter-luacheck

SublimeLinter 3 plugin for lua, using luacheck
Python
28
star
29

SublimeLinter-cppcheck

This linter plugin for SublimeLinter provides an interface to cppcheck.
Python
27
star
30

SublimeLinter-golint

This linter plugin for SublimeLinter provides an interface to golint.
Python
24
star
31

package_control_channel

Private channel for Package Control
Python
24
star
32

SublimeLinter-clang

SublimeLinter plugin for C/C++, using clang
Python
23
star
33

SublimeLinter-pug-lint

SublimeLinter plugin for Pug (formerly Jade), using pug-lint
Python
23
star
34

SublimeLinter-chktex

LaTeX linter plugin for SublimeLinter 3, using chktex.
Python
22
star
35

SublimeLinter-gcc

This linter plugin for SublimeLinter provides an interface to gcc or other gcc-like (cross-)compiler.
Python
22
star
36

SublimeLinter-cpplint

This linter plugin for SublimeLinter provides an interface to cpplint.
Python
21
star
37

SublimeLinter-gotype

This linter plugin for SublimeLinter provides an interface to gotype.
Python
21
star
38

SublimeLinter-lua

SublimeLinter 3 plugin for Lua, using luac -p.
Python
20
star
39

SublimeLinter-coffee

SublimeLinter plugin for CoffeeScript, using coffee --compile.
Python
20
star
40

SublimeLinter-govet

This linter plugin for SublimeLinter provides an interface to go vet.
Python
19
star
41

SublimeLinter-template

A template for new linter plugins
Python
15
star
42

SublimeLinter-phpmd

SublimeLinter plugin for php, using phpmd.
Python
15
star
43

SublimeLinter-haml

SublimeLinter 3 plugin for Haml, using haml -c.
Python
14
star
44

SublimeLinter-gjslint

SublimeLinter plugin for JavaScript, using gjslint.
Python
14
star
45

SublimeLinter-pyyaml

Deprecated plugin for SublimeLinter for pyyaml. Use yamllint instead.
Python
14
star
46

SublimeLinter-bandit

SublimeLinter plugin for Python, using bandit
Python
12
star
47

SublimeLinter-pydocstyle

SublimeLinter plugin for python, using pydocstyle.
Python
10
star
48

SublimeLinter-rst

Deprecated SublimeLinter plugin for reStructuredText, using docutils.
Python
9
star
49

SublimeLinter-ghc

SublimeLinter 3 plugin for Haskell, using ghc -Wall.
Python
8
star
50

SublimeLinter-hlint

SublimeLinter plugin for hlint.
Python
8
star
51

SublimeLinter-jsl

SublimeLinter plugin for JavaScript, using JavaScript Linter (jsl).
Python
7
star
52

SublimeLinter-mdl

This linter plugin for SublimeLinter provides an interface to Markdown Lint Tool (mdl)
Python
7
star
53

SublimeLinter-haml-lint

SublimeLinter 3 plugin for Haml, using haml-lint.
Python
4
star
54

SublimeLinter-erlc

SublimeLinter plugin for Erlang, using erlc
Python
3
star
55

SublimeLinter-rome

SublimeLinter plugin to provide an interface to Rome
Python
2
star
56

SublimeLinter-vale

Plugin for SublimeLinter to provide an interface to Vale
Python
1
star
57

SublimeLinter-raml-cop

SublimeLinter plugin for RAML, using raml-cop.
Python
1
star