This repository was archived by the owner on Jan 19, 2019. It is now read-only.
Breaking: Only add .implements/.accessibility/.decorators if "truthy" #354
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changes the way
implements
,accessibility
anddecorators
are applied.When running babylon AST comparison tests, I noticed that babylon only applies the above properties if they are "truthy" (not exactly the right way to describe it but hopefully it's clear what I mean).
For example, if there is at least one decorator on a node, there will be a
decorators
array in the AST, otherwise, there will be nodecorators
property at all.Currently in
typescript-eslint-parser
, we usually apply an empty array for thedecorators
in that case.Before reviewing and merging this PR, I would first like to confirm that this is indeed the desired behaviour, @Andy-MS?
I am personally pretty ambivalent about which makes more sense and would be keen to hear your thoughts on why you opted from leaving them out of the AST vs empty array/null value.
cc @hzoo @soda0289