-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
Remove/relax typescript-eslint/prefer-destructuring #1830
Comments
Please note that this is an iterable so I cannot even use |
Zamiel suggested the following settings on Discord:
|
I agree. You are supposed to ad-hoc disable the rule where it's not helpful. Sorry for not making this clear earlier. See new readme section: This is a quantitative consideration. Many rules are sometimes not useful and should be disabled, while in the majority of cases they are useful. Which do you think this is?
It was just the next rule to consider. |
I think that a rule can be enabled by default if it either:
While object destructuring fits in the first category array destructuring doesn't fit in either. If I have to add hundreds of overrides in my codebase the linting rules simply don't do their job well and should be split in two categories like vue does: recommended and strict. I use linting rules both as a teaching tool for junior to mid-senior developers and as a weapon to prevent type unsafe code. If there are too many exceptions the linting doesn't fulfill either role because it confuses the developers and prompts them to always ignore them without thinking. Please split your rules in two categories if this is not the path you want to follow: I've already seen too many people on Discord who maintain a set of overrides on top eslint-config-love and this is not the way you prompt adoption. |
Yes, array restructuring is not a safety rule. It's a style rule. And it has a relatively high false positive rate, I suppose. And you claim that it's not worth it. And that your students at some point are antagonized bt the number of errors. Okay. Perhaps it's appropriate to relax this rule in that project. It's a trade-off. It's a quantitative question of where the line is drawn. How is the decision made? How much feedback does it take to change a decision? How many users are in agreement with this rule config? How many aren't? Here's another idea: contribute an improvement to the rule so that it works better for everyone. For example, maybe it should only match with a reasonable number of skipped elements? |
That's exactly the point I'm trying to make. We're at a point where we're starting to pile up overrides on top of overrides and I'm the only one who is qualified to upgrade eslint-config-love because on each and every upgrade I need to review all the changes and decide if they make sense or if they throw off the developers. If I didn't review the magic numbers rule I would have found my app full of shit like: const ZERO = 0
for (const i = ZERO; i < something; i++) { Senior colleagues are already starting to mock this library calling it "A TypeScript ESLint config that hates you" and someone even suggested to switch to one of the many "sanitized" forks that are starting to pop out. That way we can still experiment with a more opinionated/bleeding edge config with potentially controversial changes and once they are baked in for a couple of months we can promote them to the recommended config where rules must meet one of the two criteria I've outline before.
The point is that such discussion shouldn't happen at this stage. Rules that reach the recommended config should be past any major controversy and some real world testing must have happened. Requiring a const to initialize a loop should never ever reach a recommended config. |
You want rules you don't agree with to never be released? I'd love to discuss that. Perhaps in #1841? If anyone wishes to discuss this particular issue further, please do so. |
How am I supposed to write this?
This looks like madness to me.
The text was updated successfully, but these errors were encountered: