How would I get SublimeLinter to lint a file such as .babelrc (json or js). The "lint this view" option is greyed out.
Here's my user config: https://gist.github.com/86355281aca4d4fba941
SublimeLinter
linters only work on files that have a defined syntax applied, which is recognized by the linter via the "syntax_map"
setting and the syntax
variable assigned in the linter's linter.py
file. So, for example, SublimeLinter-eslint
defines syntax
as ('javascript', 'html', 'javascriptnext', 'javascript (babel)', 'javascript (jsx)', 'jsx-real')
, meaning it will only work on files whose syntax maps to one of those values. Unfortunately, there is no setting in SublimeLinter that allows you to pass a list of file extensions to be linted; everything works by syntax.
The long and short of it is that you'll need to assign a JavaScript syntax to each file you want to lint. This is pretty straightforward: just open a .babelrc
file, change the syntax to JavaScript, then select View -> Syntax -> Open all with current extension as... -> JavaScript -> JavaScript
. This will create a file JavaScript.sublime-settings
in your Packages/User
directory with the following contents:
{
"extensions":
[
"babelrc"
]
}
You can then edit this file and add any other extensions you wish, and when you open them in Sublime they'll automatically be assigned the JavaScript syntax, and you'll be able to lint them.