update linters & their configs; add ESLint

This commit is contained in:
Chris Rebert 2014-12-30 17:52:03 -08:00
Родитель ffa1c84082
Коммит 477f434604
6 изменённых файлов: 75 добавлений и 7 удалений

52
.eslintrc Normal file
Просмотреть файл

@ -0,0 +1,52 @@
{
"env": {
"node": true
},
"rules": {
"block-scoped-var": 2,
"brace-style": [2, "stroustrup"],
"camelcase": 2,
"comma-spacing": [2, {"before": false, "after": true}],
"comma-style": [2, "last"],
"consistent-this": [2, "self"],
"curly": 2,
"eol-last": 2,
"eqeqeq": 2,
"key-spacing": [2, {"beforeColon": false, "afterColon": true}],
"new-cap": 2,
"new-parens": 2,
"no-array-constructor": 2,
"no-bitwise": 2,
"no-constant-condition": 0,
"no-floating-decimal": 2,
"no-inline-comments": 0,
"no-irregular-whitespace": 2,
"no-mixed-spaces-and-tabs": 2,
"no-multi-spaces": 2,
"no-multiple-empty-lines": 0,
"no-new-object": 2,
"no-process-env": 2,
"no-reserved-keys": 0,
"no-self-compare": 2,
"no-space-before-semi": 2,
"no-spaced-func": 2,
"no-trailing-spaces": 2,
"no-underscore-dangle": 0,
"no-void": 2,
"operator-assignment": [2, "always"],
"padded-blocks": 0,
"quotes": 0,
"radix": 2,
"semi": [2, "always"],
"space-after-keywords": [2, "always", {"checkFunctionKeyword": true}],
"space-before-blocks": [2, "always"],
"space-in-brackets": [2, "never"],
"space-in-parens": [2, "never"],
"space-return-throw-case": 2,
"space-unary-ops": [2, {"words": true, "nonwords": false}],
"spaced-line-comment": [2, "always"],
"vars-on-top": 0,
"wrap-iife": [2, "inside"],
"yoda": [2, "never"]
}
}

Просмотреть файл

@ -12,6 +12,7 @@
"requireCommaBeforeLineBreak": true,
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch", "case", "default"],
"requireLineFeedAtFileEnd": true,
"requireOperatorBeforeLineBreak": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="],
"requireParenthesesAroundIIFE": true,
"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],

Просмотреть файл

@ -10,6 +10,7 @@
"node": true,
"noempty": true,
"plusplus": false,
"predef": ["exports"],
"sub": true,
"undef": true
}

Просмотреть файл

@ -23,6 +23,17 @@ module.exports = function (grunt) {
]
},
eslint: {
options: {
config: '.eslintrc'
},
all: [
'Gruntfile.js',
'tasks/*.js',
'<%= nodeunit.tests %>'
]
},
jscs: {
options: {
config: '.jscsrc'
@ -41,13 +52,13 @@ module.exports = function (grunt) {
// Configuration to be run (and then tested).
cssflip: {
default_options: {
defaultOptions: {
options: {},
files: {
'tmp/default_options.css': 'test/fixtures/example.css'
}
},
custom_options: {
customOptions: {
options: {
indent: ' '
},
@ -74,7 +85,9 @@ module.exports = function (grunt) {
// plugin's task(s), then test the result.
grunt.registerTask('test', ['clean', 'cssflip', 'nodeunit']);
grunt.registerTask('lint', ['jshint', 'eslint', 'jscs']);
// By default, lint and run all tests.
grunt.registerTask('default', ['jshint', 'jscs', 'test']);
grunt.registerTask('default', ['lint', 'test']);
};

Просмотреть файл

@ -27,7 +27,8 @@
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-nodeunit": "~0.4.0",
"grunt-jscs": "~0.8.0",
"grunt-eslint": "^2.1.0",
"grunt-jscs": "^1.1.0",
"load-grunt-tasks": "^2.0.0"
},
"peerDependencies": {

Просмотреть файл

@ -27,7 +27,7 @@ exports.cssflip = {
// setup here if necessary
done();
},
default_options: function(test) {
defaultOptions: function (test) {
test.expect(1);
var actual = grunt.file.read('tmp/default_options.css');
@ -36,7 +36,7 @@ exports.cssflip = {
test.done();
},
custom_options: function(test) {
customOptions: function (test) {
test.expect(1);
var actual = grunt.file.read('tmp/custom_options.css');