ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Sublime​Linter

by SublimeLinter ALL Top 25

The code linting framework for Sublime Text

Details

Installs

  • Total 2.29M
  • Win 1.21M
  • Mac 654K
  • Linux 426K
Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11
Windows 55 48 64 59 51 29 35 47 61 78 55 40 24 34 58 74 48 55 46 28 51 56 47 56 73 49 43 36 51 54 54 48 44 43 36 55 66 93 72 45 26 48 52 59 66 62
Mac 27 23 36 30 17 11 8 18 29 15 30 20 13 17 26 19 30 23 22 10 12 36 22 20 30 19 11 10 24 14 22 28 25 10 12 26 25 24 22 11 28 24 24 16 21 18
Linux 23 13 21 24 15 11 19 18 24 25 25 19 21 14 23 27 21 28 19 13 7 17 21 18 19 29 18 13 15 15 21 23 19 15 11 15 23 27 27 17 14 15 19 27 15 18

Readme

Source
raw.​githubusercontent.​com

SublimeLinter

tests

The code linting framework for Sublime Text. No linters included: get them via Package Control.

Installation

[!NOTE] The current stable version of Sublime Text, Build 4169, has a bug and cannot install SublimeLinter without requiring a restart. You're fine if you have a later dev build, e.g. build 4173.

[!NOTE]

We're in a transition phase to the newer ST4 plugin host. Unless we have more experience for the process, it may be necessary to restart Sublime Text after installing or upgrading helper packages. Just check if everything works or if the console shows permanent errors. On my machine, no restarts were necessary.

Probably don't get fancy and just install SublimeLinter via Package Control. Refer https://www.sublimelinter.com/en/latest/installation.html for further information, but, spoiler!, usually you install SublimeLinter, the plugin you're currently looking at, some command line tools, these are the actual linters (e.g. eslint or flake8), and then some plugins/adapters between both. These are typically named after the linter and should be installed via Package Control as well, examples would be SublimeLinter-eslint or SublimeLinter-flake8.

By default, SublimeLinter will run in the background and most linters support this mode so you should get squiggles immediately.

Note that you find all commands we're installing using the Command Palette (ctrl+shift+p). Just search for SublimeLinter. You may find https://github.com/kaste/SublimeLinter-addon-toggler and/or https://github.com/kaste/SublimeLinter-addon-goto-flash useful.

Settings

Settings are documented in the default settings. Open the settings using the Command Palette (ctrl+shift+p) searching for Preferences: SublimeLinter Settings (mnemonic: sls).

When you open the SublimeLinter settings you'll see the defaults on the left or top. Usually that's all that is needed for end-users but some additional information is in our docs at sublimelinter.com.

Key Bindings

SublimeLinter comes with some pre-defined keyboard shortcuts. You can customize these via the Package Settings menu.

Command Linux & Windows MacOS
Lint this view Ctrl + k, l Ctrl + + l
Open diagnostics panel Ctrl + k, a Ctrl + + a
Goto next error Ctrl + k, n Ctrl + + e
Goto prev error Ctrl + k, p Ctrl + + Shift + e

Take also a look at the default bindings.sublime-keymap>) because we document other commands and have usually some tricks in there too.

For example, it is very advisable to bind sublime_linter_quick_actions, e.g.

Error: language “jsonc” is not supported
// To trigger a quick action
    // { "keys": ["ctrl+k", "ctrl+f"],
    //   "command": "sublime_linter_quick_actions"
    // },

Quick Actions/Fixers

As we do just linting SublimeLinter naturally does not come with fixers and/or code formatters. However, we have a fixer API, see the Command Palette: SublimeLinter: Quick Action, and ship (mostly) “fix by ignoring” actions. These allow you to quickly ignore specific error messages inline and ad hoc.[1]

SublimeLinter currently ships actions for eslint, stylelint, flake8, mypy, shellcheck, codespell and phpcs.

Want to see actions for your favourite linter? Please open a PR with your addition to quick_fix.py. We have tests for them!

[1] Why this limitation though? Well it is usually easy to add a semicolon here and a space there, but the inline ignore rules and syntaxes are very cumbersome to type and to remember. And there is basically no project of any size where you don't have to ignore ad-hoc something somewhere once.

Support & Bugs

Yeah, totally! Often if it doesn't work, Sublime will have something in the console (View -> Show Console). Warnings will go there by default.

You can enable debug mode in the settings to get much more information about what's going on. Especially seeing the exact command and working dir SublimeLinter will use should be noted and helpful.

As some code only runs on startup, it is good practice to restart Sublime Text and to examine the console output for anything odd.

If your issue is specific to a particular linter, please report it on that linter's repository, otherwise open it right here.

Hack on it

Sure, you're welcome! Just clone the repository into your Packages folder (Preferences -> Browse Packages).

> git clone https://github.com/SublimeLinter/SublimeLinter.git
> subl SublimeLinter

This will overrule the installed package straight away. Just delete the folder to reverse the process. The dev requirements can be read in the pyproject.toml file. Just use rye and install them:

> rye sync

Creating a linter plugin

Use the template to get started on your plugin. It contains a how-to with all the information you need. Refer to https://www.sublimelinter.com/en/master/linter_plugin.html for more detailed information. Of course, take a look at a similar linter plugin and let it inspire you.

Also Support :heart:

SublimeLinter is the kind of software that needs active maintenance all the time. If you find SublimeLinter helpful and would like to show your appreciation, you can support its development by buying me a coffee! :smile::coffee: https://paypal.me/herrkaste

:smirk: