Skip to content

Commit 5644f8d

Browse files
committed
Enable no-require-imports that was waiting for us to switch to flat config file
1 parent 5b6a2fa commit 5644f8d

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

eslint.config.mjs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ export default [
165165
'ts-check': false, // allow even without description
166166
},
167167
],
168-
// TODO: Re-enable for src when we update to eslint and switch to the new
169-
// config format
170168
'@typescript-eslint/no-require-imports': 'off',
171169
},
172170
linterOptions: {
@@ -179,6 +177,14 @@ export default [
179177
},
180178
},
181179

180+
// Source files - enable stricter TypeScript rules
181+
{
182+
files: ['src/**/*.ts', 'src/**/*.tsx'],
183+
rules: {
184+
'@typescript-eslint/no-require-imports': 'error',
185+
},
186+
},
187+
182188
// Test files override
183189
{
184190
files: ['src/test/**/*'],

src/utils/__mocks__/node-worker-contents.js renamed to src/utils/__mocks__/node-worker-contents.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44
//
5-
const { parentPort, workerData } = require('worker_threads');
6-
const fs = require('fs');
7-
const vm = require('vm');
5+
import { parentPort, workerData } from 'worker_threads';
6+
import fs from 'fs';
7+
import vm from 'vm';
88

99
if (typeof workerData !== 'string') {
1010
throw new Error(`Please pass a file name using the 'workerData' property.`);

src/utils/__mocks__/worker-factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class NodeWorker {
99
onmessage: ((event: MessageEvent) => unknown) | null;
1010

1111
constructor(file: string) {
12-
const worker = new Worker(__dirname + '/node-worker-contents.js', {
12+
const worker = new Worker(__dirname + '/node-worker-contents.mjs', {
1313
workerData: file,
1414
});
1515
worker.on('message', this.onMessage);

0 commit comments

Comments
 (0)