Skip to content
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 within HTML #116

Open
strager opened this issue Dec 26, 2020 · 4 comments
Open

Lint JavaScript within HTML #116

strager opened this issue Dec 26, 2020 · 4 comments

Comments

@strager
Copy link
Collaborator

strager commented Dec 26, 2020

<script>
console.log("lint me!");
</script>
@vegerot
Copy link
Sponsor Contributor

vegerot commented Dec 29, 2020

As a minimal starting spot, will this treat every script tag as an independent source of code, or will this feature include the absurd HTML spec regarding how script tags interact? And will QLJS lint script tag attributes, or will that be left to QLHTML?

@strager
Copy link
Collaborator Author

strager commented Dec 29, 2020

As a minimal starting spot, will this treat every script tag as an independent source of code, or will this feature include the absurd HTML spec regarding how script tags interact?

Those are good questions. I haven't thought about it. We can't reasonably peer into <script src="https://..."> and see what global variables are declared for future scripts.

I guess we'd need to disable some checks (such as knowing the set of declared global variables), but otherwise, we can do all syntax checking and many semantic checks. Then we can lint the script blocks independently (maybe iN pArAlLeL).

And will QLJS lint script tag attributes

Yes.

@strager strager mentioned this issue May 22, 2021
@strager
Copy link
Collaborator Author

strager commented May 28, 2021

This might help development: https://htmlparser.info/

@strager
Copy link
Collaborator Author

strager commented Apr 26, 2022

A nice lint rule:

<form onsubmit="publish"> ... </form>

warning: missing '()' after function name in event handler (similar to #702)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants