Skip to content

Commit

Permalink
chore: enable @typescript-eslint/consistent-type-imports rule
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Jun 13, 2024
1 parent 713e36f commit 063dffc
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 31 deletions.
2 changes: 1 addition & 1 deletion benchmark/isolate-benchmark.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { bench } from 'vitest'
import { cpus } from 'node:os'
import { Worker } from 'node:worker_threads'
import { fork } from 'node:child_process'
import Tinypool, { Options } from '../dist/index'
import Tinypool, { type Options } from '../dist/index'

const THREADS = cpus().length - 1
const ROUNDS = THREADS * 10
Expand Down
8 changes: 8 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ export default defineConfig([
'error',
{ varsIgnorePattern: '^_' },
],
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
fixStyle: 'inline-type-imports',
disallowTypeAnnotations: false,
},
],
},
},
{
Expand Down
10 changes: 5 additions & 5 deletions src/entry/process.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { stderr, stdout } from '../utils'
import {
ReadyMessage,
RequestMessage,
ResponseMessage,
StartupMessage,
TinypoolWorkerMessage,
type ReadyMessage,
type RequestMessage,
type ResponseMessage,
type StartupMessage,
type TinypoolWorkerMessage,
} from '../common'
import { getHandler, throwInNextTick } from './utils'

Expand Down
12 changes: 6 additions & 6 deletions src/entry/worker.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {
parentPort,
MessagePort,
type MessagePort,
receiveMessageOnPort,
workerData as tinypoolData,
} from 'node:worker_threads'
import {
ReadyMessage,
RequestMessage,
ResponseMessage,
StartupMessage,
TinypoolData,
type ReadyMessage,
type RequestMessage,
type ResponseMessage,
type StartupMessage,
type TinypoolData,
kResponseCountField,
kRequestCountField,
isMovable,
Expand Down
22 changes: 11 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
MessageChannel,
MessagePort,
type MessagePort,
receiveMessageOnPort,
} from 'node:worker_threads'
import { once, EventEmitterAsyncResource } from 'node:events'
Expand All @@ -13,25 +13,25 @@ import { performance } from 'node:perf_hooks'
import { readFileSync } from 'node:fs'
import { amount as physicalCpuCount } from './physicalCpuCount'
import {
ReadyMessage,
RequestMessage,
ResponseMessage,
StartupMessage,
type ReadyMessage,
type RequestMessage,
type ResponseMessage,
type StartupMessage,
kResponseCountField,
kRequestCountField,
kFieldCount,
Transferable,
Task,
TaskQueue,
type Transferable,
type Task,
type TaskQueue,
kQueueOptions,
isTransferable,
markMovable,
isMovable,
kTransferable,
kValue,
TinypoolData,
TinypoolWorker,
TinypoolChannel,
type TinypoolData,
type TinypoolWorker,
type TinypoolChannel,
} from './common'
import ThreadWorker from './runtime/thread-worker'
import ProcessWorker from './runtime/process-worker'
Expand Down
10 changes: 5 additions & 5 deletions src/runtime/process-worker.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ChildProcess, fork } from 'node:child_process'
import { MessagePort, TransferListItem } from 'node:worker_threads'
import { type ChildProcess, fork } from 'node:child_process'
import { MessagePort, type TransferListItem } from 'node:worker_threads'
import { fileURLToPath } from 'node:url'
import {
TinypoolChannel,
TinypoolWorker,
TinypoolWorkerMessage,
type TinypoolChannel,
type TinypoolWorker,
type TinypoolWorkerMessage,
} from '../common'

const __tinypool_worker_message__ = true
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/thread-worker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fileURLToPath } from 'node:url'
import { TransferListItem, Worker } from 'node:worker_threads'
import { TinypoolWorker } from '../common'
import { type TransferListItem, Worker } from 'node:worker_threads'
import { type TinypoolWorker } from '../common'

export default class ThreadWorker implements TinypoolWorker {
name = 'ThreadWorker'
Expand Down
2 changes: 1 addition & 1 deletion test/task-queue.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { dirname, resolve } from 'node:path'
import { Tinypool, Task, TaskQueue } from 'tinypool'
import { Tinypool, type Task, type TaskQueue } from 'tinypool'
import { fileURLToPath } from 'node:url'

const __dirname = dirname(fileURLToPath(import.meta.url))
Expand Down

0 comments on commit 063dffc

Please sign in to comment.