diff --git a/lib/rules/template-quotes.js b/lib/rules/template-quotes.js index 87b24d6ec2..1a917e5f1c 100644 --- a/lib/rules/template-quotes.js +++ b/lib/rules/template-quotes.js @@ -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'], @@ -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 {}; } diff --git a/tests/lib/rules/template-quotes.js b/tests/lib/rules/template-quotes.js index 69b02909f6..9fba08c912 100644 --- a/tests/lib/rules/template-quotes.js +++ b/tests/lib/rules/template-quotes.js @@ -28,6 +28,15 @@ const validHbs = [ code: ' {{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'}} ", + options: [false], + }, + { + code: '{{component \'test\'}} ', + options: [false], + }, ]; const invalidHbs = [