Skip to content

feat(eslint-plugin): removed value from abstract property nodes #3765

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

Conversation

JoshuaKGoldberg
Copy link
Member

Continues #3606 by removing the value for TSAbstractClassProperty nodes.

There are a few places that check for that member so I figured it's probably reasonable to go the extra mile.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @JoshuaKGoldberg!

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.

@JoshuaKGoldberg JoshuaKGoldberg force-pushed the abstract-property-no-initializer branch from 03e02ce to 8354f15 Compare August 21, 2021 17:34
@bradzacher bradzacher added this to the 5.0.0 milestone Aug 21, 2021
@bradzacher bradzacher added the AST PRs and Issues about the AST structure label Aug 21, 2021
@JoshuaKGoldberg JoshuaKGoldberg force-pushed the abstract-property-no-initializer branch from 8354f15 to 72dd026 Compare August 21, 2021 17:58
@bradzacher bradzacher changed the base branch from master to v5 August 21, 2021 22:12
@bradzacher bradzacher added the breaking change This change will require a new major version to be released label Aug 21, 2021
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.24 to 27.0.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

---
updated-dependencies:
- dependency-name: "@types/jest"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@JoshuaKGoldberg JoshuaKGoldberg force-pushed the abstract-property-no-initializer branch from 72dd026 to 714266f Compare August 22, 2021 17:35
@codecov
Copy link

codecov bot commented Aug 22, 2021

Codecov Report

Merging #3765 (6f1c9fd) into v5 (e80056f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##               v5    #3765   +/-   ##
=======================================
  Coverage   92.57%   92.58%           
=======================================
  Files         325      327    +2     
  Lines       11283    11294   +11     
  Branches     3181     3183    +2     
=======================================
+ Hits        10445    10456   +11     
  Misses        384      384           
  Partials      454      454           
Flag Coverage Δ
unittest 92.58% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...plugin/src/rules/explicit-module-boundary-types.ts 89.47% <ø> (ø)
packages/typescript-estree/src/convert.ts 98.28% <ø> (+<0.01%) ⬆️
packages/visitor-keys/src/visitor-keys.ts 100.00% <ø> (ø)
...ackages/eslint-plugin/src/rules/member-ordering.ts 93.12% <100.00%> (+0.05%) ⬆️
...kages/scope-manager/src/referencer/ClassVisitor.ts 92.03% <100.00%> (+0.07%) ⬆️
packages/eslint-plugin/src/rules/semi.ts 92.85% <0.00%> (ø)
packages/eslint-plugin/src/rules/indent.ts 92.85% <0.00%> (ø)
packages/eslint-plugin/src/rules/quotes.ts 89.47% <0.00%> (ø)
packages/eslint-plugin/src/rules/typedef.ts 96.05% <0.00%> (ø)
packages/typescript-estree/src/node-utils.ts 97.83% <0.00%> (ø)
... and 122 more

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review August 22, 2021 17:59
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.

Hmm - I wonder - instead of removing the property altogether, do we instead want to just set value: null?
I'm trying to figure out if it's better to make the AST nodes different shapes or not.

We will want to switch ClassProperty to PropertyDefinition to match the ESTree spec for the next version.
So it stands to reason that we'd also rename TSAbstractClassProperty to TSAbstractPropertyDefinition to match.

However - I wonder - do we want to keep that node still?
Or do we want to just add a modifier boolean on to PropertyDefinition?

I'm not entirely sure which is the 100% correct thing to do.
I'm guessing that it's probably better to keep them split as it means it's trivial for existing rules to not false-positive match on them.

Hmmmmmmmmmmm.

I think for now - what we should do is leave the value property on TSAbstractClassProperty and just set it to be "always null". The benefit of this change is that you can iterate through the similar nodes (props and abstract props) without doing if (node.type === 'ClassProperty') { // use node.value }

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.

two small comments - otherwise lgtm - thanks for doing this!

@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Aug 28, 2021
@bradzacher bradzacher removed the awaiting response Issues waiting for a reply from the OP or another party label Aug 28, 2021
@bradzacher bradzacher merged commit 69aebba into typescript-eslint:v5 Aug 28, 2021
@JoshuaKGoldberg
Copy link
Member Author

Ah, thanks - I didn't end up having time to get to the changes this week. Much appreciated!

@JoshuaKGoldberg JoshuaKGoldberg deleted the abstract-property-no-initializer branch August 29, 2021 22:57
bradzacher added a commit that referenced this pull request Sep 3, 2021
* chore: bump @types/jest from 26.0.24 to 27.0.1 (#3748)

Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.24 to 27.0.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

---
updated-dependencies:
- dependency-name: "@types/jest"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: address comments

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Brad Zacher <brad.zacher@gmail.com>
bradzacher added a commit that referenced this pull request Sep 21, 2021
* chore: bump @types/jest from 26.0.24 to 27.0.1 (#3748)

Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.24 to 27.0.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

---
updated-dependencies:
- dependency-name: "@types/jest"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: address comments

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Brad Zacher <brad.zacher@gmail.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AST PRs and Issues about the AST structure breaking change This change will require a new major version to be released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants