Possible improvements [config-typescript]
developer239 opened this issue ยท 3 comments
Hello ๐
last update.
Missing rules:
- @typescript-eslint/ban-ts-ignore warn (funny how I set everything to error but I leave this as warn isn't it? ๐ ๐)
- @typescript-eslint/camelcase warn (I would love to set this as an error but apollo code gen...)
- @typescript-eslint/class-name-casing error
- generic-type-naming error [major] (this one is deprecated I will investigate
naming-convention
but this is one of my favorite finds ๐) - @typescript-eslint/no-magic-numbers warn (I turned this off because it was impossible to use it in existing projects it might be interesting to set this to warn for new projects ๐ )
Missing plugins:
- eslint-plugin-unused-imports (this thing is amazing ๐)
Missing rules from missing plugins:
- unused-imports/no-unused-imports 0
- unused-imports/no-unused-imports-ts 2
- unused-imports/no-unused-vars
- unused-imports/no-unused-vars-ts
Rules that I would change:
- @typescript-eslint/array-type error, array
- @typescript-eslint/await-thenable error
- @typescript-eslint/no-floating-promises error (very useful rule that forces to catch errors or use await for promises)
- @typescript-eslint/no-for-in-array 0
- @typescript-eslint/no-misused-new error
- no-misused-promises error
- @typescript-eslint/no-parameter-properties 0 (important in nest.js)
- @typescript-eslint/no-this-alias error
- @typescript-eslint/no-unnecessary-qualifier error
- @typescript-eslint/no-unnecessary-type-assertion error
- @typescript-eslint/no-unused-vars 0 (I think this needs to be off for the plugin to work)
- @typescript-eslint/promise-function-async 0
- @typescript-eslint/require-await error ๐
- @typescript-eslint/restrict-template-expressions 0
- @typescript-eslint/prefer-function-type error
- @typescript-eslint/prefer-includes error
- @typescript-eslint/prefer-nullish-coalescing error (autofixable)
- @typescript-eslint/prefer-optional-chain error (autofixable)
- @typescript-eslint/prefer-string-starts-ends-with error
For fun:
- @typescript-eslint/no-explicit-any 0 (I have this one off ๐ )
- explicit-function-return-type 0 (actually I turned this off ๐)
- @typescript-eslint/explicit-member-accessibility 0 (I turned this off as well ๐ฎ)
Two new errors for me. ๐
Woah, what a ride! Great suggestions again @developer239
Missing rules
- @typescript-eslint/ban-ts-ignore warn
- redundant with
'@typescript-eslint/ban-ts-comment': 'warn'
- redundant with
- @typescript-eslint/camelcase warn
- agree!
- @typescript-eslint/class-name-casing error
- agree,
warn
at least
- agree,
- generic-type-naming error [major]
- agree,
warn
at least
- agree,
- @typescript-eslint/no-magic-numbers warn
- agree, but I would suggest to turn
ignoreEnums: true
because I don't see a reason why this should be considered as "bad" to put numbers in Enums
- agree, but I would suggest to turn
Missing plugins
Already discussed in #95
Change proposals
-
@typescript-eslint/array-type error, array
- warn should be enough
- I would also vote for
array
instead ofarray-simple
-
@typescript-eslint/await-thenable error
- agree
-
@typescript-eslint/no-floating-promises error
- warn should be enough
-
@typescript-eslint/no-for-in-array 0
- ๐คทโโ๏ธ
-
@typescript-eslint/no-misused-new error
- warn should be enough, although
error
might do the thing
- warn should be enough, although
-
no-misused-promises error
- agree
-
@typescript-eslint/no-parameter-properties 0 (important in nest.js)
- ๐คทโโ๏ธnot sure
-
@typescript-eslint/no-this-alias error
- ๐คagree
-
@typescript-eslint/no-unnecessary-qualifier error
- warn should be enough
-
@typescript-eslint/no-unnecessary-type-assertion error
- warn should be enough
-
@typescript-eslint/no-unused-vars 0
- I guess you reference plugin as
no-unused-imports
? - What's the behavior when there is an variable which is not used?
- I guess you reference plugin as
-
@typescript-eslint/promise-function-async 0
- ๐คทโโ๏ธnot sure
-
@typescript-eslint/require-await error
- agree
-
@typescript-eslint/restrict-template-expressions 0
- I had to adjust this one on personal projects as well as this was really annoying
- so maybe just adjust config of this one?
'warn', { allowNumber: true, },
-
@typescript-eslint/prefer-function-type error
- mhm, warn seems to be enough
-
@typescript-eslint/prefer-includes error
- warn seems enough
-
@typescript-eslint/prefer-nullish-coalescing error
- warn seems enough
-
@typescript-eslint/prefer-optional-chain error
- warn seems enough
-
@typescript-eslint/prefer-string-starts-ends-with error
- warn seems enough
Funny ones
- @typescript-eslint/no-explicit-any 0
- should remain as
warn
!
- should remain as
- explicit-function-return-type 0
- I disabled it as well ๐
- it was too annoying to write an extra
React.ReactNode
orJSX.Element
to React's function components return type
- @typescript-eslint/explicit-member-accessibility 0
- should remain as
warn
- should remain as
My Notes
- @typescript-eslint/prefer-readonly-parameter-types 0
- #96 (comment) - my comment & screenshots regarding
react/prefer-read-only-props
- #96 (comment) - my comment & screenshots regarding
- @typescript-eslint/explicit-module-boundary-types 0
- similar as explicit-function-return-type - too annoying
- @typescript-eslint/naming-convention 0
- I think I have it disabled because I was defining components via
function
and it was shouting at me because of PascalCase is not allowed for function names
- I think I have it disabled because I was defining components via
- @typescript-eslint/member-ordering
- It had conflicts with my personal ๐ordering system ๐
@xhudec Thank you for the review. It looks like we are late to the party and most of the rules that I proposed are replaced by class-name-casing
. ๐
Anyway, I created #105 with two changes. I noticed that there are some todos from @robertrossmann so I will leave warn
-> error
for later.
I believe about 95% of your pain points mentioned here have been addressed via 3c53970. ๐ ๐