X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=.eslintrc.js;h=850110e874a0b8d0bc67d997ece11e7b12f0342e;hb=a7dc540979d13bee0dd320858214b776fa556e4d;hp=a5c382c892f5547eddca28912a311ed4a445f690;hpb=3c5eaeb97b60678a0bdd4d8a26c622ea5f2616b6;p=poolifier.git diff --git a/.eslintrc.js b/.eslintrc.js index a5c382c8..850110e8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,14 +6,25 @@ module.exports = { }, parser: '@typescript-eslint/parser', parserOptions: { - ecmaVersion: 12, - sourceType: 'module' + ecmaVersion: 2020, + sourceType: 'module', + warnOnUnsupportedTypeScriptVersion: false }, - plugins: ['@typescript-eslint', 'prettierx'], + plugins: [ + '@typescript-eslint', + 'promise', + 'prettierx', + 'jsdoc', + 'spellcheck' + ], extends: [ 'standard', 'eslint:recommended', 'plugin:@typescript-eslint/recommended', + 'plugin:import/errors', + 'plugin:import/warnings', + 'plugin:import/typescript', + 'plugin:promise/recommended', 'plugin:prettierx/standardx', 'plugin:prettierx/@typescript-eslint' ], @@ -26,14 +37,103 @@ module.exports = { '@typescript-eslint/no-inferrable-types': [ 'error', { ignoreProperties: true } + ], + + 'sort-imports': [ + 'warn', + { + ignoreMemberSort: true, + ignoreDeclarationSort: true + } + ], + + 'spellcheck/spell-checker': [ + 'warn', + { + skipWords: [ + 'christopher', + 'comparator', + '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'], + rules: { + 'import/no-unresolved': 'off' + } + }, + { + files: ['examples/**/*.js'], + rules: { + 'node/no-missing-require': 'off' + } + } + ], + settings: { + jsdoc: { + mode: 'typescript' } - ] + } }