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

ESLint Fix

by kufii ST2/ST3 New

Sublime Text plugin to run eslint --fix on the current file

Details

Installs

  • Total 108
  • Win 40
  • OS X 50
  • Linux 18
Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3 Sep 2 Sep 1 Aug 31 Aug 30 Aug 29 Aug 28 Aug 27 Aug 26 Aug 25 Aug 24 Aug 23 Aug 22 Aug 21 Aug 20 Aug 19 Aug 18 Aug 17 Aug 16 Aug 15 Aug 14 Aug 13 Aug 12 Aug 11 Aug 10 Aug 9 Aug 8
Windows 0 5 5 7 2 1 2 6 8 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
OS X 1 9 10 4 9 0 7 4 2 5 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 1 3 4 2 3 0 1 1 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Sublime ESLint Fix

A Sublime Text 3 plugin to run eslint –fix on the current file

Installation

Dependencies

This plugin requires ESLint in order to function. For information on installing ESLint, check out the Getting Started guide.

Plugin Installation

This plugins is installable via Package Control.

To install via Package Control, do the following:

  1. Within Sublime Text, bring up the Command Palette 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.

  2. When the plugin list appears, type eslint fix. Among the entries you should see ESLint Fix. Select this entry to install it.

Commands

Command Palette

  • ESLint Fix: Fix this file

Default hotkeys:

  • Linux/Windows: [Ctrl + KE]
  • Mac: [Cmd + KE]

Settings

By default, the following settings are used:

{
    // The installation location of node.
    "node_path": {
        "windows": "node.exe",
        "linux": "/usr/bin/nodejs",
        "osx": "/usr/local/bin/node"
    },

    // The location to search for a locally installed eslint package.
    // These are all relative paths to a project's directory.
    // If this is not found, it will try to fallback to a global package
    // (see 'eslint_path' below)
    "local_eslint_path": {
        "windows": "node_modules/eslint/bin/eslint.js",
        "linux": "node_modules/.bin/eslint",
        "osx": "node_modules/.bin/eslint"
    },

    // The location of the globally installed eslint package to use as a fallback
    "eslint_path": {
        "windows": "%APPDATA%/npm/node_modules/eslint/bin/eslint",
        "linux": "/usr/bin/eslint",
        "osx": "/usr/local/bin/eslint"
    },

    // Specify this path to an eslint config file to override the default behavior.
    // Passed to eslint as --config. Read more here:
    // http://eslint.org/docs/user-guide/command-line-interface#c---config
    // If an absolute path is provided, it will use as is.
    // Else, it will look for the file in the root of the project directory.
    // Failing either, it will skip the config file
    "config_path": {
        "windows": "",
        "linux": "",
        "osx": ""
    },
}

You can modify any settings by going to Preferences > Package Settings > ESLint Fix > Settings.

Project-Specific Settings Override

To override global plugin configuration for a specific project, add a settings object with an eslint-fix key in your .sublime-project. This file is accessible via Project -> Edit Project.

For example:

{
    "folders": [
        {
            "path": "."
        }
    ],
    "settings": {
        "config_path": {
            "windows": "..."
        }
    }
}

Acknowledgments

While the code is unique, some of it is inspired by this plugin. My plugin differs by running on the current buffer instead of the last saved state of the file.