Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support --shallow argument for lint command. Closes #956 #995

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion __tests__/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ describe('lint command', function() {
try {
await documentation(['lint fixture/lint/lint.input.js'], {}, false);
} catch (err) {
var data = err.stderr.toString().split('\n').slice(2).join('\n');
var data = err.stderr
.toString()
.split('\n')
.slice(2)
.join('\n');
expect(data).toMatchSnapshot();
}
});
Expand Down Expand Up @@ -224,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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var dep = require('./lint.input.dependency');

/**
* @param {string} a
* @param {boolean} b
*/
function add(a, b) {}
11 changes: 7 additions & 4 deletions src/commands/lint.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
/* @flow */

var documentation = require('../');
var fs = require('fs');
var path = require('path');
var documentation = require('../'),
sharedOptions = require('./shared_options'),
fs = require('fs'),
path = require('path');

/* 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