mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
finish .eslintrc file and update gulp task
This commit is contained in:
46
.eslintrc
46
.eslintrc
@@ -56,7 +56,7 @@
|
||||
"no-unused-vars": 2,
|
||||
"no-use-before-define": 2,
|
||||
"global-require": 2,
|
||||
"handle-callback-err": [2, "^.*(e|E)rr"]
|
||||
"handle-callback-err": [2, "^.*(e|E)rr"],
|
||||
"no-path-concat": 2,
|
||||
"arrow-spacing": 2,
|
||||
"constructor-super": 2,
|
||||
@@ -70,11 +70,53 @@
|
||||
"object-shorthand": 2,
|
||||
"prefer-const": 2,
|
||||
"prefer-spread": 2,
|
||||
"prefer-template": 2
|
||||
"prefer-template": 2,
|
||||
"array-bracket-spacing": [2, "never"],
|
||||
"brace-style": [2, "1tbs", { "allowSingleLine": false }],
|
||||
"camel-case": 2,
|
||||
"comma-spacing": 2,
|
||||
"comma-style": [2, "last"],
|
||||
"computed-property-spacing": [2, "never"],
|
||||
"consistent-this": [2, "self"],
|
||||
"func-names": 2,
|
||||
"func-style": [2, "expression"],
|
||||
"block-spacing": [2, "always"],
|
||||
"key-spacing": [2, {"beforeColon": false, "afterColon": true}],
|
||||
"max-nested-callbacks": [2, 3],
|
||||
"new-cap": 2,
|
||||
"new-parens": 2,
|
||||
"newline-after-var": 2,
|
||||
"no-array-constructor": 2,
|
||||
"no-continue": 2,
|
||||
"no-lonely-if": 2,
|
||||
"no-mixed-spaces-and-tabs": 2,
|
||||
"no-trailing-spaces": 2,
|
||||
"no-spaced-func": 2,
|
||||
"no-new-object": 2,
|
||||
"no-nested-ternary": 2,
|
||||
"one-var": [2, "never"],
|
||||
"operator-linebreak": [2, "after"],
|
||||
"quote-props": [2, "as-needed", { "keywords": true }],
|
||||
"semi-spacing": [2, {"before": false, "after": true}],
|
||||
"space-after-keyword": 2,
|
||||
"space-before-blocks": 2,
|
||||
"space-before-function-paren": 2,
|
||||
"space-before-keywords": 2,
|
||||
"space-in-parens": [2, "never"],
|
||||
"space-infix-ops": 2,
|
||||
"space-return-throw-case": 2,
|
||||
"space-unary-ops": 2,
|
||||
"spaced-comment": [2, "always", { exceptions: ["-"]}],
|
||||
"padded-blocks": [2, "never"],
|
||||
"no-multiple-empty-lines": [2, {max: 2}],
|
||||
"lines-around-comment": [2, { "beforeBlockComment": true, "beforeLineComment": true }]
|
||||
},
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
ecmaFeatures : {
|
||||
modules: true
|
||||
},
|
||||
"extends": "eslint:recommended"
|
||||
}
|
||||
@@ -1,45 +1,15 @@
|
||||
import gulp from 'gulp';
|
||||
import eslint from 'gulp-eslint';
|
||||
import _ from 'lodash';
|
||||
|
||||
// TODO remove once we upgrade to lodash 3
|
||||
const defaultsDeep = _.partialRight(_.merge, _.defaults);
|
||||
|
||||
const shared = {
|
||||
rules: {
|
||||
indent: [2, 2],
|
||||
quotes: [2, 'single'],
|
||||
'linebreak-style': [2, 'unix'],
|
||||
semi: [2, 'always']
|
||||
},
|
||||
extends: 'eslint:recommended',
|
||||
env: {
|
||||
es6: true
|
||||
}
|
||||
};
|
||||
|
||||
gulp.task('lint:client', () => {
|
||||
// Ignore .coffee files
|
||||
return gulp.src(['./website/public/js/**/*.js'])
|
||||
.pipe(eslint(defaultsDeep({
|
||||
env: {
|
||||
node: true
|
||||
}
|
||||
}, shared)))
|
||||
.pipe(eslint.format())
|
||||
.pipe(eslint.failAfterError());
|
||||
});
|
||||
|
||||
// TODO lint client
|
||||
// TDOO separate linting cong between
|
||||
gulp.task('lint:server', () => {
|
||||
// Ignore .coffee files
|
||||
return gulp.src(['./website/src/**/*.js'])
|
||||
.pipe(eslint(defaultsDeep({
|
||||
env: {
|
||||
browser: true
|
||||
}
|
||||
}, shared)))
|
||||
return gulp
|
||||
.src(['./website/src/**/api-v3/**/*.js'])
|
||||
.pipe(eslint())
|
||||
.pipe(eslint.format())
|
||||
.pipe(eslint.failAfterError());
|
||||
});
|
||||
|
||||
gulp.task('lint', ['lint:server', 'lint:client']);
|
||||
gulp.task('lint', ['lint:server']);
|
||||
Reference in New Issue
Block a user