-module.exports = {
+// @ts-check
+const { defineConfig } = require('eslint-define-config')
+
+module.exports = defineConfig({
+ root: true,
env: {
- es2021: true,
+ es2022: true,
node: true,
mocha: true
},
- parser: '@typescript-eslint/parser',
parserOptions: {
- ecmaVersion: 12,
+ ecmaVersion: 2022,
sourceType: 'module'
},
- plugins: ['@typescript-eslint', 'prettierx'],
+ plugins: ['promise', 'spellcheck'],
extends: [
- 'standard',
'eslint:recommended',
- 'plugin:@typescript-eslint/recommended',
- 'plugin:prettierx/standardx',
- 'plugin:prettierx/@typescript-eslint'
+ 'plugin:import/recommended',
+ 'plugin:promise/recommended'
],
rules: {
- 'no-void': 'off',
-
- // We have some intentionally empty functions
- '@typescript-eslint/no-empty-function': 'off',
+ 'sort-imports': [
+ 'warn',
+ {
+ ignoreMemberSort: true,
+ ignoreDeclarationSort: true
+ }
+ ],
- '@typescript-eslint/no-inferrable-types': [
- 'error',
- { ignoreProperties: true }
+ 'spellcheck/spell-checker': [
+ 'warn',
+ {
+ skipWords: [
+ 'benny',
+ 'browserslist',
+ 'builtins',
+ 'christopher',
+ 'cjs',
+ 'comparator',
+ 'cpu',
+ 'cpus',
+ 'ctx',
+ 'ecma',
+ 'enum',
+ 'fibonacci',
+ 'fs',
+ 'inheritDoc',
+ 'jsdoc',
+ 'microjob',
+ 'num',
+ 'os',
+ 'piscina',
+ 'poolifier',
+ 'poolify',
+ 'readonly',
+ 'serializable',
+ 'sinon',
+ 'threadjs',
+ 'threadwork',
+ 'tsconfig',
+ 'tsdoc',
+ 'typedoc',
+ 'unlink',
+ 'unregister',
+ 'utf8',
+ 'workerpool'
+ ],
+ skipIfMatch: ['^@.*', '^plugin:.*']
+ }
]
},
overrides: [
{
- files: ['*.js'],
+ files: ['**/*.ts'],
+ plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
+ parser: '@typescript-eslint/parser',
+ parserOptions: {
+ project: './tsconfig.json'
+ },
+ extends: [
+ 'plugin:@typescript-eslint/eslint-recommended',
+ 'plugin:@typescript-eslint/recommended',
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking',
+ 'plugin:import/typescript',
+ 'standard-with-typescript'
+ ],
+ rules: {
+ '@typescript-eslint/no-inferrable-types': [
+ 'error',
+ { ignoreProperties: true }
+ ],
+ 'tsdoc/syntax': 'error'
+ }
+ },
+ {
+ files: ['examples/typescript/**/*.ts'],
+ rules: {
+ 'import/no-unresolved': 'off',
+ '@typescript-eslint/no-unsafe-argument': 'off',
+ '@typescript-eslint/no-unsafe-call': 'off',
+ '@typescript-eslint/no-unsafe-assignment': 'off'
+ }
+ },
+ {
+ files: ['**/*.js'],
+ plugins: ['jsdoc'],
+ extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard']
+ },
+ {
+ files: ['tests/**/*.js'],
+ rules: {
+ 'jsdoc/require-jsdoc': 'off'
+ }
+ },
+ {
+ files: ['tests/pools/selection-strategies/**/*.js'],
+ rules: {
+ 'n/no-missing-require': 'off'
+ }
+ },
+ {
+ files: ['benchmarks/**/*.js'],
+ rules: {
+ 'jsdoc/require-jsdoc': 'off'
+ }
+ },
+ {
+ files: ['benchmarks/versus-external-pools/**/*.js'],
+ rules: {
+ 'n/no-missing-require': 'off'
+ }
+ },
+ {
+ files: ['examples/**/*.js'],
rules: {
- '@typescript-eslint/no-var-requires': 'off'
+ 'n/no-missing-require': 'off',
+ 'jsdoc/require-jsdoc': 'off'
}
}
]
-}
+})