lint gulpfile, add eslint config and ignore file for those that using eslint
This commit is contained in:
parent
4296b41faf
commit
fa5afe879e
|
@ -0,0 +1,2 @@
|
||||||
|
js/**/*.js
|
||||||
|
node_modules/**/*.js
|
|
@ -0,0 +1,39 @@
|
||||||
|
module.exports = {
|
||||||
|
"root": true,
|
||||||
|
"parserOptions": {
|
||||||
|
"parser": "babel-eslint",
|
||||||
|
"ecmaVersion": 2017,
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"node": true,
|
||||||
|
"es6": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"window": true,
|
||||||
|
"location": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"airbnb-base",
|
||||||
|
],
|
||||||
|
// custom rules here
|
||||||
|
"rules": {
|
||||||
|
// don"t require .vue extension when importing
|
||||||
|
"import/extensions": ["error", "always", {
|
||||||
|
"js": "never",
|
||||||
|
"vue": "js",
|
||||||
|
"mjs": "never"
|
||||||
|
}],
|
||||||
|
"no-param-reassign": ["error", {
|
||||||
|
"props": true,
|
||||||
|
"ignorePropertyModificationsFor": [
|
||||||
|
"event", // for e.returnvalue
|
||||||
|
"response", // for Express responses
|
||||||
|
"item", // for item usually within each loops
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
// allow debugger during development
|
||||||
|
"no-debugger": process.env.NODE_ENV === "production" ? 2 : 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,3 @@
|
||||||
/* eslint-disable no-console */
|
|
||||||
import gulp from 'gulp';
|
import gulp from 'gulp';
|
||||||
import clean from 'gulp-clean';
|
import clean from 'gulp-clean';
|
||||||
import sass from 'gulp-sass';
|
import sass from 'gulp-sass';
|
||||||
|
@ -20,7 +19,7 @@ import notify from 'gulp-notify';
|
||||||
import runSequence from 'run-sequence';
|
import runSequence from 'run-sequence';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
const log = console.log;
|
const { log } = console;
|
||||||
let production = false;
|
let production = false;
|
||||||
let error = false;
|
let error = false;
|
||||||
|
|
||||||
|
@ -127,7 +126,7 @@ gulp.task('scripts', ['clean-scripts'], () => {
|
||||||
sourceMap: !production,
|
sourceMap: !production,
|
||||||
dest: `${config.public}/js/script.min.js`,
|
dest: `${config.public}/js/script.min.js`,
|
||||||
});
|
});
|
||||||
}).catch(err => {
|
}).catch((err) => {
|
||||||
notification('Failed to compile scripts. 😱', 'error');
|
notification('Failed to compile scripts. 😱', 'error');
|
||||||
log(err.stack);
|
log(err.stack);
|
||||||
error = true;
|
error = true;
|
||||||
|
|
Loading…
Reference in New Issue