Skip to content

Commit 63c0c08

Browse files
authored
Merge pull request #36 from CodinGame/update-dependencies
Update dependencies
2 parents bc28431 + feb81e3 commit 63c0c08

12 files changed

+7177
-6474
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,089-6,404
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+13-25
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 --ext .tsx src"
12+
"lint": "eslint 'src/**/*.ts' && prettier --check '**/*.{js,ts}'"
1313
},
1414
"repository": {
1515
"type": "git",
@@ -23,38 +23,26 @@
2323
],
2424
"types": "dist/index.d.ts",
2525
"dependencies": {
26-
"@codingame/monaco-languageclient-wrapper": "^9.0.0",
26+
"@codingame/monaco-languageclient-wrapper": "^10.0.0",
2727
"@rehooks/local-storage": "^2.4.5",
2828
"react": ">=18.3.1",
29-
"uuid": "^10.0.0"
29+
"uuid": "^11.0.5"
3030
},
3131
"devDependencies": {
3232
"@codingame/commitlint-config-codingame": "^1.1.1",
33-
"@codingame/eslint-config": "^1.1.10",
34-
"@codingame/eslint-config-react": "^1.0.2",
35-
"@codingame/semantic-release-config-github": "^1.0.0",
33+
"@codingame/semantic-release-config-github": "^2.0.0",
3634
"@codingame/tsconfig": "^1.1.1",
37-
"@commitlint/cli": "^19.4.0",
35+
"@commitlint/cli": "^19.7.1",
3836
"@types/deep-equal": "^1.0.4",
39-
"@types/react": "18.3.4",
37+
"@types/react": "19.0.8",
4038
"@types/uuid": "^10.0.0",
41-
"@typescript-eslint/eslint-plugin": "7.16.0",
42-
"@typescript-eslint/parser": "7.16.0",
43-
"babel-eslint": "10.1.0",
44-
"conventional-changelog-conventionalcommits": "^7.0.2",
45-
"eslint": "8.57.0",
46-
"eslint-config-standard": "17.1.0",
47-
"eslint-config-standard-jsx": "11.0.0",
48-
"eslint-plugin-import": "2.29.1",
49-
"eslint-plugin-node": "11.1.0",
50-
"eslint-plugin-promise": "6.2.0",
51-
"eslint-plugin-react": "7.34.3",
52-
"eslint-plugin-react-hooks": "4.6.2",
53-
"eslint-plugin-unused-imports": "3.2.0",
54-
"typescript": "5.5.4"
55-
},
56-
"overrides": {
57-
"@typescript-eslint/eslint-plugin": "$@typescript-eslint/eslint-plugin"
39+
"conventional-changelog-conventionalcommits": "^8.0.0",
40+
"eslint": "9.19.0",
41+
"eslint-plugin-react": "^7.37.4",
42+
"eslint-plugin-react-hooks": "^5.1.0",
43+
"typescript": "5.7.3",
44+
"typescript-eslint": "^8.23.0",
45+
"prettier": "^3.4.2"
5846
},
5947
"volta": {
6048
"node": "20.10.0",

src/LanguageClient.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function LanguageClient ({
5656
const onDidChangeStatus = useLastVersion(_onDidChangeStatus ?? noop)
5757
const onWillShutdown = useLastVersion(_onWillShutdown ?? noop)
5858

59-
const languageClientRef = useRef<LanguageClientManager>()
59+
const languageClientRef = useRef<LanguageClientManager>(undefined)
6060

6161
const [willShutdown, setWillShutdown] = useState(false)
6262
const [counter, setCounter] = useState(1)

src/hooks/useIsUserActive.ts

+22-17
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ if (typeof document.hidden !== 'undefined') {
3131
const prefixes = ['webkit', 'moz', 'ms']
3232
for (let i = 0; i < prefixes.length; i++) {
3333
const prefix = prefixes[i]
34-
if (typeof (document as unknown as Record<string, unknown>)[`${prefix}Hidden`] !== 'undefined') {
34+
if (
35+
typeof (document as unknown as Record<string, unknown>)[`${prefix}Hidden`] !== 'undefined'
36+
) {
3537
hidden = `${prefix}Hidden` as 'hidden'
3638
visibilityChangeEvent = `${prefix}visibilitychange` as 'visibilitychange'
3739
break
@@ -62,7 +64,7 @@ interface ActivityDetectorParams {
6264
initialState?: State
6365
autoInit?: boolean
6466
}
65-
function createActivityDetector ({
67+
function createActivityDetector({
6668
activityEvents = DEFAULT_ACTIVITY_EVENTS,
6769
inactivityEvents = DEFAULT_INACTIVITY_EVENTS,
6870
ignoredEventsWhenIdle = DEFAULT_IGNORED_EVENTS_WHEN_IDLE,
@@ -81,7 +83,7 @@ function createActivityDetector ({
8183
}
8284
if (state !== newState) {
8385
state = newState
84-
listeners[state].forEach(l => l())
86+
listeners[state].forEach((l) => l())
8587
}
8688
}
8789

@@ -104,21 +106,22 @@ function createActivityDetector ({
104106
*/
105107
const init = (firstState = DEFAULT_INITIAL_STATE) => {
106108
setState(firstState === State.active ? State.active : State.idle)
107-
activityEvents.forEach(eventName =>
108-
window.addEventListener(eventName, handleUserActivityEvent))
109+
activityEvents.forEach((eventName) =>
110+
window.addEventListener(eventName, handleUserActivityEvent)
111+
)
109112

110-
inactivityEvents.filter(eventName => eventName !== 'visibilitychange')
111-
.forEach(eventName =>
112-
window.addEventListener(eventName, handleUserInactivityEvent))
113+
inactivityEvents
114+
.filter((eventName) => eventName !== 'visibilitychange')
115+
.forEach((eventName) => window.addEventListener(eventName, handleUserInactivityEvent))
113116

114117
if (inactivityEvents.indexOf('visibilitychange') >= 0 && visibilityChangeEvent != null) {
115118
document.addEventListener(visibilityChangeEvent, handleVisibilityChangeEvent)
116119
}
117120
}
118121

119122
/**
120-
* Register an event listener for the required event
121-
*/
123+
* Register an event listener for the required event
124+
*/
122125
const on = (eventName: State, listener: () => void) => {
123126
listeners[eventName].push(listener)
124127
const off = () => {
@@ -131,19 +134,21 @@ function createActivityDetector ({
131134
}
132135

133136
/**
134-
* Stops the activity detector and clean the listeners
135-
*/
137+
* Stops the activity detector and clean the listeners
138+
*/
136139
const stop = () => {
137140
listeners[State.active] = []
138141
listeners[State.idle] = []
139142

140143
clearTimeout(timer)
141144

142-
activityEvents.forEach(eventName =>
143-
window.removeEventListener(eventName, handleUserActivityEvent))
145+
activityEvents.forEach((eventName) =>
146+
window.removeEventListener(eventName, handleUserActivityEvent)
147+
)
144148

145-
inactivityEvents.forEach(eventName =>
146-
window.removeEventListener(eventName, handleUserInactivityEvent))
149+
inactivityEvents.forEach((eventName) =>
150+
window.removeEventListener(eventName, handleUserInactivityEvent)
151+
)
147152

148153
if (visibilityChangeEvent != null) {
149154
document.removeEventListener(visibilityChangeEvent, handleVisibilityChangeEvent)
@@ -157,7 +162,7 @@ function createActivityDetector ({
157162
return { on, stop, init }
158163
}
159164

160-
export default function useIsUserActive (timeToIdle: number): boolean {
165+
export default function useIsUserActive(timeToIdle: number): boolean {
161166
const [active, setActive] = useState(true)
162167
useEffect(() => {
163168
const activityDetector = createActivityDetector({

src/hooks/useLastVersion.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useCallback, useEffect, useRef } from 'react'
22

3-
export function useLastVersion<P extends unknown[], R> (func: (...args: P) => R): (...args: P) => R {
3+
export function useLastVersion<P extends unknown[], R>(func: (...args: P) => R): (...args: P) => R {
44
const ref = useRef<(...args: P) => R>(func)
55
useEffect(() => {
66
ref.current = func

src/hooks/useShouldShutdownLanguageClient.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { useEffect, useState } from 'react'
22

3-
export default function useShouldShutdownLanguageClient (userActive: boolean, delay: number): boolean {
3+
export default function useShouldShutdownLanguageClient(
4+
userActive: boolean,
5+
delay: number
6+
): boolean {
47
const [paused, setPaused] = useState(false)
58
useEffect(() => {
69
setPaused(false)

src/index.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
import { CodinGameInfrastructure, Infrastructure, LanguageClientId, loadExtensionConfigurations, registerLanguageClient, WorkspaceFolder } from '@codingame/monaco-languageclient-wrapper'
1+
import {
2+
CodinGameInfrastructure,
3+
Infrastructure,
4+
LanguageClientId,
5+
loadExtensionConfigurations,
6+
registerLanguageClient,
7+
WorkspaceFolder
8+
} from '@codingame/monaco-languageclient-wrapper'
29
import LanguageClient, { LanguageClientProps, StatusChangeEvent } from './LanguageClient.js'
310

411
export default LanguageClient
5-
export {
6-
loadExtensionConfigurations,
7-
registerLanguageClient,
8-
CodinGameInfrastructure
9-
}
12+
export { loadExtensionConfigurations, registerLanguageClient, CodinGameInfrastructure }
1013
export type {
1114
LanguageClientProps,
1215
LanguageClientId,

src/types/activity-detector.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
declare module 'activity-detector' {
22
class ActivityDetector {
3-
public on (event: 'idle' | 'active', cb: () => void)
3+
public on(event: 'idle' | 'active', cb: () => void)
44
public init(): void
55
public stop(): void
66
}

0 commit comments

Comments
 (0)