Skip to content

Commit

Permalink
feat: Support --shallow argument for lint command. Closes #956 (#995
Browse files Browse the repository at this point in the history
)
  • Loading branch information
bubenkoff authored and tmcw committed Mar 1, 2018
1 parent 37a91b2 commit 64f660d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
9 changes: 9 additions & 0 deletions __tests__/bin.js
Expand Up @@ -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() {
Expand Down
19 changes: 19 additions & 0 deletions __tests__/fixture/lint/lint.input.dependency.js
@@ -0,0 +1,19 @@
/**
* @param {String} foo bar
* @returns {object} bad object return type
* @type {Array<object>} 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;
7 changes: 7 additions & 0 deletions __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) {}
5 changes: 4 additions & 1 deletion src/commands/lint.js
Expand Up @@ -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
Expand Down

0 comments on commit 64f660d

Please sign in to comment.