-
-
Notifications
You must be signed in to change notification settings - Fork 51
feat: implement templateIndentBase option
#451
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR implements a new templateIndentBase option for the indent rule, providing more flexible indentation control for HTML in template literals. When set to "first", it bases indentation on the first HTML element in the template rather than the template tag itself, which is useful when template literals are indented at varying levels.
- Added
templateIndentBaseoption with values"templateTag"(default) and"first" - Implemented
getAutoBaseSpaces()to calculate base indentation from the first element - Updated
createIndentVisitor()to accept and apply base space offset
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/eslint-plugin/lib/rules/indent/indent.js | Implements the core logic for the new templateIndentBase option, including schema definition, base space calculation, and indentation adjustment |
| packages/eslint-plugin/tests/rules/indent.test.js | Adds comprehensive test coverage for the new option with both valid and invalid cases |
| docs/rules/indent.md | Documents the new option with clear descriptions of both "templateTag" and "first" modes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #451 +/- ##
=======================================
Coverage 98.69% 98.70%
=======================================
Files 85 85
Lines 2769 2790 +21
Branches 759 764 +5
=======================================
+ Hits 2733 2754 +21
Misses 36 36
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Checklist
Description