Replies: 8 comments
-
Please note that this is an iterable so I cannot even use |
Beta Was this translation helpful? Give feedback.
-
I suspected this was part of your efforts against magic numbers, but even if I set the index as a const it still complains: |
Beta Was this translation helpful? Give feedback.
-
Zamiel suggested the following settings on Discord:
|
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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? |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
How am I supposed to write this?
This looks like madness to me.
Beta Was this translation helpful? Give feedback.
All reactions