-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lint JavaScript and HTML parts of ERB code #333
Comments
Maybe helpful for linting JavaScript with ESLint inside ERB files: this plugin. |
Note I've just also asked this question in the Rails forum here. |
Note: for the JS part inside
|
Looking at the Linter list, am I right that While we now have an ESLint plugin that allows us to lint |
We use better_html. |
I think that might be what I was looking for. Will give it a try in the next few days. Thank you! |
First of all, thanks a lot for your ERB lint project, we will definitely try it with our MaMpf codebase.
I just wanted to ask what setup you use at Shopify in order to autoformat and/or lint the pure JavaScript or pure HTML part of your ERB files? Ideally, for JavaScript, we'd like to run the mature ESLint. However, I've only found this StackOverflow question and the answer indicates you'd have to write your own processor to strip the Ruby parts and then create your custom source map such that the linter can still correctly identify line numbers.
While certainly doable with more research, I was wondering if this was not already a "solved problem" in the Ruby community. We cannot be the first to want to lint JavaScript in
.js.erb
and HTML code in.html.erb
files (locally as well as with a CI/CD pipeline), right?For IntelliSense to work in VSCode, I've just discovered this extension for HTML which I will give a try and also look closer into this reddit thread. If you're using VSCode: Do you have any recommendations for HTML/JS extensions such that IntelliSense works? Ideally (for our wish list), an autoformatter would format the document according to some style guide whenever you save the file.
Note I've searched for the terms "eslint", "javascript", "js", ".js.erb", "html", ".html.erb" in the issues but did not find anything relevant to my question. This issue is probably not related.
The text was updated successfully, but these errors were encountered: