X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=.eslintrc.js;h=7448b400d0814fad77f4338920cccba9799afce0;hb=fb78f5c0d5c578e2dfa40193059a9b671f0cd126;hp=8e43f37eb12b5751a4c1231dfe762d09818b2070;hpb=90a9a10f90101fa6ad60683f4ce75bb422c8652d;p=poolifier.git diff --git a/.eslintrc.js b/.eslintrc.js index 8e43f37e..7448b400 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,31 +2,21 @@ const { defineConfig } = require('eslint-define-config') module.exports = defineConfig({ + root: true, env: { es2021: true, node: true, mocha: true }, - parser: '@typescript-eslint/parser', parserOptions: { - ecmaVersion: 2020, - sourceType: 'module', - warnOnUnsupportedTypeScriptVersion: false + ecmaVersion: 2021, + sourceType: 'module' }, - plugins: [ - '@typescript-eslint', - 'promise', - 'prettierx', - 'jsdoc', - 'spellcheck' - ], + plugins: ['promise', 'spellcheck'], extends: [ - 'standard', 'eslint:recommended', - 'plugin:import/errors', - 'plugin:import/warnings', - 'plugin:promise/recommended', - 'plugin:prettierx/standardx' + 'plugin:import/recommended', + 'plugin:promise/recommended' ], rules: { 'no-void': 'off', @@ -43,16 +33,38 @@ module.exports = defineConfig({ 'warn', { skipWords: [ + 'benny', + 'browserslist', + 'builtins', 'christopher', + 'cjs', 'comparator', + 'cpu', + 'cpus', + 'ctx', 'ecma', 'enum', - 'inheritdoc', + 'fibonacci', + 'fs', + 'inheritDoc', 'jsdoc', + 'microjob', + 'num', + 'os', + 'piscina', 'poolifier', + 'poolify', 'readonly', 'serializable', + 'sinon', + 'threadjs', + 'threadwork', + 'tsconfig', + 'tsdoc', + 'typedoc', + 'unlink', 'unregister', + 'utf8', 'workerpool' ], skipIfMatch: ['^@.*', '^plugin:.*'] @@ -62,9 +74,16 @@ module.exports = defineConfig({ overrides: [ { files: ['**/*.ts'], + plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'], + parser: '@typescript-eslint/parser', + parserOptions: { + project: './tsconfig.json' + }, extends: [ - 'plugin:jsdoc/recommended', + 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'standard-with-typescript', 'plugin:import/typescript' ], rules: { @@ -78,62 +97,53 @@ module.exports = defineConfig({ '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' + 'tsdoc/syntax': 'error' + } + }, + { + files: ['examples/typescript/**/*.ts'], + rules: { + 'import/no-unresolved': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-assignment': 'off' } }, { files: ['**/*.js'], - extends: 'plugin:node/recommended' + plugins: ['jsdoc'], + extends: ['plugin:n/recommended', 'standard', 'plugin:jsdoc/recommended'] }, { - files: ['examples/typescript/**/*.ts'], + files: ['tests/**/*.js'], rules: { - 'import/no-unresolved': 'off', 'jsdoc/require-jsdoc': 'off' } }, + { + files: ['tests/pools/selection-strategies/**/*.js'], + rules: { + 'n/no-missing-require': 'off' + } + }, + { + files: ['benchmarks/**/*.js'], + rules: { + 'jsdoc/require-jsdoc': 'off' + } + }, + { + files: ['benchmarks/versus-external-pools/**/*.js'], + rules: { + 'n/no-missing-require': 'off' + } + }, { files: ['examples/**/*.js'], rules: { - 'node/no-missing-require': 'off' + 'n/no-missing-require': 'off', + 'jsdoc/require-jsdoc': 'off' } } - ], - settings: { - jsdoc: { - mode: 'typescript' - } - } + ] })