Skip to content

Commit 99134f6

Browse files
committed
Support --shallow argument for lint command. Closes #956
1 parent f0c3227 commit 99134f6

File tree

4 files changed

+47
-5
lines changed

4 files changed

+47
-5
lines changed

__tests__/bin.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,11 @@ describe('lint command', function() {
185185
try {
186186
await documentation(['lint fixture/lint/lint.input.js'], {}, false);
187187
} catch (err) {
188-
var data = err.stderr.toString().split('\n').slice(2).join('\n');
188+
var data = err.stderr
189+
.toString()
190+
.split('\n')
191+
.slice(2)
192+
.join('\n');
189193
expect(data).toMatchSnapshot();
190194
}
191195
});
@@ -224,6 +228,15 @@ describe('lint command', function() {
224228
expect(err.code > 0).toBeTruthy();
225229
}
226230
});
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+
});
227240
});
228241

229242
test('given no files', async function() {
Lines changed: 19 additions & 0 deletions
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;
Lines changed: 7 additions & 0 deletions
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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
/* @flow */
22

3-
var documentation = require('../');
4-
var fs = require('fs');
5-
var path = require('path');
3+
var documentation = require('../'),
4+
sharedOptions = require('./shared_options'),
5+
fs = require('fs'),
6+
path = require('path');
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy