Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/rules/template-quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ module.exports = {
{
oneOf: [
{ enum: ['double', 'single'] },
// `false` as the root config disables the rule, matching upstream
// ember-template-lint which accepts `[rule, false]` as a valid
// disabled state without schema errors.
{ type: 'boolean', enum: [false] },
{
type: 'object',
required: ['curlies', 'html'],
Expand All @@ -49,7 +53,8 @@ module.exports = {
create(context) {
const rawOption = context.options[0];

if (rawOption === undefined) {
// Disabled when options omitted or explicitly set to `false`.
if (!rawOption) {
return {};
}

Expand Down
9 changes: 9 additions & 0 deletions tests/lib/rules/template-quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ const validHbs = [
code: '<input type=\'checkbox\'> {{hello "test" x="test"}}',
options: [{ curlies: 'double', html: 'single' }],
},
// `false` as the root config disables the rule (matches upstream).
{
code: "{{component \"test\"}} {{hello x='test'}} <input type='checkbox'>",
options: [false],
},
{
code: '{{component \'test\'}} <input type="checkbox">',
options: [false],
},
];

const invalidHbs = [
Expand Down
Loading