-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
@stylistic/indent
: regression in 2.12.0
#633
Comments
Due to regression in `2.12.0`: eslint-stylistic/eslint-stylistic#633
Due to regression in `2.12.0`: eslint-stylistic/eslint-stylistic#633
Honestly, to me, this looks more like a fix rather than a regression. And it's indeed involved with preferences. If you prefer the old behaviour, I am up to introducing an option for that. /cc @9romise WDYT? |
I think this change should be introduced as an option and become the default in the next major version. I do understand that its a fix, but its not a fix for a recent regression and with it causing failures in ≈20% of projects that I have tested it on (not only my projects, fastify and undici as well) I think its too big of a change to introduce in a non-major version of a linting module. The fact that I had to do neostandard/neostandard#230 to avoid the regression for |
Though an option is better than nothing, as then I can at least ensure that the users of |
To me, this is indeed a fix for the option, but it’s a very old bug to trace back. We also need to consider users who have upgraded to If compatibility is necessary, I think turning |
Considering that it's been less than 3 days since release that group is still quite small Do you have any canary tests of your own to get a benchmark on how breaking it is? |
Yeah, for this case, I think it's tricky to define what is a "breaking change", especially this about stylistic. I understand your point of view, but it would be tricky for us to do it when every fix can be a breaking change, as the old eslint behavior are there for so long and baked in every project. I would try to define "breaking change" here as changes with incompatibility / changes on defaults. And would define "fix" as "things as they should be, but aren't before". Consider the code snippets below: A: payload = (serializerFn === false)
? serializeError({
error: statusCodes[statusCode + ''],
code: error.code,
message: error.message,
statusCode
}) B: payload = (serializerFn === false)
? serializeError({
error: statusCodes[statusCode + ''],
code: error.code,
message: error.message,
statusCode
}) Which one looks more "correct" to you? Or it's still about different preferences? I think both "fix" or "breaking changes" would result in the existing codebase having to make changes. As long as they didn't change the preference, it should be a command of |
Or, to add another way of thinking, do you think that the existing projects were coded like that because of
From our perspective, we are fixing a case that wasn't handled well before, considering it either a fix or feature, and releasing it as a minor. Of course, if this change causes a lot of trouble to the projects using it negatively, we are happy to revert that and figure out a smooth way. But do you think the final result is more positive or negative? |
I generally think that anything (fixes or features) that makes the default linting stricter or different is a breaking change unless it only affects rare edge cases (eg. <5% of users or something). I would only do such breaking changes if if necessitated for security reasons or to revert a very recent breaking change. (This is eg. why we decided to relax a rule in Its not a matter of whether the way is the more proper way, its about how its introduced. (I see benefits with both styles in this case, but I think I actually prefer the old way, as the double indention is a bit verbose) |
Umm, interesting...
That's a very interesting perspective. I personally think breaking change is a breaking change, no matter how much it affects. And making the linter stricter is way better than making it looser, as making it looser might end up having things sneak through without awareness. Just sharing what I thought for reference/fun :P But yeah, I think this down to different expectations/definitions between ESLint Stylistic and 👋 I'd love to hear more perspectives from different individuals/projects to make the decision about whether we should revert to the default behavior. And improve our workflow/standard. Either way, I'd be happy to introduce an option for the old behavior to make the case in |
In that Also: Its not just mine, its used by eg. fastify and undici as well |
Note: I edited my comment changing from |
No worries, my main point is that projects without lock files will possibly have their linting fail now, making all the PR:s etc there fail until I release a new version of |
One such example: voxpelli/buffered-async-iterable#40 |
@antfu I'd prefer option B in your example. Personally I prefer eslint/@Stylistic over prettier since it's a lot less opinionated and much more configurable. If there is a breaking change without the possibility of the user to opt-out it would be too opinionated. Just one more opinion though... Thanks to the whole team for their work! |
Personally, I considered the old behavior to be a bug, I’m glad it got fixed, and it took only a couple minutes to find the relevant PR in the In my opinion the impact of this is very small, especially since the rule is auto-fixable. It should take most projects only a handful of minutes to resolve this change in linting behavior. If the change were reverted now, people who’ve updated this package since yesterday and run the fix will have to change back, only to have to re-apply the change again in the future. |
After careful consideration, I consider #625 an intended fix, NOT an unexpected breaking change. Especially considering the tests are purely additive (https://github.com/eslint-stylistic/eslint-stylistic/pull/625/files#diff-8db334dbea6f7708da212dad8b3a868ff569b0b0980b617ab5f52bebcf6eec4a), meaning that we neither documented the previous behavior, nor had that in our test spec (if we even consider tests as part of our docs). Also, if taking our docs' examples into account, I believe the new version makes the behavior more consistent. Thus I don't think we should revert that change. To resolve the concerns of this thread, I created #636 that introduces an additional option to opt-in back the previous behaviors, as the comments above show this could be involved with preferences. Will have this open while longer for more feedback. If there is no strong objection from the team members, I am planning to release a new version with #636 in two days. |
It’s hard to define a breaking change for Coming back to this specific issue, the change affects how function calls are handled compared to arrow functions, objects, etc. when the If the old style is preferred,
Judging whether something is a breaking change purely based on the number of downstream users it affects feels a bit one-sided to me, as it also entirely depends on their ESLint configurations and coding styles. |
Lets add some historic context: When ESLint 7.19.0 was released Jan 31, 2021, that regressed the behavior from A to B in a minor release, breaking eg. It was reported as a regression to ESLint in eslint/eslint#14058 (with me commenting in eslint/eslint#14058 (comment)) but with no action from the ESLint team until they closed it because they deprecated the style rules: eslint/eslint#14058 (comment) Now almost 4 years later and at least two major versions later the regression is fixed in a minor release, yet again breaking eg. So this is the second time that If the regression had been fixed in a timely manner it wouldn't have been a breaking change, but fixing it now 4 years later is as disruptive as the regression itself originally was.
This is a false dichotomy – something can be a correct fix and yet still be a breaking change.
So if ones code has a pattern that's not covered by the current test cases and documentation, then one should accept that ones linting may break with any new release of
This is good, but it should be an opt-out rather than an opt-in. This enables
Yes, so fixing regressions in a timely manner is key. Not fixing them 4 years later to repeat the same disruption that the original regression caused.
This is an unfair representation of my comment:
It all comes down to what constitutes "documented behavior":
If the documentation says that it should return
When it comes to |
I tried my best to relate to your use case and worked to find a middle ground so both ESLint Stylistic and your project could move on. It's ok for different projects to have different policies and versioning. I respect your choice so I brought the option that makes your maintenance a bit easier. I am once again sorry if this change caused any inconvenience to you, but please also understand this world is not only black and white. I would wish we could use more friendly words to communicate in the future. |
I'm simply struggling in finding what the difference in policy is. Is the following your policy?
|
I think the policy being applied here is more fairly expressed along the lines of
As @9romise pointed out,
Do you think all user-visible changes to linting behavior should be kept out of minor versions? Where do you draw the line for what’s “too breaking”? |
@controversial That more fair expression relies on a definition of what constitutes
I think that everything that causes code that previously passed linting to no longer pass linting should be restricted to major releases unless the rule is so broken that no sensible code will ever pass it. As shown in this thread its not clear that the result in A is unintended – some even prefers it over B. |
This is a discussion more suitable for other mediums though such as blogs (or Bluesky as preferred by eg. @antfu), so lets move it away from here. As a closing note though: To help |
Obviously, some people also believe that this is the correct fix. You have always emphasized "break". So, in your opinion, does any update to an ESLint plugin that causes users to fail linting count as a "break"? If fixing the erroneous logic in a rule is also considered a "break", the work of the ESLint plugin will be difficult to continue. Rules are designed to find and fix problems. When a rule itself has a bug, how do you think we can fix it without breaking the original linting results? |
I think I answered this here? #633 (comment)
For style linting, it's to find and enforce a specific coding style, not to find and enforce problematic logic.
You can:
|
Validations
Describe the bug
In the PR that updates
neostandard
to^2.12.0
neostandard/neostandard#228 the canary tests are failing for 5 out of 26 users ofneostandard
, probably due to #625 / #621. The failing ones are:A failure rate of ≈20% is too high for a bug fix I think, so my suggestion is to revert and/or fix #625.
Until that I will pin
neostandard
to2.11.0
.Examples of failures:
It wants eg this in voxpelli/buffered-async-iterable:
To instead be this:
And eg this in fastify/fastify:
To instead be this:
Reproduction
neostandard/neostandard#228
Contributes
The text was updated successfully, but these errors were encountered: