Skip to content

Commit 2386942

Browse files
committed
toil: add more linter configuration options
1 parent 1cce97c commit 2386942

File tree

146 files changed

+2251
-927
lines changed

Some content is hidden

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

146 files changed

+2251
-927
lines changed

front/assets/.eslintrc.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ module.exports = {
105105
"semi-spacing": ["error", {"before": false, "after": true}],
106106
"react/jsx-uses-react": "off",
107107
"react/react-in-jsx-scope": "off",
108-
// "react/jsx-one-expression-per-line": ["error", { "allow": "single-child" }],
109108
"react/display-name": "off",
109+
"react/jsx-first-prop-new-line": ["error", "multiline"],
110+
"react/jsx-max-props-per-line": ["error", { maximum: {single: 2, multi: 1} }],
111+
"react/jsx-closing-bracket-location": ["error", { selfClosing: "line-aligned", nonEmpty: "line-aligned" }],
110112
"react/jsx-tag-spacing": [
111113
"error",
112114
{
@@ -116,6 +118,19 @@ module.exports = {
116118
beforeClosing: "never",
117119
},
118120
],
121+
"@typescript-eslint/comma-dangle": [
122+
"error",
123+
{
124+
arrays: "always-multiline",
125+
objects: "always-multiline",
126+
imports: "always-multiline",
127+
exports: "always-multiline",
128+
functions: "never",
129+
enums: "always-multiline",
130+
generics: "always-multiline",
131+
tuples: "always-multiline"
132+
}
133+
],
119134
"@typescript-eslint/no-misused-promises": [
120135
"error",
121136
{

front/assets/js/agents/components/activity_monitor.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ const LobbyItems = () => {
5959
in their branch, pull request and delivery queue
6060
</summary>
6161
{lobbyItems.map((item, idx) => (
62-
<ActivityItem item={item} key={idx} inLobby={true}/>
62+
<ActivityItem
63+
item={item}
64+
key={idx}
65+
inLobby={true}
66+
/>
6367
))}
6468
</details>
6569
);

front/assets/js/agents/components/instructions/kubernetes.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ export const Component = (): VNode => {
1818
<li>
1919
<div className="mb2">
2020
Install{` `}
21-
<a href="https://helm.sh/" target="_blank" rel="noreferrer">
21+
<a
22+
href="https://helm.sh/"
23+
target="_blank"
24+
rel="noreferrer"
25+
>
2226
helm
2327
</a>
2428
</div>

front/assets/js/agents/components/instructions/macos.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ export const HomebrewInstructions = () => {
182182
<li>
183183
<div className="mb2">
184184
Install{` `}
185-
<a href="https://brew.sh/" target="_blank" rel="noreferrer">
185+
<a
186+
href="https://brew.sh/"
187+
target="_blank"
188+
rel="noreferrer"
189+
>
186190
Homebrew
187191
</a>
188192
</div>

front/assets/js/agents/pages/self_hosted/agent.tsx

Lines changed: 14 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ import moment from "moment";
1212
import { Notice } from "js/notice";
1313

1414
export const Agent = () => {
15-
const { state, dispatch: dispatchSelfHostedAgent } = useContext(
16-
stores.SelfHostedAgent.Context
17-
);
15+
const { state, dispatch: dispatchSelfHostedAgent } = useContext(stores.SelfHostedAgent.Context);
1816
const navigate = useNavigate();
1917
const selfHostedAgent = state.type;
2018
const [showGuide, setShowGuide] = useState(false);
@@ -29,7 +27,7 @@ export const Agent = () => {
2927
if (!selfHostedAgent) return;
3028

3129
const { state: locationState } = useLocation();
32-
const targetId = (locationState as any)?.targetId as string;
30+
const targetId = (locationState )?.targetId as string;
3331

3432
useEffect(() => {
3533
if (state.type && state.type.totalAgentCount === 0) {
@@ -47,10 +45,7 @@ export const Agent = () => {
4745
const refreshActivity = async () => {
4846
setRefreshing(true);
4947
try {
50-
await types.SelfHosted.AgentType.get(
51-
config.selfHostedUrl,
52-
state.type.name
53-
)
48+
await types.SelfHosted.AgentType.get(config.selfHostedUrl, state.type.name)
5449
.then((agentType) => {
5550
dispatchSelfHostedAgent({
5651
type: `SET_AGENT_TYPE`,
@@ -84,9 +79,7 @@ export const Agent = () => {
8479
const EmptyList = () => {
8580
return (
8681
<div className="bg-white shadow-1 br3 pa3 pa4-l mb3">
87-
<p className="f5 gray mv0">
88-
No agents are currently connected to this agent type.
89-
</p>
82+
<p className="f5 gray mv0">No agents are currently connected to this agent type.</p>
9083
</div>
9184
);
9285
};
@@ -100,28 +93,16 @@ export const Agent = () => {
10093
</div>
10194
{config.accessProvider.canManageAgents() && (
10295
<div>
103-
<button
104-
onClick={() => navigate(`settings`)}
105-
className="btn btn-secondary mr2"
106-
>
96+
<button onClick={() => navigate(`settings`)} className="btn btn-secondary mr2">
10797
Settings
10898
</button>
109-
<button
110-
onClick={() => navigate(`reset`)}
111-
className="btn btn-secondary mr2"
112-
>
99+
<button onClick={() => navigate(`reset`)} className="btn btn-secondary mr2">
113100
Reset token
114101
</button>
115-
<button
116-
onClick={() => navigate(`disable_all`)}
117-
className="btn btn-secondary mr2"
118-
>
102+
<button onClick={() => navigate(`disable_all`)} className="btn btn-secondary mr2">
119103
Disable all
120104
</button>
121-
<button
122-
onClick={() => navigate(`delete`)}
123-
className="btn btn-danger"
124-
>
105+
<button onClick={() => navigate(`delete`)} className="btn btn-danger">
125106
Delete
126107
</button>
127108
</div>
@@ -169,13 +150,7 @@ export const Agent = () => {
169150
</div>
170151
<h2 className="f4 normal gray mb3">
171152
<span id="self-hosted-agents-count">
172-
<span className="green">
173-
{toolbox.Pluralize(
174-
selfHostedAgent.totalAgentCount,
175-
`connected agent`,
176-
`connected agents`
177-
)}
178-
</span>
153+
<span className="green">{toolbox.Pluralize(selfHostedAgent.totalAgentCount, `connected agent`, `connected agents`)}</span>
179154
</span>
180155
<span className="mh1">&middot;</span>
181156
<span className="pointer link underline" onClick={toggleInstructions}>
@@ -209,9 +184,7 @@ const ConnectedAgent = (props: ConnectAgentProps) => {
209184
}
210185
};
211186
const disableAgent = async () => {
212-
await toolbox.APIRequest.post(
213-
`${config.selfHostedUrl}/${selfHostedState.type.name}/agents/${agent.name}/disable?format=json`
214-
);
187+
await toolbox.APIRequest.post(`${config.selfHostedUrl}/${selfHostedState.type.name}/agents/${agent.name}/disable?format=json`);
215188
};
216189

217190
const agent = props.agent;
@@ -222,9 +195,7 @@ const ConnectedAgent = (props: ConnectAgentProps) => {
222195
onMouseOver={() => setShowStop(true)}
223196
onMouseOut={() => setShowStop(false)}
224197
>
225-
{showStop && (
226-
<StopAgent state={transitionState} setState={transitionTo}/>
227-
)}
198+
{showStop && <StopAgent state={transitionState} setState={transitionTo}/>}
228199
<div className="pl2-l">
229200
<div className="flex-l items-center justify-between">
230201
<h3 className="f4 mb1">
@@ -270,16 +241,10 @@ const StopAgent = (props: StopAgentProps) => {
270241
return (
271242
<div className="shadow-1 bg-white f6 br2 pa1">
272243
<span className="ph1">Are you sure?</span>
273-
<button
274-
onClick={() => props.setState(`running`)}
275-
className="input-reset pv1 ph2 br2 bg-gray white bn pointer mh1"
276-
>
244+
<button onClick={() => props.setState(`running`)} className="input-reset pv1 ph2 br2 bg-gray white bn pointer mh1">
277245
Nevermind
278246
</button>
279-
<button
280-
onClick={() => props.setState(`stopping`)}
281-
className="input-reset pv1 ph2 br2 bg-red white bn pointer"
282-
>
247+
<button onClick={() => props.setState(`stopping`)} className="input-reset pv1 ph2 br2 bg-red white bn pointer">
283248
Stop
284249
</button>
285250
</div>
@@ -293,7 +258,5 @@ const StopAgent = (props: StopAgentProps) => {
293258
}
294259
};
295260

296-
return (
297-
<div className="child absolute top-0 right-0 z-5 nt2 mr3">{content()}</div>
298-
);
261+
return <div className="child absolute top-0 right-0 z-5 nt2 mr3">{content()}</div>;
299262
};

front/assets/js/agents/pages/self_hosted/delete.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import { useNavigate, useParams } from "react-router-dom";
32
import { useContext } from "preact/hooks";
43
import * as stores from "js/agents/stores";
@@ -36,16 +35,10 @@ export const Delete = () => {
3635
</ul>
3736
<div className="mw6">
3837
<div className="mt3">
39-
<button
40-
className="btn btn-danger mr2"
41-
onClick={() => void deleteAgent()}
42-
>
38+
<button className="btn btn-danger mr2" onClick={() => void deleteAgent()}>
4339
Delete
4440
</button>
45-
<a
46-
className="btn btn-secondary pointer"
47-
onClick={() => navigate(`..`)}
48-
>
41+
<a className="btn btn-secondary pointer" onClick={() => navigate(`..`)}>
4942
Nevermind
5043
</a>
5144
</div>
Lines changed: 58 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
21
import * as toolbox from "js/toolbox";
32
import * as types from "../types";
43
import * as stores from "../stores";
54
import { useContext } from "preact/hooks";
65

7-
86
interface AvailableCreditsProps {
97
credits: types.Credits.Available[];
108
}
@@ -13,80 +11,85 @@ export const AvailableCredits = (props: AvailableCreditsProps) => {
1311
const { state } = useContext(stores.Spendings.Context);
1412
const currentCredits = state.currentSpending.summary.creditsStarting;
1513

16-
const tooltipContent = <div className="f5">
17-
<div className="mb2">
18-
<div className="b">What is this?</div>
19-
<div className="mb2">Your monthly spending will always be substracted first from the credits batch with the earliest expiry date.</div>
20-
<div className="">Credits batches that have expired or were consumed are not displayed.</div>
14+
const tooltipContent = (
15+
<div className="f5">
16+
<div className="mb2">
17+
<div className="b">What is this?</div>
18+
<div className="mb2">
19+
Your monthly spending will always be substracted first from the credits batch with the earliest expiry date.
20+
</div>
21+
<div className="">Credits batches that have expired or were consumed are not displayed.</div>
22+
</div>
2123
</div>
22-
</div>;
24+
);
2325

24-
return <div className="bb b--black-075 w-100-l mb4 br3 shadow-3 bg-white">
25-
<div className="flex items-center justify-between pa3 bb bw1 b--black-075 br3 br--top">
26-
<div>
27-
<div className="flex items-center">
28-
<span className="material-symbols-outlined pr2">payments</span>
29-
<div className="b mr1">Available credits</div>
26+
return (
27+
<div className="bb b--black-075 w-100-l mb4 br3 shadow-3 bg-white">
28+
<div className="flex items-center justify-between pa3 bb bw1 b--black-075 br3 br--top">
29+
<div>
30+
<div className="flex items-center">
31+
<span className="material-symbols-outlined pr2">payments</span>
32+
<div className="b mr1">Available credits</div>
3033

31-
<toolbox.Popover
32-
anchor={<toolbox.Asset path="images/icn-info-15.svg" className={`pointer`}/>}
33-
content={tooltipContent}
34-
/>
34+
<toolbox.Popover anchor={<toolbox.Asset path="images/icn-info-15.svg" className={`pointer`}/>} content={tooltipContent}/>
35+
</div>
3536
</div>
3637
</div>
37-
</div>
38-
<div>
39-
<div className="bb b--black-075">
40-
<div className="ph3 pv2">
41-
<div className="flex items-center-ns">
42-
<div className="w-100">
43-
<div className="flex-ns items-center">
44-
<div className="w-20-ns gray">Date expiring</div>
45-
<div className="w-20-ns tnum gray">Date added</div>
46-
<div className="w-40-ns tnum gray">Type</div>
47-
<div className="w-20-ns tr-ns tnum gray">Credits remaining</div>
38+
<div>
39+
<div className="bb b--black-075">
40+
<div className="ph3 pv2">
41+
<div className="flex items-center-ns">
42+
<div className="w-100">
43+
<div className="flex-ns items-center">
44+
<div className="w-20-ns gray">Date expiring</div>
45+
<div className="w-20-ns tnum gray">Date added</div>
46+
<div className="w-40-ns tnum gray">Type</div>
47+
<div className="w-20-ns tr-ns tnum gray">Credits remaining</div>
48+
</div>
4849
</div>
4950
</div>
5051
</div>
5152
</div>
53+
<ListAvailableCredits credits={props.credits}/>
5254
</div>
53-
<ListAvailableCredits credits={props.credits}/>
54-
55-
</div>
56-
<div>
57-
<div className="flex items-center justify-between pa3 bt bw1 b--black-075">
58-
<div className="flex items-center pl4">
59-
</div>
60-
<div className="flex items-center">
61-
<span className="b">{currentCredits}</span>
55+
<div>
56+
<div className="flex items-center justify-between pa3 bt bw1 b--black-075">
57+
<div className="flex items-center pl4"></div>
58+
<div className="flex items-center">
59+
<span className="b">{currentCredits}</span>
60+
</div>
6261
</div>
6362
</div>
6463
</div>
65-
</div>;
64+
);
6665
};
6766

6867
const ListAvailableCredits = (props: AvailableCreditsProps) => {
6968
const isLastItem = (idx: number) => {
7069
return idx === props.credits.length - 1;
7170
};
7271

73-
return <div className={`b--black-075`}>
74-
{props.credits.map((credit, idx) => {
75-
return <div className={`ph3 pv2 b--black-075 ${isLastItem(idx) ? `` : `bb`}`} key={idx}>
76-
<div className="flex items-center-ns">
77-
<div className="w-100">
78-
<div className="flex-ns items-center">
79-
<div className="w-20-ns">{toolbox.Formatter.dateFull(credit.expiresAt)}</div>
80-
<div className="w-20-ns tnum">{toolbox.Formatter.dateFull(credit.givenAt)}</div>
81-
<div className="w-40-ns tnum">{credit.typeName}</div>
82-
<div className="w-20-ns tr-ns tnum">
83-
<span className="green">{credit.amount}</span>
72+
return (
73+
<div className={`b--black-075`}>
74+
{props.credits.map((credit, idx) => {
75+
return (
76+
<div className={`ph3 pv2 b--black-075 ${isLastItem(idx) ? `` : `bb`}`} key={idx}>
77+
<div className="flex items-center-ns">
78+
<div className="w-100">
79+
<div className="flex-ns items-center">
80+
<div className="w-20-ns">{toolbox.Formatter.dateFull(credit.expiresAt)}</div>
81+
<div className="w-20-ns tnum">{toolbox.Formatter.dateFull(credit.givenAt)}</div>
82+
<div className="w-40-ns tnum">{credit.typeName}</div>
83+
<div className="w-20-ns tr-ns tnum">
84+
<span className="green">{credit.amount}</span>
85+
</div>
86+
</div>
8487
</div>
8588
</div>
8689
</div>
87-
</div>
88-
</div>;
89-
})}
90-
{props.credits.length === 0 && <div className="gray tc mv2">No credits available</div>}
91-
</div>;
90+
);
91+
})}
92+
{props.credits.length === 0 && <div className="gray tc mv2">No credits available</div>}
93+
</div>
94+
);
9295
};

0 commit comments

Comments
 (0)