在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):jscs-dev/gulp-jscs开源软件地址(OpenSource Url):https://github.com/jscs-dev/gulp-jscs开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-jscs
Issues with the output should be reported on the JSCS issue tracker. Install
UsageReportingconst gulp = require('gulp');
const jscs = require('gulp-jscs');
gulp.task('default', () => {
return gulp.src('src/app.js')
.pipe(jscs())
.pipe(jscs.reporter());
}); Fixingconst gulp = require('gulp');
const jscs = require('gulp-jscs');
gulp.task('default', () => {
return gulp.src('src/app.js')
.pipe(jscs({fix: true}))
.pipe(gulp.dest('src'));
}); Reporting & fixing & failing on lint errorconst gulp = require('gulp');
const jscs = require('gulp-jscs');
gulp.task('default', () => {
return gulp.src('src/app.js')
.pipe(jscs({fix: true}))
.pipe(jscs.reporter())
.pipe(jscs.reporter('fail'))
.pipe(gulp.dest('src'));
}); ResultsA {
success: false, // or true if no errors
errorCount: 1, // number of errors in the errors array
errors: [{ // an array of jscs error objects
filename: 'index.js', // basename of the file
rule: 'requireCamelCaseOrUpperCaseIdentifiers', // the rule which triggered the error
message: 'All identifiers must be camelCase or UPPER_CASE', // error message
line: 32, // error line number
column: 7 // error column
}]
}; APIJSCS config should be placed in a jscs([options])optionsfixType: Make JSCS attempt to auto-fix your files. configPathType: Set the path to the JSCS config file. jscs.reporter([reporter])reporterType: See the JSCS reporter docs for supported input. Can be used multiple times in the same pipeline. This plugin also ships with some custom reporters:
LicenseMIT © Sindre Sorhus |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论