From: Stas Vilchik Date: Fri, 27 Apr 2018 15:22:22 +0000 (+0200) Subject: use eslint-config-sonarqube (#191) X-Git-Tag: 7.5~1291 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0e0296c32b281364f3174b2b14d9dc31b8426769;p=sonarqube.git use eslint-config-sonarqube (#191) --- diff --git a/server/sonar-vsts/.eslintrc b/server/sonar-vsts/.eslintrc index ddca3b05c68..f3c47f9df45 100644 --- a/server/sonar-vsts/.eslintrc +++ b/server/sonar-vsts/.eslintrc @@ -1,211 +1,3 @@ { - "extends": [ - "eslint:recommended", - "plugin:import/errors", - "plugin:react/recommended", - "plugin:jsx-a11y/recommended", - "plugin:promise/recommended", - "plugin:sonarjs/recommended" - ], - - "env": { - "browser": true, - "es6": true, - "jest": true, - "node": true - }, - - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module", - "ecmaFeatures": { - "jsx": true, - "modules": true - } - }, - - "parser": "typescript-eslint-parser", - - "plugins": ["import", "jsx-a11y", "react", "promise", "sonarjs"], - - "rules": { - // possible errors - "for-direction": "error", - "no-prototype-builtins": "error", - "no-template-curly-in-string": "error", - "no-unsafe-negation": "error", - - // best practices - // TODO turn all rules to "error" eventually - "array-callback-return": "error", - "block-scoped-var": "error", - "complexity": "warn", - "consistent-return": "warn", - "eqeqeq": ["error", "smart"], - "guard-for-in": "error", - "no-alert": "error", - "no-caller": "error", - "no-div-regex": "error", - "no-eval": "error", - "no-extend-native": "error", - "no-extra-bind": "error", - "no-extra-label": "error", - "no-floating-decimal": "error", - "no-implied-eval": "error", - "no-iterator": "error", - "no-labels": "error", - "no-lone-blocks": "error", - "no-loop-func": "error", - "no-new": "warn", - "no-new-func": "error", - "no-new-wrappers": "error", - "no-proto": "error", - "no-restricted-properties": "error", - "no-return-assign": "error", - "no-return-await": "error", - "no-self-compare": "error", - "no-sequences": "error", - "no-throw-literal": "error", - "no-unmodified-loop-condition": "error", - "no-unused-expressions": "error", - "no-useless-call": "error", - "no-useless-concat": "error", - "no-useless-escape": "error", - "no-useless-return": "error", - "no-void": "error", - "no-with": "error", - "radix": "error", - "require-await": "error", - "wrap-iife": "error", - "yoda": "error", - - // stylistic - "camelcase": "warn", - "consistent-this": ["warn", "that"], - "func-name-matching": "error", - "func-style": ["warn", "declaration", { "allowArrowFunctions": true }], - "lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }], - "max-depth": "warn", - "max-lines": ["warn", 1000], - "max-params": ["warn", 4], - "no-array-constructor": "warn", - "no-bitwise": "warn", - "no-lonely-if": "error", - "no-multi-assign": "warn", - "no-nested-ternary": "warn", - "no-new-object": "warn", - "no-underscore-dangle": "warn", - "no-unneeded-ternary": "warn", - "one-var": ["warn", "never"], - "operator-assignment": "warn", - "padding-line-between-statements": [ - "error", - { "blankLine": "always", "prev": "*", "next": ["class", "function"] }, - { "blankLine": "always", "prev": ["class", "function"], "next": "*" } - ], - - // es2015 - "no-duplicate-imports": "error", - "no-useless-computed-key": "error", - "no-useless-rename": "error", - "no-var": "error", - "object-shorthand": "error", - "prefer-arrow-callback": "error", - "prefer-const": "error", - "prefer-destructuring": ["warn", { "object": true, "array": false }], - "prefer-numeric-literals": "warn", - "prefer-rest-params": "warn", - "prefer-spread": "warn", - - // disabled because of the usage of typescript-eslint-parser - // https://github.com/eslint/typescript-eslint-parser/issues/77 - "no-undef": "off", - "no-unused-vars": "off", - - // import - "import/extensions": "error", - "import/first": "error", - "import/newline-after-import": "error", - "import/no-absolute-path": "error", - "import/no-amd": "error", - "import/no-deprecated": "error", - "import/no-duplicates": "error", - "import/no-dynamic-require": "error", - "import/no-extraneous-dependencies": "error", - "import/no-mutable-exports": "error", - "import/no-named-as-default": "error", - "import/no-named-as-default-member": "error", - "import/no-named-default": "error", - "import/no-webpack-loader-syntax": "error", - "import/order": [ - "error", - { - "groups": ["builtin", "external", ["index", "sibling"], ["parent", "internal"]], - "newlines-between": "never" - } - ], - - // does not properly work with ts - "import/no-unresolved": "off", - - // react - // TODO turn all rules to "error" eventually - "react/button-has-type": "warn", - "react/display-name": "warn", - "react/jsx-boolean-value": ["error", "always"], - "react/jsx-no-comment-textnodes": "warn", - "react/jsx-no-target-blank": "warn", - "react/jsx-pascal-case": "error", - "react/jsx-sort-default-props": "warn", - "react/jsx-sort-props": "warn", - "react/no-access-state-in-setstate": "warn", - "react/no-find-dom-node": "warn", - "react/no-string-refs": "warn", - "react/no-this-in-sfc": "error", - "react/self-closing-comp": "error", - "react/sort-comp": [ - "error", - { - "order": [ - "type-annotations", - "instance-variables", - "static-methods", - "lifecycle", - "everything-else", - "rendering" - ], - "groups": { "rendering": ["/^render.+$/", "render"] } - } - ], - - // turn off prop types validation, better use ts ;) - "react/prop-types": "off", - - // jsx-a11y - "jsx-a11y/anchor-has-content": "warn", - "jsx-a11y/no-noninteractive-tabindex": "warn", - "jsx-a11y/no-redundant-roles": "warn", - "jsx-a11y/no-static-element-interactions": "warn", - - "jsx-a11y/anchor-is-valid": "off", - "jsx-a11y/click-events-have-key-events": "off", - "jsx-a11y/no-autofocus": "off", - "jsx-a11y/no-noninteractive-element-interactions": "off", - // has FPs - "jsx-a11y/label-has-for": "off", - - // promise - "promise/catch-or-return": ["warn", { "allowThen": true }], - - "promise/always-return": "off", - "promise/avoid-new": "off", - - // sonarjs - "sonarjs/cognitive-complexity": "warn", - "sonarjs/no-identical-functions": "warn" - }, - - "settings": { - "import/ignore": ["node_modules"] - } + "extends": "sonarqube" } diff --git a/server/sonar-vsts/package.json b/server/sonar-vsts/package.json index 9a061014420..89d6479ef8e 100644 --- a/server/sonar-vsts/package.json +++ b/server/sonar-vsts/package.json @@ -41,11 +41,12 @@ "enzyme-adapter-react-16": "1.1.1", "enzyme-to-json": "3.3.0", "escape-string-regexp": "1.0.5", - "eslint": "4.17.0", - "eslint-plugin-import": "2.8.0", - "eslint-plugin-jsx-a11y": "6.0.2", - "eslint-plugin-promise": "3.6.0", - "eslint-plugin-react": "7.6.1", + "eslint": "4.19.1", + "eslint-config-sonarqube": "0.1.0", + "eslint-plugin-import": "2.11.0", + "eslint-plugin-jsx-a11y": "6.0.3", + "eslint-plugin-promise": "3.7.0", + "eslint-plugin-react": "7.7.0", "eslint-plugin-sonarjs": "0.1.0", "html-webpack-plugin": "3.0.6", "jest": "22.0.6", @@ -60,7 +61,7 @@ "ts-jest": "22.0.1", "ts-loader": "4.1.0", "typescript": "2.8.1", - "typescript-eslint-parser": "13.0.0", + "typescript-eslint-parser": "15.0.0", "webpack": "4.1.1", "webpack-bundle-analyzer": "2.11.1", "webpack-dev-server": "3.1.1" diff --git a/server/sonar-vsts/yarn.lock b/server/sonar-vsts/yarn.lock index 5d03d335354..8b3d6df8060 100644 --- a/server/sonar-vsts/yarn.lock +++ b/server/sonar-vsts/yarn.lock @@ -103,7 +103,11 @@ address@1.0.3, address@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/address/-/address-1.0.3.tgz#b5f50631f8d6cec8bd20c963963afb55e06cbce9" -ajv-keywords@^3.0.0, ajv-keywords@^3.1.0: +ajv-keywords@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" + +ajv-keywords@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.1.0.tgz#ac2b27939c543e95d2c06e7f7f5c27be4aa543be" @@ -114,7 +118,7 @@ ajv@^4.9.1: co "^4.6.0" json-stable-stringify "^1.0.1" -ajv@^5.1.0, ajv@^5.3.0: +ajv@^5.1.0, ajv@^5.2.3, ajv@^5.3.0: version "5.5.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" dependencies: @@ -123,7 +127,7 @@ ajv@^5.1.0, ajv@^5.3.0: fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.3.0" -ajv@^6.0.1, ajv@^6.1.0: +ajv@^6.1.0: version "6.4.0" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.4.0.tgz#d3aff78e9277549771daf0164cff48482b754fc6" dependencies: @@ -1286,7 +1290,7 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" -builtin-modules@^1.0.0, builtin-modules@^1.1.1: +builtin-modules@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -2425,6 +2429,10 @@ escodegen@^1.9.0: optionalDependencies: source-map "~0.6.1" +eslint-config-sonarqube@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/eslint-config-sonarqube/-/eslint-config-sonarqube-0.1.0.tgz#c656609903ab553e37865c7e95d56efc9d7a9d22" + eslint-import-resolver-node@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" @@ -2432,31 +2440,31 @@ eslint-import-resolver-node@^0.3.1: debug "^2.6.9" resolve "^1.5.0" -eslint-module-utils@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.1.1.tgz#abaec824177613b8a95b299639e1b6facf473449" +eslint-module-utils@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz#b270362cd88b1a48ad308976ce7fa54e98411746" dependencies: debug "^2.6.8" pkg-dir "^1.0.0" -eslint-plugin-import@2.8.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.8.0.tgz#fa1b6ef31fcb3c501c09859c1b86f1fc5b986894" +eslint-plugin-import@2.11.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.11.0.tgz#15aeea37a67499d848e8e981806d4627b5503816" dependencies: - builtin-modules "^1.1.1" contains-path "^0.1.0" debug "^2.6.8" doctrine "1.5.0" eslint-import-resolver-node "^0.3.1" - eslint-module-utils "^2.1.1" + eslint-module-utils "^2.2.0" has "^1.0.1" - lodash.cond "^4.3.0" + lodash "^4.17.4" minimatch "^3.0.3" read-pkg-up "^2.0.0" + resolve "^1.6.0" -eslint-plugin-jsx-a11y@6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.0.2.tgz#659277a758b036c305a7e4a13057c301cd3be73f" +eslint-plugin-jsx-a11y@6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.0.3.tgz#54583d1ae442483162e040e13cc31865465100e5" dependencies: aria-query "^0.7.0" array-includes "^3.0.3" @@ -2464,15 +2472,15 @@ eslint-plugin-jsx-a11y@6.0.2: axobject-query "^0.1.0" damerau-levenshtein "^1.0.0" emoji-regex "^6.1.0" - jsx-ast-utils "^1.4.0" + jsx-ast-utils "^2.0.0" -eslint-plugin-promise@3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-3.6.0.tgz#54b7658c8f454813dc2a870aff8152ec4969ba75" +eslint-plugin-promise@3.7.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-3.7.0.tgz#f4bde5c2c77cdd69557a8f69a24d1ad3cfc9e67e" -eslint-plugin-react@7.6.1: - version "7.6.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.6.1.tgz#5d0e908be599f0c02fbf4eef0c7ed6f29dff7633" +eslint-plugin-react@7.7.0: + version "7.7.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.7.0.tgz#f606c719dbd8a1a2b3d25c16299813878cca0160" dependencies: doctrine "^2.0.2" has "^1.0.1" @@ -2494,9 +2502,9 @@ eslint-visitor-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" -eslint@4.17.0: - version "4.17.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.17.0.tgz#dc24bb51ede48df629be7031c71d9dc0ee4f3ddf" +eslint@4.19.1: + version "4.19.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300" dependencies: ajv "^5.3.0" babel-code-frame "^6.22.0" @@ -2507,7 +2515,7 @@ eslint@4.17.0: doctrine "^2.1.0" eslint-scope "^3.7.1" eslint-visitor-keys "^1.0.0" - espree "^3.5.2" + espree "^3.5.4" esquery "^1.0.0" esutils "^2.0.2" file-entry-cache "^2.0.0" @@ -2529,14 +2537,15 @@ eslint@4.17.0: path-is-inside "^1.0.2" pluralize "^7.0.0" progress "^2.0.0" + regexpp "^1.0.1" require-uncached "^1.0.3" semver "^5.3.0" strip-ansi "^4.0.0" strip-json-comments "~2.0.1" - table "^4.0.1" + table "4.0.2" text-table "~0.2.0" -espree@^3.5.2: +espree@^3.5.4: version "3.5.4" resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" dependencies: @@ -4326,11 +4335,7 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -jsx-ast-utils@^1.4.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz#3867213e8dd79bf1e8f2300c0cfc1efb182c0df1" - -jsx-ast-utils@^2.0.1: +jsx-ast-utils@^2.0.0, jsx-ast-utils@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz#e801b1b39985e20fffc87b40e3748080e2dcac7f" dependencies: @@ -4442,10 +4447,6 @@ lodash.camelcase@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" -lodash.cond@^4.3.0: - version "4.5.2" - resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" - lodash.flattendeep@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" @@ -6078,6 +6079,10 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" +regexpp@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.1.0.tgz#0e3516dd0b7904f413d2d4193dce4618c3a689ab" + regexpu-core@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-1.0.0.tgz#86a763f58ee4d7c2f6b102e4764050de7ed90c6b" @@ -6262,6 +6267,12 @@ resolve@^1.1.7, resolve@^1.5.0: dependencies: path-parse "^1.0.5" +resolve@^1.6.0: + version "1.7.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.7.1.tgz#aadd656374fd298aee895bc026b8297418677fd3" + dependencies: + path-parse "^1.0.5" + restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" @@ -6865,12 +6876,12 @@ symbol-tree@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" -table@^4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc" +table@4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" dependencies: - ajv "^6.0.1" - ajv-keywords "^3.0.0" + ajv "^5.2.3" + ajv-keywords "^2.1.0" chalk "^2.1.0" lodash "^4.17.4" slice-ansi "1.0.0" @@ -7064,9 +7075,9 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -typescript-eslint-parser@13.0.0: - version "13.0.0" - resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-13.0.0.tgz#57f9be603d0fad7c26da76c2be67c0779d23362c" +typescript-eslint-parser@15.0.0: + version "15.0.0" + resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-15.0.0.tgz#882fd3d7aabffbab0a7f98d2a59fb9a989c2b37f" dependencies: lodash.unescape "4.0.1" semver "5.5.0" diff --git a/server/sonar-web/.eslintrc b/server/sonar-web/.eslintrc index e03bc7b4c63..f3c47f9df45 100644 --- a/server/sonar-web/.eslintrc +++ b/server/sonar-web/.eslintrc @@ -1,216 +1,3 @@ { - "extends": [ - "eslint:recommended", - "plugin:import/errors", - "plugin:react/recommended", - "plugin:jsx-a11y/recommended", - "plugin:promise/recommended", - "plugin:sonarjs/recommended" - ], - - "env": { - "browser": true, - "es6": true, - "jest": true, - "node": true - }, - - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module", - "ecmaFeatures": { - "jsx": true, - "modules": true - } - }, - - "globals": { - "baseUrl": true, - "SyntheticInputEvent": true - }, - - "parser": "typescript-eslint-parser", - - "plugins": ["import", "jsx-a11y", "react", "promise", "sonarjs"], - - "rules": { - // possible errors - "for-direction": "error", - "no-prototype-builtins": "error", - "no-template-curly-in-string": "error", - "no-unsafe-negation": "error", - - // best practices - // TODO turn all rules to "error" eventually - "array-callback-return": "error", - "block-scoped-var": "error", - "complexity": "warn", - "consistent-return": "warn", - "eqeqeq": ["error", "smart"], - "guard-for-in": "error", - "no-alert": "error", - "no-caller": "error", - "no-div-regex": "error", - "no-eval": "error", - "no-extend-native": "error", - "no-extra-bind": "error", - "no-extra-label": "error", - "no-floating-decimal": "error", - "no-implied-eval": "error", - "no-iterator": "error", - "no-labels": "error", - "no-lone-blocks": "error", - "no-loop-func": "error", - "no-new": "warn", - "no-new-func": "error", - "no-new-wrappers": "error", - "no-proto": "error", - "no-restricted-properties": "error", - "no-return-assign": "error", - "no-return-await": "error", - "no-self-compare": "error", - "no-sequences": "error", - "no-throw-literal": "error", - "no-unmodified-loop-condition": "error", - "no-unused-expressions": "error", - "no-useless-call": "error", - "no-useless-concat": "error", - "no-useless-escape": "error", - "no-useless-return": "error", - "no-void": "error", - "no-with": "error", - "radix": "error", - "require-await": "error", - "wrap-iife": "error", - "yoda": "error", - - // stylistic - "camelcase": "warn", - "consistent-this": ["warn", "that"], - "func-name-matching": "error", - "func-style": ["warn", "declaration", { "allowArrowFunctions": true }], - "lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }], - "max-depth": "warn", - "max-lines": ["warn", 1000], - "max-params": ["warn", 4], - "no-array-constructor": "warn", - "no-bitwise": "warn", - "no-lonely-if": "error", - "no-multi-assign": "warn", - "no-nested-ternary": "warn", - "no-new-object": "warn", - "no-underscore-dangle": "warn", - "no-unneeded-ternary": "warn", - "one-var": ["warn", "never"], - "operator-assignment": "warn", - "padding-line-between-statements": [ - "error", - { "blankLine": "always", "prev": "*", "next": ["class", "function"] }, - { "blankLine": "always", "prev": ["class", "function"], "next": "*" } - ], - - // es2015 - "no-duplicate-imports": "error", - "no-useless-computed-key": "error", - "no-useless-rename": "error", - "no-var": "error", - "object-shorthand": "error", - "prefer-arrow-callback": "error", - "prefer-const": "error", - "prefer-destructuring": ["warn", { "object": true, "array": false }], - "prefer-numeric-literals": "warn", - "prefer-rest-params": "warn", - "prefer-spread": "warn", - - // disabled because of the usage of typescript-eslint-parser - // https://github.com/eslint/typescript-eslint-parser/issues/77 - "no-undef": "off", - "no-unused-vars": "off", - - // import - "import/extensions": "error", - "import/first": "error", - "import/newline-after-import": "error", - "import/no-absolute-path": "error", - "import/no-amd": "error", - "import/no-deprecated": "error", - "import/no-duplicates": "error", - "import/no-dynamic-require": "error", - "import/no-extraneous-dependencies": "error", - "import/no-mutable-exports": "error", - "import/no-named-as-default": "error", - "import/no-named-as-default-member": "error", - "import/no-named-default": "error", - "import/no-webpack-loader-syntax": "error", - "import/order": [ - "error", - { - "groups": ["builtin", "external", ["index", "sibling"], ["parent", "internal"]], - "newlines-between": "never" - } - ], - - // does not properly work with ts - "import/no-unresolved": "off", - - // react - // TODO turn all rules to "error" eventually - "react/button-has-type": "warn", - "react/display-name": "warn", - "react/jsx-boolean-value": ["error", "always"], - "react/jsx-no-comment-textnodes": "warn", - "react/jsx-no-target-blank": "warn", - "react/jsx-pascal-case": "error", - "react/jsx-sort-default-props": "warn", - "react/jsx-sort-props": "warn", - "react/no-access-state-in-setstate": "warn", - "react/no-find-dom-node": "warn", - "react/no-string-refs": "warn", - "react/no-this-in-sfc": "error", - "react/self-closing-comp": "error", - "react/sort-comp": [ - "error", - { - "order": [ - "type-annotations", - "instance-variables", - "static-methods", - "lifecycle", - "everything-else", - "rendering" - ], - "groups": { "rendering": ["/^render.+$/", "render"] } - } - ], - - // turn off prop types validation, better use ts ;) - "react/prop-types": "off", - - // jsx-a11y - "jsx-a11y/anchor-has-content": "warn", - "jsx-a11y/no-noninteractive-tabindex": "warn", - "jsx-a11y/no-redundant-roles": "warn", - "jsx-a11y/no-static-element-interactions": "warn", - - "jsx-a11y/anchor-is-valid": "off", - "jsx-a11y/click-events-have-key-events": "off", - "jsx-a11y/no-autofocus": "off", - "jsx-a11y/no-noninteractive-element-interactions": "off", - // has FPs - "jsx-a11y/label-has-for": "off", - - // promise - "promise/catch-or-return": ["warn", { "allowThen": true }], - - "promise/always-return": "off", - "promise/avoid-new": "off", - - // sonarjs - "sonarjs/cognitive-complexity": "warn", - "sonarjs/no-identical-functions": "warn" - }, - - "settings": { - "import/ignore": ["node_modules"] - } + "extends": "sonarqube" } diff --git a/server/sonar-web/package.json b/server/sonar-web/package.json index 113fc9abe25..11e65a186d7 100644 --- a/server/sonar-web/package.json +++ b/server/sonar-web/package.json @@ -77,11 +77,12 @@ "enzyme-adapter-react-16": "1.1.1", "enzyme-to-json": "3.3.0", "escape-string-regexp": "1.0.5", - "eslint": "4.17.0", - "eslint-plugin-import": "2.8.0", - "eslint-plugin-jsx-a11y": "6.0.2", - "eslint-plugin-promise": "3.6.0", - "eslint-plugin-react": "7.6.1", + "eslint": "4.19.1", + "eslint-config-sonarqube": "0.1.0", + "eslint-plugin-import": "2.11.0", + "eslint-plugin-jsx-a11y": "6.0.3", + "eslint-plugin-promise": "3.7.0", + "eslint-plugin-react": "7.7.0", "eslint-plugin-sonarjs": "0.1.0", "expose-loader": "0.7.5", "flow-bin": "^0.52.0", @@ -100,7 +101,7 @@ "ts-jest": "22.0.1", "ts-loader": "4.1.0", "typescript": "2.8.1", - "typescript-eslint-parser": "13.0.0", + "typescript-eslint-parser": "15.0.0", "webpack": "4.1.1", "webpack-bundle-analyzer": "2.11.1", "webpack-dev-server": "3.1.1" diff --git a/server/sonar-web/src/main/js/helpers/latinize.ts b/server/sonar-web/src/main/js/helpers/latinize.ts index ff9d9559a60..7d5cefe98f7 100644 --- a/server/sonar-web/src/main/js/helpers/latinize.ts +++ b/server/sonar-web/src/main/js/helpers/latinize.ts @@ -403,5 +403,6 @@ for (let i = 0; i < defaultDiacriticsRemovalap.length; i++) { // "what?" version ... http://jsperf.com/diacritics/12 export default function removeDiacritics(str: string): string { + // eslint-disable-next-line no-control-regex return str.replace(/[^\u0000-\u007E]/g, a => diacriticsMap[a] || a); } diff --git a/server/sonar-web/yarn.lock b/server/sonar-web/yarn.lock index a2087e788b9..873367f260e 100644 --- a/server/sonar-web/yarn.lock +++ b/server/sonar-web/yarn.lock @@ -158,7 +158,7 @@ acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" -acorn@^5.0.0, acorn@^5.1.2, acorn@^5.3.0, acorn@^5.4.0: +acorn@^5.0.0, acorn@^5.1.2, acorn@^5.3.0, acorn@^5.5.0: version "5.5.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.5.3.tgz#f473dd47e0277a08e28e9bec5aeeb04751f0b8c9" @@ -1365,7 +1365,7 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" -builtin-modules@^1.0.0, builtin-modules@^1.1.1: +builtin-modules@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -2623,6 +2623,10 @@ escodegen@^1.9.0: optionalDependencies: source-map "~0.5.6" +eslint-config-sonarqube@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/eslint-config-sonarqube/-/eslint-config-sonarqube-0.1.0.tgz#c656609903ab553e37865c7e95d56efc9d7a9d22" + eslint-import-resolver-node@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.1.tgz#4422574cde66a9a7b099938ee4d508a199e0e3cc" @@ -2630,31 +2634,31 @@ eslint-import-resolver-node@^0.3.1: debug "^2.6.8" resolve "^1.2.0" -eslint-module-utils@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.1.1.tgz#abaec824177613b8a95b299639e1b6facf473449" +eslint-module-utils@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz#b270362cd88b1a48ad308976ce7fa54e98411746" dependencies: debug "^2.6.8" pkg-dir "^1.0.0" -eslint-plugin-import@2.8.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.8.0.tgz#fa1b6ef31fcb3c501c09859c1b86f1fc5b986894" +eslint-plugin-import@2.11.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.11.0.tgz#15aeea37a67499d848e8e981806d4627b5503816" dependencies: - builtin-modules "^1.1.1" contains-path "^0.1.0" debug "^2.6.8" doctrine "1.5.0" eslint-import-resolver-node "^0.3.1" - eslint-module-utils "^2.1.1" + eslint-module-utils "^2.2.0" has "^1.0.1" - lodash.cond "^4.3.0" + lodash "^4.17.4" minimatch "^3.0.3" read-pkg-up "^2.0.0" + resolve "^1.6.0" -eslint-plugin-jsx-a11y@6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.0.2.tgz#659277a758b036c305a7e4a13057c301cd3be73f" +eslint-plugin-jsx-a11y@6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.0.3.tgz#54583d1ae442483162e040e13cc31865465100e5" dependencies: aria-query "^0.7.0" array-includes "^3.0.3" @@ -2662,15 +2666,15 @@ eslint-plugin-jsx-a11y@6.0.2: axobject-query "^0.1.0" damerau-levenshtein "^1.0.0" emoji-regex "^6.1.0" - jsx-ast-utils "^1.4.0" + jsx-ast-utils "^2.0.0" -eslint-plugin-promise@3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-3.6.0.tgz#54b7658c8f454813dc2a870aff8152ec4969ba75" +eslint-plugin-promise@3.7.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-3.7.0.tgz#f4bde5c2c77cdd69557a8f69a24d1ad3cfc9e67e" -eslint-plugin-react@7.6.1: - version "7.6.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.6.1.tgz#5d0e908be599f0c02fbf4eef0c7ed6f29dff7633" +eslint-plugin-react@7.7.0: + version "7.7.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.7.0.tgz#f606c719dbd8a1a2b3d25c16299813878cca0160" dependencies: doctrine "^2.0.2" has "^1.0.1" @@ -2692,9 +2696,9 @@ eslint-visitor-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" -eslint@4.17.0: - version "4.17.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.17.0.tgz#dc24bb51ede48df629be7031c71d9dc0ee4f3ddf" +eslint@4.19.1: + version "4.19.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300" dependencies: ajv "^5.3.0" babel-code-frame "^6.22.0" @@ -2705,7 +2709,7 @@ eslint@4.17.0: doctrine "^2.1.0" eslint-scope "^3.7.1" eslint-visitor-keys "^1.0.0" - espree "^3.5.2" + espree "^3.5.4" esquery "^1.0.0" esutils "^2.0.2" file-entry-cache "^2.0.0" @@ -2727,18 +2731,19 @@ eslint@4.17.0: path-is-inside "^1.0.2" pluralize "^7.0.0" progress "^2.0.0" + regexpp "^1.0.1" require-uncached "^1.0.3" semver "^5.3.0" strip-ansi "^4.0.0" strip-json-comments "~2.0.1" - table "^4.0.1" + table "4.0.2" text-table "~0.2.0" -espree@^3.5.2: - version "3.5.3" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.3.tgz#931e0af64e7fbbed26b050a29daad1fc64799fa6" +espree@^3.5.4: + version "3.5.4" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" dependencies: - acorn "^5.4.0" + acorn "^5.5.0" acorn-jsx "^3.0.0" esprima@^2.6.0: @@ -4634,11 +4639,7 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -jsx-ast-utils@^1.4.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz#3867213e8dd79bf1e8f2300c0cfc1efb182c0df1" - -jsx-ast-utils@^2.0.1: +jsx-ast-utils@^2.0.0, jsx-ast-utils@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz#e801b1b39985e20fffc87b40e3748080e2dcac7f" dependencies: @@ -4829,10 +4830,6 @@ lodash.clonedeep@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" -lodash.cond@^4.3.0: - version "4.5.2" - resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" - lodash.flattendeep@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" @@ -6633,6 +6630,10 @@ regex-not@^1.0.0: dependencies: extend-shallow "^2.0.1" +regexpp@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.1.0.tgz#0e3516dd0b7904f413d2d4193dce4618c3a689ab" + regexpu-core@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-1.0.0.tgz#86a763f58ee4d7c2f6b102e4764050de7ed90c6b" @@ -6817,6 +6818,12 @@ resolve@^1.1.7, resolve@^1.2.0: dependencies: path-parse "^1.0.5" +resolve@^1.6.0: + version "1.7.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.7.1.tgz#aadd656374fd298aee895bc026b8297418677fd3" + dependencies: + path-parse "^1.0.5" + restore-cursor@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" @@ -7451,7 +7458,7 @@ symbol-tree@^3.2.1: version "3.2.2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" -table@^4.0.1: +table@4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" dependencies: @@ -7657,9 +7664,9 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -typescript-eslint-parser@13.0.0: - version "13.0.0" - resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-13.0.0.tgz#57f9be603d0fad7c26da76c2be67c0779d23362c" +typescript-eslint-parser@15.0.0: + version "15.0.0" + resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-15.0.0.tgz#882fd3d7aabffbab0a7f98d2a59fb9a989c2b37f" dependencies: lodash.unescape "4.0.1" semver "5.5.0"