aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/projects/components
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/js/apps/projects/components
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/js/apps/projects/components')
-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
7 files changed, 18 insertions, 7 deletions
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()