Added eslint and basic eslint config

This commit is contained in:
Kolja Lampe 2016-08-30 17:33:55 +02:00 committed by Yuya Ochiai
parent 1f154cf3ac
commit 0926c915b5
3 changed files with 262 additions and 0 deletions

2
.eslintignore Normal file
View file

@ -0,0 +1,2 @@
node_modules/*
src/node_modules/*

258
.eslintrc.json Normal file
View file

@ -0,0 +1,258 @@
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true,
"modules": true
}
},
"plugins": [
"react"
],
"globals": {
"__dirname": false,
"global": false,
"process": false,
"require": false
},
"rules": {
"array-bracket-spacing": [1, "never"],
"array-callback-return": 1,
"arrow-body-style": 0,
"arrow-parens": [1, "always"],
"arrow-spacing": [1, { "before": true, "after": true }],
"block-scoped-var": 1,
"brace-style": [1, "stroustrup", { "allowSingleLine": false }],
"camelcase": [1, {"properties": "never"}],
"comma-dangle": [1, "never"],
"comma-spacing": [1, {"before": false, "after": true}],
"comma-style": [1, "last"],
"complexity": [1, 10],
"computed-property-spacing": [1, "never"],
"consistent-return": 1,
"consistent-this": [1, "self"],
"constructor-super": 1,
"curly": "off",
"dot-location": [1, "property"],
"dot-notation": 1,
"eqeqeq": [1, "smart"],
"func-names": 1,
"func-names": [
"error",
"never"
],
"func-style": "off",
"generator-star-spacing": "error",
"global-require": 1,
"guard-for-in": 1,
"id-blacklist": 0,
"indent": "off",
"jsx-quotes": [1, "prefer-single"],
"key-spacing": [1, {"beforeColon": false, "afterColon": true}],
"keyword-spacing": [1, {"before": true, "after": true, "overrides": {}}],
"linebreak-style": 1,
"lines-around-comment": [1, { "beforeBlockComment": true, "beforeLineComment": true, "allowBlockStart": true, "allowBlockEnd": true }],
"max-lines": [1, {"max": 450, "skipBlankLines": true, "skipComments": false}],
"max-nested-callbacks": [1, {"max":1}],
"max-nested-callbacks": [1, {"max":2}],
"max-statements-per-line": [1, {"max": 1}],
"new-cap": 1,
"new-parens": 1,
"newline-before-return": 0,
"newline-per-chained-call": 0,
"no-alert": 1,
"no-array-constructor": 1,
"no-caller": 1,
"no-case-declarations": 1,
"no-class-assign": 1,
"no-cond-assign": [1, "except-parens"],
"no-confusing-arrow": 1,
"no-console": "off",
"no-const-assign": 1,
"no-constant-condition": 1,
"no-debugger": 1,
"no-div-regex": 1,
"no-dupe-args": 1,
"no-dupe-class-members": 1,
"no-dupe-keys": 1,
"no-duplicate-case": 1,
"no-duplicate-imports": [1, {"includeExports": true}],
"no-else-return": 1,
"no-empty": 1,
"no-empty-function": 1,
"no-empty-pattern": 1,
"no-eval": 1,
"no-ex-assign": 1,
"no-extend-native": 1,
"no-extra-bind": 1,
"no-extra-label": 1,
"no-extra-parens": 0,
"no-extra-semi": 1,
"no-fallthrough": 1,
"no-floating-decimal": 1,
"no-func-assign": 1,
"no-implicit-globals": 0,
"no-implied-eval": 1,
"no-inner-declarations": 0,
"no-invalid-regexp": 1,
"no-irregular-whitespace": 1,
"no-iterator": 1,
"no-labels": 1,
"no-lone-blocks": 1,
"no-lonely-if": 1,
"no-loop-func": 1,
"no-magic-numbers": [1, { "ignore": [-1, 0, 1, 2], "enforceConst": true, "detectObjects": true } ],
"no-mixed-operators": [1, {"allowSamePrecedence": false}],
"no-mixed-spaces-and-tabs": 1,
"no-multi-spaces": [1, { "exceptions": { "Property": false } }],
"no-multi-str": 0,
"no-multiple-empty-lines": [1, {"max": 1}],
"no-native-reassign": 1,
"no-negated-condition": 1,
"no-nested-ternary": 1,
"no-new": 1,
"no-new-func": 1,
"no-new-object": 1,
"no-new-symbol": 1,
"no-new-wrappers": 1,
"no-octal-escape": 1,
"no-param-reassign": 1,
"no-process-env": 1,
"no-process-exit": 1,
"no-proto": 1,
"no-redeclare": 1,
"no-return-assign": [1, "always"],
"no-script-url": 1,
"no-self-assign": 1,
"no-self-compare": 1,
"no-sequences": 1,
"no-shadow": [1, {"hoist": "functions"}],
"no-shadow-restricted-names": 1,
"no-spaced-func": 1,
"no-ternary": 0,
"no-this-before-super": 1,
"no-throw-literal": 1,
"no-trailing-spaces": [1, { "skipBlankLines": false }],
"no-undef-init": 1,
"no-undefined": 1,
"no-underscore-dangle": 1,
"no-unexpected-multiline": 1,
"no-unmodified-loop-condition": 1,
"no-unneeded-ternary": [1, {"defaultAssignment": false}],
"no-unreachable": 1,
"no-unsafe-finally": 1,
"no-unused-expressions": 1,
"no-unused-vars": [1, {"vars": "all", "args": "after-used"}],
"no-use-before-define": [1, "nofunc"],
"no-useless-computed-key": 1,
"no-useless-concat": 1,
"no-useless-constructor": 1,
"no-useless-escape": 1,
"no-useless-rename": 1,
"no-var": 0,
"no-void": 1,
"no-warning-comments": 1,
"no-whitespace-before-property": 1,
"no-with": 1,
"object-curly-newline": 0,
"object-curly-spacing": [1, "always"],
"object-property-newline": [1, {"allowMultiplePropertiesPerLine": true}],
"object-shorthand": [1, "always"],
"one-var": [1, "never"],
"one-var-declaration-per-line": 0,
"operator-linebreak": [1, "after"],
"padded-blocks": [1, "never"],
"prefer-arrow-callback": 1,
"prefer-const": 1,
"prefer-reflect": 1,
"prefer-rest-params": 1,
"prefer-spread": 1,
"prefer-template": 0,
"quote-props": [1, "as-needed"],
"quotes": [1, "single", "avoid-escape"],
"radix": 1,
"react/display-name": [1, { "ignoreTranspilerName": false }],
"react/jsx-boolean-value": [1, "always"],
"react/jsx-closing-bracket-location": [1, { "location": "tag-aligned" }],
"react/jsx-curly-spacing": [1, "always"],
"react/jsx-equals-spacing": [1, "never"],
"react/jsx-first-prop-new-line": [1, "multiline"],
"react/jsx-handler-names": 0,
"react/jsx-indent": [1, 2],
"react/jsx-indent-props": [1, 2],
"react/jsx-key": 1,
"react/jsx-max-props-per-line": [1, { "maximum": 1 }],
"react/jsx-no-bind": 0,
"react/jsx-no-comment-textnodes": 1,
"react/jsx-no-duplicate-props": [1, { "ignoreCase": false }],
"react/jsx-no-literals": 1,
"react/jsx-no-target-blank": 1,
"react/jsx-no-undef": 1,
"react/jsx-pascal-case": 1,
"react/jsx-filename-extension": 1,
"react/jsx-space-before-closing": [1, "never"],
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1,
"react/jsx-wrap-multilines": 1,
"react/no-danger": 0,
"react/no-deprecated": 1,
"react/no-did-mount-set-state": 1,
"react/no-did-update-set-state": 1,
"react/no-direct-mutation-state": 1,
"react/no-is-mounted": 1,
"react/no-multi-comp": [1, { "ignoreStateless": true }],
"react/no-render-return-value": 1,
"react/no-set-state": 0,
"react/no-string-refs": 0,
"react/no-unknown-property": 1,
"react/prefer-es6-class": 1,
"react/prefer-stateless-function": 0,
"react/prop-types": 1,
"react/require-optimization": 1,
"react/require-render-return": 1,
"react/self-closing-comp": 1,
"react/sort-comp": 0,
"require-jsdoc": "off",
"rest-spread-spacing": "error",
"semi": "off",
"semi-spacing": "error",
"sort-imports": "error",
"sort-keys": "off",
"sort-vars": "error",
"space-before-blocks": "error",
"space-before-function-paren": "off",
"space-in-parens": [
"error",
"never"
],
"space-infix-ops": "error",
"space-unary-ops": "error",
"spaced-comment": "off",
"strict": [
"error",
"global"
],
"symbol-description": "error",
"template-curly-spacing": "error",
"unicode-bom": [
"error",
"never"
],
"valid-jsdoc": "error",
"vars-on-top": "off",
"wrap-iife": [1, "outside"],
"wrap-regex": "error",
"yield-star-spacing": "error",
"yoda": [
"error",
"never"
]
}
}

View file

@ -47,6 +47,8 @@
"electron-prebuilt": "1.4.2", "electron-prebuilt": "1.4.2",
"esformatter": "^0.9.6", "esformatter": "^0.9.6",
"esformatter-jsx": "^7.0.1", "esformatter-jsx": "^7.0.1",
"eslint": "^3.4.0",
"eslint-plugin-react": "^6.2.0",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-diff": "^1.0.0", "gulp-diff": "^1.0.0",
"gulp-esformatter": "^6.0.0", "gulp-esformatter": "^6.0.0",