Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

fix: Making sure union type stringification respects compact flag #199

Merged
merged 1 commit into from
Oct 28, 2017

Conversation

mitermayer
Copy link
Contributor

@mitermayer mitermayer commented Sep 18, 2017

All other types on stringifyImpl currently supports the compact flag but UnionType.

Currently regardless of the compact flag Uniontypes are printed as

A|B|C

This PR adds support for printing as:

A | B | C 

fixes: #200

@jsf-clabot
Copy link

jsf-clabot commented Sep 18, 2017

CLA assistant check
All committers have signed the CLA.

@@ -237,7 +237,7 @@ describe('Expression', function () {
type: doctrine.Syntax.NameExpression,
name: 'Number'
}]
}).should.equal('(String|Number)');
}, {compact: false }).should.equal('(String | Number)');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I modified this line of code to make this test more explicit on the flag that has been used

@@ -248,7 +248,7 @@ describe('Expression', function () {
type: doctrine.Syntax.NameExpression,
name: 'Number'
}]
}, { topLevel: true }).should.equal('String|Number');
}, { topLevel: true, compact: true }).should.equal('String|Number');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have also explicitly set the compact flag to true on this test to assure that the compact behavior still works as expected

@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.25% when pulling 49f5590 on mitermayer:respect-compact-mode into e3a011b on eslint:master.

3 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.25% when pulling 49f5590 on mitermayer:respect-compact-mode into e3a011b on eslint:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.25% when pulling 49f5590 on mitermayer:respect-compact-mode into e3a011b on eslint:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.25% when pulling 49f5590 on mitermayer:respect-compact-mode into e3a011b on eslint:master.

@mitermayer
Copy link
Contributor Author

anyone can look into this ??? :(

@platinumazure
Copy link
Member

LGTM, just want another set of eyes on this. Thanks for contributing!

@mitermayer
Copy link
Contributor Author

@platinumazure any news around this issue ?

@mitermayer
Copy link
Contributor Author

@platinumazure any news on this ? keen to delete some work around hacks from a project that i am working on that depends on this

@not-an-aardvark not-an-aardvark merged commit 009f33d into eslint:master Oct 28, 2017
tmcw pushed a commit to documentationjs/doctrine that referenced this pull request Apr 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Union type stringification does not respect compact flag
5 participants