X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=.eslintrc.js;h=bd96a47107386e767d85e5ea058b7f6e010dc7c1;hb=69f2cb6e003d2128e68be673a21f3488e5d57645;hp=738e7df94c87ec612a42acc67b43dff4fbd6a048;hpb=50eceb07c3713782d1d6bbe49d3fe47318e45c93;p=poolifier.git diff --git a/.eslintrc.js b/.eslintrc.js index 738e7df9..bd96a471 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', 'jsdoc'], + plugins: [ + '@typescript-eslint', + 'promise', + 'prettierx', + 'jsdoc', + 'spellcheck' + ], extends: [ 'standard', 'eslint:recommended', @@ -38,6 +48,27 @@ module.exports = { ignoreMemberSort: true, ignoreDeclarationSort: true } + ], + + 'spellcheck/spell-checker': [ + 'warn', + { + skipWords: [ + 'christopher', + 'comparator', + 'ecma', + 'enum', + 'inheritdoc', + 'jsdoc', + 'pioardi', + 'poolifier', + 'readonly', + 'serializable', + 'unregister', + 'workerpool' + ], + skipIfMatch: ['^@.*', '^plugin:.*'] + } ] }, overrides: [ @@ -45,7 +76,39 @@ module.exports = { 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' } @@ -70,5 +133,10 @@ module.exports = { 'node/no-missing-require': 'off' } } - ] -} + ], + settings: { + jsdoc: { + mode: 'typescript' + } + } +})