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

4594 - fix unnecessary-constructor parameters for super call #4813

Conversation

@tanmoyopenroot
Copy link
Contributor

commented Jul 27, 2019

PR checklist

  • Addresses an existing issue: fixes #4594
  • enhancement
  • Includes tests
  • Documentation update

Overview of change:

Add check-super-calls option to unnecessary-constructor

{
  "rules": {
    "unnecessary-constructor": [
        true,
        { "check-super-calls": true }
    ]
  }
}

Is there anything you'd like reviewers to focus on?

Not sure if the option name check-super-calls is correct.

CHANGELOG.md entry:

[new-rule-option] check-super-calls option for unnecessary-constructor rule

Copy link
Collaborator

left a comment

A good start! 🎊
Left some comments on requested structural changes and missing test changes.

src/rules/unnecessaryConstructorRule.ts Outdated Show resolved Hide resolved
src/rules/unnecessaryConstructorRule.ts Outdated Show resolved Hide resolved
src/rules/unnecessaryConstructorRule.ts Outdated Show resolved Hide resolved
@JoshuaKGoldberg

This comment has been minimized.

Copy link
Collaborator

commented Jul 27, 2019

Looks like you have some lint failures you'll need to clean up too:

This type is not allowed in the 'if' condition because it could be undefined. Allowed types are boolean or boolean-or-undefined. (strict-boolean-expressions)
  87 | 
  88 | const isEmptyOrContainsOnlySuper = (node: ts.ConstructorDeclaration, options: Options): boolean => {
> 89 |     if (node.body) {
     |        ^
  90 |         const { unnecessarySuperCall } = options;
  91 | 
  92 |         if (!containsStatements(node.body.statements)) {
… requested code structure
@tanmoyopenroot

This comment has been minimized.

Copy link
Contributor Author

commented Jul 28, 2019

Looks like you have some lint failures you'll need to clean up too:

This type is not allowed in the 'if' condition because it could be undefined. Allowed types are boolean or boolean-or-undefined. (strict-boolean-expressions)
  87 | 
  88 | const isEmptyOrContainsOnlySuper = (node: ts.ConstructorDeclaration, options: Options): boolean => {
> 89 |     if (node.body) {
     |        ^
  90 |         const { unnecessarySuperCall } = options;
  91 | 
  92 |         if (!containsStatements(node.body.statements)) {

Done

@tanmoyopenroot

This comment has been minimized.

Copy link
Contributor Author

commented Aug 10, 2019

A good start!
Left some comments on requested structural changes and missing test changes.

Done

@tanmoyopenroot

This comment has been minimized.

Copy link
Contributor Author

commented Aug 23, 2019

@adidahiya

This comment has been minimized.

Copy link
Member

commented Sep 10, 2019

testNext failure is unreleated. I'd like to release this and improve it in future PRs if necessary

@adidahiya adidahiya merged commit b6c8b0c into palantir:master Sep 10, 2019
13 of 14 checks passed
13 of 14 checks passed
ci/circleci: testNext Your tests failed on CircleCI
Details
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: checkout-code Your tests passed on CircleCI!
Details
ci/circleci: clean-lockfile Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: test Your tests passed on CircleCI!
Details
ci/circleci: test2.1 Your tests passed on CircleCI!
Details
ci/circleci: test2.4 Your tests passed on CircleCI!
Details
ci/circleci: test2.7 Your tests passed on CircleCI!
Details
ci/circleci: test2.8 Your tests passed on CircleCI!
Details
ci/circleci: test2.9 Your tests passed on CircleCI!
Details
ci/circleci: test3.0 Your tests passed on CircleCI!
Details
ci/circleci: testRc Your tests passed on CircleCI!
Details
cla/palantir CLA signed on 2019-06-25 06:29 UTC+00:00
Details
@adidahiya adidahiya referenced this pull request Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.