ESlint + sublimelinter not working with Sublime Text 3
Asked Answered
T

0

9

I followed the guide "Lint like it's 2015" and had no luck, also read on stack-overflow for a similar problem and no luck.

I can run eslint fine on the terminal, use it for a test file and showed error (on the terminal). However I just can't get it to work on ST3, it seems like my ST3 is not linting with eslint. It has no red/yellow dot on the gutter, when I use "lint this page" it showed no error (I purposely put some error).

Here's the setting for my SublimeLinter setting

{
"user": {
    "debug": false,
    "delay": 0.25,
    "error_color": "D02000",
    "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
    "gutter_theme_excludes": [],
    "lint_mode": "background",
    "linters": {
        "eslint": {
            "@disable": false,
            "args": [],
            "excludes": []
        }
    },
    "mark_style": "outline",
    "no_column_highlights_line": false,
    "passive_warnings": false,
    "paths": {
        "linux": [],
        "osx": [],
        "windows": []
    },
    "python_paths": {
        "linux": [],
        "osx": [],
        "windows": []
    },
    "rc_search_limit": 3,
    "shell_timeout": 10,
    "show_errors_on_save": false,
    "show_marks_in_minimap": true,
    "syntax_map": {
        "html (django)": "html",
        "html (rails)": "html",
        "html 5": "html",
        "javascript (babel)": "javascript",
        "php": "html",
        "python django": "python"
    },
    "warning_color": "DDB700",
    "wrap_find": true
    }
}

I installed eslint (1.7.3) globally, babel-eslint locally, .eslintrc exist on my project.

here's my .eslintrc

{
    "rules": {
        "indent": [
            2,
            "tab"
        ],
        "quotes": [
            2,
            "single"
        ],
        "linebreak-style": [
            2,
            "unix"
        ],
        "semi": [
            2,
            "always"
        ]
    },
    "env": {
        "es6": true,
        "browser": true
    },
    "extends": "eslint:recommended",
    "ecmaFeatures": {
        "jsx": true,
        "experimentalObjectRestSpread": true
    },
    "plugins": [
        "react"
    ],
    "parser": "babel-eslint"
}

I did installed the package sublimelinter-contrib-eslint

edit: here's my console output:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 304, in on_activated
    callback.on_activated(v)
  File "/Users/Jim/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/sublimelinter.py", line 279, in on_activated
    self.check_syntax(view)
  File "/Users/Jim/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/sublimelinter.py", line 206, in check_syntax
    Linter.assign(view, reset=True)
  File "/Users/Jim/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/linter.py", line 745, in assign
    linter = linter_class(view, syntax)
  File "/Users/Jim/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/node_linter.py", line 56, in __init__
    self.read_manifest(path.getmtime(self.manifest_path))
  File "/Users/Jim/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/node_linter.py", line 227, in read_manifest
    self.cached_manifest = json.load(codecs.open(self.manifest_path, 'r', 'utf-8'))
  File "./json/__init__.py", line 274, in load
  File "./json/__init__.py", line 319, in loads
  File "./json/decoder.py", line 352, in decode
  File "./json/decoder.py", line 368, in raw_decode
  File "./json/scanner.py", line 38, in _scan_once
  File "./json/decoder.py", line 198, in JSONObject
  File "./json/scanner.py", line 38, in _scan_once
  File "./json/decoder.py", line 220, in JSONObject
ValueError: Expecting property name enclosed in double quotes: line 11 column 9 (char 284)

did a search and seems it could lead to package.json setup, so here's my package.json, which I don't think there's a problem:

{
    "name": "my-project",
    "version": "1.0.0",
    "private": "true",
    "dependencies": {},
    "devDependencies": {
        "babel-eslint": "^4.1.3",
        "eslint": "^1.7.3",
        "eslint-plugin-react": "^3.6.3",
        "gulp": "~3.8.8",
        "gulp-sass": "~2.0.1",
        "gulp-webserver": "~0.9.1"
    }
}

thanks for any suggestions / help

Tuttle answered 30/10, 2015 at 8:28 Comment(6)
SublimeLinter has a "debug mode" that you can turn on. (Tools->Sublime Linter->Debug Mode). Once enabled, open up the ST console (control ~) on a Mac, and then open up a test file and see what about shows up. You should see text such as SublimeLinter: eslint: blah blah blah. Hopefully that will give you some more info as nothing is jumping out at me as wrong just looking at your configs.Fulminate
thanks for the suggestion, however, I have no idea what went wrong / how to fix itTuttle
now that I'm narrow downed to project specific error, which means It eslint worked on other projects, but not on certain project. I'm wonder if this has something to do with package.json or other project specific file? any suggestion?Tuttle
make sure to check for an .eslintrc and .eslintignore files. What does the debugger say when you open a file in the project?Fulminate
thanks, Rob, the error is still the same as I posted in the original question (edited part), and I don't have any .eslintignore filesTuttle
Hmm, weird, try installing babel-eslint globallyFulminate

© 2022 - 2024 — McMap. All rights reserved.