gulp js添加版本号
I've noticed that I am a loose coder on my personal projects but want some level of decorum on Mozilla and other open source projects. The more developers you have contributing to a project, the tighter the ship you must keep. The easiest way to do that is requiring contributions to meet a certain code convention criteria via a tool like ESLint. Since I like to use gulp.js for my build process, I thought I'd share a very basic use of ESLint for your project.
我注意到我在个人项目中是一个松散的编码器,但是希望在Mozilla和其他开放源代码项目上有一定程度的礼节。 您为项目贡献的开发人员越多,您必须保持的船型越紧。 最简单的方法是通过诸如ESLint之类的工具要求捐助来满足某些代码约定标准。 由于我喜欢在构建过程中使用gulp.js,因此我想为您的项目共享ESLint的基本用法。
You start by adding ESLint to your package.json
file or installing via NPM manually:
首先,将ESLint添加到package.json
文件中, 或者通过NPM手动安装:
npm install gulp-eslint
With ESLint available somewhere within the node path, you can set up a lint
task within your gulpfile.js:
使用ESLint在节点路径中的某个位置可用,您可以在gulpfile.js中设置一个lint
任务:
gulp.task('lint', function() {
return gulp.src('lib/**').pipe(eslint({
'rules':{
'quotes': [1, 'single'],
'semi': [1, 'always']
}
}))
.pipe(eslint.format())
// Brick on failure to be super strict
.pipe(eslint.failOnError());
});
You can get a full list of rules and possible values here. How strict you want to be depends on your general philosophy within JavaScript. Many people make lint
a part of their test
task as well so that travis-ci can reject code that isn't up to snuff.
您可以在此处获得规则和可能值的完整列表。 您想要达到的严格程度取决于JavaScript的总体原理。 许多人也将lint
作为其test
任务的一部分,以使travis-ci可以拒绝不符合要求的代码。
Now that I've written this post, I'll probably take the time to add ESLint to my personal projects so that I can get in the habit of always coding to a certain standard. Practice makes perfect!
现在,我已经写了这篇文章,我可能会花时间将ESLint添加到我的个人项目中,以便养成始终按照特定标准进行编码的习惯。 实践使完美!
gulp js添加版本号