-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce ESLint #10
Introduce ESLint #10
Changes from 5 commits
346928a
565ea60
e80b95a
4789bd0
6191f7f
f17a9a4
ebf9b0a
b5f83f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"es6": true | ||
}, | ||
"parserOptions": { | ||
"sourceType": "module" | ||
}, | ||
"globals": { | ||
"estatico": true, | ||
"Modernizr": false, | ||
"open": true, | ||
"name": true, | ||
"Promise": false | ||
}, | ||
"rules": { | ||
"no-bitwise": 2, | ||
"camelcase": [ | ||
2, | ||
{ | ||
"properties": "never" | ||
} | ||
], | ||
"curly": [ | ||
2, | ||
"all" | ||
], | ||
"eqeqeq": 2, | ||
"guard-for-in": 2, | ||
"no-extend-native": 2, | ||
"wrap-iife": 2, | ||
"indent": [ | ||
2, | ||
"tab", | ||
{ | ||
"SwitchCase": 1, | ||
"VariableDeclarator": 1 | ||
} | ||
], | ||
"no-use-before-define": [ | ||
2, | ||
{ | ||
"functions": false | ||
} | ||
], | ||
"new-cap": 2, | ||
"no-caller": 2, | ||
"no-empty": [ | ||
2, | ||
{ | ||
"allowEmptyCatch": true | ||
} | ||
], | ||
"no-irregular-whitespace": 2, | ||
"no-new": 2, | ||
"no-plusplus": 0, | ||
"quotes": [ | ||
2, | ||
"single" | ||
], | ||
"no-undef": 2, | ||
"no-unused-vars": 2, | ||
"strict": 0, | ||
"max-params": [ | ||
2, | ||
6 | ||
], | ||
"max-depth": [ | ||
2, | ||
3 | ||
], | ||
"max-statements": 0, | ||
"complexity": 0, | ||
"max-len": 0, | ||
"semi": [ | ||
2, | ||
"always" | ||
], | ||
"no-cond-assign": 0, | ||
"no-debugger": 0, | ||
"no-eq-null": 0, | ||
"no-eval": 0, | ||
"no-unused-expressions": 0, | ||
"block-scoped-var": 0, | ||
"no-iterator": 0, | ||
"linebreak-style": 0, | ||
"comma-style": [ | ||
2, | ||
"last" | ||
], | ||
"no-loop-func": 0, | ||
"no-multi-str": 0, | ||
"require-yield": 0, | ||
"valid-typeof": 0, | ||
"no-proto": 0, | ||
"no-script-url": 0, | ||
"no-shadow": 2, | ||
"dot-notation": 2, | ||
"no-new-func": 0, | ||
"no-new-wrappers": 0, | ||
"no-invalid-this": 0, | ||
"brace-style": [ | ||
2, | ||
"1tbs", | ||
{ | ||
"allowSingleLine": true | ||
} | ||
], | ||
"no-mixed-spaces-and-tabs": 2, | ||
"no-multiple-empty-lines": 2, | ||
"no-multi-spaces": 2, | ||
"dot-location": [ | ||
2, | ||
"property" | ||
], | ||
"operator-linebreak": [ | ||
2, | ||
"after" | ||
], | ||
"key-spacing": [ | ||
2, | ||
{ | ||
"beforeColon": false, | ||
"afterColon": true | ||
} | ||
], | ||
"space-unary-ops": [ | ||
2, | ||
{ | ||
"words": false, | ||
"nonwords": false | ||
} | ||
], | ||
"space-before-function-paren": [ | ||
2, | ||
{ | ||
"anonymous": "ignore", | ||
"named": "never" | ||
} | ||
], | ||
"no-spaced-func": 2, | ||
"array-bracket-spacing": [ | ||
2, | ||
"never", | ||
{} | ||
], | ||
"space-in-parens": [ | ||
2, | ||
"never" | ||
], | ||
"comma-dangle": [ | ||
2, | ||
"never" | ||
], | ||
"no-trailing-spaces": 2, | ||
"yoda": [ | ||
2, | ||
"never" | ||
], | ||
"eol-last": 2, | ||
"one-var": [ | ||
2, | ||
"always" | ||
], | ||
"newline-after-var": [ | ||
2, | ||
"always" | ||
], | ||
"lines-around-comment": [ | ||
2, | ||
{ | ||
"beforeLineComment": true, | ||
"allowBlockStart": true | ||
} | ||
], | ||
"space-infix-ops": 2, | ||
"keyword-spacing": [ | ||
2, | ||
{ | ||
"overrides": { | ||
"else": { | ||
"before": true | ||
}, | ||
"while": { | ||
"before": true | ||
}, | ||
"catch": { | ||
"before": true | ||
}, | ||
"in": { | ||
"before": true | ||
} | ||
} | ||
} | ||
], | ||
"spaced-comment": [ | ||
2, | ||
"always" | ||
], | ||
"space-before-blocks": [ | ||
2, | ||
"always" | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,16 +10,18 @@ var gulp = require('gulp'); | |
var taskName = 'js:lint', | ||
taskConfig = { | ||
src: [ | ||
|
||
// './gulp/**/*.js', | ||
// './helpers/**/*.js', | ||
// './test/**/*.js', | ||
// '!./test/**/expected/**/*.js', | ||
'./source/assets/js/**/*.js', | ||
'./source/modules/**/*.js', | ||
'./source/pages/**/*.js', | ||
'./source/demo/modules/**/*.js', | ||
/*'./source/demo/modules/!**!/!*.jsx',*/ | ||
'./source/demo/pages/**/*.js', | ||
'!./source/modules/.scaffold/scaffold.js' | ||
], | ||
watch: [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @flavaflo, if the task has its own watcher, we should probably remove it as a dependency of the |
||
'./source/assets/js/**/*.js', | ||
'./source/modules/**/*.js', | ||
'./source/pages/**/*.js', | ||
'./source/demo/modules/**/*.js', | ||
'./source/demo/pages/**/*.js', | ||
'!./source/modules/.scaffold/scaffold.js' | ||
] | ||
|
@@ -30,24 +32,16 @@ gulp.task(taskName, function() { | |
tap = require('gulp-tap'), | ||
path = require('path'), | ||
cached = require('gulp-cached'), | ||
jshint = require('gulp-jshint'), | ||
jscs = require('gulp-jscs'); | ||
eslint = require('gulp-eslint'); | ||
|
||
return gulp.src(taskConfig.src, { | ||
dot: true | ||
}) | ||
.pipe(cached('linting')) | ||
.pipe(jshint({ linter: require('jshint-jsx').JSXHINT })) | ||
.pipe(jscs({ | ||
configPath: '.jscsrc' | ||
|
||
// Automatically fix invalid code (files would have to be saved back to disk below) | ||
// fix: true | ||
})) | ||
.pipe(jshint.reporter('jshint-stylish')) | ||
.pipe(jscs.reporter()) | ||
.pipe(eslint()) | ||
.pipe(eslint.formatEach()) | ||
.pipe(tap(function(file) { | ||
if (!file.jshint.success || !file.jscs.success) { | ||
if (file.eslint && file.eslint.errorCount > 0) { | ||
helpers.errors({ | ||
task: taskName, | ||
message: 'Linting error in file "' + path.relative('./source/', file.path) + '" (details above)' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @backflip we can now remove |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the documentation http://eslint.org/docs/rules/no-bitwise and even to previous versions of the documentation (https://github.com/eslint/eslint/blob/master/docs/rules/no-bitwise.md)
"no-bitwise"
should not admit a number as a value. Additionally, configuring"extends": "eslint:recommended"
would also bring this by default as an error, and if ESLint changes the API for this rule we wouldn't need to worry about it in the future.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@orioltf, every rule takes a number, if I'm not mistaken: http://eslint.org/docs/user-guide/configuring#configuring-rules