Skip to content

Commit cda8bed

Browse files
Merge pull request #2696 from johanrd/day_fix/template-quotes
Post-merge-review: Fix template-quotes: accept boolean root config
2 parents ad97334 + 2f0dce9 commit cda8bed

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/rules/template-quotes.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ module.exports = {
2323
{
2424
oneOf: [
2525
{ enum: ['double', 'single'] },
26+
// `false` as the root config disables the rule, matching upstream
27+
// ember-template-lint which accepts `[rule, false]` as a valid
28+
// disabled state without schema errors.
29+
{ type: 'boolean', enum: [false] },
2630
{
2731
type: 'object',
2832
required: ['curlies', 'html'],
@@ -49,7 +53,8 @@ module.exports = {
4953
create(context) {
5054
const rawOption = context.options[0];
5155

52-
if (rawOption === undefined) {
56+
// Disabled when options omitted or explicitly set to `false`.
57+
if (!rawOption) {
5358
return {};
5459
}
5560

tests/lib/rules/template-quotes.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ const validHbs = [
2828
code: '<input type=\'checkbox\'> {{hello "test" x="test"}}',
2929
options: [{ curlies: 'double', html: 'single' }],
3030
},
31+
// `false` as the root config disables the rule (matches upstream).
32+
{
33+
code: "{{component \"test\"}} {{hello x='test'}} <input type='checkbox'>",
34+
options: [false],
35+
},
36+
{
37+
code: '{{component \'test\'}} <input type="checkbox">',
38+
options: [false],
39+
},
3140
];
3241

3342
const invalidHbs = [

0 commit comments

Comments
 (0)