aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2018-02-09 13:50:43 +0100
committerGitHub <noreply@github.com>2018-02-09 13:50:43 +0100
commit2e06a921076f73f901b333eb7fa236f7971ff3ac (patch)
tree5e39c74eb413af1339db70a337114931f84300e8 /server
parentc1a9442546346aeaa8fd1d43535783af0face16c (diff)
downloadsonarqube-2e06a921076f73f901b333eb7fa236f7971ff3ac.tar.gz
sonarqube-2e06a921076f73f901b333eb7fa236f7971ff3ac.zip
enable eslint rules to enforce newlines (#3043)
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/.eslintrc6
-rw-r--r--server/sonar-web/src/main/js/api/metrics.ts1
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/App.js1
-rw-r--r--server/sonar-web/src/main/js/apps/overview/main/Coverage.js1
-rw-r--r--server/sonar-web/src/main/js/apps/overview/main/Duplications.js1
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/PasswordForm.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserScmAccountInput.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UsersSelectSearch.tsx1
-rw-r--r--server/sonar-web/src/main/js/components/controls/SearchSelect.tsx1
-rw-r--r--server/sonar-web/src/main/js/helpers/measures.ts1
-rw-r--r--server/sonar-web/src/main/js/store/notifications/duck.js1
13 files changed, 21 insertions, 0 deletions
diff --git a/server/sonar-web/.eslintrc b/server/sonar-web/.eslintrc
index 16ebf9a4f53..d03895d0134 100644
--- a/server/sonar-web/.eslintrc
+++ b/server/sonar-web/.eslintrc
@@ -88,6 +88,7 @@
"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],
@@ -101,6 +102,11 @@
"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",
diff --git a/server/sonar-web/src/main/js/api/metrics.ts b/server/sonar-web/src/main/js/api/metrics.ts
index 1dfb0e7789f..c84d8890aac 100644
--- a/server/sonar-web/src/main/js/api/metrics.ts
+++ b/server/sonar-web/src/main/js/api/metrics.ts
@@ -34,6 +34,7 @@ export function getMetrics(data: { p?: number; ps?: number }): Promise<MetricsRe
export function getAllMetrics(data?: { p?: number; ps?: number }): Promise<Metric[]> {
return inner(data);
+
function inner(
data: { p?: number; ps?: number } = { ps: 500 },
prev?: MetricsResponse
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx
index 353eb41b50b..eb400536ed1 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx
@@ -105,6 +105,7 @@ it('should work for long-living branches', () => {
it('should work for all qualifiers', () => {
['TRK', 'BRC', 'VW', 'SVW', 'APP'].forEach(checkWithQualifier);
expect.assertions(5);
+
function checkWithQualifier(qualifier: string) {
const component = { ...baseComponent, configuration: { showSettings: true }, qualifier };
expect(
diff --git a/server/sonar-web/src/main/js/apps/issues/components/App.js b/server/sonar-web/src/main/js/apps/issues/components/App.js
index a4f0a861a95..a6068133e94 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/App.js
+++ b/server/sonar-web/src/main/js/apps/issues/components/App.js
@@ -904,6 +904,7 @@ export default class App extends React.PureComponent {
</div>
);
}
+
render() {
const { component } = this.props;
const { openIssue, paging } = this.state;
diff --git a/server/sonar-web/src/main/js/apps/overview/main/Coverage.js b/server/sonar-web/src/main/js/apps/overview/main/Coverage.js
index ecc08743527..6d800e2a8f6 100644
--- a/server/sonar-web/src/main/js/apps/overview/main/Coverage.js
+++ b/server/sonar-web/src/main/js/apps/overview/main/Coverage.js
@@ -182,4 +182,5 @@ class Coverage extends React.PureComponent {
);
}
}
+
export default enhance(Coverage);
diff --git a/server/sonar-web/src/main/js/apps/overview/main/Duplications.js b/server/sonar-web/src/main/js/apps/overview/main/Duplications.js
index e668ff8efc2..3f94296f6b3 100644
--- a/server/sonar-web/src/main/js/apps/overview/main/Duplications.js
+++ b/server/sonar-web/src/main/js/apps/overview/main/Duplications.js
@@ -171,4 +171,5 @@ class Duplications extends React.PureComponent {
);
}
}
+
export default enhance(Duplications);
diff --git a/server/sonar-web/src/main/js/apps/users/components/PasswordForm.tsx b/server/sonar-web/src/main/js/apps/users/components/PasswordForm.tsx
index 053ece8b03d..1caef1c894a 100644
--- a/server/sonar-web/src/main/js/apps/users/components/PasswordForm.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/PasswordForm.tsx
@@ -70,8 +70,10 @@ export default class PasswordForm extends React.PureComponent<Props, State> {
handleConfirmPasswordChange = (event: React.SyntheticEvent<HTMLInputElement>) =>
this.setState({ confirmPassword: event.currentTarget.value });
+
handleNewPasswordChange = (event: React.SyntheticEvent<HTMLInputElement>) =>
this.setState({ newPassword: event.currentTarget.value });
+
handleOldPasswordChange = (event: React.SyntheticEvent<HTMLInputElement>) =>
this.setState({ oldPassword: event.currentTarget.value });
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx b/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx
index 867d503b933..2cb241d0b1a 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx
@@ -91,10 +91,13 @@ export default class UserForm extends React.PureComponent<Props, State> {
handleEmailChange = (event: React.SyntheticEvent<HTMLInputElement>) =>
this.setState({ email: event.currentTarget.value });
+
handleLoginChange = (event: React.SyntheticEvent<HTMLInputElement>) =>
this.setState({ login: event.currentTarget.value });
+
handleNameChange = (event: React.SyntheticEvent<HTMLInputElement>) =>
this.setState({ name: event.currentTarget.value });
+
handlePasswordChange = (event: React.SyntheticEvent<HTMLInputElement>) =>
this.setState({ password: event.currentTarget.value });
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserScmAccountInput.tsx b/server/sonar-web/src/main/js/apps/users/components/UserScmAccountInput.tsx
index 48db1e71bc0..6f93c423cd2 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserScmAccountInput.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserScmAccountInput.tsx
@@ -30,6 +30,7 @@ export interface Props {
export default class UserScmAccountInput extends React.PureComponent<Props> {
handleChange = (event: React.SyntheticEvent<HTMLInputElement>) =>
this.props.onChange(this.props.idx, event.currentTarget.value);
+
handleRemove = () => this.props.onRemove(this.props.idx);
render() {
diff --git a/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearch.tsx b/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearch.tsx
index 4b605759a84..2d54fee167c 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearch.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearch.tsx
@@ -55,6 +55,7 @@ export default class UsersSelectSearch extends React.PureComponent<Props, State>
this.handleSearch = debounce(this.handleSearch, 250);
this.state = { searchResult: [], isLoading: false, search: '' };
}
+
componentDidMount() {
this.mounted = true;
this.handleSearch(this.state.search);
diff --git a/server/sonar-web/src/main/js/components/controls/SearchSelect.tsx b/server/sonar-web/src/main/js/components/controls/SearchSelect.tsx
index 07f9b2dac2a..6d6403c41c2 100644
--- a/server/sonar-web/src/main/js/components/controls/SearchSelect.tsx
+++ b/server/sonar-web/src/main/js/components/controls/SearchSelect.tsx
@@ -68,6 +68,7 @@ export default class SearchSelect extends React.PureComponent<Props, State> {
get minimumQueryLength() {
return this.props.minimumQueryLength !== undefined ? this.props.minimumQueryLength : 2;
}
+
get resetOnBlur() {
return this.props.resetOnBlur !== undefined ? this.props.resetOnBlur : true;
}
diff --git a/server/sonar-web/src/main/js/helpers/measures.ts b/server/sonar-web/src/main/js/helpers/measures.ts
index b6354557ad1..da64a3d6654 100644
--- a/server/sonar-web/src/main/js/helpers/measures.ts
+++ b/server/sonar-web/src/main/js/helpers/measures.ts
@@ -315,6 +315,7 @@ function getRatingGrid(): string {
}
let maintainabilityRatingGrid: number[];
+
function getMaintainabilityRatingGrid(): number[] {
if (maintainabilityRatingGrid) {
return maintainabilityRatingGrid;
diff --git a/server/sonar-web/src/main/js/store/notifications/duck.js b/server/sonar-web/src/main/js/store/notifications/duck.js
index 8dce9f8895c..0861944491c 100644
--- a/server/sonar-web/src/main/js/store/notifications/duck.js
+++ b/server/sonar-web/src/main/js/store/notifications/duck.js
@@ -104,6 +104,7 @@ function onAddNotification(state /*: NotificationsState */, notification /*: Not
function isNotificationsEqual(a /*: Notification */, b /*: Notification */) {
return a.channel === b.channel && a.type === b.type && a.project === b.project;
}
+
return uniqWith([...state, notification], isNotificationsEqual);
}