eslint / typescript-eslint-parser

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

[new-cap] false positives about upper camel cased decorators #569

Closed iwata closed 5 years ago

iwata commented 5 years ago

What version of TypeScript are you using? 3.1.6

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

What code were you trying to parse?

import { Vue, Component } from 'vue-property-decorator'
import Hello from './hello.vue'

@Component({
  components: {Hello}
})
export default class Header extends Vue {
   private title = ''
}

What did you expect to happen? All is good.

What happened? Error that A function with a name starting with an uppercase letter should only be used as a constructor. on @Component({...}).

kaicataldo commented 5 years ago

I don't think we'll be able to fix this in ESLint core by default, but I believe you can use capIsNewExceptions to work around this.

iwata commented 5 years ago

@kaicataldo Thanks! I'm working good.

platinumazure commented 5 years ago

I also think maybe we could consider creating a rule in eslint-plugin-typescript if this is a commonly desired behavior. In any case, I agree there isn't much we can/should do here.