update eslint
This commit is contained in:
parent
088fd42e78
commit
9f31ad65c6
|
@ -23,8 +23,3 @@ trim_trailing_whitespace = false
|
||||||
[{package,bower}.json]
|
[{package,bower}.json]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
[gulpfile.js]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
|
|
||||||
|
|
31
.eslintrc.json
Normal file
31
.eslintrc.json
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"angular",
|
||||||
|
"eslint:recommended"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"indent": [
|
||||||
|
"error",
|
||||||
|
4
|
||||||
|
],
|
||||||
|
"linebreak-style": [
|
||||||
|
"error",
|
||||||
|
"unix"
|
||||||
|
],
|
||||||
|
"quotes": [
|
||||||
|
"error",
|
||||||
|
"single"
|
||||||
|
],
|
||||||
|
"semi": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
189
gulpfile.js
189
gulpfile.js
|
@ -7,144 +7,143 @@ var $ = gulpLoadPlugins();
|
||||||
var reload = browserSync.reload;
|
var reload = browserSync.reload;
|
||||||
|
|
||||||
gulp.task('styles', function () {
|
gulp.task('styles', function () {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'src/styles/**/*.css'
|
'src/styles/**/*.css'
|
||||||
]).pipe($.autoprefixer({browsers: ['> 1%', 'last 2 versions', 'Firefox ESR']}))
|
]).pipe($.autoprefixer({browsers: ['> 1%', 'last 2 versions', 'Firefox ESR']}))
|
||||||
.pipe(gulp.dest('.tmp/styles'))
|
.pipe(gulp.dest('.tmp/styles'))
|
||||||
.pipe(reload({stream: true}));
|
.pipe(reload({stream: true}));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('scripts', function () {
|
gulp.task('scripts', function () {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'src/scripts/**/*.js'
|
'src/scripts/**/*.js'
|
||||||
]).pipe($.plumber())
|
]).pipe($.plumber())
|
||||||
.pipe(gulp.dest('.tmp/scripts'))
|
.pipe(gulp.dest('.tmp/scripts'))
|
||||||
.pipe(reload({stream: true}));
|
.pipe(reload({stream: true}));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('views', function () {
|
gulp.task('views', function () {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'src/views/**/*.html'
|
'src/views/**/*.html'
|
||||||
]).pipe($.htmlmin({collapseWhitespace: true}))
|
]).pipe($.htmlmin({collapseWhitespace: true}))
|
||||||
.pipe($.angularTemplatecache({module: 'ariaNg', filename: 'views/templates.js', root: 'views/'}))
|
.pipe($.angularTemplatecache({module: 'ariaNg', filename: 'views/templates.js', root: 'views/'}))
|
||||||
.pipe(gulp.dest('.tmp/scripts'));
|
.pipe(gulp.dest('.tmp/scripts'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('lint', function () {
|
gulp.task('lint', function () {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'src/scripts/**/*.js'
|
'src/scripts/**/*.js'
|
||||||
]).pipe(reload({stream: true, once: true}))
|
]).pipe(reload({stream: true, once: true}))
|
||||||
.pipe($.eslint({fix: true}))
|
.pipe($.eslint.format())
|
||||||
.pipe($.eslint.format())
|
.pipe($.if(!browserSync.active, $.eslint.failAfterError()))
|
||||||
.pipe($.if(!browserSync.active, $.eslint.failAfterError()))
|
.pipe(gulp.dest('src/scripts'));
|
||||||
.pipe(gulp.dest('src/scripts'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('html', ['styles', 'scripts', 'views'], function () {
|
gulp.task('html', ['styles', 'scripts', 'views'], function () {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'src/*.html'
|
'src/*.html'
|
||||||
]).pipe($.useref({searchPath: ['.tmp', 'src', '.']}))
|
]).pipe($.useref({searchPath: ['.tmp', 'src', '.']}))
|
||||||
.pipe($.injectVersion())
|
.pipe($.injectVersion())
|
||||||
.pipe($.if('js/*.js', $.replace(/\/\/# sourceMappingURL=.*/g, '')))
|
.pipe($.if('js/*.js', $.replace(/\/\/# sourceMappingURL=.*/g, '')))
|
||||||
.pipe($.if('css/*.css', $.replace(/\/\*# sourceMappingURL=.* \*\/$/g, '')))
|
.pipe($.if('css/*.css', $.replace(/\/\*# sourceMappingURL=.* \*\/$/g, '')))
|
||||||
.pipe($.if(['js/moment-with-locales-*.min.js', 'js/plugins.min.js', 'js/aria-ng.min.js'], $.uglify({preserveComments: 'license'})))
|
.pipe($.if(['js/moment-with-locales-*.min.js', 'js/plugins.min.js', 'js/aria-ng.min.js'], $.uglify({preserveComments: 'license'})))
|
||||||
.pipe($.if(['css/plugins.min.css', 'css/aria-ng.min.css'], $.cssnano({safe: true, autoprefixer: false})))
|
.pipe($.if(['css/plugins.min.css', 'css/aria-ng.min.css'], $.cssnano({safe: true, autoprefixer: false})))
|
||||||
.pipe($.if(['js/plugins.min.js', 'js/aria-ng.min.js', 'css/plugins.min.css', 'css/aria-ng.min.css'], $.rev()))
|
.pipe($.if(['js/plugins.min.js', 'js/aria-ng.min.js', 'css/plugins.min.css', 'css/aria-ng.min.css'], $.rev()))
|
||||||
.pipe($.if('*.html', $.htmlmin({collapseWhitespace: true})))
|
.pipe($.if('*.html', $.htmlmin({collapseWhitespace: true})))
|
||||||
.pipe($.revReplace())
|
.pipe($.revReplace())
|
||||||
.pipe(gulp.dest('dist'));
|
.pipe(gulp.dest('dist'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('langs', function () {
|
gulp.task('langs', function () {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'src/langs/**/*'
|
'src/langs/**/*'
|
||||||
]).pipe(gulp.dest('dist/langs'));
|
]).pipe(gulp.dest('dist/langs'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('images', function () {
|
gulp.task('images', function () {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'src/imgs/**/*'
|
'src/imgs/**/*'
|
||||||
]).pipe(gulp.dest('dist/imgs'));
|
]).pipe(gulp.dest('dist/imgs'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('fonts', function () {
|
gulp.task('fonts', function () {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'bower_components/font-awesome/fonts/fontawesome-webfont.*'
|
'bower_components/font-awesome/fonts/fontawesome-webfont.*'
|
||||||
]).pipe(gulp.dest('.tmp/fonts'))
|
]).pipe(gulp.dest('.tmp/fonts'))
|
||||||
.pipe(gulp.dest('dist/fonts'));
|
.pipe(gulp.dest('dist/fonts'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('manifest', function () {
|
gulp.task('manifest', function () {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'dist/css/**',
|
'dist/css/**',
|
||||||
'dist/js/**',
|
'dist/js/**',
|
||||||
'dist/fonts/fontawesome-webfont.woff2',
|
'dist/fonts/fontawesome-webfont.woff2',
|
||||||
'dist/*.html'
|
'dist/*.html'
|
||||||
], {base: 'dist/'})
|
], {base: 'dist/'})
|
||||||
.pipe($.manifest({
|
.pipe($.manifest({
|
||||||
hash: true,
|
hash: true,
|
||||||
preferOnline: true,
|
preferOnline: true,
|
||||||
network: ['*'],
|
network: ['*'],
|
||||||
filename: 'index.manifest',
|
filename: 'index.manifest',
|
||||||
exclude: 'index.manifest'
|
exclude: 'index.manifest'
|
||||||
}))
|
}))
|
||||||
.pipe(gulp.dest('dist'));
|
.pipe(gulp.dest('dist'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('extras', function () {
|
gulp.task('extras', function () {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'src/*.*',
|
'src/*.*',
|
||||||
'!src/*.html'
|
'!src/*.html'
|
||||||
], {
|
], {
|
||||||
dot: true
|
dot: true
|
||||||
}).pipe(gulp.dest('dist'));
|
}).pipe(gulp.dest('dist'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('clean', del.bind(null, ['.tmp', 'dist']));
|
gulp.task('clean', del.bind(null, ['.tmp', 'dist']));
|
||||||
|
|
||||||
gulp.task('serve', ['styles', 'scripts', 'fonts'], function () {
|
gulp.task('serve', ['styles', 'scripts', 'fonts'], function () {
|
||||||
browserSync({
|
browserSync({
|
||||||
notify: false,
|
notify: false,
|
||||||
port: 9000,
|
port: 9000,
|
||||||
server: {
|
server: {
|
||||||
baseDir: ['.tmp', 'src'],
|
baseDir: ['.tmp', 'src'],
|
||||||
routes: {
|
routes: {
|
||||||
'/bower_components': 'bower_components'
|
'/bower_components': 'bower_components'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.watch([
|
gulp.watch([
|
||||||
'src/*.html',
|
'src/*.html',
|
||||||
'src/langs/*.txt',
|
'src/langs/*.txt',
|
||||||
'src/views/*.html',
|
'src/views/*.html',
|
||||||
'src/imgs/**/*',
|
'src/imgs/**/*',
|
||||||
'.tmp/fonts/**/*'
|
'.tmp/fonts/**/*'
|
||||||
]).on('change', reload);
|
]).on('change', reload);
|
||||||
|
|
||||||
gulp.watch('src/styles/**/*.css', ['styles']);
|
gulp.watch('src/styles/**/*.css', ['styles']);
|
||||||
gulp.watch('src/scripts/**/*.js', ['scripts']);
|
gulp.watch('src/scripts/**/*.js', ['scripts']);
|
||||||
gulp.watch('src/fonts/**/*', ['fonts']);
|
gulp.watch('src/fonts/**/*', ['fonts']);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('serve:dist', function () {
|
gulp.task('serve:dist', function () {
|
||||||
browserSync({
|
browserSync({
|
||||||
notify: false,
|
notify: false,
|
||||||
port: 9000,
|
port: 9000,
|
||||||
server: {
|
server: {
|
||||||
baseDir: ['dist']
|
baseDir: ['dist']
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('info', function () {
|
gulp.task('info', function () {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'dist/**/*'
|
'dist/**/*'
|
||||||
]).pipe($.size({title: 'build', gzip: true}));
|
]).pipe($.size({title: 'build', gzip: true}));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('build', $.sequence('lint', 'html', 'langs', 'images', 'fonts', 'manifest', 'extras', 'info'));
|
gulp.task('build', $.sequence('lint', 'html', 'langs', 'images', 'fonts', 'manifest', 'extras', 'info'));
|
||||||
|
|
||||||
gulp.task('default', ['clean'], function () {
|
gulp.task('default', ['clean'], function () {
|
||||||
gulp.start('build');
|
gulp.start('build');
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"browser-sync": "^2.18.2",
|
"browser-sync": "^2.18.2",
|
||||||
"del": "^2.2.2",
|
"del": "^2.2.2",
|
||||||
|
"eslint-config-angular": "^0.5.0",
|
||||||
|
"eslint-plugin-angular": "^1.4.1",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-angular-templatecache": "^2.0.0",
|
"gulp-angular-templatecache": "^2.0.0",
|
||||||
"gulp-autoprefixer": "^3.1.1",
|
"gulp-autoprefixer": "^3.1.1",
|
||||||
|
|
Reference in a new issue