Skip to content

Commit 64f660d

Browse files
bubenkofftmcw
authored andcommitted
feat: Support --shallow argument for lint command. Closes #956 (#995)
1 parent 37a91b2 commit 64f660d

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

__tests__/bin.js

+9
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,15 @@ describe('lint command', function() {
228228
expect(err.code > 0).toBeTruthy();
229229
}
230230
});
231+
232+
test('generates lint output with shallow', async function() {
233+
const data = await documentation(
234+
['lint fixture/lint/lint.input.shallow.js --shallow'],
235+
{},
236+
false
237+
);
238+
expect(data).toBe('');
239+
});
231240
});
232241

233242
test('given no files', async function() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @param {String} foo bar
3+
* @returns {object} bad object return type
4+
* @type {Array<object>} bad object type
5+
* @memberof notfound
6+
*/
7+
8+
/**
9+
* @param {String} baz bar
10+
* @property {String} bad property
11+
* @private
12+
*/
13+
14+
/**
15+
* @param {number} c explicit but not found
16+
*/
17+
function add(a, b) {}
18+
19+
module.exports.add = add;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var dep = require('./lint.input.dependency');
2+
3+
/**
4+
* @param {string} a
5+
* @param {boolean} b
6+
*/
7+
function add(a, b) {}

src/commands/lint.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
const documentation = require('../');
44
const fs = require('fs');
55
const path = require('path');
6+
const sharedOptions = require('./shared_options');
67

78
/* eslint no-console: 0 */
89

910
module.exports.command = 'lint [input..]';
1011
module.exports.description = 'check for common style and uniformity mistakes';
11-
module.exports.builder = {};
12+
module.exports.builder = {
13+
shallow: sharedOptions.sharedInputOptions.shallow
14+
};
1215

1316
/**
1417
* Wrap around the documentation.lint method and add the additional

0 commit comments

Comments
 (0)