Skip to content

Commit

Permalink
Disable embedded templates handling for eol-last rule
Browse files Browse the repository at this point in the history
  • Loading branch information
robinborst95 committed Mar 15, 2023
1 parent cdf677a commit 66b876e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/rules/eol-last.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import Rule from './_base.js';

export default class EolLast extends Rule {
parseConfig(config) {
if (!this.isStrictMode) {
return false;
}

let configType = typeof config;

switch (configType) {
Expand Down
15 changes: 15 additions & 0 deletions test/unit/rules/eol-last-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ generateRuleTests({
config: 'always',
template: '{{#my-component}}{{/my-component}}\n',
},
// Test that the config is ignored when the template is embedded, because this rule
// is meant for newlines at the end of files, not for templates themselves.
{
config: 'always',
template: [
"import { hbs } from 'ember-cli-htmlbars';",
'',
"test('it renders', async (assert) => {",
' await render(hbs`<img>`);',
');',
].join('\n'),
meta: {
filePath: 'layout.js',
},
},
],

bad: [
Expand Down

0 comments on commit 66b876e

Please sign in to comment.