build(ci): enable dependencies caching with pnpm
[poolifier.git] / .eslintrc.js
index b37ad59fb91769bb590ec5829dade6800872973b..80dcda2b7212d88878c7f2f65b426896e9a02a99 100644 (file)
@@ -2,23 +2,23 @@
 const { defineConfig } = require('eslint-define-config')
 
 module.exports = defineConfig({
+  root: true,
   env: {
-    es2021: true,
+    es2022: true,
     node: true,
     mocha: true
   },
-  plugins: ['promise', 'prettierx', 'jsdoc', 'spellcheck'],
+  parserOptions: {
+    ecmaVersion: 2022,
+    sourceType: 'module'
+  },
+  plugins: ['promise', 'spellcheck'],
   extends: [
-    'standard',
     'eslint:recommended',
     'plugin:import/recommended',
-    'plugin:jsdoc/recommended',
-    'plugin:promise/recommended',
-    'plugin:prettierx/standardx'
+    'plugin:promise/recommended'
   ],
   rules: {
-    'no-void': 'off',
-
     'sort-imports': [
       'warn',
       {
@@ -31,17 +31,49 @@ module.exports = defineConfig({
       'warn',
       {
         skipWords: [
+          'Benoit',
+          'benny',
+          'browserslist',
+          'builtins',
           'christopher',
+          'cjs',
           'comparator',
+          'cpu',
+          'cpus',
+          'ctx',
+          'deprecations',
+          'dequeue',
           'ecma',
+          'enqueue',
           'enum',
-          'inheritdoc',
+          'errored',
+          'esm',
+          'fibonacci',
+          'fs',
+          'inheritDoc',
           'jsdoc',
+          'microjob',
+          'mjs',
+          'num',
+          'os',
+          'piscina',
+          'pnpm',
           'poolifier',
+          'poolify',
           'readonly',
+          'resize',
           'serializable',
+          'sinon',
+          'threadjs',
+          'threadwork',
+          'tsconfig',
+          'tsdoc',
+          'typedoc',
+          'unlink',
           'unregister',
-          'workerpool'
+          'utf8',
+          'workerpool',
+          'wwr'
         ],
         skipIfMatch: ['^@.*', '^plugin:.*']
       }
@@ -50,68 +82,39 @@ module.exports = defineConfig({
   overrides: [
     {
       files: ['**/*.ts'],
+      plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
       parser: '@typescript-eslint/parser',
       parserOptions: {
-        ecmaVersion: 2020,
-        sourceType: 'module',
-        project: './tsconfig.json'
+        project: './tsconfig.eslint.json'
       },
-      plugins: ['@typescript-eslint'],
       extends: [
         'plugin:@typescript-eslint/eslint-recommended',
         'plugin:@typescript-eslint/recommended',
         'plugin:@typescript-eslint/recommended-requiring-type-checking',
-        'plugin:import/typescript'
+        'plugin:import/typescript',
+        'standard-with-typescript'
       ],
       rules: {
-        // We have some intentionally empty functions
-        '@typescript-eslint/no-empty-function': 'off',
-
         '@typescript-eslint/no-inferrable-types': [
           'error',
           { ignoreProperties: true }
         ],
-
-        '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'
-            ]
-          }
-        ],
-        'jsdoc/require-param-type': 'off',
-        'jsdoc/require-returns-type': 'off'
+        'tsdoc/syntax': 'warn'
+      }
+    },
+    {
+      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'],
-      extends: 'plugin:node/recommended'
+      files: ['**/*.js', '**/*.mjs'],
+      plugins: ['jsdoc'],
+      extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard']
     },
     {
       files: ['tests/**/*.js'],
@@ -119,6 +122,12 @@ module.exports = defineConfig({
         'jsdoc/require-jsdoc': 'off'
       }
     },
+    {
+      files: ['tests/pools/selection-strategies/**/*.js'],
+      rules: {
+        'n/no-missing-require': 'off'
+      }
+    },
     {
       files: ['benchmarks/**/*.js'],
       rules: {
@@ -126,23 +135,17 @@ module.exports = defineConfig({
       }
     },
     {
-      files: ['examples/**/*.js'],
+      files: ['benchmarks/versus-external-pools/**/*.js'],
       rules: {
-        'node/no-missing-require': 'off',
-        'jsdoc/require-jsdoc': 'off'
+        'n/no-missing-require': 'off'
       }
     },
     {
-      files: ['examples/typescript/**/*.ts'],
+      files: ['examples/**/*.js'],
       rules: {
-        'import/no-unresolved': 'off',
+        'n/no-missing-require': 'off',
         'jsdoc/require-jsdoc': 'off'
       }
     }
-  ],
-  settings: {
-    jsdoc: {
-      mode: 'typescript'
-    }
-  }
+  ]
 })