Skip to content
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

chore(lint): proper formatting for control flow #3003

Open
wants to merge 1 commit into
base: rc
Choose a base branch
from

Conversation

Supamiu
Copy link
Contributor

@Supamiu Supamiu commented Aug 6, 2024

Description

Having both prettier and @angular-eslint configs for template formatting was causing conflicts and issues in the result template. Removing the angular-eslint part from settings fixed that, as well as updating lint-related deps.



@Supamiu Supamiu added the 🔨 Technical Doesn't affect the output (refactor, dependencies update, cleaning, etc.) label Aug 6, 2024
@Supamiu Supamiu requested a review from a team as a code owner August 6, 2024 07:58
@LuccaIntegration
Copy link

@CCNET-iLucca
Copy link

Tests d'interfaces

@Supamiu Supamiu changed the title chore(lint): let prettier config handle template formatting alone chore(lint): proper formatting for control flow Aug 6, 2024
ng add @angular-eslint/schematics just does the job !
@Supamiu Supamiu force-pushed the chore/template-control-flow-lint branch from 4e9f64d to fd1bb9a Compare August 6, 2024 08:07
@Supamiu Supamiu requested a review from a team as a code owner August 6, 2024 08:07
@LuccaIntegration
Copy link

@CCNET-iLucca
Copy link

Tests d'interfaces

],
"extends": [
"plugin:@angular-eslint/template/recommended",
"plugin:prettier/recommended"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use this exact configuration in other projects and it doesn't raise any issue. I don't understand why removing prettier/recommended here solves anything 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me neither, I tested on several files and it makes no sense.

If I add it back, the result format is derping, if I revert all the changes and exclude eslint for formatting (and thus format with only prettier), it works fine. Now if I enable prettier only in this eslint config, I get an error due to < being unexpected, showing that somehow it's considering that as a ts file???

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the problem that

  • in prettier config : .component.html and .page.html files are used with the angular parser
  • in prettier config : .html files are used with the html parser
  • in eslint config : all .html files are used with the same rules ?

Maybe there should be the same split between files in eslint config ? 🤔 and .html files would just use prettier:prettier/recommended while .component.html and .page.html files would use both angular-eslint and prettier ?

Or maybe just use .html in prettier like in the recommended config by angular eslint : https://github.com/angular-eslint/angular-eslint/blob/main/docs/CONFIGURING_ESLINTRC.md#notes-for-eslint-plugin-prettier-users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 Technical Doesn't affect the output (refactor, dependencies update, cleaning, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants