X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=.eslintrc.js;h=c3c51fe731d28df4f2f5268a849cd84e24849d18;hb=0e19141a4c860c96cde0eac21023cef79e6b22f5;hp=8f902bd228e5b3a81ede40194c699f73ef121b66;hpb=fa699c4287a0a4940862e452109dddc7be53403b;p=poolifier.git diff --git a/.eslintrc.js b/.eslintrc.js index 8f902bd2..c3c51fe7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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,93 @@ module.exports = { 'warn', { ignoreMemberSort: true, - memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple'] + ignoreDeclarationSort: true + } + ], + + 'spellcheck/spell-checker': [ + 'warn', + { + skipWords: [ + 'poolifier', + 'christopher', + 'ecma', + 'enum', + 'jsdoc', + 'pioardi', + 'readonly', + 'serializable', + 'unregister', + 'workerpool' + ], + skipIfMatch: ['^@.*', '^plugin:.*'] } ] }, overrides: [ + { + files: ['src/**/*.ts'], + extends: 'plugin:jsdoc/recommended', + rules: { + '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' } - ] + } }