8000 chore(website): add current version of typescript to playground dropd… · joshhunt/typescript-eslint@a0d5a70 · GitHub
[go: up one dir, main page]

Skip to content

Commit a0d5a70

Browse files
authored
chore(website): add current version of typescript to playground dropdown (typescript-eslint#5341)
1 parent 7ea14ae commit a0d5a70

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

packages/website/src/components/OptionsSelector.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,9 @@ function OptionsSelectorContent({
9090
name="ts"
9191
className="text--right"
9292
value={state.ts}
93+
disabled={!tsVersions.length}
9394
onChange={updateTS}
94-
options={((tsVersions.length && tsVersions) || [state.ts]).filter(
95-
item => parseFloat(item) >= 3.3,
96-
)}
95+
options={(tsVersions.length && tsVersions) || [state.ts]}
9796
/>
9897
</label>
9998
<label className={styles.optionLabel}>

packages/website/src/components/editor/useSandboxServices.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,14 @@ export const useSandboxServices = (
110110

111111
const webLinter = new WebLinter(system, compilerOptions, lintUtils);
112112

113-
props.onLoaded(webLinter.ruleNames, sandboxInstance.supportedVersions);
113+
props.onLoaded(
114+
webLinter.ruleNames,
115+
Array.from(
116+
new Set([...sandboxInstance.supportedVersions, window.ts.version]),
117+
)
118+
.filter(item => parseFloat(item) >= 3.3)
119+
.sort((a, b) => b.localeCompare(a)),
120+
);
114121

115122
setServices({
116123
main,

packages/website/src/components/inputs/Dropdown.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface DropdownProps<T> {
1313
readonly value: T | undefined;
1414
readonly name: string;
1515
readonly className?: string;
16+
readonly disabled?: boolean;
1617
}
1718

1819
function Dropdown<T extends boolean | string | number>(
@@ -27,6 +28,7 @@ function Dropdown<T extends boolean | string | number>(
2728
return (
2829
<select
2930
name={props.name}
31+
disabled={props.disabled}
3032
value={String(props.value)}
3133
className={clsx(styles.optionSelect, props.className)}
3234
onChange={(e): void => {

0 commit comments

Comments
 (0)
0