Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linting not working when using babel-eslint on Sublime Text 3

I am trying to get babel-eslint to work on Sublime 3. I have installed:

  • eslint and babel-eslint globally on npm
  • SublimeLinter package on Sublime
  • SublimeLinter-contrib-eslint package on Sublime

Also, I have added: "syntax_map": { ... "JavaScript (Babel)": "javascript" } to my SublimeLinter.sublime-settings file.

When I run the linter with "parser": "espree" on my .eslintrc file it works fine. But when I change the parser to babel-eslint it stops working.

I tried to follow the tutorial here: https://medium.com/@dan_abramov/lint-like-it-s-2015-6987d44c5b48 and I seem to be doing everything correctly.

Any ideas on what I'm doing wrong?

like image 629
Ren Avatar asked Apr 25 '15 12:04

Ren


People also ask

Does ESLint use Babel?

ESLint allows for the use of custom parsers. When using this plugin, your code is parsed by Babel's parser (using the configuration specified in your Babel configuration file) and the resulting AST is transformed into an ESTree-compliant structure that ESLint can understand.

What is Linting in sublime text editor?

Linting is the process of checking your code for potential errors. This could be either the syntax or the code style. The linting process can be done during three stages of development: Via your editor (live linting)

What is ESLint parser?

vue-eslint-parser is the main parser to use instead of the default one ( espree ). It will handle . vue SFC files, especially the <template> tags. Within this parser, you have a custom option to specify which parser to use to lint the <script> tag in the . vue files.


1 Answers

Except what was in mentioned tutorial, what helped me was:

  • upgrade global / local eslint to latest version
  • install babel-eslint locally
  • if you are using any eslint plugins, it appears they must be also installed locally (eslint-plugin-react in my case)
  • as Dalgard mentioned you can also enable debug mode in Sublime eslint to find out what else can be wrong, i.e. incompatible versions or corrupted config.

I hope some of this will help.

like image 70
zangrafx Avatar answered Oct 08 '22 22:10

zangrafx