chore: v2.4.7
[poolifier.git] / .eslintrc.js
index a6a077faf902fd0741234919af922213af7e9021..ae288a7c0ae81acc761208fa7045df0dce0e5eef 100644 (file)
@@ -2,45 +2,23 @@
 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: 2020,
-    sourceType: 'module',
-    warnOnUnsupportedTypeScriptVersion: false
+    ecmaVersion: 2022,
+    sourceType: 'module'
   },
-  plugins: [
-    '@typescript-eslint',
-    'promise',
-    'prettierx',
-    'jsdoc',
-    'spellcheck'
-  ],
+  plugins: ['promise', 'spellcheck'],
   extends: [
-    'standard',
     'eslint:recommended',
-    'plugin:@typescript-eslint/recommended',
-    'plugin:import/errors',
-    'plugin:import/warnings',
-    'plugin:import/typescript',
-    'plugin:promise/recommended',
-    'plugin:prettierx/standardx'
+    'plugin:import/recommended',
+    'plugin:promise/recommended'
   ],
   rules: {
-    'no-void': 'off',
-
-    // We have some intentionally empty functions
-    '@typescript-eslint/no-empty-function': 'off',
-
-    '@typescript-eslint/no-inferrable-types': [
-      'error',
-      { ignoreProperties: true }
-    ],
-
     'sort-imports': [
       'warn',
       {
@@ -53,16 +31,46 @@ module.exports = defineConfig({
       'warn',
       {
         skipWords: [
+          'Benoit',
+          'benny',
+          'browserslist',
+          'builtins',
           'christopher',
+          'cjs',
           'comparator',
+          'cpu',
+          'cpus',
+          'ctx',
+          'deprecations',
+          'dequeue',
           'ecma',
+          'enqueue',
           'enum',
-          'inheritdoc',
+          'esm',
+          'fibonacci',
+          'fs',
+          'inheritDoc',
           'jsdoc',
+          'microjob',
+          'mjs',
+          'num',
+          'os',
+          'piscina',
+          'pnpm',
           'poolifier',
+          'poolify',
           'readonly',
+          'resize',
           'serializable',
+          'sinon',
+          'threadjs',
+          'threadwork',
+          'tsconfig',
+          'tsdoc',
+          'typedoc',
+          'unlink',
           'unregister',
+          'utf8',
           'workerpool'
         ],
         skipIfMatch: ['^@.*', '^plugin:.*']
@@ -71,70 +79,71 @@ module.exports = defineConfig({
   },
   overrides: [
     {
-      files: ['src/**/*.ts'],
-      extends: 'plugin:jsdoc/recommended',
+      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: {
-        'no-useless-constructor': 'off',
-
-        'jsdoc/match-description': [
-          'warn',
-          {
-            mainDescription:
-              '/^[A-Z`].+?(\\.|:)(\\n\\n.*((\\n{1,2}- .+)|(_.+_)|`.+`|\\n\\n---))?$/us',
-            matchDescription: '^[A-Z`].+(\\.|`.+`)$',
-            contexts: ['any'],
-            tags: {
-              param: true,
-              returns: true
-            }
-          }
-        ],
-        'jsdoc/no-types': 'error',
-        'jsdoc/require-jsdoc': [
-          'warn',
-          {
-            contexts: [
-              'ClassDeclaration',
-              'ClassProperty:not([accessibility=/(private|protected)/])',
-              'ExportNamedDeclaration:has(VariableDeclaration)',
-              'FunctionExpression',
-              'MethodDefinition:not([accessibility=/(private|protected)/]) > FunctionExpression',
-              'TSEnumDeclaration',
-              'TSInterfaceDeclaration',
-              'TSMethodSignature',
-              // 'TSPropertySignature',
-              'TSTypeAliasDeclaration'
-            ]
-          }
+        '@typescript-eslint/no-inferrable-types': [
+          'error',
+          { ignoreProperties: true }
         ],
-        'jsdoc/require-param-type': 'off',
-        'jsdoc/require-returns-type': 'off'
+        'tsdoc/syntax': 'warn'
       }
     },
     {
-      files: ['**/*.js'],
-      extends: 'plugin:node/recommended',
+      files: ['examples/typescript/**/*.ts'],
       rules: {
-        '@typescript-eslint/no-unused-vars': 'off',
-        '@typescript-eslint/no-var-requires': 'off'
+        'import/no-unresolved': 'off',
+        '@typescript-eslint/no-unsafe-argument': 'off',
+        '@typescript-eslint/no-unsafe-call': 'off',
+        '@typescript-eslint/no-unsafe-assignment': 'off'
       }
     },
     {
-      files: ['examples/typescript/**/*.ts'],
+      files: ['**/*.js', '**/*.mjs'],
+      plugins: ['jsdoc'],
+      extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard']
+    },
+    {
+      files: ['tests/**/*.js'],
       rules: {
-        'import/no-unresolved': 'off'
+        '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: {
-        'node/no-missing-require': 'off'
+        'n/no-missing-require': 'off',
+        'jsdoc/require-jsdoc': 'off'
       }
     }
-  ],
-  settings: {
-    jsdoc: {
-      mode: 'typescript'
-    }
-  }
+  ]
 })