-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect linting of .gjs
files with <template>
ttags
#268
Comments
In prettier v3, Thing is, there is an issue opened in prettier-synchronized: it doesn't support Prettier plugins. This was okay until we need to support the new prettier-plugin-ember-template-tag. To support the new prettier plugin, the dependency to prettier-synchronized needs to be removed and a workaround needs to be built. It seems the best option would be to have something similar to https://github.com/prettier/eslint-plugin-prettier/blob/v5.0.0/worker.js |
Why can't we use the async versions? Is that a limitation of ember-template-lint's plugin API? |
prettier 3.1 should have fixed this (and latest plugin), ya? |
We can't use these new async versions because of the ember-template-lint's rule API. A rule is a class with a "visitor". The visitor is a sync function. It is used to traverse the AST nodes to analyse them and / report / fix issues.
No, actually the bug fix released in 3.1 was for a different issue. This issue still remains: the prettier-synchronized package we use here doesn't support prettier plugins. So, in order to support prettier-plugin-ember-template-tag, we need to build a workaround similar to what has been done here: https://github.com/prettier/eslint-plugin-prettier/blob/v5.0.0/worker.js |
If you want a quick and efficient workaround to this issue, you can remove the dependency to ember-template-lint-plugin-prettier and modify the package.json to add two lines: "scripts": {
...
"lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
"lint:css": "stylelint \"**/*.css\"",
"lint:css:fix": "concurrently \"npm:lint:css -- --fix\"",
"lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
"lint:hbs": "ember-template-lint .",
"lint:hbs:fix": "ember-template-lint . --fix",
"lint:prettier": "prettier --check .", <-- add this line
"lint:prettier:fix": "prettier --write .", <-- add this line
...
}, |
@dcyriller Thanks! I just ended up doing that and adding prettier to CI |
I'm using the recommended prettier plugin with
.gjs
files and<template>
tags in components.The prettier rule formats the component code after the
<template>
tag.Example:
However,
ember-template-lint
with this plugin is giving a lint error and collapsing the first and last tags to the same line astemplate
which doesn't look good.The text was updated successfully, but these errors were encountered: