From a142bec0b8d2e252aebeae383cc0ca3fe9f657bd Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 29 Jun 2016 10:19:22 +0200 Subject: [PATCH] update js linters --- server/sonar-web/.eslintrc | 44 +++++++++---------- server/sonar-web/.jscsrc | 38 ---------------- server/sonar-web/package.json | 9 ++-- .../sonar-web/src/main/js/apps/code/utils.js | 1 - .../components/IconBubbles.js | 2 +- .../components/IconHistory.js | 2 +- .../component-measures/components/IconList.js | 2 +- .../component-measures/components/IconTree.js | 2 +- .../details/ProfileInheritance.js | 2 +- .../main/js/components/controls/DateInput.js | 1 + .../js/components/controls/FavoriteBase.js | 2 +- .../main/js/components/shared/pending-icon.js | 2 +- .../src/main/js/components/shared/pin-icon.js | 2 +- .../main/js/helpers/handlebars/changelog.js | 2 +- 14 files changed, 36 insertions(+), 75 deletions(-) delete mode 100644 server/sonar-web/.jscsrc diff --git a/server/sonar-web/.eslintrc b/server/sonar-web/.eslintrc index 58a1645c8b9..c1cff1a0ef4 100644 --- a/server/sonar-web/.eslintrc +++ b/server/sonar-web/.eslintrc @@ -26,40 +26,40 @@ ], "rules": { - "arrow-spacing": 1, - "comma-spacing": [1, { "before": false, "after": true }], + "arrow-spacing": 2, + "comma-spacing": 2, "curly": 2, - "eol-last": 1, + "eol-last": 2, "eqeqeq": [2, "smart"], - "indent": [1, 2, { "SwitchCase": 1, "VariableDeclarator": 2 }], - "jsx-quotes": 1, - "key-spacing": [1, { "beforeColon": false, "afterColon": true }], - "no-multi-spaces": 1, + "indent": [2, 2, { "SwitchCase": 1, "VariableDeclarator": 2 }], + "jsx-quotes": 2, + "key-spacing": 2, + "no-multi-spaces": 2, "no-self-compare": 2, "no-unexpected-multiline": 2, - "max-len": 0, + "max-len": [2, 120], "no-const-assign": 2, - "no-multiple-empty-lines": [1, { "max": 3 }], - "no-spaced-func": 1, + "no-multiple-empty-lines": [2, { "max": 3 }], + "no-spaced-func": 2, "no-this-before-super": 2, - "no-trailing-spaces": 1, - "no-unneeded-ternary": 1, - "object-curly-spacing": [1, "always"], + "no-trailing-spaces": 2, + "no-unneeded-ternary": 2, + "object-curly-spacing": [2, "always"], "no-var": 2, "object-shorthand": 2, - "one-var": [1, { "let": "never", "const": "never" }], - "quotes": [1, "single", "avoid-escape"], + "one-var": [2, { "let": "never", "const": "never" }], + "quotes": [2, "single", "avoid-escape"], "prefer-const": 2, - "semi": [1, "always"], - "keyword-spacing": 1, + "semi": [2, "always"], + "keyword-spacing": 2, - "react/jsx-closing-bracket-location": [1, "after-props"], + "react/jsx-closing-bracket-location": [2, "after-props"], "react/jsx-handler-names": 0, - "react/jsx-max-props-per-line": [1, { "maximum": 3 }], + "react/jsx-max-props-per-line": [2, { "maximum": 3 }], "react/jsx-no-duplicate-props": 2, "react/jsx-no-undef": 2, - "react/jsx-pascal-case": 1, - "react/jsx-uses-react": 1, + "react/jsx-pascal-case": 2, + "react/jsx-uses-react": 2, "react/jsx-uses-vars": 2, "react/no-did-mount-set-state": [2, "allow-in-func"], "react/no-did-update-set-state": [2, "allow-in-func"], @@ -69,7 +69,7 @@ "react/prop-types": 0, "react/react-in-jsx-scope": 2, "react/self-closing-comp": 2, - "react/sort-comp": 1 + "react/sort-comp": 2 }, "settings": { diff --git a/server/sonar-web/.jscsrc b/server/sonar-web/.jscsrc deleted file mode 100644 index 4b865a25859..00000000000 --- a/server/sonar-web/.jscsrc +++ /dev/null @@ -1,38 +0,0 @@ -{ - "preset": "airbnb", - "esnext": true, - "excludeFiles": [ - "src/main/js/libs/**" - ], - - "disallowSpacesInFunctionDeclaration": false, - "requireTrailingComma": false, - "requirePaddingNewLinesAfterBlocks": false, - "requireShorthandArrowFunctions": false, - "disallowQuotedKeysInObjects": false, - "requireSpacesInFunctionDeclaration": { - "beforeOpeningRoundBrace": true, - "beforeOpeningCurlyBrace": true - }, - "requireDotNotation": { - "allExcept": [ - "snake_case" - ] - }, - "disallowSpaceAfterObjectKeys": false, - "maximumLineLength": 120, - "safeContextKeyword": [ - "that" - ], - "requireDollarBeforejQueryAssignment": false, - "requireDotNotation": false, - "disallowArrayDestructuringReturn": false, - "requireEnhancedObjectLiterals": true, - "requireObjectKeysOnNewLine": { - "allExcept": ["sameLine"] - }, - "requireSpaceBeforeDestructuredValues": true, - "requireSpaceBeforeObjectValues": true, - "requireSpacesInsideObjectBrackets": "all", - "requirePaddingNewLinesBeforeLineComments": false -} diff --git a/server/sonar-web/package.json b/server/sonar-web/package.json index c16172f1192..3bc34ccd86f 100644 --- a/server/sonar-web/package.json +++ b/server/sonar-web/package.json @@ -26,9 +26,9 @@ "d3": "3.5.6", "del": "2.0.2", "enzyme": "2.2.0", - "eslint": "^2.9.0", - "eslint-plugin-import": "^1.8.0", - "eslint-plugin-react": "^5.1.1", + "eslint": "^2.13.1", + "eslint-plugin-import": "^1.9.2", + "eslint-plugin-react": "^5.2.2", "event-stream": "3.3.1", "expose-loader": "0.7.1", "express": "4.13.4", @@ -47,7 +47,6 @@ "history": "2.0.0", "imports-loader": "0.6.5", "jquery": "2.2.0", - "jscs": "^2.11.0", "jsdom": "6.5.1", "lodash": "4.6.1", "mocha": "2.3.4", @@ -88,7 +87,7 @@ "build": "gulp build", "test": "mocha --opts tests/mocha.opts src/main/js/**/__tests__/**/*", "coverage": "nyc --exclude tests,**/__tests__/** mocha --opts tests/mocha.opts src/main/js/**/__tests__/**/* && nyc report --reporter lcov --report-dir target/coverage", - "lint": "eslint src/main/js && jscs src/main/js", + "lint": "eslint src/main/js", "dev": "NODE_ENV=hot node devServer" }, "engines": { diff --git a/server/sonar-web/src/main/js/apps/code/utils.js b/server/sonar-web/src/main/js/apps/code/utils.js index b236ee82d92..eb63248fb13 100644 --- a/server/sonar-web/src/main/js/apps/code/utils.js +++ b/server/sonar-web/src/main/js/apps/code/utils.js @@ -18,7 +18,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import without from 'lodash/without'; -import sortBy from 'lodash/sortBy'; import { addComponent, diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/IconBubbles.js b/server/sonar-web/src/main/js/apps/component-measures/components/IconBubbles.js index a0914801a08..b5411d4cc81 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/IconBubbles.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/IconBubbles.js @@ -20,7 +20,7 @@ import React from 'react'; export default function IconBubbles () { - /* jscs:disable maximumLineLength */ + /* eslint max-len: 0 */ return (