diff --git a/__tests__/bin.js b/__tests__/bin.js index fca6d019e..7ced5698c 100644 --- a/__tests__/bin.js +++ b/__tests__/bin.js @@ -228,6 +228,15 @@ describe('lint command', function() { expect(err.code > 0).toBeTruthy(); } }); + + test('generates lint output with shallow', async function() { + const data = await documentation( + ['lint fixture/lint/lint.input.shallow.js --shallow'], + {}, + false + ); + expect(data).toBe(''); + }); }); test('given no files', async function() { diff --git a/__tests__/fixture/lint/lint.input.dependency.js b/__tests__/fixture/lint/lint.input.dependency.js new file mode 100644 index 000000000..b4ff5d4d8 --- /dev/null +++ b/__tests__/fixture/lint/lint.input.dependency.js @@ -0,0 +1,19 @@ +/** + * @param {String} foo bar + * @returns {object} bad object return type + * @type {Array} bad object type + * @memberof notfound + */ + +/** + * @param {String} baz bar + * @property {String} bad property + * @private + */ + +/** + * @param {number} c explicit but not found + */ +function add(a, b) {} + +module.exports.add = add; diff --git a/__tests__/fixture/lint/lint.input.shallow.js b/__tests__/fixture/lint/lint.input.shallow.js new file mode 100644 index 000000000..aa404f37e --- /dev/null +++ b/__tests__/fixture/lint/lint.input.shallow.js @@ -0,0 +1,7 @@ +var dep = require('./lint.input.dependency'); + +/** + * @param {string} a + * @param {boolean} b + */ +function add(a, b) {} diff --git a/src/commands/lint.js b/src/commands/lint.js index d6ef90cff..a2cfbd49a 100644 --- a/src/commands/lint.js +++ b/src/commands/lint.js @@ -3,12 +3,15 @@ const documentation = require('../'); const fs = require('fs'); const path = require('path'); +const sharedOptions = require('./shared_options'); /* eslint no-console: 0 */ module.exports.command = 'lint [input..]'; module.exports.description = 'check for common style and uniformity mistakes'; -module.exports.builder = {}; +module.exports.builder = { + shallow: sharedOptions.sharedInputOptions.shallow +}; /** * Wrap around the documentation.lint method and add the additional