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

fix(eslint-plugin): [member-delimiter-style] correct invalid fix for multiline with params on the same line #3177

Merged

Conversation

tanohzana
Copy link
Contributor

Everything was explained here: #2982

The rule would produce invalid code when trying to fix it.

Fixes #2982

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @tanohzana!

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. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@tanohzana tanohzana changed the title fix(eslint-plugin): member-delimiter-style should not fix code when semi creates error in multiline fix(eslint-plugin): [member-delimiter-style] should not fix code when semi creates error in multiline Mar 12, 2021
@codecov
Copy link

codecov bot commented Mar 12, 2021

Codecov Report

Merging #3177 (4697939) into master (e3a3ea0) will decrease coverage by 0.00%.
The diff coverage is 94.44%.

@@            Coverage Diff             @@
##           master    #3177      +/-   ##
==========================================
- Coverage   92.91%   92.91%   -0.01%     
==========================================
  Files         316      316              
  Lines       10818    10829      +11     
  Branches     3059     3062       +3     
==========================================
+ Hits        10052    10062      +10     
  Misses        342      342              
- Partials      424      425       +1     
Flag Coverage Δ
unittest 92.91% <94.44%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
.../eslint-plugin/src/rules/member-delimiter-style.ts 94.28% <94.44%> (-0.63%) ⬇️

@bradzacher bradzacher added the bug Something isn't working label Mar 12, 2021
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

there are a lot of changes here which seem to go further than fixing the bug.
could you please detail why you've removed an option from the rule to fix the bug?

Comment on lines 5 to 8
import {
RuleFix,
RuleFixer,
} from '@typescript-eslint/experimental-utils/src/ts-eslint';
Copy link
Member

Choose a reason for hiding this comment

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

don't add deep imports on /src from plugins.
This is availaible on the TSESLint export of @typescript-eslint/experimental-utils

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed here: a27e2e3

Comment on lines 86 to 88
multilineDetection: {
enum: ['brackets', 'last-member'],
},
Copy link
Member

Choose a reason for hiding this comment

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

why have you removed this from the schema entirely?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed here: 75e83de

@@ -21,14 +28,26 @@ type Config = BaseOptions & {
typeLiteral?: BaseOptions;
interface?: BaseOptions;
};
multilineDetection?: 'brackets' | 'last-member';
Copy link
Member

Choose a reason for hiding this comment

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

why have you removed this option entirely?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed here: e5353a9

@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Mar 15, 2021
@tanohzana
Copy link
Contributor Author

Sorry for the unneeded changes, I had differences between the version I cloned a few weeks ago and the new one. But all should be fixed now

@bradzacher bradzacher removed the awaiting response Issues waiting for a reply from the OP or another party label Mar 18, 2021
@tanohzana tanohzana requested a review from armano2 March 21, 2021 15:55
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for working on this!

@bradzacher bradzacher changed the title fix(eslint-plugin): [member-delimiter-style] should not fix code when semi creates error in multiline fix(eslint-plugin): [member-delimiter-style] correct invalid fix for multiline with params on the same line Mar 21, 2021
@bradzacher bradzacher merged commit 7ad343b into typescript-eslint:master Mar 21, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[member-delimiter-style] member-delimiter-style autofixer produces invalid code with {delimiter: 'none'}
3 participants