Extract selection strategies to classes (#176)
[poolifier.git] / .eslintrc.js
index 8f902bd228e5b3a81ede40194c699f73ef121b66..a5a0075e24e5f8acb9686ccf579174e97419b6ff 100644 (file)
@@ -9,7 +9,13 @@ module.exports = {
     ecmaVersion: 2020,
     sourceType: 'module'
   },
-  plugins: ['@typescript-eslint', 'prettierx'],
+  plugins: [
+    '@typescript-eslint',
+    'promise',
+    'prettierx',
+    'jsdoc',
+    'spellcheck'
+  ],
   extends: [
     'standard',
     'eslint:recommended',
@@ -17,11 +23,9 @@ module.exports = {
     'plugin:import/errors',
     'plugin:import/warnings',
     'plugin:import/typescript',
+    'plugin:promise/recommended',
     'plugin:prettierx/standardx',
-    'plugin:prettierx/@typescript-eslint',
-    'prettier',
-    'prettier/standard',
-    'prettier/@typescript-eslint'
+    'plugin:prettierx/@typescript-eslint'
   ],
   rules: {
     'no-void': 'off',
@@ -38,23 +42,96 @@ module.exports = {
       'warn',
       {
         ignoreMemberSort: true,
-        memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple']
+        ignoreDeclarationSort: true
+      }
+    ],
+
+    'spellcheck/spell-checker': [
+      'warn',
+      {
+        skipWords: [
+          'christopher',
+          'ecma',
+          'enum',
+          'inheritdoc',
+          'jsdoc',
+          'pioardi',
+          'poolifier',
+          'readonly',
+          'serializable',
+          'unregister',
+          'workerpool'
+        ],
+        skipIfMatch: ['^@.*', '^plugin:.*']
       }
     ]
   },
   overrides: [
+    {
+      files: ['src/**/*.ts'],
+      extends: 'plugin:jsdoc/recommended',
+      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'
+            ]
+          }
+        ],
+        'jsdoc/require-param-type': 'off',
+        'jsdoc/require-returns-type': 'off'
+      }
+    },
     {
       files: ['*.js'],
+      extends: 'plugin:node/recommended',
       rules: {
         '@typescript-eslint/no-unused-vars': 'off',
         '@typescript-eslint/no-var-requires': 'off'
       }
     },
     {
-      files: ['examples/typescript/*.ts'],
+      files: ['examples/typescript/**/*.ts'],
       rules: {
         'import/no-unresolved': 'off'
       }
+    },
+    {
+      files: ['examples/**/*.js'],
+      rules: {
+        'node/no-missing-require': 'off'
+      }
+    }
+  ],
+  settings: {
+    jsdoc: {
+      mode: 'typescript'
     }
-  ]
+  }
 }