Skip to content

Commit

Permalink
Run creevey with typescript and fix eslint after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Sorokin committed Aug 20, 2020
1 parent 63de4d3 commit 81f839e
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 447 deletions.
3 changes: 2 additions & 1 deletion .creevey/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require("path");

require("@babel/register")({
babelrc: false,
extensions: [".js", ".jsx"],
extensions: [".js", ".jsx", ".ts", ".tsx"],
presets: [
"@babel/preset-flow",
[
Expand All @@ -14,6 +14,7 @@ require("@babel/register")({
},
}
],
"@babel/typescript",
"@babel/preset-react"
],
plugins: [
Expand Down
2 changes: 1 addition & 1 deletion src/Api/MoiraApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export default class MoiraApi implements IMoiraApi {

async getSettings(): Promise<Settings> {
const result = await this.get<Settings>("/user/settings");
result.subscriptions.forEach(s => {
result.subscriptions.forEach((s) => {
// eslint-disable-next-line no-param-reassign
s.tags = s.tags === null ? [] : s.tags;
});
Expand Down
8 changes: 4 additions & 4 deletions src/Api/MoiraApiInjection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export function withMoiraApi<ComponentProps extends { moiraApi: IMoiraApi }>(
): React.ComponentType<Omit<ComponentProps, "moiraApi">> {
function ComponentWithApi(props: Omit<ComponentProps, "moiraApi">) {
const moiraApi = React.useContext(ApiContext);
return <Component {...props as ComponentProps} moiraApi={moiraApi} />;
return <Component {...(props as ComponentProps)} moiraApi={moiraApi} />;
}

ComponentWithApi.displayName = `withApi(${Component.displayName ||
Component.name ||
"Component"})`;
ComponentWithApi.displayName = `withApi(${
Component.displayName || Component.name || "Component"
})`;
return ComponentWithApi;
}
2 changes: 1 addition & 1 deletion src/Domain/Schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const WholeWeek: DaysOfWeek[] = [

export function createSchedule(days: DaysOfWeek[]): Schedule {
return {
days: WholeWeek.map(x => ({ enabled: days.includes(x), name: x })),
days: WholeWeek.map((x) => ({ enabled: days.includes(x), name: x })),
tzOffset: new Date().getTimezoneOffset(),
startOffset: 0,
endOffset: 1439,
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/PromiseUtils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function delay(timeout: number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, timeout));
return new Promise((resolve) => setTimeout(resolve, timeout));
}
2 changes: 1 addition & 1 deletion src/helpers/check-mobile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ const check = {
};

const checkMobile = (userAgent: string): boolean =>
Object.values(check).some(callback => callback(userAgent));
Object.values(check).some((callback) => callback(userAgent));

export default checkMobile;
2 changes: 1 addition & 1 deletion src/helpers/group-metrics-by-statuses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface IMetricByStatuses {
function groupMetricsByStatuses(metrics: MetricList): IMetricByStatuses {
const result: IMetricByStatuses = {};

Object.keys(metrics).forEach(metricName => {
Object.keys(metrics).forEach((metricName) => {
const metric = metrics[metricName];
const { state } = metric;

Expand Down
2 changes: 1 addition & 1 deletion src/logic/parseLocalStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function parseLocalStorage(localData: string): MoiraUrlParams {
- что onlyProblems будет булевым
*/
if (Array.isArray(tags)) {
result.tags = tags.map(value => value.toString());
result.tags = tags.map((value) => value.toString());
}
if (onlyProblems !== undefined) {
result.onlyProblems = onlyProblems === "false" ? false : Boolean(onlyProblems);
Expand Down
2 changes: 1 addition & 1 deletion src/logic/parseLocationSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function parseLocationSearch(search: string): MoiraUrlParams {
result.page = parseInt(page, 10);
}
if (Array.isArray(tags)) {
result.tags = tags.map(value => value.toString());
result.tags = tags.map((value) => value.toString());
}
if (onlyProblems !== undefined) {
result.onlyProblems = onlyProblems === "false" ? false : Boolean(onlyProblems);
Expand Down
Loading

0 comments on commit 81f839e

Please sign in to comment.