简体   繁体   中英

How to to run eslint on *.js.erb files?

I'd like to lint the files in my rails project (ideally, in my editor while making edits) via eslint , but I am currently unable to lint files that are pre-processed with ERB.

How can I include *.js.erb files in the linting process?

You would need to run eslint with -ext js.erb flag. If your files contain more then just javascript, however, you will have to create your own plugin with processor, that would strip out everything but pure javascript and maintain source map, so that error messages can be changed to point to correct line numbers after linting. You can see more information about processors here: http://eslint.org/docs/developer-guide/working-with-plugins#processors-in-plugins

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM