Commit 5d249b0f authored by gumen's avatar gumen 🐢

Merge branch 'master' into 'master'

Add "throws" to default ordering after param and before return

See merge request !2
parents d21baddc 8c84bbad
......@@ -43,7 +43,7 @@ const vertiacallyAlignableTags = [
'property',
'return',
'throws',
// 'yields',
'yields',
]
/**
......@@ -278,6 +278,7 @@ module.exports = {
'examples',
'other',
'param',
'throws',
'yields',
'return',
]}],
......
......@@ -160,28 +160,32 @@ test('Should not add TODO for return desc if it has undefined|null|void type', (
test('Should align vartically param|property|return|throws if option set to true', () => {
test('Should align vertically param|property|return|yields|throws if option set to true', () => {
const options = {
jsdocVerticalAlignment: true
}
const Result1 = subject(`/**
* @property {Object} unalginedProp unaligned property descriptin
* @param {String} unalginedParam unaligned param description
* @yields {Number} yields description
* @returns {undefined}
*/`, options)
const Expected1 = `/**
* @property {Object} unalginedProp Unaligned property descriptin
* @param {String} unalginedParam Unaligned param description
* @yields {Number} Yields description
* @return {undefined}
*/
`
const Result2 = subject(`/**
* @throws {CustomExceptio} unaligned throws description
* @yields {Number} yields description
* @returns {String} unaligned returns description
*/`, options)
const Expected2 = `/**
* @throws {CustomExceptio} Unaligned throws description
* @yields {Number} Yields description
* @return {String} Unaligned returns description
*/
`
......@@ -190,7 +194,7 @@ test('Should align vartically param|property|return|throws if option set to true
expect(Result2).toEqual(Expected2)
})
test('Should align vartically param|property|return|throws if option set to true, and amount of spaces is different than default', () => {
test('Should align vertically param|property|return|yields|throws if option set to true, and amount of spaces is different than default', () => {
const options1 = {
jsdocVerticalAlignment: true,
jsdocSpaces: 2
......@@ -199,13 +203,15 @@ test('Should align vartically param|property|return|throws if option set to true
* @property {Object} unalginedProp unaligned property descriptin
* @param {String} unalginedParam unaligned param description
* @throws {CustomExceptio} unaligned throws description
* @yields {Number} yields description
* @returns {undefined}
*/`
const Result1 = subject(unformattedJsdoc, options1)
const Expected1 = `/**
* @property {Object} unalginedProp Unaligned property descriptin
* @throws {CustomExceptio} Unaligned throws description
* @param {String} unalginedParam Unaligned param description
* @throws {CustomExceptio} Unaligned throws description
* @yields {Number} Yields description
* @return {undefined}
*/
`
......@@ -218,15 +224,17 @@ test('Should align vartically param|property|return|throws if option set to true
* @property {Object} unalginedProp unaligned property descriptin
* @param {String} unalginedParam unaligned param description
* @throws {CustomExceptio} unaligned throws description
* @yields {Number} yields description
* @returns {String} unaligned returns description
*/`, options2)
const Expected2 = `/**
* @property {Object} unalginedProp Unaligned property
* descriptin
* @throws {CustomExceptio} Unaligned throws
* description
* @param {String} unalginedParam Unaligned param
* description
* @throws {CustomExceptio} Unaligned throws
* description
* @yields {Number} Yields description
* @return {String} Unaligned returns
* description
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment