-
-
Notifications
You must be signed in to change notification settings - Fork 50
feat: add enforceTemplatedAttrValue option on quotes #387
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
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 introduces a new enforceTemplatedAttrValue option to the quotes rule, allowing users to enforce quote styles on templated attribute values.
- Added support for the
enforceTemplatedAttrValueboolean option in the rule schema and implementation - Extended tests with valid and invalid cases for templated attribute values
- Updated documentation to explain and illustrate the new option
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/eslint-plugin/tests/rules/quotes.test.js | Added valid/invalid tests covering the new enforceTemplatedAttrValue behavior |
| packages/eslint-plugin/lib/rules/quotes.js | Introduced the enforceTemplatedAttrValue option and adjusted logic to respect it |
| docs/rules/quotes.md | Updated the rule description, option list, and examples to document the new option |
Comments suppressed due to low confidence (2)
docs/rules/quotes.md:37
- There isn't a matching
<!-- prettier-ignore -->for this<!-- prettier-ignore-end -->. Please remove it or add the corresponding start marker.
<!-- prettier-ignore-end -->
packages/eslint-plugin/lib/rules/quotes.js:6
- [nitpick] The name
SingleOrQuoteOptionis a bit ambiguous. Consider renaming toQuoteStyleOptionorSingleOrDoubleQuoteOptionto make it clearer that it covers both quote styles.
* @typedef {"single" | "double"} SingleOrQuoteOption
| const enforceTemplatedAttrValue = | ||
| context.options && | ||
| context.options[1] && | ||
| context.options[1].enforceTemplatedAttrValue; |
Copilot
AI
Jul 13, 2025
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.
[nitpick] You could simplify this by destructuring with a default value, e.g.: const { enforceTemplatedAttrValue = false } = context.options[1] || {}; to make the intention clearer and reduce repetitive context.options checks.
| const enforceTemplatedAttrValue = | |
| context.options && | |
| context.options[1] && | |
| context.options[1].enforceTemplatedAttrValue; | |
| const { enforceTemplatedAttrValue = false } = context.options[1] || {}; |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #387 +/- ##
=======================================
Coverage 98.36% 98.36%
=======================================
Files 81 81
Lines 2630 2635 +5
Branches 720 725 +5
=======================================
+ Hits 2587 2592 +5
Misses 43 43
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Thank you! |
Checklist
Description