Skip to content

Commit ecbf6b1

Browse files
authored
Merge pull request #54 from CodinGame/update-dependencies
Update dependencies
2 parents 4fb37e7 + 5de8cc8 commit ecbf6b1

11 files changed

+7570
-6580
lines changed

.eslintrc.cjs

-16
This file was deleted.

.prettierrc.cjs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
singleQuote: true,
3+
jsxSingleQuote: true,
4+
trailingComma: 'none',
5+
semi: false,
6+
printWidth: 100
7+
}

commitlint.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export default {
2-
extends: ['@codingame/commitlint-config-codingame']
3-
};
2+
extends: ['@codingame/commitlint-config-codingame']
3+
}

eslint.config.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import eslint from '@eslint/js'
2+
import tsEslint from 'typescript-eslint'
3+
import eslintPluginReact from 'eslint-plugin-react'
4+
import eslintPluginReactHooks from 'eslint-plugin-react-hooks'
5+
import globals from 'globals'
6+
7+
export default tsEslint.config(
8+
eslint.configs.recommended,
9+
tsEslint.configs.recommended,
10+
eslintPluginReact.configs.flat.recommended,
11+
eslintPluginReact.configs.flat?.['jsx-runtime'],
12+
{
13+
rules: { '@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }] },
14+
languageOptions: {
15+
globals: {
16+
...globals.browser
17+
}
18+
}
19+
},
20+
21+
// TODO: Simplify when https://github.com/facebook/react/issues/28313 is resolved
22+
{
23+
plugins: {
24+
'react-hooks': eslintPluginReactHooks
25+
},
26+
rules: { ...eslintPluginReactHooks.configs.recommended.rules }
27+
}
28+
)

package-lock.json

+7,484-6,516
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+18-23
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"scripts": {
1010
"build": "npm run lint && npm run compile",
1111
"compile": "tsc -p tsconfig.build.json",
12-
"lint": "eslint --ext .ts,.tsx src/"
12+
"lint": "eslint 'src/**/*.ts' && prettier --check '**/*.{js,ts}'"
1313
},
1414
"repository": {
1515
"type": "git",
@@ -39,37 +39,32 @@
3939
],
4040
"types": "dist/index.d.ts",
4141
"dependencies": {
42-
"@codingame/monaco-editor-wrapper": "^9.0.1",
42+
"@codingame/monaco-editor-wrapper": "^11.0.0",
4343
"deep-equal": "^2.2.3",
4444
"lodash.debounce": "^4.0.8",
45-
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@^8.0.3",
45+
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@^13.1.3",
4646
"react-dom": "^18.3.1",
47-
"vscode": "npm:@codingame/monaco-vscode-api@^8.0.3"
47+
"vscode": "npm:@codingame/monaco-vscode-extension-api@^13.1.3"
4848
},
4949
"devDependencies": {
5050
"@codingame/commitlint-config-codingame": "^1.1.1",
51-
"@codingame/eslint-config": "^1.1.10",
52-
"@codingame/eslint-config-react": "^1.0.2",
53-
"@codingame/semantic-release-config-github": "^1.0.0",
51+
"@codingame/semantic-release-config-github": "^2.0.0",
5452
"@codingame/tsconfig": "^1.1.1",
55-
"@commitlint/cli": "^19.4.0",
53+
"@commitlint/cli": "^19.7.1",
5654
"@types/deep-equal": "^1.0.4",
5755
"@types/lodash.debounce": "^4.0.9",
58-
"@types/react": "18.3.4",
59-
"@types/react-dom": "^18.3.0",
60-
"@types/vscode": "^1.92.0",
61-
"@typescript-eslint/eslint-plugin": "7.16.0",
62-
"@typescript-eslint/parser": "7.16.0",
63-
"conventional-changelog-conventionalcommits": "^7.0.2",
64-
"eslint": "8.57.0",
65-
"eslint-config-standard": "17.1.0",
66-
"eslint-config-standard-jsx": "11.0.0",
67-
"eslint-plugin-import": "2.29.1",
68-
"eslint-plugin-node": "11.1.0",
69-
"eslint-plugin-react": "7.34.3",
70-
"eslint-plugin-react-hooks": "4.6.2",
71-
"eslint-plugin-unused-imports": "3.2.0",
72-
"typescript": "5.5.4"
56+
"@types/react": "19.0.8",
57+
"@types/react-dom": "^19.0.3",
58+
"@types/vscode": "^1.96.0",
59+
"@typescript-eslint/eslint-plugin": "8.23.0",
60+
"@typescript-eslint/parser": "8.23.0",
61+
"conventional-changelog-conventionalcommits": "^8.0.0",
62+
"eslint": "9.19.0",
63+
"eslint-plugin-react": "^7.37.4",
64+
"eslint-plugin-react-hooks": "^5.1.0",
65+
"prettier": "^3.4.2",
66+
"typescript": "5.7.3",
67+
"typescript-eslint": "^8.23.0"
7368
},
7469
"peerDependencies": {
7570
"react": ">=16.0.0"

src/MonacoEditor.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ function MonacoEditor ({
125125
onEditorOpenRequest,
126126
onDidSave = defaultOnDidSave
127127
}: MonacoEditorProps, ref: ForwardedRef<monaco.editor.IStandaloneCodeEditor>): ReactElement {
128-
const editorRef = useRef<monaco.editor.IStandaloneCodeEditor>()
129-
const modelRef = useRef<monaco.editor.ITextModel>()
128+
const editorRef = useRef<monaco.editor.IStandaloneCodeEditor>(undefined)
129+
const modelRef = useRef<monaco.editor.ITextModel>(undefined)
130130
const [modelReady, setModelReady] = useState(false)
131131
const preventTriggerChangeEventRef = useRef<boolean>(false)
132132

@@ -193,7 +193,6 @@ function MonacoEditor ({
193193
}
194194
}
195195
return undefined
196-
// eslint-disable-next-line react-hooks/exhaustive-deps
197196
}, [])
198197

199198
// Create/Update model

src/hooks.ts

+15-10
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import deepEqual from 'deep-equal'
33
import { getConfiguration, onConfigurationChanged, monaco } from '@codingame/monaco-editor-wrapper'
44
import { StandaloneServices, IThemeService } from 'vscode/services'
55

6-
function getCurrentThemeColor (color: string): string | undefined {
6+
function getCurrentThemeColor(color: string): string | undefined {
77
const themeService = StandaloneServices.get(IThemeService)
88
return themeService.getColorTheme().getColor(color)?.toString()
99
}
1010

11-
export function useThemeColor (color: string): string | undefined {
11+
export function useThemeColor(color: string): string | undefined {
1212
const [colorValue, setColorValue] = useState(getCurrentThemeColor(color))
1313
useEffect(() => {
1414
const disposable = StandaloneServices.get(IThemeService).onDidColorThemeChange(() => {
@@ -25,7 +25,9 @@ export function useThemeColor (color: string): string | undefined {
2525
return colorValue
2626
}
2727

28-
export function useUserConfiguration (programmingLanguageId?: string): Partial<monaco.editor.IEditorOptions> {
28+
export function useUserConfiguration(
29+
programmingLanguageId?: string
30+
): Partial<monaco.editor.IEditorOptions> {
2931
const [userConfiguration, setUserConfiguration] = useState(() => getConfiguration()!)
3032
useEffect(() => {
3133
const updateOptions = () => {
@@ -39,33 +41,36 @@ export function useUserConfiguration (programmingLanguageId?: string): Partial<m
3941
return userConfiguration
4042
}
4143

42-
export function useLastValueRef<T> (value: T): MutableRefObject<T> {
44+
export function useLastValueRef<T>(value: T): MutableRefObject<T> {
4345
const ref = useRef<T>(value)
4446
ref.current = value
4547
return ref
4648
}
4749

48-
export function useLastVersion<P extends unknown[], R> (func: (...args: P) => R): (...args: P) => R {
50+
export function useLastVersion<P extends unknown[], R>(func: (...args: P) => R): (...args: P) => R {
4951
const ref = useRef<(...args: P) => R>(func)
5052
useEffect(() => {
5153
ref.current = func
5254
}, [func])
5355
return useCallback((...args: P) => {
5456
return ref.current(...args)
55-
// eslint-disable-next-line react-hooks/exhaustive-deps
5657
}, [])
5758
}
5859

59-
export function usePrevious<T> (value: T): T | undefined {
60-
const ref = useRef<T>()
60+
export function usePrevious<T>(value: T): T | undefined {
61+
const ref = useRef<T>(undefined)
6162
useEffect(() => {
6263
ref.current = value
6364
}, [value])
6465
return ref.current
6566
}
6667

67-
export function useDeepMemo<T, D extends unknown[]> (memoFn: () => T, deps: D, isEqual: (a: D, b: D) => boolean = deepEqual): T {
68-
const ref = useRef<{ deps: D, value: T }>()
68+
export function useDeepMemo<T, D extends unknown[]>(
69+
memoFn: () => T,
70+
deps: D,
71+
isEqual: (a: D, b: D) => boolean = deepEqual
72+
): T {
73+
const ref = useRef<{ deps: D; value: T }>(undefined)
6974
if (ref.current == null || !isEqual(deps, ref.current.deps)) {
7075
ref.current = { deps, value: memoFn() }
7176
}

src/index.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
import { loadLanguage, monaco, updateKeybindings, updateUserConfiguration } from '@codingame/monaco-editor-wrapper'
2-
import { IEditorOptions, IResolvedTextEditorModel } from '@codingame/monaco-vscode-editor-service-override'
1+
import {
2+
loadLanguage,
3+
monaco,
4+
updateKeybindings,
5+
updateUserConfiguration
6+
} from '@codingame/monaco-editor-wrapper'
7+
import {
8+
IEditorOptions,
9+
IResolvedTextEditorModel
10+
} from '@codingame/monaco-vscode-editor-service-override'
311
import type { IReference } from 'vscode/monaco'
412
import { useThemeColor, useUserConfiguration } from './hooks.js'
513
import MonacoEditor, { MonacoEditorProps } from './MonacoEditor.js'
@@ -13,9 +21,4 @@ export {
1321
updateUserConfiguration,
1422
loadLanguage
1523
}
16-
export type {
17-
MonacoEditorProps,
18-
IReference,
19-
IEditorOptions,
20-
IResolvedTextEditorModel
21-
}
24+
export type { MonacoEditorProps, IReference, IEditorOptions, IResolvedTextEditorModel }

src/style.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export function addStyle (styleString: string): void {
1+
export function addStyle(styleString: string): void {
22
const style = document.createElement('style')
33
style.textContent = styleString
44
document.head.append(style)

tsconfig.build.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
},
2222
"resolveJsonModule": true,
2323
"sourceMap": true,
24-
"target": "ES2022"
24+
"target": "ES2022",
25+
"skipLibCheck": true
2526
},
2627
"include": ["src"],
2728
"exclude": [

0 commit comments

Comments
 (0)