mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
fix: make gulp lint work; delint
Previously, `gulp lint` finished immediately, without linting anything.
This commit is contained in:
parent
86f08218cf
commit
d7706309ee
25
gulpfile.js
25
gulpfile.js
@ -1,8 +1,6 @@
|
||||
/* eslint max-nested-callbacks: 0 */
|
||||
const eslint = require('gulp-eslint');
|
||||
const { exec } = require('child_process');
|
||||
const gulp = require('gulp');
|
||||
const jsonEditor = require('gulp-json-editor');
|
||||
const path = require('path');
|
||||
|
||||
function execCb(cb, err, stdout, stderr) {
|
||||
@ -28,38 +26,25 @@ const options = {
|
||||
nodePath: process.execPath
|
||||
};
|
||||
|
||||
function bump(cb) {
|
||||
gulp.src('./package.json')
|
||||
.pipe(jsonEditor({
|
||||
revision: String( Date.now() )
|
||||
}))
|
||||
.pipe(gulp.dest('./'));
|
||||
|
||||
cb();
|
||||
}
|
||||
|
||||
function coverage(cb) {
|
||||
const cmd = `./node_modules/.bin/nyc --reporter=html ${options.nodeBin} -T`;
|
||||
|
||||
exec(cmd, execCb.bind(null, cb));
|
||||
return exec(cmd, execCb.bind(null, cb));
|
||||
}
|
||||
|
||||
function lint(cb) {
|
||||
gulp.src(options.lintPaths)
|
||||
function lint() {
|
||||
return gulp.src(options.lintPaths)
|
||||
.pipe(eslint())
|
||||
.pipe(eslint.formatEach())
|
||||
.pipe(eslint.failOnError());
|
||||
|
||||
cb();
|
||||
.pipe(eslint.failAfterError());
|
||||
}
|
||||
|
||||
function test(cb) {
|
||||
const cmd = `${options.nodePath} "${options.nodeBin}" -T`;
|
||||
|
||||
exec(cmd, execCb.bind(null, cb));
|
||||
return exec(cmd, execCb.bind(null, cb));
|
||||
}
|
||||
|
||||
exports.bump = bump;
|
||||
exports.coverage = coverage;
|
||||
exports.default = gulp.series(lint, test);
|
||||
exports.lint = lint;
|
||||
|
||||
80
package-lock.json
generated
80
package-lock.json
generated
@ -2629,7 +2629,8 @@
|
||||
"version": "2.20.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
|
||||
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"commondir": {
|
||||
"version": "1.0.1",
|
||||
@ -3338,12 +3339,6 @@
|
||||
"integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
|
||||
"dev": true
|
||||
},
|
||||
"deepmerge": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.1.tgz",
|
||||
"integrity": "sha512-32P7FIV6JKt0hPMFNlWFytzVGpppYHFKdnhFUEMXheWc8Lw4HnHEzJa5yxhaQedDAXv2SI6zD7+UbqnC5k9g9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"default-compare": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/default-compare/-/default-compare-1.0.0.tgz",
|
||||
@ -3475,12 +3470,6 @@
|
||||
"integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=",
|
||||
"dev": true
|
||||
},
|
||||
"detect-indent": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.0.0.tgz",
|
||||
"integrity": "sha512-oSyFlqaTHCItVRGK5RmrmjB+CmaMOW7IaNA/kdxqhoa6d17j/5ce9O9eWXmV/KEdRwqpQA+Vqe8a8Bsybu4YnA==",
|
||||
"dev": true
|
||||
},
|
||||
"dezalgo": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.3.tgz",
|
||||
@ -3573,18 +3562,6 @@
|
||||
"safer-buffer": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"editorconfig": {
|
||||
"version": "0.15.3",
|
||||
"resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz",
|
||||
"integrity": "sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "^2.19.0",
|
||||
"lru-cache": "^4.1.5",
|
||||
"semver": "^5.6.0",
|
||||
"sigmund": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"emoji-regex": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
|
||||
@ -5769,30 +5746,6 @@
|
||||
"plugin-error": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"gulp-json-editor": {
|
||||
"version": "2.5.4",
|
||||
"resolved": "https://registry.npmjs.org/gulp-json-editor/-/gulp-json-editor-2.5.4.tgz",
|
||||
"integrity": "sha512-3IdMYsSACfLFYipet9Rmpag7PEU059KnR6TWgfuAfz+ftyzN8yaEvf9vXAD5b9K9v711Ymcpqe6vWGQYfQJ/uQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"deepmerge": "^4.2.1",
|
||||
"detect-indent": "^6.0.0",
|
||||
"js-beautify": "^1.10.2",
|
||||
"plugin-error": "^1.0.1",
|
||||
"through2": "^3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"through2": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz",
|
||||
"integrity": "sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"readable-stream": "2 || 3"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gulplog": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz",
|
||||
@ -6668,19 +6621,6 @@
|
||||
"add-matchers": "0.6.2"
|
||||
}
|
||||
},
|
||||
"js-beautify": {
|
||||
"version": "1.10.2",
|
||||
"resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.10.2.tgz",
|
||||
"integrity": "sha512-ZtBYyNUYJIsBWERnQP0rPN9KjkrDfJcMjuVGcvXOUJrD1zmOGwhRwQ4msG+HJ+Ni/FA7+sRQEMYVzdTQDvnzvQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"config-chain": "^1.1.12",
|
||||
"editorconfig": "^0.15.3",
|
||||
"glob": "^7.1.3",
|
||||
"mkdirp": "~0.5.1",
|
||||
"nopt": "~4.0.1"
|
||||
}
|
||||
},
|
||||
"js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
@ -7690,16 +7630,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"nopt": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz",
|
||||
"integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"abbrev": "1",
|
||||
"osenv": "^0.1.4"
|
||||
}
|
||||
},
|
||||
"normalize-package-data": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
|
||||
@ -9187,12 +9117,6 @@
|
||||
"integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
|
||||
"dev": true
|
||||
},
|
||||
"sigmund": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
|
||||
"integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=",
|
||||
"dev": true
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
"eslint": "^6.7.2",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-eslint": "^6.0.0",
|
||||
"gulp-json-editor": "^2.5.4",
|
||||
"jasmine": "^3.5.0",
|
||||
"jasmine-console-reporter": "^3.1.0",
|
||||
"klaw-sync": "^6.0.0",
|
||||
|
||||
@ -22,10 +22,13 @@ class Scanner extends EventEmitter {
|
||||
* @param {number} [depth]
|
||||
* @fires sourceFileFound
|
||||
*/
|
||||
scan(searchPaths = [], depth = 1, filter) {
|
||||
scan(searchPaths, depth, filter) {
|
||||
let currentFile;
|
||||
let filePaths = [];
|
||||
|
||||
searchPaths = searchPaths || [];
|
||||
depth = depth || 1;
|
||||
|
||||
searchPaths.forEach($ => {
|
||||
const filepath = path.resolve( env.pwd, decodeURIComponent($) );
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*global document */
|
||||
/* global document */
|
||||
(() => {
|
||||
const source = document.getElementsByClassName('prettyprint source linenums');
|
||||
let i = 0;
|
||||
|
||||
@ -14,8 +14,8 @@ describe('jsdoc/src/filter', () => {
|
||||
describe('Filter', () => {
|
||||
let myFilter;
|
||||
|
||||
const defaultIncludePattern = new RegExp('.+\\.js(doc)?$');
|
||||
const defaultExcludePattern = new RegExp('(^|\\/|\\\\)_');
|
||||
const defaultIncludePattern = /.+\.js(doc)?$/;
|
||||
const defaultExcludePattern = /(^|\/|\\)_/;
|
||||
|
||||
beforeEach(() => {
|
||||
myFilter = new filter.Filter({});
|
||||
@ -68,7 +68,7 @@ describe('jsdoc/src/filter', () => {
|
||||
});
|
||||
|
||||
it('should contain the regexp passed to the constructor', () => {
|
||||
const regExp = new RegExp('^foo$');
|
||||
const regExp = /^foo$/;
|
||||
const options = {};
|
||||
|
||||
options[name] = regExp;
|
||||
|
||||
@ -3,8 +3,8 @@ describe('jsdoc/src/scanner', () => {
|
||||
const scanner = require('jsdoc/src/scanner');
|
||||
|
||||
const filter = new (require('jsdoc/src/filter').Filter)({
|
||||
includePattern: new RegExp('.+\\.js(doc)?$'),
|
||||
excludePattern: new RegExp('(^|\\/|\\\\)_')
|
||||
includePattern: /.+\.js(doc)?$/,
|
||||
excludePattern: /(^|\/|\\)_/
|
||||
});
|
||||
const sourcePath = path.normalize(`${__dirname}/../../../fixtures/src`);
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@ describe('@example tag', () => {
|
||||
const docSet = jsdoc.getDocSetFromFile('test/fixtures/exampletag.js');
|
||||
const doc = docSet.getByLongname('x')[0];
|
||||
const doc2 = docSet.getByLongname('y')[0];
|
||||
const txtRegExp = new RegExp('console\\.log\\("foo"\\);[\\r\\n]{1,2}console\\.log\\("bar"\\);');
|
||||
const txt2RegExp = new RegExp('<caption>Example 2</caption>[\\r\\n]{1,2}1 \\+ 2;');
|
||||
const txtRegExp = /console\.log\("foo"\);[\r\n]{1,2}console\.log\("bar"\)/;
|
||||
const txt2RegExp = /<caption>Example 2<\/caption>[\r\n]{1,2}1 \+ 2;/;
|
||||
|
||||
it("creates an 'examples' property on the doclet with the example", () => {
|
||||
expect(doc.examples).toBeArrayOfSize(1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user