X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=.eslintrc.js;h=15fcb940ae0e8025076ceebc05196192d900e010;hb=4edc4c1690134933db8cf9d97c926769a1972c7c;hp=04c5b05b596ab76bf7a9aa897900b190e4791b49;hpb=583a27ce13d67cc33ded52f46fe1665c64a8fec7;p=poolifier.git diff --git a/.eslintrc.js b/.eslintrc.js index 04c5b05b..15fcb940 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,4 +1,7 @@ -module.exports = { +// @ts-check +const { defineConfig } = require('eslint-define-config') + +module.exports = defineConfig({ env: { es2021: true, node: true, @@ -7,9 +10,16 @@ module.exports = { parser: '@typescript-eslint/parser', parserOptions: { ecmaVersion: 2020, - sourceType: 'module' + sourceType: 'module', + warnOnUnsupportedTypeScriptVersion: false }, - plugins: ['@typescript-eslint', 'promise', 'prettierx'], + plugins: [ + '@typescript-eslint', + 'promise', + 'prettierx', + 'jsdoc', + 'spellcheck' + ], extends: [ 'standard', 'eslint:recommended', @@ -18,8 +28,7 @@ module.exports = { 'plugin:import/warnings', 'plugin:import/typescript', 'plugin:promise/recommended', - 'plugin:prettierx/standardx', - 'plugin:prettierx/@typescript-eslint' + 'plugin:prettierx/standardx' ], rules: { 'no-void': 'off', @@ -38,9 +47,70 @@ module.exports = { ignoreMemberSort: true, ignoreDeclarationSort: true } + ], + + 'spellcheck/spell-checker': [ + 'warn', + { + skipWords: [ + 'christopher', + 'comparator', + 'ecma', + 'enum', + 'inheritdoc', + 'jsdoc', + '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', @@ -61,5 +131,10 @@ module.exports = { 'node/no-missing-require': 'off' } } - ] -} + ], + settings: { + jsdoc: { + mode: 'typescript' + } + } +})