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

Proposal: Remove ESLint rules that conflict with Prettier #4

Open
p2edwards opened this issue Mar 18, 2023 · 0 comments
Open

Proposal: Remove ESLint rules that conflict with Prettier #4

p2edwards opened this issue Mar 18, 2023 · 0 comments

Comments

@p2edwards
Copy link
Contributor

Sometimes our ESLint config and Prettier want 2 different things.

Generally the correct thing is to run ESLint --fix first, because ESLint autofixes will sometimes leave the code indented in weird ways, and then you run Prettier. But the next time you run ESLint, it will complain about a missing comma (because Prettier happily removed it.)

export type MfaUserMethodsResponse = [
  {
    name: 'app';
    is_primary: boolean;
    is_active: boolean;
    date_created: string;
    date_modified: string;
    date_disabled: string;
  },  // ESLint disagrees with Prettier about this comma.
];

We could continue to handle these cases by trying to make Prettier and ESLint agree. But there may be value in separating concerns here.

What if we turn off all "styling" ESLint rules, and delegate this to Prettier?

  • Advantages:
    • Better signal-to-noise ratio in 'warnings'. Useful rules like no-undef stand out more.
    • Could shorten the ESLint config
  • ?
    • Editor won't bug you about things Prettier can fix on save. (But maybe this is a good thing.)

The bluntest way to do it is use prettier/eslint-config-prettier to simply override any conflicting ESLint rules, without even changing the rest of our ESLint config. The "right thing" (more work, could be a separate issue) would be to take the opportunity to shorten our ESLint config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant