Skip to content

Commit

Permalink
Merge pull request #4286 from serlo/chore/upgrade-ts
Browse files Browse the repository at this point in the history
chore: upgrade typescript version, bump target to es2018
  • Loading branch information
elbotho authored Nov 15, 2024
2 parents 5143a68 + cee1ec3 commit a7f7414
Show file tree
Hide file tree
Showing 20 changed files with 39 additions and 36 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
"tailwindcss": "^3.4.15",
"tailwindcss-animate": "^1.0.7",
"ts-unused-exports": "^10.1.0",
"typescript": "^5.4.5"
"typescript": "^5.6.3"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/equations-app/equation-task.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ function findActions(
}
return op
})
.filter((x) => x !== null) as Action[]
.filter((x) => x !== null)
}
}
throw new Error('invalid input')
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/equations-app/equations-app-v2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function readSolved() {
sessionStorage.getItem('serlo_gleichungs_app_solved') ?? '[]'
)
if (Array.isArray(state) && state.every((x) => typeof x === 'number')) {
return state as number[]
return state
}
return []
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/equations-app/equations-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ function findActions(
}
return op
})
.filter((x) => x !== null) as Action[]
.filter((x) => x !== null)
}
}
throw new Error('invalid input')
Expand Down
4 changes: 1 addition & 3 deletions apps/web/src/fetcher/create-breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ export function taxonomyParentsToRootToBreadcrumbsData(

// get the subject from the secondary menu data so we link to the correct landing pages
const subject = secondaryMenus.find(
// this is probably a bug in our code, but for now we ignore it:
// eslint-disable-next-line no-constant-binary-expression
(menu) => menu.rootId === breadcrumbs[0]?.id ?? term.id
(menu) => menu.rootId === (breadcrumbs[0]?.id || term.id)
)

if (subject) {
Expand Down
19 changes: 10 additions & 9 deletions apps/web/src/pages/___exercise_folder_dashboard/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import { faMagnifyingGlass } from '@fortawesome/free-solid-svg-icons'
Expand Down Expand Up @@ -235,8 +233,8 @@ export default function Page() {
<span className="ml-4 text-sm text-gray-500">
Gesamtquote:{' '}
{(
(data.versions[start].solved! /
data.versions[start].visits!) *
(data.versions[start].solved /
data.versions[start].visits) *
100
).toFixed(2)}
%
Expand All @@ -246,7 +244,7 @@ export default function Page() {
data.versions[start].medianTimeCount !== undefined && (
<span className="ml-4 text-sm text-gray-500">
Median Arbeitszeit:{' '}
{Math.round(data.versions[start].medianTime! / 1000 / 60)}{' '}
{Math.round(data.versions[start].medianTime / 1000 / 60)}{' '}
min ({data.versions[start].medianTimeCount})
</span>
)}
Expand All @@ -269,8 +267,8 @@ export default function Page() {
<span className="ml-4 text-sm text-gray-500">
Gesamtquote:{' '}
{(
(data.versions[end].solved! /
data.versions[end].visits!) *
(data.versions[end].solved /
data.versions[end].visits) *
100
).toFixed(2)}
%
Expand All @@ -280,7 +278,7 @@ export default function Page() {
data.versions[end].medianTimeCount !== undefined && (
<span className="ml-4 text-sm text-gray-500">
Median Arbeitszeit:{' '}
{Math.round(data.versions[end].medianTime! / 1000 / 60)}{' '}
{Math.round(data.versions[end].medianTime / 1000 / 60)}{' '}
min ({data.versions[end].medianTimeCount})
</span>
)}
Expand Down Expand Up @@ -328,6 +326,7 @@ export default function Page() {
</a>
){' '}
{renderSolved(
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
entry.__id,
data.versions[i].start,
data.versions[i].end,
Expand Down Expand Up @@ -360,7 +359,8 @@ export default function Page() {
)
</p>
{entry.children
? entry.children.map((child: any) => {
? // eslint-disable-next-line @typescript-eslint/no-unsafe-call
entry.children.map((child: any) => {
return (
<p key={child.__id} className="my-2 ml-5">
Teilaufgabe {child.__id} (
Expand All @@ -382,6 +382,7 @@ export default function Page() {
</a>
){' '}
{renderSolved(
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
child.__id,
data.versions[i].start,
data.versions[i].end,
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"files": true
},
"compilerOptions": {
"target": "es2018",
"lib": ["es2018", "DOM"],
"target": "ES2018",
"lib": ["ES2018", "DOM"],
"esModuleInterop": true,
"module": "commonjs",
"strictNullChecks": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"ts-debounce": "^4.0.0",
"ts-jest": "^29.2.5",
"ts-key-enum": "^2.0.13",
"typescript": "^5.4.5",
"typescript": "^5.6.3",
"uuid": "^11.0.3",
"vite": "^5.4.11",
"vite-plugin-dts": "4.3.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/editor/src/core/sub-document/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export function SubDocumentEditor({ id, pluginProps }: SubDocumentProps) {
const defaultConfig =
typeof plugin.config === 'function' ? plugin.config() : plugin.config
const overrideConfig = (pluginProps && pluginProps.config) || {}
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const config = R.mergeDeepRight(defaultConfig, overrideConfig)

const onChange = (
Expand Down Expand Up @@ -153,6 +154,7 @@ export function SubDocumentEditor({ id, pluginProps }: SubDocumentProps) {

const isInlineChildEditor =
Object.hasOwn(config, 'isInlineChildEditor') &&
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
(config.isInlineChildEditor as boolean)

const isTemplatePlugin = document.plugin.startsWith('type-')
Expand All @@ -176,6 +178,7 @@ export function SubDocumentEditor({ id, pluginProps }: SubDocumentProps) {
containerRef={containerRef}
id={id}
focused={focused}
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
config={config}
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
state={state}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function isBlankActive(editor: SlateEditor) {

export function getBlankElement(editor: SlateEditor): Blank | undefined {
const [match] = Array.from(SlateEditor.nodes(editor, { match: matchBlanks }))
return match && (match[0] as Blank)
return match && match[0]
}

export function toggleBlank(editor: SlateEditor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function isLinkActive(editor: SlateEditor) {

export function getLinkElement(editor: SlateEditor): Link | undefined {
const [match] = Array.from(SlateEditor.nodes(editor, { match: matchLinks }))
return match && (match[0] as Link)
return match && match[0]
}

export function toggleLink(editor: SlateEditor) {
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/plugins/box/renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function BoxRenderer({
const isAttention = boxType === 'attention'

const icon = boxTypeIcons[boxType] ? (
<FaIcon className="mr-1" icon={boxTypeIcons[boxType]!} />
<FaIcon className="mr-1" icon={boxTypeIcons[boxType]} />
) : null

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"typescript": "^5.4.5"
"typescript": "^5.6.3"
}
}
2 changes: 1 addition & 1 deletion packages/typescript-config/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "es6"
"target": "ES2018"
},
"exclude": ["node_modules"]
}
3 changes: 2 additions & 1 deletion packages/typescript-config/editor.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"display": "React Library",
"extends": "./base.json",
"compilerOptions": {
"jsx": "react-jsx"
"jsx": "react-jsx",
"target": "ES2018"
}
}
22 changes: 11 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5877,7 +5877,7 @@ __metadata:
ts-debounce: ^4.0.0
ts-jest: ^29.2.5
ts-key-enum: ^2.0.13
typescript: ^5.4.5
typescript: ^5.6.3
uuid: ^11.0.3
vite: ^5.4.11
vite-plugin-dts: 4.3.0
Expand All @@ -5897,7 +5897,7 @@ __metadata:
eslint-plugin-import: ^2.31.0
eslint-plugin-react: ^7.37.2
eslint-plugin-react-hooks: ^5.0.0
typescript: ^5.4.5
typescript: ^5.6.3
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -6007,7 +6007,7 @@ __metadata:
tippy.js: ^6.3.7
ts-debounce: ^4.0.0
ts-unused-exports: ^10.1.0
typescript: ^5.4.5
typescript: ^5.6.3
use-query-params: ^2.2.1
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -18865,13 +18865,13 @@ react-mathquill@Entkenntnis/tmp-react-mathquill:
languageName: node
linkType: hard

"typescript@npm:^5.4.5":
version: 5.4.5
resolution: "typescript@npm:5.4.5"
"typescript@npm:^5.6.3":
version: 5.6.3
resolution: "typescript@npm:5.6.3"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 53c879c6fa1e3bcb194b274d4501ba1985894b2c2692fa079db03c5a5a7140587a1e04e1ba03184605d35f439b40192d9e138eb3279ca8eee313c081c8bcd9b0
checksum: ba302f8822777ebefb28b554105f3e074466b671e7444ec6b75dadc008a62f46f373d9e57ceced1c433756d06c8b7dc569a7eefdf3a9573122a49205ff99021a
languageName: node
linkType: hard

Expand All @@ -18885,13 +18885,13 @@ react-mathquill@Entkenntnis/tmp-react-mathquill:
languageName: node
linkType: hard

"typescript@patch:typescript@^5.4.5#~builtin<compat/typescript>":
version: 5.4.5
resolution: "typescript@patch:typescript@npm%3A5.4.5#~builtin<compat/typescript>::version=5.4.5&hash=14eedb"
"typescript@patch:typescript@^5.6.3#~builtin<compat/typescript>":
version: 5.6.3
resolution: "typescript@patch:typescript@npm%3A5.6.3#~builtin<compat/typescript>::version=5.6.3&hash=14eedb"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 2373c693f3b328f3b2387c3efafe6d257b057a142f9a79291854b14ff4d5367d3d730810aee981726b677ae0fd8329b23309da3b6aaab8263dbdccf1da07a3ba
checksum: ade87bce2363ee963eed0e4ca8a312ea02c81873ebd53609bc3f6dc0a57f6e61ad7e3fb8cbb7f7ab8b5081cbee801b023f7c4823ee70b1c447eae050e6c7622b
languageName: node
linkType: hard

Expand Down

0 comments on commit a7f7414

Please sign in to comment.