eslint/typescript-eslint-parser

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

iwata opened this issue · 3 comments

iwata commented

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({...}).

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

@kaicataldo
Thanks!
I'm working good.

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.