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

[indent] Forbidden to use spaces when declaring a custom type with several types #632

Closed
a-tarasyuk opened this issue Jun 21, 2019 · 3 comments
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@a-tarasyuk
Copy link
Contributor

Repro

{
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "sourceType": "module",
        "project": "./tsconfig.json"
    },
    "plugins": [
        "@typescript-eslint",
    ],
    "rules": {
        "indent": "off",
        "@typescript-eslint/indent": ["error", 4, {
            "SwitchCase": 1
        }],
    }
}
export type ProjectServiceEvent = LargeFileReferencedEvent
   | ProjectsUpdatedInBackgroundEvent
   | ProjectLoadingStartEvent
   | ProjectLoadingFinishEvent
   | ConfigFileDiagEvent
   | ProjectLanguageServiceStateEvent
   | ProjectInfoTelemetryEvent
   | OpenFileInfoTelemetryEvent;

Expected Result
No indent error should keep the indentation of 4 spaces.

Actual Result
Expected indentation of 0 spaces but found 4.

Versions

package version
@typescript-eslint/eslint-plugin 1.10.2
@typescript-eslint/parser 1.10.2
TypeScript 3.5.2
ESLint 5.16.0
node 8.15.0
npm 6.4.1
@a-tarasyuk a-tarasyuk added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Jun 21, 2019
@j-f1 j-f1 added bug Something isn't working and removed triage Waiting for maintainers to take a look labels Jun 21, 2019
@j-f1
Copy link
Contributor

j-f1 commented Jun 21, 2019

You might be able to fix this by putting the first type reference onto the next line and adding a | in front of it, which is syntactically valid.

@j-f1
Copy link
Contributor

j-f1 commented Jun 21, 2019

I still think that this is a bug which should be fixed.

@j-f1 j-f1 reopened this Jun 21, 2019
@bradzacher
Copy link
Member

Duplicate of #121

This requires the indent rewrite to handle, because by default eslint completely ignores the indentation of binary operations.

@j-f1 j-f1 added duplicate This issue or pull request already exists and removed bug Something isn't working labels Jun 21, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

3 participants