Skip to content

Commit ed6897c

Browse files
committed
toil: normalize eslint rules
1 parent 25b79b8 commit ed6897c

File tree

114 files changed

+1239
-1206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1239
-1206
lines changed

front/assets/.eslintrc.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626
},
2727
ignorePatterns: ["*.js", "*.json"],
2828
rules: {},
29-
overrides: [
29+
overrides: [
3030
{
3131
files: ["js/**/*.spec.js"],
3232
env: {
@@ -86,7 +86,8 @@ module.exports = {
8686
},
8787
},
8888
],
89-
"no-console": 1,
89+
"no-console": ["error", { allow: ["warn", "error"] }],
90+
"max-len": ["error", {"code": 140, "ignoreComments": true, "ignoreStrings": true, "ignoreTemplateLiterals": true}],
9091
"no-multi-spaces": "error",
9192
"@typescript-eslint/member-delimiter-style": [
9293
"warn",
@@ -97,13 +98,14 @@ module.exports = {
9798
},
9899
singleline: {
99100
delimiter: "comma",
100-
requireLast: true,
101+
requireLast: false,
101102
},
102103
},
103104
],
104105
"semi-spacing": ["error", {"before": false, "after": true}],
105106
"react/jsx-uses-react": "off",
106107
"react/react-in-jsx-scope": "off",
108+
// "react/jsx-one-expression-per-line": ["error", { "allow": "single-child" }],
107109
"react/display-name": "off",
108110
"react/jsx-tag-spacing": [
109111
"error",
@@ -114,6 +116,12 @@ module.exports = {
114116
beforeClosing: "never",
115117
},
116118
],
119+
"@typescript-eslint/no-misused-promises": [
120+
"error",
121+
{
122+
"checksVoidReturn": false
123+
}
124+
]
117125
},
118126
},
119127
],

front/assets/js/agents/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom";
55
import * as stores from "js/agents/stores";
66
import * as pages from "js/agents/pages";
77

8-
export default function ({ dom, config }: { dom: HTMLElement, config: any, }) {
8+
export default function ({ dom, config }: { dom: HTMLElement, config: any }) {
99
const configState = stores.Config.State.fromJSON(config);
1010
render(
1111
<BrowserRouter basename={config.baseUrl}>

front/assets/js/agents/stores/activity.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ export class Item {
125125
}
126126

127127
export type Action =
128-
| { type: `SET_WAITING_ITEMS`, value: Item[], }
129-
| { type: `SET_RUNNING_ITEMS`, value: Item[], }
130-
| { type: `SET_LOBBY_ITEMS`, value: Item[], }
131-
| { type: `SET_HOSTED_AGENTS`, value: Agent[], }
132-
| { type: `SET_SELF_HOSTED_AGENTS`, value: Agent[], }
133-
| { type: `DELETE_SELF_HOSTED_AGENT`, value: string, }
134-
| { type: `SET_INVISIBLE_JOBS_COUNT`, value: number, };
128+
| { type: `SET_WAITING_ITEMS`, value: Item[] }
129+
| { type: `SET_RUNNING_ITEMS`, value: Item[] }
130+
| { type: `SET_LOBBY_ITEMS`, value: Item[] }
131+
| { type: `SET_HOSTED_AGENTS`, value: Agent[] }
132+
| { type: `SET_SELF_HOSTED_AGENTS`, value: Agent[] }
133+
| { type: `DELETE_SELF_HOSTED_AGENT`, value: string }
134+
| { type: `SET_INVISIBLE_JOBS_COUNT`, value: number };
135135

136136
export interface State {
137137
hostedAgents: Agent[];

front/assets/js/agents/stores/self_hosted_agent.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { createContext } from "preact";
22
import * as types from "../types";
33

44
export type Action =
5-
| { type: `SET_AGENT_TYPE`, value: types.SelfHosted.AgentType, }
6-
| { type: `SET_AGENTS`, value: types.SelfHosted.Agent[], }
7-
| { type: `SET_TOKEN`, value: string, }
8-
| { type: `REVEAL_TOKEN`, }
9-
| { type: `HIDE_TOKEN`, }
10-
| { type: `JUST_CREATED`, }
11-
| { type: `JUST_RESET`, };
5+
| { type: `SET_AGENT_TYPE`, value: types.SelfHosted.AgentType }
6+
| { type: `SET_AGENTS`, value: types.SelfHosted.Agent[] }
7+
| { type: `SET_TOKEN`, value: string }
8+
| { type: `REVEAL_TOKEN` }
9+
| { type: `HIDE_TOKEN` }
10+
| { type: `JUST_CREATED` }
11+
| { type: `JUST_RESET` };
1212

1313
export interface State {
1414
token: string;

front/assets/js/billing/components/charts.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const DefaultPlotState: PlotState = {
2121
width: 0,
2222
};
2323

24-
const PlotContext = createContext<{ plotState: PlotState, plotData: PlotData[], }>({
24+
const PlotContext = createContext<{ plotState: PlotState, plotData: PlotData[] }>({
2525
plotState: DefaultPlotState,
2626
plotData: [],
2727
});

front/assets/js/billing/components/group_tooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const GroupTooltip = (props: GroupTooltipProps) => {
1414
/>;
1515
};
1616

17-
const GroupDescription = ({ group }: { group: types.Spendings.Group, }) => {
17+
const GroupDescription = ({ group }: { group: types.Spendings.Group }) => {
1818
switch (group.type) {
1919
case types.Spendings.GroupType.MachineCapacity:
2020
return (

front/assets/js/billing/components/invoice_list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const InvoiceList = () => {
6161
);
6262
};
6363

64-
const Invoice = ({ invoice, lastItem }: { invoice: types.Spendings.Invoice, lastItem?: boolean, }) => {
64+
const Invoice = ({ invoice, lastItem }: { invoice: types.Spendings.Invoice, lastItem?: boolean }) => {
6565
return (
6666
<div className={ lastItem ? `` : `b--black-075 bb`}>
6767
<div className="ph3 pv2">

front/assets/js/billing/components/loader.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ export const Container = (props: Props) => {
2222
}
2323
};
2424

25-
export const LoadingSpinner = ({ text }: { text: string, }) => {
25+
export const LoadingSpinner = ({ text }: { text: string }) => {
2626
return (<div className="pv2 flex items-center justify-center">
2727
<toolbox.Asset path="images/spinner-2.svg" width="20" height="20"/>
2828
<div className="ml1 gray">{text}</div>
2929
</div>);
3030
};
3131

32-
export const LoadingFailed = ({ text, retry }: { text: string, retry?: boolean, }) => {
32+
export const LoadingFailed = ({ text, retry }: { text: string, retry?: boolean }) => {
3333

3434
const { dispatch: dispatchRequest } = useContext(stores.Request.Context);
3535
if(retry) {

front/assets/js/billing/components/navigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const Navigation = () => {
1414
const displayProjects = config.projectSpendings;
1515
const hasPlans = config.availablePlans.length > 0;
1616

17-
const className = ({ isActive }: { isActive: boolean, }) => {
17+
const className = ({ isActive }: { isActive: boolean }) => {
1818
return (
1919
`link db pv1 ph2 br3 ` +
2020
(isActive ? `white active bg-green` : `dark-gray hover-bg-lightest-gray`)

front/assets/js/billing/components/plan_flags.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const PlanFlags = () => {
1616
);
1717
};
1818

19-
const SuspensionFlag = ({ plan }: { plan: types.Spendings.Plan, }) => {
19+
const SuspensionFlag = ({ plan }: { plan: types.Spendings.Plan }) => {
2020
if (plan.didCreditsRunOut()) {
2121
return <CreditsRunOut plan={plan}/>;
2222
}
@@ -30,7 +30,7 @@ const SuspensionFlag = ({ plan }: { plan: types.Spendings.Plan, }) => {
3030
}
3131
};
3232

33-
const NoPaymentMethod = ({ plan }: { plan: types.Spendings.Plan, }) => {
33+
const NoPaymentMethod = ({ plan }: { plan: types.Spendings.Plan }) => {
3434
return (
3535
<div className="flex items-center justify-between bb b--black-075 w-100-l mb3 br3 bg-red bg-pattern-wave pa3">
3636
<div className="white f3">Payment method not set.</div>
@@ -39,7 +39,7 @@ const NoPaymentMethod = ({ plan }: { plan: types.Spendings.Plan, }) => {
3939
);
4040
};
4141

42-
const PaymentFailed = ({ plan }: { plan: types.Spendings.Plan, }) => {
42+
const PaymentFailed = ({ plan }: { plan: types.Spendings.Plan }) => {
4343
return (
4444
<div className="flex items-center justify-between bb b--black-075 w-100-l mb3 br3 bg-red bg-pattern-wave pa3">
4545
<div className="white f3">Your last payment failed.</div>
@@ -48,7 +48,7 @@ const PaymentFailed = ({ plan }: { plan: types.Spendings.Plan, }) => {
4848
);
4949
};
5050

51-
const CreditsRunOut = ({ plan }: { plan: types.Spendings.Plan, }) => {
51+
const CreditsRunOut = ({ plan }: { plan: types.Spendings.Plan }) => {
5252
let content = `You ran out of credits.`;
5353
if (plan.isFree()) {
5454
content = `You used up your free credit quota.`;

0 commit comments

Comments
 (0)