Skip to content

Commit

Permalink
Strict ESlint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverroick committed Jan 30, 2025
1 parent e80f06b commit da70876
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 13 deletions.
37 changes: 37 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,43 @@ export default tseslint.config(
"react/jsx-uses-react": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error"],
"indent": ["error", 2, { "SwitchCase": 1 }],
"quotes": ["error", "double"],
"jsx-quotes": ["error", "prefer-double"],
"semi": [2, "always"],
"eol-last": ["error", "always"],
"no-console": 1,
"no-extra-semi": 2,
"semi-spacing": [2, { "before": false, "after": true }],
"no-dupe-else-if": 0,
"no-setter-return": 0,
"prefer-promise-reject-errors": 0,
"react/button-has-type": 2,
"react/default-props-match-prop-types": 2,
"react/jsx-closing-bracket-location": 2,
"react/jsx-closing-tag-location": 2,
"react/jsx-curly-spacing": 2,
"react/jsx-curly-newline": 2,
"react/jsx-equals-spacing": 2,
"react/jsx-max-props-per-line": [2, { "maximum": 1, "when": "multiline" }],
"react/jsx-first-prop-new-line": 2,
"react/jsx-curly-brace-presence": [
2,
{ "props": "never", "children": "never" }
],
"react/jsx-pascal-case": 2,
"react/jsx-props-no-multi-spaces": 2,
"react/jsx-tag-spacing": [2, { "beforeClosing": "never" }],
"react/jsx-wrap-multilines": 2,
"react/no-array-index-key": 2,
"react/no-typos": 2,
"react/no-unsafe": 2,
"react/no-unused-prop-types": 2,
"react/no-unused-state": 2,
"react/self-closing-comp": 2,
"react/sort-comp": 2,
"react/style-prop-object": 2,
"react/void-dom-elements-no-children": 2,
},
},
);
7 changes: 3 additions & 4 deletions src/ImageBuilder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function ImageLogs({ setTerm, setFitAddon, name }) {

return (
<div className="terminal-container border">
<div id={terminalId}></div>
<div id={terminalId} />
</div>
);
}
Expand Down Expand Up @@ -146,7 +146,7 @@ export function ImageBuilder({ name, isActive }) {
"\nImage has been built! Click the start button to launch your server",
);
})
.catch(() => console.log(`Error building image.`))
.catch(() => console.log("Error building image."))
.finally(() => setIsBuildingImage(false));
};

Expand Down Expand Up @@ -214,8 +214,7 @@ export function ImageBuilder({ name, isActive }) {
aria-hidden="true"
style={{ display: "none" }}
onInvalid={() =>
setCustomImageError("Wait for the image build to complete.")
}
setCustomImageError("Wait for the image build to complete.")}
onChange={() => {}} // Hack to prevent a console error, while at the same time allowing for this field to be validatable, ie. not making it read-only
/>
<div className="profile-option-container">
Expand Down
2 changes: 1 addition & 1 deletion src/ProfileForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ describe("Profile form", () => {
<ProfileForm />
</SpawnerFormProvider>,
);
const hiddenRadio = container.querySelector('[name="profile"]');
const hiddenRadio = container.querySelector("[name='profile']");
expect((hiddenRadio as HTMLInputElement).value).toEqual("custom");
const defaultRadio = screen.getByRole("radio", {
name: "Bring your own image Specify your own docker image",
Expand Down
14 changes: 7 additions & 7 deletions src/ProfileOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ export function ProfileOptions({ config, profile }: IProfileOptionsProps) {
{Object.entries(config).map(([key, option]) => {
const customOptions = hasDynamicImageBuilding(key, option)
? [
{
value: "--extra-selectable-item",
label: "Build your own image",
description:
{
value: "--extra-selectable-item",
label: "Build your own image",
description:
"Use a mybinder.org compatible GitHub repo to build your own image",
component: ImageBuilder,
},
]
component: ImageBuilder,
},
]
: [];

return (
Expand Down
1 change: 0 additions & 1 deletion src/components/form/CustomSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export function CustomizedSelect({
);
}}
onChange={(option, meta) => {
console.log(meta);
if (
lastSelectedChoice !== null &&
option !== lastSelectedChoice &&
Expand Down

0 comments on commit da70876

Please sign in to comment.