-
Notifications
You must be signed in to change notification settings - Fork 2
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
Use ESLint to lint JavaScript code blocks inside .cshtml (OSOE-585) #9
Comments
I think you will get syntax errors from the Razor. Copy a script block into a JS file first to check what can you expect before investing time setting up the plugin, |
What do you mean by this:
? |
What I wrote in the previous sentence. :) I expect that you will get syntax errors in the script block if you treat cshtml as html. You can verify it by just taking the content of the script block and putting it into a JS file and running ESLint on it. Also see |
Oh, I totally forgot about code inside of script blocks, too - that'd be tricky to work around. |
Due to C# and JS being mixed, this would indeed be tricky. I think we can't realistically tackle this, rather, we should focus on having as little inline JS as possible. Serious issues also impacting runtime will then be surfaced during UI tests. |
Perhaps the html eslint plugin could be invoked by the UI test like we do with html-validate? |
Hmm, interesting, yeah, we could do that, I guess. |
Linting external JavaScript files is great, but let's also cover inline script as it's still widely used.
The
html
plugin already supports inline<script>
block inhtml
files - maybe it's enough to add.cshtml
to the list of html extensions? Maybe not.Let's try it out!
Jira issue
The text was updated successfully, but these errors were encountered: