prettier / eslint-config-prettier

Turns off all rules that are unnecessary or might conflict with Prettier.
MIT License
5.41k stars 254 forks source link

interface has semi-colons being removed #99

Closed mneumark closed 5 years ago

mneumark commented 5 years ago

In our codebase we do not use semi-colons. We are trying to use prettier and would like to enforce this, but we need to make an exception for TypeScript interfaces. There is no way to do this currently, and so it removes the semi-colons from our interfaces and breaks our code.

lydell commented 5 years ago

Hi!

It does not seem like your issue has anything to do with eslint-config-prettier?

I’ll try to provide some answers anyway.

You are correct that there’s no way to use --no-semi in Prettier, but still get semicolons in interfaces. If this is super important to you, you could use prettier-eslint paired with an ESLint rule that autofixes interfaces to use semicolons. You might have to write that ESLint rule first, though. I would recommend dropping your rule of “interfaces must use semicolons” and move on with more interesting stuff, though :)

breaks our code.

What do you mean? The semicolons in interfaces are optional. Removing them should not break anything.

ken0x0a commented 5 years ago

@lydell Hello, I want to share part of my configuration.

@ prettierrc

semi: false,

@ eslintrc

    '@typescript-eslint/member-delimiter-style': [
      2,
      {
        multiline: {
          delimiter: 'none',
          requireLast: false,
        },
        singleline: {
          delimiter: 'semi',
          requireLast: true,
        },
      },
    ],

By using this combination, error will never disappear.

But, this part singleline: { requireLast: true } is very important to not break code when autofix, So, I also want to disable only semi rule from prettier.

Is it possible? or I want this feature!

ken0x0a commented 5 years ago

@mneumark Would you share your details?