},
parser: '@typescript-eslint/parser',
parserOptions: {
- ecmaVersion: 12,
+ ecmaVersion: 2020,
sourceType: 'module'
},
plugins: ['@typescript-eslint', 'prettierx'],
'standard',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
+ 'plugin:import/errors',
+ 'plugin:import/warnings',
+ 'plugin:import/typescript',
'plugin:prettierx/standardx',
- 'plugin:prettierx/@typescript-eslint'
+ 'plugin:prettierx/@typescript-eslint',
+ 'prettier',
+ 'prettier/standard',
+ 'prettier/@typescript-eslint'
],
rules: {
'no-void': 'off',
'@typescript-eslint/no-inferrable-types': [
'error',
{ ignoreProperties: true }
+ ],
+
+ 'sort-imports': [
+ 'warn',
+ {
+ ignoreMemberSort: true,
+ memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple']
+ }
]
},
overrides: [
{
files: ['*.js'],
rules: {
+ '@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-var-requires': 'off'
}
+ },
+ {
+ files: ['examples/typescript/*.ts'],
+ rules: {
+ 'import/no-unresolved': 'off'
+ }
}
]
}
+import { join } from 'path'
import { DynamicThreadPool, FixedThreadPool } from 'poolifier'
import { MyData, MyResponse } from './worker'
-import { join } from 'path'
-
export const fixedPool = new FixedThreadPool<MyData, Promise<MyResponse>>(
8,
join(__dirname, 'worker.js'),
"integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
"dev": true
},
+ "prettier": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz",
+ "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==",
+ "dev": true
+ },
"prettier-linter-helpers": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
"test": "npm run build && nyc mocha --exit --timeout 20000 tests/*test.js ",
"test:debug": "mocha --inspect-brk --exit tests/*test.js ",
"coverage": "nyc report --reporter=text-lcov | coveralls",
- "format": "prettierx --write .",
+ "format": "prettier --loglevel silent --write .; prettierx --write .",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"@typescript-eslint/parser": "^4.15.0",
"benchmark": "^2.1.4",
"coveralls": "^3.1.0",
+ "eslint": "^7.19.0",
"eslint-config-prettier": "^7.2.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettierx": "^0.17.0",
"eslint-plugin-promise": "^4.2.1",
- "eslint": "^7.19.0",
"expect": "^26.6.2",
- "mocha-lcov-reporter": "^1.3.0",
"mocha": "^8.2.1",
+ "mocha-lcov-reporter": "^1.3.0",
"nyc": "^15.1.0",
+ "prettier": "^2.2.1",
"prettier-plugin-organize-imports": "^1.1.1",
"prettierx": "^0.17.0",
"rimraf": "^3.0.2",
"typescript": "^4.1.3"
},
"engines": {
- "node": ">=12.0.0"
+ "node": ">=12.11.0"
}
}
+import { EventEmitter } from 'events'
import {
FixedThreadPool,
FixedThreadPoolOptions,
WorkerWithMessageChannel
} from './fixed'
-import { EventEmitter } from 'events'
-
class MyEmitter extends EventEmitter {}
export type DynamicThreadPoolOptions = FixedThreadPoolOptions
-import { MessageChannel, SHARE_ENV, Worker, isMainThread } from 'worker_threads'
+import { isMainThread, MessageChannel, SHARE_ENV, Worker } from 'worker_threads'
export type Draft<T> = { -readonly [P in keyof T]?: T[P] }
import { FixedThreadPool } from './fixed'
import { ThreadWorker } from './workers'
+export { DynamicThreadPoolOptions } from './dynamic'
export {
Draft,
FixedThreadPoolOptions,
WorkerWithMessageChannel
} from './fixed'
-export { DynamicThreadPoolOptions } from './dynamic'
export { ThreadWorkerOptions } from './workers'
export { FixedThreadPool, DynamicThreadPool, ThreadWorker }
-import { isMainThread, parentPort } from 'worker_threads'
-
import { AsyncResource } from 'async_hooks'
+import { isMainThread, parentPort } from 'worker_threads'
export interface ThreadWorkerOptions {
/**