Skip to content

Commit 249226a

Browse files
committed
fix: fix SonarQube errors
1 parent 1cc2009 commit 249226a

7 files changed

Lines changed: 12 additions & 13 deletions

File tree

src/actions/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const fetchResource = createAction(
2121
ActionTypes.GET_RESOURCE,
2222
ApiClient.fetchResource,
2323
(resourceType: string, filters?: any, include?: string[], embed?: string[], meta?: any) => {
24-
return Object.assign({}, meta, { resourceType });
24+
return { ...meta, resourceType };
2525
}
2626
);
2727

src/actions/queueHandler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function queueHandler(store) {
3232
markAndSendObservation(store, item);
3333
});
3434

35-
const shouldRetryImmediately = ((opts && opts.initial === true) || store.getState().updateFlush);
35+
const shouldRetryImmediately = ((opts?.initial === true) || store.getState().updateFlush);
3636
if (shouldRetryImmediately) {
3737
_.each(timers, (_, key) => {
3838
clearTimeout(key);

src/components/LoginScreen.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ class LoginScreen extends React.Component {
3434
}
3535
handleChange(field) {
3636
return (event) => {
37-
this.setState(
38-
Object.assign(
39-
this.state,
40-
{[field]: event.target.value}
41-
));
37+
this.setState(prevState => ({
38+
...prevState,
39+
[field]: event.target.value
40+
}));
4241
};
4342
}
4443
render() {

src/components/NotFound.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const NotFound: React.FC = () => {
77
<div className="list-group facility-return clearfix">
88
<Link to="/" className="list-group-item">
99
<span className="action-icon glyphicon glyphicon-chevron-left"></span>
10-
Takaisin
10+
{' '}Takaisin
1111
</Link>
1212
</div>
1313
<h4>404 - Sivua ei löytynyt</h4>

src/components/UnitDetails.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ interface ObservablePropertyPanelProps {
3030
header: string;
3131
}
3232

33-
export function ObservableProperty({ quality, property, identifier, name, unitId }: ObservablePropertyProps): React.ReactElement {
33+
export function ObservableProperty({ quality, property, identifier, name, unitId }: Readonly<ObservablePropertyProps>): React.ReactElement {
3434
const url = `/unit/${unitId}/update/${property}/${identifier}`;
3535
const color = COLORS[quality] || 'primary';
3636
const icon = ICONS[identifier];
@@ -40,7 +40,7 @@ export function ObservableProperty({ quality, property, identifier, name, unitId
4040
return <Link to={url} className={buttonClassName}><span className={iconClassName}></span><br />{name.fi}</Link>;
4141
}
4242

43-
export function ObservablePropertyPanel({ allowedValues, header }: ObservablePropertyPanelProps): React.ReactElement {
43+
export function ObservablePropertyPanel({ allowedValues, header }: Readonly<ObservablePropertyPanelProps>): React.ReactElement {
4444
const amountOfValues = allowedValues.length;
4545
const cutPoint = (amountOfValues / 2) + (amountOfValues % 2);
4646
const left = allowedValues.slice(0, cutPoint);
@@ -65,7 +65,7 @@ export function ObservablePropertyPanel({ allowedValues, header }: ObservablePro
6565

6666
const UnitDetails: React.FC = () => {
6767
const params = useParams<{ unitId: string }>();
68-
const unitId = params.unitId!;
68+
const unitId = params.unitId;
6969

7070
const unit = useSelector((state: RootState) => state.data.unit[unitId]);
7171
const isLoading = useSelector((state: RootState) => state.data.loading.unit === true);

src/components/UnitHistory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class UnitHistory extends React.Component {
3737
<div className="list-group facility-return clearfix">
3838
<Link to={`/unit/${unit.id}`} className="list-group-item">
3939
<span className="action-icon glyphicon glyphicon-chevron-left"></span>
40-
Takaisin
40+
{' '}Takaisin
4141
</Link>
4242
</div>
4343
<div className="well">

src/components/UnitList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface UnitListElementProps {
1111
unit: Unit;
1212
}
1313

14-
export function UnitListElement(props: UnitListElementProps): React.ReactElement {
14+
export function UnitListElement(props: Readonly<UnitListElementProps>): React.ReactElement {
1515
const { unit } = props;
1616
const url = `/unit/${unit.id}`;
1717
let iconClassName: string;

0 commit comments

Comments
 (0)