├── .gitignore ├── .sublimelinterrc ├── .travis.yml ├── LICENSE ├── README.md ├── linter.py ├── messages.json └── messages └── install.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /.sublimelinterrc: -------------------------------------------------------------------------------- 1 | { 2 | "@python": 3, 3 | "linters": { 4 | "flake8": { 5 | "max-line-length": 120 6 | }, 7 | "pep257": { 8 | "ignore": ["D202"] 9 | }, 10 | "pep8": { 11 | "max-line-length": 120 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "3.4" 4 | # command to install dependencies 5 | install: 6 | - pip install flake8 7 | - pip install pep257 8 | # command to run tests 9 | script: 10 | - flake8 . --max-line-length=120 11 | - pep257 . --ignore=D202,D203 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy 2 | of this software and associated documentation files (the "Software"), to deal 3 | in the Software without restriction, including without limitation the rights 4 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5 | copies of the Software, and to permit persons to whom the Software is 6 | furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in 9 | all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17 | THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SublimeLinter-contrib-semistandard 2 | ================================ 3 | 4 | [![Build Status](https://travis-ci.org/Flet/SublimeLinter-contrib-semistandard.svg?branch=master)](https://travis-ci.org/Flet/SublimeLinter-contrib-semistandard) 5 | 6 | This linter plugin for [SublimeLinter][docs] provides an interface to [semistandard](https://www.npmjs.com/package/semistandard). It will be used with files that have the “javascript” syntax. 7 | 8 | ## Installation 9 | SublimeLinter 3 must be installed in order to use this plugin. If SublimeLinter 3 is not installed, please follow the instructions [here][installation]. 10 | 11 | ### Linter installation 12 | Before using this plugin, you must ensure that `semistandard` is installed on your system. To install `semistandard`, do the following: 13 | 14 | 1. Install [Node.js](http://nodejs.org) (and [npm](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager) on Linux). 15 | 16 | 1. Install `semistandard` by typing the following in a terminal: 17 | ``` 18 | npm install -g semistandard 19 | ``` 20 | 21 | 1. If you are using `nvm` and `zsh`, ensure that the line to load `nvm` is in `.zshenv` and not `.zshrc`. 22 | 23 | 1. If you are using `zsh` and `oh-my-zsh`, do not load the `nvm` plugin for `oh-my-zsh`. 24 | 25 | 26 | **Note:** This plugin requires `semistandard` 2.3.2 or later. 27 | 28 | ### Linter configuration 29 | In order for `semistandard` to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. Before going any further, please read and follow the steps in [“Finding a linter executable”](http://sublimelinter.readthedocs.org/en/latest/troubleshooting.html#finding-a-linter-executable) through “Validating your PATH” in the documentation. 30 | 31 | Once you have installed and configured `semistandard`, you can proceed to install the SublimeLinter-contrib-semistandard plugin if it is not yet installed. 32 | 33 | ### Plugin installation 34 | Please use [Package Control][pc] to install the linter plugin. This will ensure that the plugin will be updated when new versions are available. If you want to install from source so you can modify the source code, you probably know what you are doing so we won’t cover that here. 35 | 36 | To install via Package Control, do the following: 37 | 38 | 1. Within Sublime Text, bring up the [Command Palette][cmd] and type `install`. Among the commands you should see `Package Control: Install Package`. If that command is not highlighted, use the keyboard or mouse to select it. There will be a pause of a few seconds while Package Control fetches the list of available plugins. 39 | 40 | 1. When the plugin list appears, type `semistandard`. Among the entries you should see `SublimeLinter-contrib-semistandard`. If that entry is not highlighted, use the keyboard or mouse to select it. 41 | 42 | ## Automatic Formatting 43 | This can be accomplished via @bcomnes StandardFormat on package control. 44 | 45 | 1) Make sure you have at least `semistandard-format`, just update to the latest to be sure: 46 | ```bash 47 | npm install semistandard-format -g 48 | ``` 49 | 2) Install **StandardFormat** from package control 50 | 3) Open the "user" package settings for "Standard Format" 51 | - via command pallete: standard format settings user 52 | - or via menu: Preference > Package Settings > Standard Format > Settings - User 53 | 54 | 4) Add a reference to `semistandard-format --stdin`: 55 | ```js 56 | { 57 | // set this to false if you don't want to format on save 58 | "format_on_save": true, 59 | "command": ["semistandard-format", "--stdin"], 60 | } 61 | ``` 62 | 5) Save the settings file. 63 | 6) Restart Sublime Text. 64 | 65 | StandardFormat will also map CTRL+ALT+F to format automatically. :) 66 | 67 | 68 | 69 | ## Settings 70 | For general information on how SublimeLinter works with settings, please see [Settings][settings]. For information on generic linter settings, please see [Linter Settings][linter-settings]. 71 | 72 | ## Contributing 73 | If you would like to contribute enhancements or fixes, please do the following: 74 | 75 | 1. Fork the plugin repository. 76 | 1. Hack on a separate topic branch created from the latest `master`. 77 | 1. Commit and push the topic branch. 78 | 1. Make a pull request. 79 | 1. Be patient. ;-) 80 | 81 | Please note that modifications should follow these coding guidelines: 82 | 83 | - Indent is 4 spaces. 84 | - Code should pass flake8 and pep257 linters. 85 | - Vertical whitespace helps readability, don’t be afraid to use it. 86 | - Please use descriptive variable names, no abbreviations unless they are very well known. 87 | 88 | Thank you for helping out! 89 | 90 | [docs]: http://sublimelinter.readthedocs.org 91 | [installation]: http://sublimelinter.readthedocs.org/en/latest/installation.html 92 | [locating-executables]: http://sublimelinter.readthedocs.org/en/latest/usage.html#how-linter-executables-are-located 93 | [pc]: https://sublime.wbond.net/installation 94 | [cmd]: http://docs.sublimetext.info/en/sublime-text-3/extensibility/command_palette.html 95 | [settings]: http://sublimelinter.readthedocs.org/en/latest/settings.html 96 | [linter-settings]: http://sublimelinter.readthedocs.org/en/latest/linter_settings.html 97 | [inline-settings]: http://sublimelinter.readthedocs.org/en/latest/settings.html#inline-settings 98 | -------------------------------------------------------------------------------- /linter.py: -------------------------------------------------------------------------------- 1 | # 2 | # linter.py 3 | # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 4 | # 5 | # Written by Dan Flettre 6 | # Copyright (c) 2015 Dan Flettre 7 | # 8 | # License: MIT 9 | # 10 | 11 | """This module exports the Semistandard plugin class.""" 12 | 13 | from SublimeLinter.lint import NodeLinter 14 | 15 | 16 | class Semistandard(NodeLinter): 17 | """Provides an interface to semistandard.""" 18 | 19 | defaults = { 20 | 'selector': 'source.js, source.js.embedded.html, source.javascript, source.javascript.babel' 21 | } 22 | cmd = 'semistandard --stdin --verbose' 23 | regex = r'^\s.+:(?P\d+):(?P\d+):(?P.+)' 24 | -------------------------------------------------------------------------------- /messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "install": "messages/install.txt" 3 | } 4 | -------------------------------------------------------------------------------- /messages/install.txt: -------------------------------------------------------------------------------- 1 | SublimeLinter-contrib-semistandard 2 | ------------------------------- 3 | This linter plugin for SublimeLinter provides an interface to semistandard. 4 | 5 | ** IMPORTANT! ** 6 | 7 | Before this plugin will activate, you *must* 8 | follow the installation instructions here: 9 | 10 | https://github.com/Flet/SublimeLinter-contrib-semistandard 11 | 12 | 13 | ## Automatic Formatting 14 | This can be accomplished via @bcomnes StandardFormat on package control. 15 | 16 | 1) Make sure you have at least `semistandard-format`, just update to the latest to be sure: 17 | ```bash 18 | npm install semistandard-format -g 19 | ``` 20 | 2) Install **StandardFormat** from package control 21 | 3) Open the "user" package settings for "Standard Format" 22 | - via command pallete: standard format settings user 23 | - or via menu: Preference > Package Settings > Standard Format > Settings - User 24 | 25 | 4) Add a reference to `semistandard-format --stdin`: 26 | ```js 27 | { 28 | // set this to false if you don't want to format on save 29 | "format_on_save": true, 30 | "command": ["semistandard-format", "--stdin"], 31 | } 32 | ``` 33 | 5) Save the settings file. 34 | 6) Restart Sublime Text. 35 | 36 | StandardFormat will also map CTRL+ALT+F to format automatically. :) 37 | --------------------------------------------------------------------------------