aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-10-23 20:38:19 +0200
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-10-30 09:20:37 +0100
commit3aeea07185ebb2eceeab4a0ec520f7d641d02f39 (patch)
tree0406942e88fa3ae9d9539186ff31520beaac90ac /server/sonar-web/src/main
parent973d117229fc17176e9ea3384ec4a737178b28c2 (diff)
downloadsonarqube-3aeea07185ebb2eceeab4a0ec520f7d641d02f39.tar.gz
sonarqube-3aeea07185ebb2eceeab4a0ec520f7d641d02f39.zip
use eslint for typescript, update eslint configuration (#2742)
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r--server/sonar-web/src/main/js/app/components/App.tsx8
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx18
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx1
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/Workers.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/ScannerContext-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stacktrace-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/WorkersForm-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/App.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/portfolio/components/Activity.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/portfolio/components/App.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/portfolio/components/__tests__/Activity-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/portfolio/components/__tests__/Report-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/portfolio/components/__tests__/Subscription-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/BranchRow.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/RenameBranchModal.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LongBranchesPattern-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/RenameBranchModal-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/SettingForm-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/App-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/App-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/Table-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts1
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverallMeasures.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/DefaultPageSelector-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/FavoriteFilter-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/utils.ts4
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/App-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/BulkApplyTemplateModal-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/CreateProjectForm-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/DeleteModal-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissions-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsForm-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsFormSelect-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsGroup-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsUser-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/App.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/system/utils.ts6
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/__tests__/Domain-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/charts/bar-chart.js8
-rw-r--r--server/sonar-web/src/main/js/components/common/SelectListItem.js2
-rw-r--r--server/sonar-web/src/main/js/components/controls/DateInput.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/intl/DateFormatter.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/intl/DateFromNow.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/intl/DateTimeFormatter.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/intl/TimeFormatter.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/measure/Measure.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/measure/__tests__/Measure-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/components/ui/Rating.tsx2
-rw-r--r--server/sonar-web/src/main/js/helpers/issues.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/l10n.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/measures.ts6
74 files changed, 155 insertions, 90 deletions
diff --git a/server/sonar-web/src/main/js/app/components/App.tsx b/server/sonar-web/src/main/js/app/components/App.tsx
index e69c1116cda..44528fc0b4d 100644
--- a/server/sonar-web/src/main/js/app/components/App.tsx
+++ b/server/sonar-web/src/main/js/app/components/App.tsx
@@ -40,7 +40,6 @@ interface State {
class App extends React.PureComponent<Props, State> {
mounted: boolean;
- state: State = { branchesEnabled: false, canAdmin: false, loading: true, onSonarCloud: false };
static childContextTypes = {
branchesEnabled: PropTypes.bool.isRequired,
@@ -48,6 +47,11 @@ class App extends React.PureComponent<Props, State> {
onSonarCloud: PropTypes.bool
};
+ constructor(props: Props) {
+ super(props);
+ this.state = { branchesEnabled: false, canAdmin: false, loading: true, onSonarCloud: false };
+ }
+
getChildContext() {
return {
branchesEnabled: this.state.branchesEnabled,
@@ -73,7 +77,7 @@ class App extends React.PureComponent<Props, State> {
return this.props.fetchAppState().then(appState => {
if (this.mounted) {
const onSonarCloud =
- appState.settings != undefined &&
+ appState.settings !== undefined &&
appState.settings['sonar.sonarcloud.enabled'] === 'true';
this.setState({
branchesEnabled: appState.branchesEnabled,
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx
index ed7838f8ea3..623451a6542 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first */
jest.mock('../../../api/branches', () => ({ getBranches: jest.fn() }));
jest.mock('../../../api/components', () => ({ getComponentData: jest.fn() }));
jest.mock('../../../api/nav', () => ({ getComponentNavigation: jest.fn() }));
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx
index e3a27248da2..c062c716722 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx
@@ -46,17 +46,21 @@ interface State {
export default class ComponentNavBranch extends React.PureComponent<Props, State> {
mounted: boolean;
- state: State = {
- dropdownOpen: false,
- noBranchSupportPopupOpen: false,
- singleBranchPopupOpen: false
- };
static contextTypes = {
branchesEnabled: PropTypes.bool.isRequired,
onSonarCloud: PropTypes.bool
};
+ constructor(props: Props) {
+ super(props);
+ this.state = {
+ dropdownOpen: false,
+ noBranchSupportPopupOpen: false,
+ singleBranchPopupOpen: false
+ };
+ }
+
componentDidMount() {
this.mounted = true;
}
@@ -94,7 +98,7 @@ export default class ComponentNavBranch extends React.PureComponent<Props, State
};
toggleSingleBranchPopup = (show?: boolean) => {
- if (show != undefined) {
+ if (show !== undefined) {
this.setState({ singleBranchPopupOpen: show });
} else {
this.setState(state => ({ singleBranchPopupOpen: !state.singleBranchPopupOpen }));
@@ -102,7 +106,7 @@ export default class ComponentNavBranch extends React.PureComponent<Props, State
};
toggleNoBranchSupportPopup = (show?: boolean) => {
- if (show != undefined) {
+ if (show !== undefined) {
this.setState({ noBranchSupportPopupOpen: show });
} else {
this.setState(state => ({ noBranchSupportPopupOpen: !state.noBranchSupportPopupOpen }));
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx
index e3f468d2dd0..a4d7899387b 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx
@@ -46,12 +46,16 @@ interface State {
export default class ComponentNavBranchesMenu extends React.PureComponent<Props, State> {
private node: HTMLElement | null;
- state = { query: '', selected: null };
static contextTypes = {
router: PropTypes.object
};
+ constructor(props: Props) {
+ super(props);
+ this.state = { query: '', selected: null };
+ }
+
componentDidMount() {
window.addEventListener('click', this.handleClickOutside);
}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx
index 5f770db9ed4..ef2234c896d 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx
@@ -127,7 +127,6 @@ export default class ComponentNavMenu extends React.PureComponent<Props> {
}
renderActivityLink() {
-
if (this.props.branch && isShortLivingBranch(this.props.branch)) {
return null;
}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx
index 7db06bfa00c..9975e19bf06 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx
@@ -17,20 +17,23 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
+/* eslint-disable import/first, import/order */
jest.mock('../ComponentNavFavorite', () => ({
+ // eslint-disable-next-line
default: function ComponentNavFavorite() {
return null;
}
}));
jest.mock('../ComponentNavBreadcrumbs', () => ({
+ // eslint-disable-next-line
default: function ComponentNavBreadcrumbs() {
return null;
}
}));
jest.mock('../ComponentNavMenu', () => ({
+ // eslint-disable-next-line
default: function ComponentNavMenu() {
return null;
}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx
index 72e517426cc..e5441faa51f 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first */
jest.mock('../../../../../helpers/l10n', () => {
const l10n = require.requireActual('../../../../../helpers/l10n');
l10n.hasMessage = jest.fn(() => true);
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx
index 748acacd729..285e7a4d50f 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx
@@ -69,9 +69,9 @@ export default class TaskActions extends React.PureComponent<Props, State> {
render() {
const { component, task } = this.props;
- const canFilter = component == undefined;
+ const canFilter = component === undefined;
const canCancel = task.status === STATUSES.PENDING;
- const canShowStacktrace = task.errorMessage != undefined;
+ const canShowStacktrace = task.errorMessage !== undefined;
const hasActions = canFilter || canCancel || task.hasScannerContext || canShowStacktrace;
if (!hasActions) {
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.tsx
index 9c51b4a9c10..87fa85e25e7 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.tsx
@@ -83,7 +83,7 @@ export default class Workers extends React.PureComponent<{}, State> {
};
toggleNoSupportPopup = (show?: boolean) => {
- if (show != undefined) {
+ if (show !== undefined) {
this.setState({ noSupportPopup: show });
} else {
this.setState(state => ({ noSupportPopup: !state.noSupportPopup }));
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/ScannerContext-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/ScannerContext-test.tsx
index af7194151d6..64cd98c8f77 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/ScannerContext-test.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/ScannerContext-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../../api/ce', () => ({
getTask: jest.fn()
}));
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stacktrace-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stacktrace-test.tsx
index 979af8df09e..28bddab75a8 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stacktrace-test.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stacktrace-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../../api/ce', () => ({
getTask: jest.fn()
}));
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/WorkersForm-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/WorkersForm-test.tsx
index 813eff21896..94bd72f7542 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/WorkersForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/WorkersForm-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../../api/ce', () => ({
setWorkerCount: () => Promise.resolve()
}));
diff --git a/server/sonar-web/src/main/js/apps/code/components/App.tsx b/server/sonar-web/src/main/js/apps/code/components/App.tsx
index aa773ae2177..2fd66d70ad7 100644
--- a/server/sonar-web/src/main/js/apps/code/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/App.tsx
@@ -222,8 +222,8 @@ export default class App extends React.PureComponent<Props, State> {
<Breadcrumbs branch={branchName} breadcrumbs={breadcrumbs} rootComponent={component} />
)}
- {sourceViewer == undefined &&
- components != undefined && (
+ {sourceViewer === undefined &&
+ components !== undefined && (
<div className={componentsClassName}>
<Components
baseComponent={baseComponent}
@@ -234,12 +234,12 @@ export default class App extends React.PureComponent<Props, State> {
</div>
)}
- {sourceViewer == undefined &&
- components != undefined && (
+ {sourceViewer === undefined &&
+ components !== undefined && (
<ListFooter count={components.length} total={total} loadMore={this.handleLoadMore} />
)}
- {sourceViewer != undefined && (
+ {sourceViewer !== undefined && (
<div className="spacer-top">
<SourceViewer branch={branchName} component={sourceViewer.key} />
</div>
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx
index c0947e98ec0..65f855700ed 100644
--- a/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx
@@ -59,7 +59,7 @@ export default function ComponentName(props: Props) {
const { branch, component, rootComponent, previous, canBrowse = false } = props;
const areBothDirs = component.qualifier === 'DIR' && previous && previous.qualifier === 'DIR';
const prefix =
- areBothDirs && previous != undefined
+ areBothDirs && previous !== undefined
? mostCommitPrefix([component.name + '/', previous.name + '/'])
: '';
const name = prefix ? (
diff --git a/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx b/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx
index 6e4b9a13805..b086fb5a125 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx
@@ -61,8 +61,8 @@ export default function ComponentBreadcrumbs({ branch, component, issue, organiz
)}
{displaySubProject &&
- issue.subProject != undefined &&
- issue.subProjectName != undefined && (
+ issue.subProject !== undefined &&
+ issue.subProjectName !== undefined && (
<span title={issue.subProjectName}>
<Link to={getProjectUrl(issue.subProject, branch)} className="link-no-underline">
{limitComponentName(issue.subProjectName)}
diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/Activity.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/Activity.tsx
index 66cef7e572d..7816da08c76 100644
--- a/server/sonar-web/src/main/js/apps/portfolio/components/Activity.tsx
+++ b/server/sonar-web/src/main/js/apps/portfolio/components/Activity.tsx
@@ -103,8 +103,8 @@ export default class Activity extends React.PureComponent<Props> {
{this.state.loading ? (
<i className="spinner" />
) : (
- this.state.metrics != undefined &&
- this.state.history != undefined && (
+ this.state.metrics !== undefined &&
+ this.state.history !== undefined && (
<AnyPreviewGraph
history={this.state.history}
metrics={this.state.metrics}
diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx
index ec7f35fc0b2..7d3efb507bf 100644
--- a/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx
@@ -98,10 +98,10 @@ export default class App extends React.PureComponent<Props, State> {
);
}
- isEmpty = () => this.state.measures == undefined || this.state.measures['ncloc'] == undefined;
+ isEmpty = () => this.state.measures === undefined || this.state.measures['ncloc'] === undefined;
isNotComputed = () =>
- this.state.measures && this.state.measures['reliability_rating'] == undefined;
+ this.state.measures && this.state.measures['reliability_rating'] === undefined;
renderSpinner() {
return (
@@ -151,8 +151,8 @@ export default class App extends React.PureComponent<Props, State> {
<MaintainabilityBox component={component.key} measures={measures!} />
</div>
- {subComponents != undefined &&
- totalSubComponents != undefined && (
+ {subComponents !== undefined &&
+ totalSubComponents !== undefined && (
<WorstProjects
component={component.key}
subComponents={subComponents}
diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/Activity-test.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/Activity-test.tsx
index 1959dc4daaf..e0fc5b8ff9d 100644
--- a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/Activity-test.tsx
+++ b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/Activity-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../../helpers/storage', () => ({
getCustomGraph: () => ['coverage'],
getGraph: () => 'custom'
diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx
index e9c93fb7279..0a894272da3 100644
--- a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../../api/measures', () => ({
getMeasures: jest.fn(() => Promise.resolve([]))
}));
@@ -27,12 +28,14 @@ jest.mock('../../../../api/components', () => ({
// mock Activity to not deal with localstorage
jest.mock('../Activity', () => ({
+ // eslint-disable-next-line
default: function Activity() {
return null;
}
}));
jest.mock('../Report', () => ({
+ // eslint-disable-next-line
default: function Report() {
return null;
}
diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/Report-test.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/Report-test.tsx
index 1a21649ae06..7b725a0ee5e 100644
--- a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/Report-test.tsx
+++ b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/Report-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../../api/report', () => {
const report = require.requireActual('../../../../api/report');
report.getReportStatus = jest.fn(() => Promise.resolve({}));
diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/Subscription-test.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/Subscription-test.tsx
index 4fa146bc940..003d49545a6 100644
--- a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/Subscription-test.tsx
+++ b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/Subscription-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../../api/report', () => {
const report = require.requireActual('../../../../api/report');
report.subscribe = jest.fn(() => Promise.resolve());
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx
index 5ff696ef9d7..19092afe655 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx
@@ -18,15 +18,15 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import { FormattedMessage } from 'react-intl';
+import { Link } from 'react-router';
import BranchRow from './BranchRow';
import LongBranchesPattern from './LongBranchesPattern';
import { Branch } from '../../../app/types';
import { sortBranchesAsTree } from '../../../helpers/branches';
import { translate } from '../../../helpers/l10n';
import { getValues } from '../../../api/settings';
-import { FormattedMessage } from 'react-intl';
import { formatMeasure } from '../../../helpers/measures';
-import { Link } from 'react-router';
interface Props {
branches: Branch[];
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchRow.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchRow.tsx
index 3cbc25df9a4..5290f17718c 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchRow.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchRow.tsx
@@ -18,8 +18,8 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { Branch } from '../../../app/types';
import * as classNames from 'classnames';
+import { Branch } from '../../../app/types';
import DeleteBranchModal from './DeleteBranchModal';
import LeakPeriodForm from './LeakPeriodForm';
import BranchStatus from '../../../components/common/BranchStatus';
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/RenameBranchModal.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/RenameBranchModal.tsx
index 181fee72365..02bd8572c9c 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/RenameBranchModal.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/RenameBranchModal.tsx
@@ -109,7 +109,7 @@ export default class RenameBranchModal extends React.PureComponent<Props, State>
required={true}
size={50}
type="text"
- value={this.state.name != undefined ? this.state.name : branch.name}
+ value={this.state.name !== undefined ? this.state.name : branch.name}
/>
</div>
</div>
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx
index 9ffafb34d72..166c8d4a99a 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../../api/settings', () => ({
getValues: jest.fn(() => Promise.resolve([]))
}));
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx
index b2870587114..c5455dbcac6 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first */
jest.mock('../../../../api/branches', () => ({ deleteBranch: jest.fn() }));
import * as React from 'react';
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LongBranchesPattern-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LongBranchesPattern-test.tsx
index ff142d2065c..48c79f25fed 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LongBranchesPattern-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LongBranchesPattern-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../../api/settings', () => ({
getValues: jest.fn(() => Promise.resolve([]))
}));
@@ -40,7 +41,7 @@ it('renders', () => {
it('opens form', () => {
const wrapper = shallow(<LongBranchesPattern project="project" />);
- (wrapper.instance() as LongBranchesPattern) .mounted = true;
+ (wrapper.instance() as LongBranchesPattern).mounted = true;
wrapper.setState({ loading: false, setting: { value: 'release-.*' } });
click(wrapper.find('a'));
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/RenameBranchModal-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/RenameBranchModal-test.tsx
index 3a1c962d68e..9c2b6602815 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/RenameBranchModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/RenameBranchModal-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first */
jest.mock('../../../../api/branches', () => ({ renameBranch: jest.fn() }));
import * as React from 'react';
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/SettingForm-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/SettingForm-test.tsx
index f74831cd522..60ffeb3fbb4 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/SettingForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/SettingForm-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../../api/settings', () => ({
setSimpleSettingValue: jest.fn(() => Promise.resolve()),
resetSettingValue: jest.fn(() => Promise.resolve())
diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/App-test.tsx
index ac0d97d33d7..4fa2bc575af 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/App-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../api/quality-gates', () => ({
associateGateWithProject: jest.fn(() => Promise.resolve()),
dissociateGateWithProject: jest.fn(() => Promise.resolve()),
diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/App-test.tsx
index 2323bad9cfe..9e873f1187f 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/App-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../api/quality-profiles', () => ({
associateProject: jest.fn(() => Promise.resolve()),
dissociateProject: jest.fn(() => Promise.resolve()),
@@ -116,7 +117,7 @@ function randomProfile(key: string, language: string, isDefault = false) {
isDefault,
key,
name: key,
- language: language,
+ language,
languageName: language,
organization: 'org'
};
diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/Table-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/Table-test.tsx
index 84e70359fab..14b93b8fc10 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/Table-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/Table-test.tsx
@@ -42,7 +42,7 @@ function randomProfile(key: string, language: string) {
activeDeprecatedRuleCount: 0,
key,
name: key,
- language: language,
+ language,
languageName: language,
organization: 'org'
};
diff --git a/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts
index e40971e373b..7f4330bbf52 100644
--- a/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts
@@ -49,6 +49,7 @@ describe('cumulativeMapFacetValues', () => {
{ val: '4', count: 2 },
{ val: '5', count: 0 }
])
+ // eslint-disable-next-line
).toEqual({ '1': 50, '2': 9, '3': 8, '4': 2, '5': 0 });
});
it('should correctly cumulate facets with NO_DATA items', () => {
diff --git a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx
index 4181d618a10..65bdfac3f43 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx
@@ -51,7 +51,6 @@ interface State {
export default class AllProjects extends React.PureComponent<Props, State> {
mounted: boolean;
- state: State = { loading: true, query: {} };
static contextTypes = {
currentUser: PropTypes.object.isRequired,
@@ -59,6 +58,11 @@ export default class AllProjects extends React.PureComponent<Props, State> {
router: PropTypes.object.isRequired
};
+ constructor(props: Props) {
+ super(props);
+ this.state = { loading: true, query: {} };
+ }
+
componentDidMount() {
this.mounted = true;
if (this.props.isFavorite && !this.context.currentUser.isLoggedIn) {
@@ -88,7 +92,7 @@ export default class AllProjects extends React.PureComponent<Props, State> {
getSort = () => this.state.query.sort || 'name';
- isFiltered = () => Object.values(this.state.query).some(value => value != undefined);
+ isFiltered = () => Object.values(this.state.query).some(value => value !== undefined);
stopLoading = () => {
if (this.mounted) {
@@ -280,10 +284,10 @@ export default class AllProjects extends React.PureComponent<Props, State> {
/>
)}
<ListFooter
- count={this.state.projects != undefined ? this.state.projects.length : 0}
+ count={this.state.projects !== undefined ? this.state.projects.length : 0}
loadMore={this.fetchMoreProjects}
ready={!this.state.loading}
- total={this.state.total != undefined ? this.state.total : 0}
+ total={this.state.total !== undefined ? this.state.total : 0}
/>
</div>
);
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.tsx
index 4bf823864e0..277a3b6eec8 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.tsx
@@ -37,7 +37,7 @@ export default class ProjectCardLanguages extends React.PureComponent<Props> {
};
render() {
- if (this.props.distribution == undefined) {
+ if (this.props.distribution === undefined) {
return null;
}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx
index 80ce9ceadb0..7dcae1fe7a2 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx
@@ -43,7 +43,7 @@ export default function ProjectCardOverall({ organization, project }: Props) {
return (
<div data-key={project.key} className="boxed-group project-card">
<div className="boxed-group-header clearfix">
- {project.isFavorite != undefined && (
+ {project.isFavorite !== undefined && (
<Favorite
className="spacer-right"
component={project.key}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverallMeasures.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverallMeasures.tsx
index 8c3cdc978f2..5bba45518c1 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverallMeasures.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverallMeasures.tsx
@@ -34,7 +34,7 @@ interface Props {
}
export default function ProjectCardOverallMeasures({ measures }: Props) {
- if (measures == undefined) {
+ if (measures === undefined) {
return null;
}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx
index 5afb5f49874..c696b9509c9 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx
@@ -17,19 +17,23 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../ProjectsList', () => ({
+ // eslint-disable-next-line
default: function ProjectsList() {
return null;
}
}));
jest.mock('../PageHeader', () => ({
+ // eslint-disable-next-line
default: function PageHeader() {
return null;
}
}));
jest.mock('../PageSidebar', () => ({
+ // eslint-disable-next-line
default: function PageSidebar() {
return null;
}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/DefaultPageSelector-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/DefaultPageSelector-test.tsx
index ce03b94e0b3..b5d80b02f7e 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/DefaultPageSelector-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/DefaultPageSelector-test.tsx
@@ -17,7 +17,9 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../AllProjects', () => ({
+ // eslint-disable-next-line
default: function AllProjects() {
return null;
}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/FavoriteFilter-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/FavoriteFilter-test.tsx
index b7971fb416a..658ee1ab158 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/FavoriteFilter-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/FavoriteFilter-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first */
jest.mock('../../../../helpers/storage', () => ({
saveAll: jest.fn(),
saveFavorite: jest.fn()
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx
index 2da7a189b2a..655dd4ce491 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx
@@ -85,7 +85,7 @@ export default class Filter extends React.PureComponent<Props> {
}
renderOptionBar(facetValue: number | undefined) {
- if (facetValue == undefined || !this.props.maxFacetValue) {
+ if (facetValue === undefined || !this.props.maxFacetValue) {
return null;
}
return (
diff --git a/server/sonar-web/src/main/js/apps/projects/utils.ts b/server/sonar-web/src/main/js/apps/projects/utils.ts
index c8f99c27b56..7ad9dd4e7c0 100644
--- a/server/sonar-web/src/main/js/apps/projects/utils.ts
+++ b/server/sonar-web/src/main/js/apps/projects/utils.ts
@@ -198,7 +198,7 @@ export function fetchProjects(
const value = isDiffMetric(measure.metric)
? getPeriodValue(measure, 1)
: measure.value;
- if (value != undefined) {
+ if (value !== undefined) {
componentMeasures[measure.metric] = value;
}
});
@@ -248,7 +248,7 @@ function convertToQueryData(
if (sort.s) {
data.s = sort.s;
}
- if (sort.hasOwnProperty('asc')) {
+ if (sort.asc !== undefined) {
data.asc = sort.asc;
}
return data;
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx
index 314988d7eed..3e81e28cb5c 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx
@@ -69,7 +69,7 @@ export default class BulkApplyTemplateModal extends React.PureComponent<Props, S
loading: false,
permissionTemplate:
permissionTemplates.length > 0 ? permissionTemplates[0].id : undefined,
- permissionTemplates: permissionTemplates
+ permissionTemplates
});
}
},
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx
index d41a5c5e1bb..94318dbae7c 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx
@@ -22,8 +22,7 @@ import * as Select from 'react-select';
import { sortBy } from 'lodash';
import BulkApplyTemplateModal from './BulkApplyTemplateModal';
import DeleteModal from './DeleteModal';
-import { QUALIFIERS_ORDER } from './utils';
-import { Project } from './utils';
+import { QUALIFIERS_ORDER, Project } from './utils';
import { Organization } from '../../app/types';
import Checkbox from '../../components/controls/Checkbox';
import { translate } from '../../helpers/l10n';
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/App-test.tsx
index 0fb6b1d21d0..dadd3a45a1b 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/App-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('lodash', () => {
const lodash = require.requireActual('lodash');
lodash.debounce = (fn: Function) => (...args: any[]) => fn(args);
@@ -25,6 +26,7 @@ jest.mock('lodash', () => {
// actual version breaks `mount`
jest.mock('rc-tooltip', () => ({
+ // eslint-disable-next-line
default: function Tooltip() {
return null;
}
@@ -81,7 +83,7 @@ it('searches', () => {
expect(getComponents).lastCalledWith({ ...defaultSearchParameters, q: 'foo', qualifiers: 'TRK' });
});
-it('loads more', async () => {
+it('loads more', () => {
const wrapper = mountRender();
wrapper.find('ListFooter').prop<Function>('loadMore')();
expect(getComponents).lastCalledWith({ ...defaultSearchParameters, p: 2, qualifiers: 'TRK' });
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/BulkApplyTemplateModal-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/BulkApplyTemplateModal-test.tsx
index cdb33cf7f33..75368168411 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/BulkApplyTemplateModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/BulkApplyTemplateModal-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../api/permissions', () => ({
bulkApplyTemplate: jest.fn(() => Promise.resolve()),
getPermissionTemplates: jest.fn(() => Promise.resolve({ permissionTemplates: [] }))
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/CreateProjectForm-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/CreateProjectForm-test.tsx
index bd8c3114b4e..c514345b78a 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/CreateProjectForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/CreateProjectForm-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../api/components', () => ({
createProject: jest.fn(({ name }: { name: string }) =>
Promise.resolve({ project: { key: name, name } })
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/DeleteModal-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/DeleteModal-test.tsx
index 976be4403a8..d73e5306632 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/DeleteModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/DeleteModal-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../api/components', () => ({
bulkDeleteProjects: jest.fn(() => Promise.resolve())
}));
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx
index 792e29ccc48..cc29a0e243d 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first */
jest.mock('../../permissions/project/views/ApplyTemplateView');
import * as React from 'react';
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx
index 1d16a885659..d159d8354a3 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx
@@ -32,7 +32,7 @@ interface Props {
onRequestFail: (reasong: any) => void;
organization: string | null;
profiles: Profile[];
- router: { replace: ({}) => void };
+ router: { replace: (path: any) => void };
updateProfiles: () => Promise<void>;
}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx
index fe94b38b03d..8d892127fc7 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx
@@ -82,7 +82,7 @@ export default class ProfilePermissionsForm extends React.PureComponent<Props, S
const { selected } = this.state;
if (selected) {
this.setState({ submitting: true });
- if ((selected as User).login != undefined) {
+ if ((selected as User).login !== undefined) {
this.handleUserAdd(selected as User);
} else {
this.handleGroupAdd(selected as Group);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx
index e265206a49f..911bf55cca4 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx
@@ -113,7 +113,7 @@ export default class ProfilePermissionsFormSelect extends React.PureComponent<Pr
}
function isUser(option: Option): option is User {
- return (option as User).login != undefined;
+ return (option as User).login !== undefined;
}
function getStringValue(option: Option) {
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissions-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissions-test.tsx
index c61a60d83a8..fc13a173960 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissions-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissions-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../../api/quality-profiles', () => ({
searchUsers: jest.fn(() => Promise.resolve([])),
searchGroups: jest.fn(() => Promise.resolve([]))
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsForm-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsForm-test.tsx
index 603967ba787..a71948cbbbd 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsForm-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../../api/quality-profiles', () => ({
addUser: jest.fn(() => Promise.resolve()),
addGroup: jest.fn(() => Promise.resolve())
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsFormSelect-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsFormSelect-test.tsx
index 3483c66c085..7a029559e80 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsFormSelect-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsFormSelect-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first */
jest.mock('lodash', () => {
const lodash = require.requireActual('lodash');
lodash.debounce = (fn: Function) => (...args: any[]) => fn(...args);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsGroup-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsGroup-test.tsx
index d792b2c36bf..d9edeb1d1a1 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsGroup-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsGroup-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../../api/quality-profiles', () => ({
removeGroup: jest.fn(() => Promise.resolve())
}));
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsUser-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsUser-test.tsx
index 6fbd6f8ec9b..f2b26b8ce41 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsUser-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsUser-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first, import/order */
jest.mock('../../../../api/quality-profiles', () => ({
removeUser: jest.fn(() => Promise.resolve())
}));
diff --git a/server/sonar-web/src/main/js/apps/system/components/App.tsx b/server/sonar-web/src/main/js/apps/system/components/App.tsx
index 2211ed17dd5..a8108bf1865 100644
--- a/server/sonar-web/src/main/js/apps/system/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/App.tsx
@@ -41,12 +41,16 @@ interface State {
export default class App extends React.PureComponent<Props, State> {
mounted: boolean;
- state: State = { loading: true };
static contextTypes = {
router: PropTypes.object
};
+ constructor(props: Props) {
+ super(props);
+ this.state = { loading: true };
+ }
+
componentDidMount() {
this.mounted = true;
this.fetchSysInfo();
diff --git a/server/sonar-web/src/main/js/apps/system/utils.ts b/server/sonar-web/src/main/js/apps/system/utils.ts
index 7048439a678..7d6ccca5a0d 100644
--- a/server/sonar-web/src/main/js/apps/system/utils.ts
+++ b/server/sonar-web/src/main/js/apps/system/utils.ts
@@ -94,7 +94,7 @@ export function getSearchNodes(sysInfoData: ClusterSysInfo): NodeInfo[] {
export function isCluster(sysInfoData?: SysInfo): boolean {
return (
- sysInfoData != undefined && sysInfoData['System'] && sysInfoData['System'][HA_FIELD] === true
+ sysInfoData !== undefined && sysInfoData['System'] && sysInfoData['System'][HA_FIELD] === true
);
}
@@ -165,8 +165,8 @@ export function getStandaloneSecondarySections(sysInfoData: SysInfo): SysInfoSec
}
export function groupSections(sysInfoData: SysValueObject) {
- let mainSection: SysValueObject = {};
- let sections: SysInfoSection = {};
+ const mainSection: SysValueObject = {};
+ const sections: SysInfoSection = {};
each(sysInfoData, (item, key) => {
if (typeof item !== 'object' || item instanceof Array) {
mainSection[key] = item;
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx b/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx
index ebc579d5ca5..8ddcd805b10 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx
@@ -44,17 +44,21 @@ interface State {
export default class WebApiApp extends React.PureComponent<Props, State> {
mounted: boolean;
- state: State = {
- domains: [],
- searchQuery: '',
- showDeprecated: false,
- showInternal: false
- };
static contextTypes = {
router: PropTypes.object.isRequired
};
+ constructor(props: Props) {
+ super(props);
+ this.state = {
+ domains: [],
+ searchQuery: '',
+ showDeprecated: false,
+ showInternal: false
+ };
+ }
+
componentDidMount() {
this.mounted = true;
this.fetchList();
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Domain-test.tsx b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Domain-test.tsx
index 4114f4944e0..539f425e8d4 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Domain-test.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Domain-test.tsx
@@ -77,7 +77,7 @@ it('should not render internal actions', () => {
it('should render only actions matching the query', () => {
const actions = [ACTION, { ...ACTION, key: 'bar', description: 'Bar desc' }];
- const domain = { ...DOMAIN, actions: actions };
+ const domain = { ...DOMAIN, actions };
expect(
shallow(<Domain {...DEFAULT_PROPS} domain={domain} searchQuery="Foo" />)
).toMatchSnapshot();
@@ -89,7 +89,7 @@ it('should also render actions with a description matching the query', () => {
{ ...ACTION, key: 'bar', description: 'Bar desc' },
{ ...ACTION, key: 'baz', description: 'foobar' }
];
- const domain = { ...DOMAIN, actions: actions };
+ const domain = { ...DOMAIN, actions };
expect(
shallow(<Domain {...DEFAULT_PROPS} domain={domain} searchQuery="Foo" />)
).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/components/charts/bar-chart.js b/server/sonar-web/src/main/js/components/charts/bar-chart.js
index 1548036d0c6..87786e6d9dd 100644
--- a/server/sonar-web/src/main/js/components/charts/bar-chart.js
+++ b/server/sonar-web/src/main/js/components/charts/bar-chart.js
@@ -48,6 +48,10 @@ export const BarChart = createReactClass({
};
},
+ getInitialState() {
+ return { width: this.props.width, height: this.props.height };
+ },
+
componentDidUpdate(prevProps) {
if (this.props.width && prevProps.width !== this.props.width) {
this.setState({ width: this.props.width });
@@ -57,10 +61,6 @@ export const BarChart = createReactClass({
}
},
- getInitialState() {
- return { width: this.props.width, height: this.props.height };
- },
-
handleClick(point) {
this.props.onBarClick(point);
},
diff --git a/server/sonar-web/src/main/js/components/common/SelectListItem.js b/server/sonar-web/src/main/js/components/common/SelectListItem.js
index 0fa49725305..dd6e81957bb 100644
--- a/server/sonar-web/src/main/js/components/common/SelectListItem.js
+++ b/server/sonar-web/src/main/js/components/common/SelectListItem.js
@@ -47,7 +47,7 @@ export default class SelectListItem extends React.PureComponent {
renderLink() {
let children = this.props.item;
- if (this.props.hasOwnProperty('children')) {
+ if (this.props.children) {
children = this.props.children;
}
return (
diff --git a/server/sonar-web/src/main/js/components/controls/DateInput.tsx b/server/sonar-web/src/main/js/components/controls/DateInput.tsx
index 5a0c0911f61..265643354e6 100644
--- a/server/sonar-web/src/main/js/components/controls/DateInput.tsx
+++ b/server/sonar-web/src/main/js/components/controls/DateInput.tsx
@@ -105,7 +105,7 @@ export default class DateInput extends React.PureComponent<Props> {
<path d="M5.5 6h2v2h-2V6zm3 0h2v2h-2V6zm3 0h2v2h-2V6zm-9 6h2v2h-2v-2zm3 0h2v2h-2v-2zm3 0h2v2h-2v-2zm-3-3h2v2h-2V9zm3 0h2v2h-2V9zm3 0h2v2h-2V9zm-9 0h2v2h-2V9zm11-9v1h-2V0h-7v1h-2V0h-2v16h15V0h-2zm1 15h-13V4h13v11z" />
</svg>
</span>
- {this.props.value != undefined && (
+ {this.props.value !== undefined && (
<a className="date-input-control-reset" href="#" onClick={this.handleResetClick}>
<CloseIcon className="" />
</a>
diff --git a/server/sonar-web/src/main/js/components/intl/DateFormatter.tsx b/server/sonar-web/src/main/js/components/intl/DateFormatter.tsx
index 91670a3c895..9c12362ba9d 100644
--- a/server/sonar-web/src/main/js/components/intl/DateFormatter.tsx
+++ b/server/sonar-web/src/main/js/components/intl/DateFormatter.tsx
@@ -33,10 +33,8 @@ export const longFormatterOption = { year: 'numeric', month: 'long', day: 'numer
export default function DateFormatter({ children, date, long }: Props) {
return (
- <FormattedDate
- children={children}
- value={parseDate(date)}
- {...(long ? longFormatterOption : formatterOption)}
- />
+ <FormattedDate value={parseDate(date)} {...(long ? longFormatterOption : formatterOption)}>
+ {children}
+ </FormattedDate>
);
}
diff --git a/server/sonar-web/src/main/js/components/intl/DateFromNow.tsx b/server/sonar-web/src/main/js/components/intl/DateFromNow.tsx
index ce2adea2a94..3e600273471 100644
--- a/server/sonar-web/src/main/js/components/intl/DateFromNow.tsx
+++ b/server/sonar-web/src/main/js/components/intl/DateFromNow.tsx
@@ -27,5 +27,5 @@ interface Props {
}
export default function DateFromNow({ children, date }: Props) {
- return <FormattedRelative children={children} value={parseDate(date)} />;
+ return <FormattedRelative value={parseDate(date)}>{children}</FormattedRelative>;
}
diff --git a/server/sonar-web/src/main/js/components/intl/DateTimeFormatter.tsx b/server/sonar-web/src/main/js/components/intl/DateTimeFormatter.tsx
index 9d9c1bcd03c..c26c72f4010 100644
--- a/server/sonar-web/src/main/js/components/intl/DateTimeFormatter.tsx
+++ b/server/sonar-web/src/main/js/components/intl/DateTimeFormatter.tsx
@@ -35,5 +35,9 @@ export const formatterOption = {
};
export default function DateTimeFormatter({ children, date }: Props) {
- return <FormattedDate children={children} value={parseDate(date)} {...formatterOption} />;
+ return (
+ <FormattedDate value={parseDate(date)} {...formatterOption}>
+ {children}
+ </FormattedDate>
+ );
}
diff --git a/server/sonar-web/src/main/js/components/intl/TimeFormatter.tsx b/server/sonar-web/src/main/js/components/intl/TimeFormatter.tsx
index efa15fc38a0..e6324cb6b01 100644
--- a/server/sonar-web/src/main/js/components/intl/TimeFormatter.tsx
+++ b/server/sonar-web/src/main/js/components/intl/TimeFormatter.tsx
@@ -33,10 +33,8 @@ export const longFormatterOption = { hour: 'numeric', minute: 'numeric', second:
export default function TimeFormatter({ children, date, long }: Props) {
return (
- <FormattedTime
- children={children}
- value={parseDate(date)}
- {...(long ? longFormatterOption : formatterOption)}
- />
+ <FormattedTime value={parseDate(date)} {...(long ? longFormatterOption : formatterOption)}>
+ {children}
+ </FormattedTime>
);
}
diff --git a/server/sonar-web/src/main/js/components/measure/Measure.tsx b/server/sonar-web/src/main/js/components/measure/Measure.tsx
index e52c12a7512..cb9a85aab5e 100644
--- a/server/sonar-web/src/main/js/components/measure/Measure.tsx
+++ b/server/sonar-web/src/main/js/components/measure/Measure.tsx
@@ -31,14 +31,14 @@ interface Props {
}
export default function Measure({ className, decimals, measure }: Props) {
- if (measure == undefined) {
+ if (measure === undefined) {
return <span>{'–'}</span>;
}
const metric = measure.metric;
const value = isDiffMetric(metric.key) ? measure.leak : measure.value;
- if (value == undefined) {
+ if (value === undefined) {
return <span>{'–'}</span>;
}
diff --git a/server/sonar-web/src/main/js/components/measure/__tests__/Measure-test.tsx b/server/sonar-web/src/main/js/components/measure/__tests__/Measure-test.tsx
index 5eb0a6efa3e..80f2e31efab 100644
--- a/server/sonar-web/src/main/js/components/measure/__tests__/Measure-test.tsx
+++ b/server/sonar-web/src/main/js/components/measure/__tests__/Measure-test.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/* eslint-disable import/first */
jest.mock('../../../helpers/measures', () => {
const measures = require.requireActual('../../../helpers/measures');
measures.getRatingTooltip = jest.fn(() => 'tooltip');
diff --git a/server/sonar-web/src/main/js/components/ui/Rating.tsx b/server/sonar-web/src/main/js/components/ui/Rating.tsx
index 183994c7eae..1225efed716 100644
--- a/server/sonar-web/src/main/js/components/ui/Rating.tsx
+++ b/server/sonar-web/src/main/js/components/ui/Rating.tsx
@@ -30,7 +30,7 @@ interface Props {
}
export default function Rating({ className, muted = false, small = false, value }: Props) {
- if (value == undefined) {
+ if (value === undefined) {
return <span>{'–'}</span>;
}
const formatted = formatMeasure(value, 'RATING');
diff --git a/server/sonar-web/src/main/js/helpers/issues.ts b/server/sonar-web/src/main/js/helpers/issues.ts
index efa8b272af6..33f8792bab6 100644
--- a/server/sonar-web/src/main/js/helpers/issues.ts
+++ b/server/sonar-web/src/main/js/helpers/issues.ts
@@ -81,7 +81,7 @@ function injectRelational(
) {
const newFields: { [x: string]: any } = {};
const baseValue = issue[baseField];
- if (baseValue != undefined && source != undefined) {
+ if (baseValue !== undefined && source !== undefined) {
const lookupValue = source.find(candidate => candidate[lookupField] === baseValue);
if (lookupValue != null) {
Object.keys(lookupValue).forEach(key => {
diff --git a/server/sonar-web/src/main/js/helpers/l10n.ts b/server/sonar-web/src/main/js/helpers/l10n.ts
index a6598790266..aa54768bea1 100644
--- a/server/sonar-web/src/main/js/helpers/l10n.ts
+++ b/server/sonar-web/src/main/js/helpers/l10n.ts
@@ -42,6 +42,7 @@ export function translate(...keys: string[]): string {
const messageKey = keys.join('.');
if (process.env.NODE_ENV === 'development') {
if (!messages[messageKey]) {
+ // eslint-disable-next-line
console.error(`No message for: ${messageKey}`);
}
}
@@ -59,6 +60,7 @@ export function translateWithParameters(
.reduce((acc, parameter, index) => acc.replace(`{${index}}`, parameter), message);
} else {
if (process.env.NODE_ENV === 'development') {
+ // eslint-disable-next-line
console.error(`No message for: ${messageKey}`);
}
return `${messageKey}.${parameters.join('.')}`;
diff --git a/server/sonar-web/src/main/js/helpers/measures.ts b/server/sonar-web/src/main/js/helpers/measures.ts
index 8c200a239ac..c0e89838f59 100644
--- a/server/sonar-web/src/main/js/helpers/measures.ts
+++ b/server/sonar-web/src/main/js/helpers/measures.ts
@@ -101,7 +101,7 @@ function useFormatter(
formatter: Formatter,
options?: any
): string {
- return value != undefined && value !== '' ? formatter(value, options) : '';
+ return value !== undefined && value !== '' ? formatter(value, options) : '';
}
function getFormatter(type: string): Formatter {
@@ -313,7 +313,7 @@ function formatDurationShort(
function durationFormatter(value: string | number): string {
if (typeof value === 'string') {
- value = parseInt(value);
+ value = parseInt(value, 10);
}
if (value === 0) {
return '0';
@@ -330,7 +330,7 @@ function durationFormatter(value: string | number): string {
function shortDurationFormatter(value: string | number): string {
if (typeof value === 'string') {
- value = parseInt(value);
+ value = parseInt(value, 10);
}
if (value === 0) {
return '0';