blakeembrey / tslint-config-standard

A TSLint config for JavaScript Standard Style
Other
358 stars 43 forks source link

Abstract class shouldn't error for empty methods #19

Closed quantuminformation closed 7 years ago

quantuminformation commented 7 years ago

image

image

blakeembrey commented 7 years ago

Sounds like an issue for the rules repo?

quantuminformation commented 7 years ago

Which one is that?

blakeembrey commented 7 years ago

Probably https://palantir.github.io/tslint/rules/no-empty/ - you can use a comment for now. Not sure what the behaviour compared to ESLint is here.

quantuminformation commented 7 years ago

Well I doubt there is one, since there is no abstract class. Would be tricky to implement a layer on top just for TS too I think.

blakeembrey commented 7 years ago

I realise. You could compare the configuration that exists, there's likely a case for finer grain configuration in the rules. From what I can tell, ESLint separates it into block and function checks (http://eslint.org/docs/rules/no-empty and http://eslint.org/docs/rules/no-empty-function). Maybe it's something to propose into one of the rule repos? Unless you have a suggestion for this repo, I'll close it in favour of an issue in either ESLint rules or TSLint. Feel free to link it back here for context 😄

blakeembrey commented 7 years ago

I'd say make an issue in https://github.com/buzinas/tslint-eslint-rules to be more specific and similar to ESLint's built-in rules and make a second issue in TSLint itself - it seems like an oversight to not support abstract methods (via configuration or by default).

blakeembrey commented 7 years ago

Also, there weren't any line numbers so I couldn't really tell if some code was hidden or not (you should consider using markdown code blocks to make it easier). But I think you may have been using the method incorrectly too - why not mark the method as abstract so it doesn't need a body at all? An abstract class can still have normal or abstract methods.

quantuminformation commented 7 years ago

Thanks, just using abstract draw (canvas: CanvasRenderingContext2D) fixes it for me!