Skip to content

Commit 3244402

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

File tree

179 files changed

+2317
-971
lines changed

Some content is hidden

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

179 files changed

+2317
-971
lines changed

front/assets/.eslintrc.js

Lines changed: 17 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,20 @@ module.exports = {
116118
beforeClosing: "never",
117119
},
118120
],
121+
"comma-dangle": "off",
122+
"@typescript-eslint/comma-dangle": [
123+
"error",
124+
{
125+
arrays: "always-multiline",
126+
objects: "always-multiline",
127+
imports: "always-multiline",
128+
exports: "always-multiline",
129+
functions: "always-multiline",
130+
enums: "always-multiline",
131+
generics: "always-multiline",
132+
tuples: "always-multiline"
133+
}
134+
],
119135
"@typescript-eslint/no-misused-promises": [
120136
"error",
121137
{

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ const JobSummary = (props: JobSummaryProps) => {
264264
labels.push(
265265
<span className="fw5 bg-green white ph1 br1 mr1">
266266
{jobPlural(runningCount)} running
267-
</span>
267+
</span>,
268268
);
269269
}
270270

@@ -273,7 +273,7 @@ const JobSummary = (props: JobSummaryProps) => {
273273
labels.push(
274274
<span className="fw5 bg-yellow black-60 ph1 br1 mr1">
275275
{showLabel ? jobPlural(waitingCount) : waitingCount} waiting
276-
</span>
276+
</span>,
277277
);
278278
}
279279

@@ -282,7 +282,7 @@ const JobSummary = (props: JobSummaryProps) => {
282282
labels.push(
283283
<span className="fw5 bg-mid-gray white ph1 br1 mr1">
284284
{showLabel ? jobPlural(leftCount) : leftCount} left
285-
</span>
285+
</span>,
286286
);
287287
}
288288

@@ -301,7 +301,7 @@ const JobSummary = (props: JobSummaryProps) => {
301301

302302
if (waitingCount > 0 && runningCount > 0) {
303303
descriptionItems.push(
304-
`${type} (${runningCount} running, ${waitingCount} waiting)`
304+
`${type} (${runningCount} running, ${waitingCount} waiting)`,
305305
);
306306
continue;
307307
}

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/aws.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const Component = (): VNode => {
2020
active: boolean;
2121
}
2222
const SubOS = (
23-
props: SubOSProps
23+
props: SubOSProps,
2424
) => {
2525
const ButtonEl = styled.button`
2626
&:hover,

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: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ export const icon = `images/icn-os-mac.svg`;
99

1010
export const Component = (): VNode => {
1111
const [selectedOs, setSelectedOs] = useState<`macos` | `homebrew`>(
12-
`homebrew`
12+
`homebrew`,
1313
);
1414

1515
interface SubOsProps extends h.JSX.HTMLAttributes {
1616
name: string;
1717
active: boolean;
1818
}
1919
const SubOS = (
20-
props: SubOsProps
20+
props: SubOsProps,
2121
) => {
2222
const ButtonEl = styled.button`
2323
&:hover,
@@ -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/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ export default function ({ dom, config }: { dom: HTMLElement, config: any }) {
3535
</Routes>
3636
</stores.Config.Context.Provider>
3737
</BrowserRouter>,
38-
dom
38+
dom,
3939
);
4040
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ export const Page = () => {
1313
const [activity, dispatchActivity] = useReducer(stores.Activity.Reducer, {
1414
...stores.Activity.EmptyState,
1515
hostedAgents: config.activity.agent_stats.agent_types.map(
16-
stores.Activity.Agent.fromJSON
16+
stores.Activity.Agent.fromJSON,
1717
),
1818
selfHostedAgents: config.activity.agent_stats.self_hosted_agent_types.map(
19-
stores.Activity.Agent.fromJSON
19+
stores.Activity.Agent.fromJSON,
2020
),
2121
waitingItems: config.activity.items.waiting.items.map(
22-
stores.Activity.Item.fromJSON
22+
stores.Activity.Item.fromJSON,
2323
),
2424
runningItems: config.activity.items.running.items.map(
25-
stores.Activity.Item.fromJSON
25+
stores.Activity.Item.fromJSON,
2626
),
2727
lobbyItems: config.activity.items.lobby.items.map(
28-
stores.Activity.Item.fromJSON
28+
stores.Activity.Item.fromJSON,
2929
),
3030
});
3131

@@ -44,7 +44,7 @@ export const Page = () => {
4444
dispatchActivity({
4545
type: `SET_SELF_HOSTED_AGENTS`,
4646
value: agent_stats.self_hosted_agent_types.map(
47-
stores.Activity.Agent.fromJSON
47+
stores.Activity.Agent.fromJSON,
4848
),
4949
});
5050

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>

0 commit comments

Comments
 (0)