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): [typedef] handle AssignmentPattern inside TSParameterProperty #923

Merged
merged 2 commits into from Aug 30, 2019
Merged

fix(eslint-plugin): [typedef] handle AssignmentPattern inside TSParameterProperty #923

merged 2 commits into from Aug 30, 2019

Conversation

mrmlnc
Copy link
Contributor

@mrmlnc mrmlnc commented Aug 29, 2019

What is the purpose of this pull request?

This is a potential fix for #921.

What changes did you make? (Give an overview)

The node with the TSParameterProperty type can contains the node with the AssignmentPattern type. In this case, we should check type annotations for the node with AssignmentPattern type.

class Something {
    // Works fine without `= {}`
    constructor(private readonly _options: Options = {}) {
        //         ^                 ^ AssignmentPattern
        //         | TSParameterProperty
        //                                               
    }
}

Tests cover the case when parameters are used inside the constructor.
@typescript-eslint
Copy link
Contributor

Thanks for the PR, @mrmlnc!

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

@mrmlnc mrmlnc changed the title Issue 921 fix typedef rule ISSUE-921: correctly handle AssignmentPattern inside TSParameterProperty Aug 29, 2019
@codecov
Copy link

codecov bot commented Aug 29, 2019

Codecov Report

Merging #923 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #923      +/-   ##
==========================================
+ Coverage   94.08%   94.08%   +<.01%     
==========================================
  Files         113      113              
  Lines        4916     4919       +3     
  Branches     1369     1371       +2     
==========================================
+ Hits         4625     4628       +3     
  Misses        165      165              
  Partials      126      126
Impacted Files Coverage Δ
packages/eslint-plugin/src/rules/typedef.ts 95.91% <100%> (+0.26%) ⬆️

@bradzacher bradzacher changed the title ISSUE-921: correctly handle AssignmentPattern inside TSParameterProperty fix(eslint-plugin): [typedef] handle AssignmentPattern inside TSParameterProperty Aug 29, 2019
@bradzacher bradzacher added the bug Something isn't working label Aug 29, 2019
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 doing this!

@bradzacher bradzacher merged commit 6bd7f2d into typescript-eslint:master Aug 30, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2020
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.

None yet

2 participants