helixbass / eslint-plugin-coffee

ESLint rules for linting Coffeescript source files
MIT License
24 stars 2 forks source link

Using eslint-plugin-coffee with SublimeText: it was easy! #39

Closed PatrickKing closed 4 years ago

PatrickKing commented 4 years ago

First of all, a big <3 for your work on this project!

Per the SublimeLinter-eslint docs, SublimeLinter uses the source type of the file to determine whether the file is passed to Eslint. The default selector for eslint issource.js - meta.attribute-with-value, and this can be extended to target .coffee files in exactly the way you'd expect.

From top to bottom in SublimeText:

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

Edited: This configuration works with global or local eslint, updated instructions to reflect this.

GeoffreyBooth commented 4 years ago

This would be good to add to the README.

helixbass commented 4 years ago

@PatrickKing thanks!

I just tried this out after installing Sublime Text and the one thing I ran into is that it didn't seem to want to show ESLint errors in .coffee files until I also installed the Better CoffeeScript package

Should I add that step to your instructions when adding to the README? Or is there another preferred alternative to Better CoffeeScript that would accomplish the same thing?

PatrickKing commented 4 years ago

@helixbass

You're right, I overlooked this: for Sublime to treat a file as belonging to a certain language a syntax highlighting package for it has to be installed. I don't know of any better option than BetterCoffeeScript, that probably does need to go in the instructions.

helixbass commented 4 years ago

Ok added your instructions to the README (including Better CoffeeScript step): https://github.com/helixbass/eslint-plugin-coffee/blob/master/README.md#sublime-text