-
-
Notifications
You must be signed in to change notification settings - Fork 52
docs: add docs for using HTML ESLint with other HTML-processing plugins #435
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
Conversation
Co-authored-by: yeonjuan <41323220+yeonjuan@users.noreply.github.com>
Co-authored-by: yeonjuan <41323220+yeonjuan@users.noreply.github.com>
.cspell.json
Outdated
| "controlslist", | ||
| "describedby" | ||
| "describedby", | ||
| "eslinthtml", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type: Suggestion ➕
1. Suggestion
I suggest using file names like eslint-html and eslint-js instead of eslinthtml and eslintjs, respectively.
2. The reason for the suggested changes
File names like eslintjs and eslinthtml are anti-patterns for spell checkers. Spell checkers don’t recognize two different words in eslintjs and eslinthtml, and users need to add eslintjs and eslinthtml to the list of exceptions. On the other hand, good spell checkers like CSpell should recognize two different words in eslint-html, eslint_html, and eslintHtml.
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kristinita Thanks! I made the following changes
eslinthtml->eslint-htmleslint-js->eslint
|
The content does not seem to be an appropriate solution. I will create a separate pull request myself. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #435 +/- ##
=======================================
Coverage 98.71% 98.71%
=======================================
Files 85 85
Lines 2810 2810
Branches 772 772
=======================================
Hits 2774 2774
Misses 36 36
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Users need to configure HTML ESLint alongside other plugins like
eslint-plugin-htmlto lint both HTML syntax and inline JavaScript, but ESLint's parser architecture prevents using both in a single config file. This creates confusion and undocumented workarounds.Changes
Documentation
docs/using-with-other-plugins.mdexplaining the parser conflict and solutionIntegration
Example Configuration
Run both:
eslint --config eslinthtml.config.mjs "**/*.html" && eslint --config eslintjs.config.mjs "**/*.html"Resolves #108, #211
Original prompt
This section details on the original issue you should resolve
<issue_title>feature_request(docs): configuring HTML ESLint with other plugins for HTML files</issue_title>
<issue_description>Related issues — #108, #211
1. Summary
It would be helpful if HTML ESLint documentation will contain information on how users should configure HTML ESLint if they use other ESLint plugins for HTML files like eslint-plugin-html.
2. Argumentation of the need of the documentation improvements
I created the additional configuration file
eslinthtml.config.mjsfor HTML ESLint and additionally need launching ESLint with the argument--config—eslint --config eslinthtml.config.mjs. I can’t configure HTML ESLint and eslint-plugin-html both in a single fileeslint.config.mjs. Due to the ESLint discussion #18808 opened by @yeonjuan and issues #14286 and #17655 it’s not possible and not planned. If it’s possible, please show me what I need to change in my MCVE (the item 4.3.1 of this issue).Whether it’s possible or not, setting the HTML ESLint configuration may take a lot of time. Documentation improvements can significantly reduce the time needed for setting.
3. MCVE
3.1. Installation
3.2. HTML file for testing
KiraExample.html:4. Configurations
4.1. Solely for HTML ESLint
4.1.1. Configuration file
eslinthtml.config.mjs:4.1.2. CLI command
4.1.3. Behavior
Expected. ESLint returns HTML ESLint’s errors.
4.2. Solely for eslint-plugin-html
4.2.1. Configuration file
eslintjs.config.mjs:4.2.2. CLI command
4.2.3. Behavior
Expected. ESLint returns JavaScript errors in the HTML file.
4.3. Merged configuration
4.3.1. Configuration file
eslint.config.mjs: