Skip to content
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

feat(eslint-plugin): apply final v6 changes to configs #7110

Merged

Conversation

JoshuaKGoldberg
Copy link
Member

PR Checklist

Overview

Applies the final set of changes to preset configs for v6, as discussed in #6014.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @JoshuaKGoldberg!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

@netlify
Copy link

netlify bot commented Jun 16, 2023

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit e8855fa
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/648f00b6847d080008cd23e0
😎 Deploy Preview https://deploy-preview-7110--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@codecov
Copy link

codecov bot commented Jun 16, 2023

Codecov Report

Merging #7110 (e8855fa) into v6 (89b14f2) will decrease coverage by 0.25%.
The diff coverage is 62.50%.

Additional details and impacted files
@@            Coverage Diff             @@
##               v6    #7110      +/-   ##
==========================================
- Coverage   87.75%   87.50%   -0.25%     
==========================================
  Files         372      372              
  Lines       12814    12849      +35     
  Branches     3800     3813      +13     
==========================================
- Hits        11245    11244       -1     
- Misses       1193     1227      +34     
- Partials      376      378       +2     
Flag Coverage Δ
unittest 87.50% <62.50%> (-0.25%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...eslint-plugin/src/rules/consistent-type-exports.ts 97.67% <ø> (ø)
...kages/eslint-plugin/src/rules/no-base-to-string.ts 98.38% <ø> (ø)
...t-plugin/src/rules/no-confusing-void-expression.ts 100.00% <ø> (ø)
...plugin/src/rules/no-duplicate-type-constituents.ts 100.00% <ø> (ø)
...ackages/eslint-plugin/src/rules/no-implied-eval.ts 96.92% <ø> (ø)
...plugin/src/rules/no-redundant-type-constituents.ts 92.36% <ø> (ø)
packages/eslint-plugin/src/rules/no-shadow.ts 77.65% <ø> (ø)
...-plugin/src/rules/no-unsafe-declaration-merging.ts 77.77% <ø> (ø)
...lint-plugin/src/rules/no-unsafe-enum-comparison.ts 100.00% <ø> (ø)
...lint-plugin/src/rules/prefer-nullish-coalescing.ts 96.61% <ø> (-3.39%) ⬇️
... and 12 more

... and 28 files with indirect coverage changes

@nx-cloud
Copy link

nx-cloud bot commented Jun 16, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit e8855fa. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 31 targets

Sent with 💌 from NxCloud.

@JoshuaKGoldberg JoshuaKGoldberg added this to the 6.0.0 milestone Jun 17, 2023
@JoshuaKGoldberg JoshuaKGoldberg requested a review from a team June 17, 2023 21:44
.eslintrc.js Outdated Show resolved Hide resolved
packages/eslint-plugin/src/rules/no-empty-interface.ts Outdated Show resolved Hide resolved
packages/type-utils/src/isTypeReadonly.ts Outdated Show resolved Hide resolved
packages/scope-manager/src/ScopeManager.ts Outdated Show resolved Hide resolved
packages/eslint-plugin/src/util/collectUnusedVariables.ts Outdated Show resolved Hide resolved
packages/eslint-plugin/src/rules/no-shadow.ts Outdated Show resolved Hide resolved
packages/eslint-plugin/src/rules/no-redeclare.ts Outdated Show resolved Hide resolved
@JoshuaKGoldberg JoshuaKGoldberg merged commit c13ce0b into typescript-eslint:v6 Jun 18, 2023
44 of 46 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the final-config-changes branch June 18, 2023 13:25
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 26, 2023
Comment on lines +75 to +79
allowAny: true,
allowBoolean: true,
allowNullish: true,
allowNumberAndString: true,
allowRegExp: true,
Copy link
Member

Choose a reason for hiding this comment

The 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?
I thought we discussed that turning all the rule options on was bad as it made the rule effectively useless.

Copy link
Member Author

Choose a reason for hiding this comment

The 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 strict ruleset than recommended... that would be a nice way to still get folks using the rule to its fullest if they want to be more strict. 🤔 #7318

Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Member Author

Choose a reason for hiding this comment

The 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.

Copy link
Member

Choose a reason for hiding this comment

The 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?
The rules enforce pretty nothing like this so it's just wasted lint time.

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: string + object and string + unknown. The former is also banned under no-base-to-string, and one could argue the latter should be allowed under the allowAny option.

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple reasons swayed me:

  • (lesser) There is benefit to string + unknown
  • (greater) I've seen a projects turn off no-base-to-string without turning off restrict-plus-operands

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.

Copy link
Member

Choose a reason for hiding this comment

The 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?
https://typescript-eslint.io/rules/restrict-plus-operands#:~:text=%2C%0A%5D%3B-,CAUTION,-We%20generally%20recommend

Just seems like we're contradicting ourselves "don't use these options but also they're all turned on by default"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah :/ agreed. I don't like this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personal preference:
Given this rule is really doing nothing and a lot of people don't like it - we should just undo this change and only include it in strict-type-checked

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants