`Delete ⏎⏎⏎⏎⏎⏎⏎⏎⏎⏎⏎····················· (fixable)` always appears in test files
Closed this issue · 3 comments
ember-template-lint/ember-template-lint-plugin-prettier#168
Delete ⏎⏎⏎⏎⏎⏎⏎⏎⏎⏎⏎····················· (fixable)
Every single one of my app's test files shows this VSCode error at position [1, 1]. Clicking "fix" causes the entire test code to be laid out on a single line.
I am utilizing ember-template-lint
along with ember-template-lint-plugin-prettier
.
- Disabling
ember-template-lint-plugin-prettier
in.template-lintrc.js
makes the error go away - Disabling Unstable Ember Language Server in VSCode makes the error go away
- Deleting the tagged template literals in the tests makes the error go away
Furthermore the error only appears in VSCode's "Problems" drawer--it does not appear in the CLI after linting.
So it seems that ember-template-lint
is attempting to parse the test files because they contain snippets of HBS. But for some reason this is only happening when Unstable Ember Language Server is activated in VSCode.
Does anyone have any tips on fixing this?
DEBUG: -------------------------------
DEBUG: Ember : 3.25.4
DEBUG: Ember Data : 3.25.0
DEBUG: Ember Simple Auth : 3.1.0
DEBUG: Model Fragments : 5.0.0-beta.2
DEBUG: -------------------------------
// .template-lintrc.js
'use strict';
module.exports = {
plugins: ['ember-template-lint-plugin-prettier'],
extends: ['recommended', 'ember-template-lint-plugin-prettier:recommended'],
};
// .prettierrc.js
'use strict';
module.exports = {
singleQuote: true,
printWidth: 300,
overrides: [
{
files: '*.hbs',
options: {
singleQuote: false,
},
},
],
};
Hi @charlesfries! Could you disable this rule for /tests/ folder?
ember-template-lint could not lint hbs inside javascript/typescript,
bu UELS - able to do it, we literally extract hbs from js/ts and lint it, and we keep spaces as is in extracted hbs file
that's why you see this error only during development in vscode
Hi @lifeart thank you for the reply, Which rule do I need to disable here? VSCode does not seem to specify the exact rule name.
During some research yesterday I came across the embeddedLanguageFormatting
option in Prettier--is this the rule that's causing problems?
https://prettier.io/docs/en/options.html#embedded-language-formatting
Disabling prettier for tests fixed the issue. Here is my config file:
// .template-lintrc.js
'use strict';
module.exports = {
plugins: ['ember-template-lint-plugin-prettier'],
extends: ['recommended', 'ember-template-lint-plugin-prettier:recommended'],
overrides: [
{
files: ['**/integration/**/*-test.{js,ts}'],
rules: {
prettier: false,
},
},
],
};
For some reason passing ['tests/**/*-test.{js,ts}']
to the files property doesn't work, even though it seems like it should. Regardless, this works well enough. Thanks for your help.