Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
feat(eslint-plugin): apply final v6 changes to configs#7110
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
eb03fb4632dee06e27cfcd47cc0e97f8815380461de8855faFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -84,6 +84,7 @@ export default util.createRule<Options, MessageIds>({ | ||
| const symbol = services.getSymbolAtLocation(specifier.exported); | ||
| const aliasedSymbol = checker.getAliasedSymbol(symbol!); | ||
| // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison | ||
| if (!aliasedSymbol || aliasedSymbol.escapedName === 'unknown') { | ||
JoshuaKGoldberg marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| return undefined; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -5,7 +5,7 @@ import * as ts from 'typescript'; | ||
| import * as util from '../util'; | ||
| enum Usefulness { | ||
| Always = 'always', | ||
| Never = 'will', | ||
| Sometimes = 'may', | ||
| } | ||
JoshuaKGoldberg marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| @@ -23,7 +23,7 @@ export default util.createRule<Options, MessageIds>({ | ||
| docs: { | ||
| description: | ||
| 'Require `.toString()` to only be called on objects which provide useful information when stringified', | ||
| recommended: 'recommended', | ||
| requiresTypeChecking: true, | ||
| }, | ||
| messages: { | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -72,19 +72,24 @@ export default util.createRule<Options, MessageIds>({ | ||
| }, | ||
| defaultOptions: [ | ||
| { | ||
| allowAny: true, | ||
| allowBoolean: true, | ||
| allowNullish: true, | ||
| allowNumberAndString: true, | ||
| allowRegExp: true, | ||
Comment on lines +75 to +79 Member 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. @JoshuaKGoldberg i don't remember our discussion here - why did we turn all of the options on? MemberAuthor 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. The issue was that it was chafing a lot of users by being very strict by default. A lot of folks are intentionally e.g. logging template literal strings with various primitives inside. This does bring up the idea of having different configs in the Member 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. Your example is template strings - but this is restrict-plus-operands. So was this an accidental mix-up? MemberAuthor 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. I think it applies to both of them. I've seen both happen with users. Which is why I keep mixing them up in comments 😅 to me, they're similar -just not exactly the same- cases. Member 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. I guess the question is - why even have these turned on at all if all the options are on by default? Eg for RPO there's the following cases. Of these 16 cases the default options mean the rule only matches FOUR cases - two of which are TS already errors. So we're recommending a rule to everyone to stop them from doing: tl;dr - why are we even turning on the rules in the recommended set if they don't do anything with an overly permissive default option? MemberAuthor 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. A couple reasons swayed me:
From a performance perspective, if one of these two rules is already asking for the types of these, I some level of caching on the TypeScript side would make the other rule not a significant change. Member 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. The thing I'd point to is that we added this big caution block to the RPO docs because we didn't think people using the options was good - and yet it's the default that everyone uses these options? Just seems like we're contradicting ourselves "don't use these options but also they're all turned on by default" MemberAuthor 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. Yeah :/ agreed. I don't like this. Member 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. Personal preference: | ||
| skipCompoundAssignments: false, | ||
| }, | ||
| ], | ||
| create( | ||
| context, | ||
| [ | ||
| { | ||
| allowAny, | ||
| allowBoolean, | ||
| allowNullish, | ||
| allowNumberAndString, | ||
| allowRegExp, | ||
| skipCompoundAssignments, | ||
| }, | ||
| ], | ||
| ) { | ||
Uh oh!
There was an error while loading.Please reload this page.