diff --git a/.eslintignore b/.eslintignore index 7679058f..4a002ec5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,4 @@ -node_modules/* -src/node_modules/* \ No newline at end of file +dist/ +node_modules/ +release/ +src/node_modules/ diff --git a/.eslintrc-platform-v3.4.0.json b/.eslintrc-platform-v3.4.0.json new file mode 100644 index 00000000..c5c100e6 --- /dev/null +++ b/.eslintrc-platform-v3.4.0.json @@ -0,0 +1,240 @@ +{ + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module", + "ecmaFeatures": { + "jsx": true, + "impliedStrict": true, + "modules": true + } + }, + "parser": "babel-eslint", + "plugins": [ + "react" + ], + "env": { + "browser": true, + "node": true, + "jquery": true, + "es6": true + }, + "globals": { + "jest": true, + "describe": true, + "it": true, + "expect": true, + "before": true, + "after": true + }, + "rules": { + "array-bracket-spacing": [2, "never"], + "array-callback-return": 2, + "arrow-body-style": 0, + "arrow-parens": [2, "always"], + "arrow-spacing": [2, { "before": true, "after": true }], + "block-scoped-var": 2, + "brace-style": [2, "1tbs", { "allowSingleLine": false }], + "camelcase": [2, {"properties": "never"}], + "comma-dangle": [2, "never"], + "comma-spacing": [2, {"before": false, "after": true}], + "comma-style": [2, "last"], + "complexity": [1, 10], + "computed-property-spacing": [2, "never"], + "consistent-return": 2, + "consistent-this": [2, "self"], + "constructor-super": 2, + "curly": [2, "all"], + "dot-location": [2, "object"], + "dot-notation": 2, + "eqeqeq": [2, "smart"], + "func-names": 2, + "func-style": [2, "declaration"], + "generator-star-spacing": [2, {"before": false, "after": true}], + "global-require": 2, + "guard-for-in": 2, + "id-blacklist": 0, + "indent": [2, 4, {"SwitchCase": 0}], + "jsx-quotes": [2, "prefer-single"], + "key-spacing": [2, {"beforeColon": false, "afterColon": true}], + "keyword-spacing": [2, {"before": true, "after": true, "overrides": {}}], + "linebreak-style": 2, + "lines-around-comment": [2, { "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": [2, {"max":2}], + "max-statements-per-line": [2, {"max": 1}], + "new-cap": 2, + "new-parens": 2, + "newline-before-return": 0, + "newline-per-chained-call": 0, + "no-alert": 2, + "no-array-constructor": 2, + "no-caller": 2, + "no-case-declarations": 2, + "no-class-assign": 2, + "no-cond-assign": [2, "except-parens"], + "no-confusing-arrow": 2, + "no-console": 2, + "no-const-assign": 2, + "no-constant-condition": 2, + "no-debugger": 2, + "no-div-regex": 2, + "no-dupe-args": 2, + "no-dupe-class-members": 2, + "no-dupe-keys": 2, + "no-duplicate-case": 2, + "no-duplicate-imports": [2, {"includeExports": true}], + "no-else-return": 2, + "no-empty": 2, + "no-empty-function": 2, + "no-empty-pattern": 2, + "no-eval": 2, + "no-ex-assign": 2, + "no-extend-native": 2, + "no-extra-bind": 2, + "no-extra-label": 2, + "no-extra-parens": 0, + "no-extra-semi": 2, + "no-fallthrough": 2, + "no-floating-decimal": 2, + "no-func-assign": 2, + "no-implicit-globals": 0, + "no-implied-eval": 2, + "no-inner-declarations": 0, + "no-invalid-regexp": 2, + "no-irregular-whitespace": 2, + "no-iterator": 2, + "no-labels": 2, + "no-lone-blocks": 2, + "no-lonely-if": 2, + "no-loop-func": 2, + "no-magic-numbers": [1, { "ignore": [-1, 0, 1, 2], "enforceConst": true, "detectObjects": true } ], + "no-mixed-operators": [2, {"allowSamePrecedence": false}], + "no-mixed-spaces-and-tabs": 2, + "no-multi-spaces": [2, { "exceptions": { "Property": false } }], + "no-multi-str": 0, + "no-multiple-empty-lines": [2, {"max": 1}], + "no-native-reassign": 2, + "no-negated-condition": 2, + "no-nested-ternary": 2, + "no-new": 2, + "no-new-func": 2, + "no-new-object": 2, + "no-new-symbol": 2, + "no-new-wrappers": 2, + "no-octal-escape": 2, + "no-param-reassign": 2, + "no-process-env": 2, + "no-process-exit": 2, + "no-proto": 2, + "no-redeclare": 2, + "no-return-assign": [2, "always"], + "no-script-url": 2, + "no-self-assign": 2, + "no-self-compare": 2, + "no-sequences": 2, + "no-shadow": [2, {"hoist": "functions"}], + "no-shadow-restricted-names": 2, + "no-spaced-func": 2, + "no-ternary": 0, + "no-this-before-super": 2, + "no-throw-literal": 2, + "no-trailing-spaces": [2, { "skipBlankLines": false }], + "no-undef-init": 2, + "no-undefined": 2, + "no-underscore-dangle": 2, + "no-unexpected-multiline": 2, + "no-unmodified-loop-condition": 2, + "no-unneeded-ternary": [2, {"defaultAssignment": false}], + "no-unreachable": 2, + "no-unsafe-finally": 2, + "no-unused-expressions": 2, + "no-unused-vars": [2, {"vars": "all", "args": "after-used"}], + "no-use-before-define": [2, "nofunc"], + "no-useless-computed-key": 2, + "no-useless-concat": 2, + "no-useless-constructor": 2, + "no-useless-escape": 2, + "no-useless-rename": 2, + "no-var": 0, + "no-void": 2, + "no-warning-comments": 1, + "no-whitespace-before-property": 2, + "no-with": 2, + "object-curly-newline": 0, + "object-curly-spacing": [2, "never"], + "object-property-newline": [2, {"allowMultiplePropertiesPerLine": true}], + "object-shorthand": [2, "always"], + "one-var": [2, "never"], + "one-var-declaration-per-line": 0, + "operator-linebreak": [2, "after"], + "padded-blocks": [2, "never"], + "prefer-arrow-callback": 2, + "prefer-const": 2, + "prefer-reflect": 2, + "prefer-rest-params": 2, + "prefer-spread": 2, + "prefer-template": 0, + "quote-props": [2, "as-needed"], + "quotes": [2, "single", "avoid-escape"], + "radix": 2, + "react/display-name": [2, { "ignoreTranspilerName": false }], + "react/jsx-boolean-value": [2, "always"], + "react/jsx-closing-bracket-location": [2, { "location": "tag-aligned" }], + "react/jsx-curly-spacing": [2, "never"], + "react/jsx-equals-spacing": [2, "never"], + "react/jsx-first-prop-new-line": [2, "multiline"], + "react/jsx-handler-names": 0, + "react/jsx-indent": [2, 4], + "react/jsx-indent-props": [2, 4], + "react/jsx-key": 2, + "react/jsx-max-props-per-line": [2, { "maximum": 1 }], + "react/jsx-no-bind": 0, + "react/jsx-no-duplicate-props": [2, { "ignoreCase": false }], + "react/jsx-no-literals": 2, + "react/jsx-no-target-blank": 2, + "react/jsx-no-undef": 2, + "react/jsx-pascal-case": 2, + "react/jsx-filename-extension": 2, + "react/jsx-space-before-closing": [2, "never"], + "react/jsx-uses-react": 2, + "react/jsx-uses-vars": 2, + "react/no-comment-textnodes": 2, + "react/no-danger": 0, + "react/no-deprecated": 2, + "react/no-did-mount-set-state": 2, + "react/no-did-update-set-state": 2, + "react/no-direct-mutation-state": 2, + "react/no-is-mounted": 2, + "react/no-multi-comp": [2, { "ignoreStateless": true }], + "react/no-render-return-value": 2, + "react/no-set-state": 0, + "react/no-string-refs": 0, + "react/no-unknown-property": 2, + "react/prefer-es6-class": 2, + "react/prefer-stateless-function": 0, + "react/prop-types": 2, + "react/require-optimization": 1, + "react/require-render-return": 2, + "react/self-closing-comp": 2, + "react/sort-comp": 0, + "react/wrap-multilines": 2, + "require-yield": 2, + "rest-spread-spacing": [2, "never"], + "semi": [2, "always"], + "semi-spacing": [2, {"before": false, "after": true}], + "sort-imports": 0, + "space-before-blocks": [2, "always"], + "space-before-function-paren": [2, "never"], + "space-in-parens": [2, "never"], + "space-infix-ops": 2, + "space-unary-ops": [2, { "words": true, "nonwords": false }], + "template-curly-spacing": [2, "never"], + "valid-typeof": 2, + "vars-on-top": 0, + "wrap-iife": [2, "outside"], + "wrap-regex": 2, + "yoda": [2, "never", {"exceptRange": false, "onlyEquality": false}] + } +} diff --git a/.eslintrc.json b/.eslintrc.json index 8072b4d0..6fecbe88 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,258 +1,18 @@ { - "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 - }, + "extends": "./.eslintrc-platform-v3.4.0.json", "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, + "indent": [2, 2, {"SwitchCase": 0}], + "no-console": 0, "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-process-env": 0, + "no-native-reassign": ["error", {"exceptions": ["Notification"]}], "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/jsx-indent": [2, 2], + "react/jsx-indent-props": [2, 2], + "react/no-multi-comp": 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" - ] + "react/prop-types": 1 } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 9f55de20..108db080 100644 --- a/package.json +++ b/package.json @@ -31,11 +31,12 @@ "package:mac": "build --mac --x64 --ia32", "package:linux": "build --linux --x64 --ia32 --em.name=mattermost-desktop", "manipulate-windows-zip": "node scripts/manipulate_windows_zip.js", - "prettify": "gulp prettify" + "lint:js": "eslint ." }, "devDependencies": { "7zip-bin": "^2.0.1", "babel-core": "^6.7.5", + "babel-eslint": "^6.1.2", "babel-loader": "^6.2.4", "babel-preset-react": "^6.5.0", "chai": "^3.5.0", diff --git a/test/.eslintrc.json b/test/.eslintrc.json new file mode 100644 index 00000000..836966a6 --- /dev/null +++ b/test/.eslintrc.json @@ -0,0 +1,14 @@ +{ + "env": { + "mocha": true + }, + "globals": { + "open_window": true + }, + "rules": { + "global-require": 0, + "max-nested-callbacks": 0, + "no-eval": 0, + "no-magic-numbers": 0 + } +}