Skip to content

Commit 5696f2e

Browse files
[UE5.7] fix(eslint): pin tsconfigRootDir so lint works from any CWD (#834) (#837)
* fix(eslint): pin tsconfigRootDir so lint works from any CWD (#834) Each workspace's eslint.config.mjs set parserOptions.project to a workspace-prefixed path (e.g. 'Common/tsconfig.cjs.json') on the assumption that typescript-eslint resolves it relative to the repo root. That assumption holds only for some versions of typescript-eslint and breaks outright when lint is invoked with CWD = workspace dir — which is exactly how .github/workflows/healthcheck-libraries.yml runs it (working-directory: Common, etc.). Pin parserOptions.tsconfigRootDir to import.meta.dirname so the relative project path is always resolved against the eslint config file's own directory, regardless of CWD or typescript-eslint version. Drop the workspace prefix from project accordingly. (cherry picked from commit 7aa1fe2) * fix: rebuilt package-lock * fix: fixing lint issues. --------- Co-authored-by: mcottontensor <80377552+mcottontensor@users.noreply.github.com> Co-authored-by: Matthew.Cotton <matt@tensorworks.com.au>
1 parent c3e46a8 commit 5696f2e

11 files changed

Lines changed: 8720 additions & 11294 deletions

File tree

.changeset/quiet-foxes-dance.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@epicgames-ps/lib-pixelstreamingcommon-ue5.7": patch
3+
"@epicgames-ps/lib-pixelstreamingsignalling-ue5.7": patch
4+
"@epicgames-ps/wilbur": patch
5+
"@epicgames-ps/lib-pixelstreamingfrontend-ue5.7": patch
6+
"@epicgames-ps/lib-pixelstreamingfrontend-ui-ue5.7": patch
7+
---
8+
9+
Make `npm run lint` work regardless of the directory it's invoked from. Each workspace's `eslint.config.mjs` now pins `parserOptions.tsconfigRootDir` to `import.meta.dirname`, so `parserOptions.project` resolves relative to the config file's own directory rather than whichever CWD `typescript-eslint` happens to pick by default. Previously the six workspace configs prefixed `project` with the workspace directory (e.g. `'Common/tsconfig.cjs.json'`), which only worked under one specific `typescript-eslint` version's resolution behavior and broke CI when run from within the workspace.

Common/eslint.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export default tseslint.config(
1313
languageOptions: {
1414
parser: tseslint.parser,
1515
parserOptions: {
16-
project: 'Common/tsconfig.cjs.json',
16+
project: 'tsconfig.cjs.json',
17+
tsconfigRootDir: import.meta.dirname,
1718
},
1819
},
1920
files: ["src/**/*.ts"],

Extras/JSStreamer/eslint.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export default tseslint.config(
1313
languageOptions: {
1414
parser: tseslint.parser,
1515
parserOptions: {
16-
project: 'Extras/JSStreamer/tsconfig.cjs.json',
16+
project: 'tsconfig.cjs.json',
17+
tsconfigRootDir: import.meta.dirname,
1718
},
1819
},
1920
files: ["src/**/*.ts"],

Frontend/library/eslint.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export default tseslint.config(
1212
languageOptions: {
1313
parser: tseslint.parser,
1414
parserOptions: {
15-
project: 'Frontend/library/tsconfig.json',
15+
project: 'tsconfig.json',
16+
tsconfigRootDir: import.meta.dirname,
1617
},
1718
},
1819
files: ["src/**/*.ts"],

Frontend/library/src/DataChannel/DataChannelController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class DataChannelController {
3535
this.label = label;
3636
this.datachannelOptions = datachannelOptions;
3737
if (datachannelOptions == null) {
38-
this.datachannelOptions = {} as RTCDataChannelInit;
38+
this.datachannelOptions = {};
3939
this.datachannelOptions.ordered = true;
4040
}
4141

Frontend/library/src/Inputs/GamepadController.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ export class GamepadController implements IInputController {
170170
const previousButton = controller.prevState.buttons[i];
171171
if (currentButton.pressed) {
172172
// press
173-
if ((i as GamepadLayout) === GamepadLayout.LeftTrigger) {
173+
if (i === Number(GamepadLayout.LeftTrigger)) {
174174
// UEs left analog has a button index of 5
175175
toStreamerHandlers.get('GamepadAnalog')([controllerId, 5, currentButton.value]);
176-
} else if ((i as GamepadLayout) === GamepadLayout.RightTrigger) {
176+
} else if (i === Number(GamepadLayout.RightTrigger)) {
177177
// UEs right analog has a button index of 6
178178
toStreamerHandlers.get('GamepadAnalog')([controllerId, 6, currentButton.value]);
179179
} else {
@@ -185,10 +185,10 @@ export class GamepadController implements IInputController {
185185
}
186186
} else if (!currentButton.pressed && previousButton.pressed) {
187187
// release
188-
if ((i as GamepadLayout) === GamepadLayout.LeftTrigger) {
188+
if (i === Number(GamepadLayout.LeftTrigger)) {
189189
// UEs left analog has a button index of 5
190190
toStreamerHandlers.get('GamepadAnalog')([controllerId, 5, 0]);
191-
} else if ((i as GamepadLayout) === GamepadLayout.RightTrigger) {
191+
} else if (i === Number(GamepadLayout.RightTrigger)) {
192192
// UEs right analog has a button index of 6
193193
toStreamerHandlers.get('GamepadAnalog')([controllerId, 6, 0]);
194194
} else {

Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export class WebRtcPlayerController {
175175
this.transport = new WebSocketTransport(config.webSocketProtocols);
176176
this.protocol = new SignallingProtocol(this.transport);
177177
this.protocol.addListener(Messages.config.typeName, (msg: BaseMessage) =>
178-
this.handleOnConfigMessage(msg as Messages.config)
178+
this.handleOnConfigMessage(msg)
179179
);
180180
this.protocol.addListener(Messages.ping.typeName, (msg: BaseMessage) =>
181181
this.handlePingMessage(msg as Messages.ping)

Frontend/ui-library/eslint.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export default tseslint.config(
1212
languageOptions: {
1313
parser: tseslint.parser,
1414
parserOptions: {
15-
project: 'Frontend/ui-library/tsconfig.json',
15+
project: 'tsconfig.json',
16+
tsconfigRootDir: import.meta.dirname,
1617
},
1718
},
1819
files: ["src/**/*.ts"],

Signalling/eslint.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export default tseslint.config(
1313
languageOptions: {
1414
parser: tseslint.parser,
1515
parserOptions: {
16-
project: 'Signalling/tsconfig.cjs.json',
16+
project: 'tsconfig.cjs.json',
17+
tsconfigRootDir: import.meta.dirname,
1718
},
1819
},
1920
files: ["src/**/*.ts"],

SignallingWebServer/eslint.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export default tseslint.config(
1414
languageOptions: {
1515
parser: tseslint.parser,
1616
parserOptions: {
17-
project: 'SignallingWebServer/tsconfig.json',
17+
project: 'tsconfig.json',
18+
tsconfigRootDir: import.meta.dirname,
1819
},
1920
},
2021
files: ["src/**/*.ts"],

0 commit comments

Comments
 (0)