-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gm/update-base-and-readme #32
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,32 @@ export default tsEslint.config( | |
"@typescript-eslint/consistent-type-exports": "error", | ||
"@typescript-eslint/no-import-type-side-effects": "error", | ||
"@typescript-eslint/consistent-type-imports": "error", | ||
"@typescript-eslint/use-unknown-in-catch-callback-variable": "off", | ||
"@typescript-eslint/restrict-template-expressions": [ | ||
"error", | ||
{ | ||
allowAny: true, | ||
allowBoolean: true, | ||
allowNullish: false, | ||
allowNumber: true, | ||
allowRegExp: true, | ||
}, | ||
], | ||
Comment on lines
+38
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This rule I catches some nice little bugz that happen inside template literals, like Template literals will call the I kept the `error with item id: ${item?.id ?? "<item not found>"}` https://typescript-eslint.io/rules/restrict-template-expressions/ |
||
"@typescript-eslint/no-confusing-void-expression": [ | ||
"error", | ||
{ | ||
ignoreArrowShorthand: true, | ||
ignoreVoidOperator: true, | ||
}, | ||
], | ||
Comment on lines
+48
to
+54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I started my journey here without the overrides. And then like 50 files in... it started to feel a bit overboard... The core of this rule supports lots of good patterns, but for these 2 overrides, i feel like I'm comfortable not going all the way. This means, we can still: <button onClick={() => console.log("🎉")} /> https://typescript-eslint.io/rules/no-confusing-void-expression/ |
||
"@typescript-eslint/no-unused-expressions": [ | ||
"error", | ||
{ | ||
allowShortCircuit: true, | ||
allowTernary: true, | ||
enforceForJSX: true, | ||
}, | ||
], | ||
Comment on lines
+55
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, this one was a bit funky. Essentially it is trying to protect you from misunderstanding function calls, but it went a little far. They provided the above overrides, which maintained our current coding style, while adding som protection when you actually do something wrong. https://eslint.org/docs/latest/rules/no-unused-expressions#options |
||
}, | ||
languageOptions: { | ||
globals: { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things I think are true:
unknown
Things I want to be true:
then().catch()
(it does not yet)Therefore, I don't think this rule is important enough (and i don't feel like making that many code changes to support it 😬 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't say I've encountered this but your answer seems reasonable to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TS made the unknown thing a default a bit ago, and I got wrecked with a refactor of tons of tiny changes from
any
tounknown
. But apparently, that was only for try/catch, not then().catch()So we wait on...