eslint / typescript-eslint-parser

An ESLint custom parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.
Other
915 stars 75 forks source link

"Indent" rule throws false positives for object under ternary. #452

Closed phyllisstein closed 5 years ago

phyllisstein commented 6 years ago

What version of TypeScript are you using?

v2.8.0-rc

What version of typescript-eslint-parser are you using?

v14.0.0

What code were you trying to parse?

const firebaseApp = firebase.apps.length
  ? firebase.app()
  : firebase.initializeApp({
      apiKey: __FIREBASE_API_KEY__,
      authDomain: __FIREBASE_AUTH_DOMAIN__,
      databaseURL: __FIREBASE_DATABASE_URL__,
      projectId: __FIREBASE_PROJECT_ID__,
      storageBucket: __FIREBASE_STORAGE_BUCKET__,
      messagingSenderId: __FIREBASE_MESSAGING_SENDER_ID__,
    })

What did you expect to happen?

ESLint should not flag the object as incorrectly indented (cf. results from the standard ESLint parser).

What happened?

ESLint w/ typescript-eslint-parser flagged the object as incorrectly indented:

warning: Expected indentation of 6 spaces but found 8 (indent) at src/app/flux/lib/configure-store.ts:38:1:
  36 |     ? firebase.app()
  37 |     : firebase.initializeApp({
> 38 |         apiKey: __FIREBASE_API_KEY__,
     | ^
  39 |         authDomain: __FIREBASE_AUTH_DOMAIN__,
  40 |         databaseURL: __FIREBASE_DATABASE_URL__,
  41 |         projectId: __FIREBASE_PROJECT_ID__,
phyllisstein commented 6 years ago

👋 Any chance one of the maintainers could take a look at this one?

armano2 commented 5 years ago

issue is no longer present in v21.0.1

phyllisstein commented 5 years ago

💖Thanks for the update! I'll go ahead and close this guy.