X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=.eslintrc.js;h=9d0d7ce4cea3efda4777c7004a459cd307f8df57;hb=5aa31a743fde300612ae89a242b809ae7db083ed;hp=59f0a1133f6abd76bba4543c75dfa10e861409d9;hpb=e4bc7a498d48e2773b2e68fd4ffcaf4d328d5a0b;p=poolifier.git diff --git a/.eslintrc.js b/.eslintrc.js index 59f0a113..9d0d7ce4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,71 +1,107 @@ -// @ts-check const { defineConfig } = require('eslint-define-config') module.exports = defineConfig({ + root: true, env: { - es2021: true, + es2022: true, node: true, mocha: true }, parserOptions: { - ecmaVersion: 2021, + ecmaVersion: 2022, sourceType: 'module' }, - plugins: ['promise', 'prettierx', 'jsdoc', 'spellcheck'], + plugins: ['promise', 'spellcheck'], extends: [ - 'standard', 'eslint:recommended', 'plugin:import/recommended', - 'plugin:jsdoc/recommended', - 'plugin:promise/recommended', - 'plugin:prettierx/standardx' + 'plugin:promise/recommended' ], + settings: { + 'import/resolver': { + typescript: { + project: './tsconfig.json' + } + } + }, rules: { - 'no-void': 'off', - 'sort-imports': [ - 'warn', + 'error', { - ignoreMemberSort: true, ignoreDeclarationSort: true } ], + 'import/order': 'error', 'spellcheck/spell-checker': [ 'warn', { skipWords: [ + 'axios', + 'benoit', 'browserslist', 'builtins', 'christopher', 'cjs', + 'cloneable', 'comparator', 'cpu', 'cpus', + 'cryptographically', 'ctx', + 'deprecations', + 'deque', + 'dequeue', + 'dequeued', + 'deregisters', + 'dts', 'ecma', + 'elu', + 'enqueue', 'enum', + 'errored', + 'esm', + 'fastify', 'fibonacci', + 'fp', 'fs', + 'func', 'inheritDoc', + 'javascript', 'jsdoc', + 'localhost', 'microjob', + 'mjs', + 'nodemailer', + 'npx', 'num', 'os', + 'perf', 'piscina', + 'pnpm', 'poolifier', - 'poolify', + 'prepend', + 'prepends', + 'readdir', 'readonly', - 'serializable', + 'req', + 'resize', 'sinon', + 'smtp', 'threadjs', 'threadwork', + 'tinypool', 'tsconfig', + 'tsdoc', 'typedoc', 'unlink', - 'unregister', + 'unref', 'utf8', - 'workerpool' + 'webcrypto', + 'workerpool', + 'ws', + 'wss', + 'wwr' ], skipIfMatch: ['^@.*', '^plugin:.*'] } @@ -74,109 +110,76 @@ module.exports = defineConfig({ overrides: [ { files: ['**/*.ts'], + plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'], parser: '@typescript-eslint/parser', parserOptions: { project: './tsconfig.json' }, - plugins: ['@typescript-eslint'], extends: [ - 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended-requiring-type-checking', - 'plugin:import/typescript' + 'plugin:import/typescript', + 'standard-with-typescript' ], rules: { - // We have some intentionally empty functions - '@typescript-eslint/no-empty-function': 'off', - '@typescript-eslint/no-inferrable-types': [ 'error', { ignoreProperties: true } ], - - 'no-useless-constructor': 'off', - - 'jsdoc/match-description': [ - 'warn', - { - 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': 'warn' } }, { files: ['examples/typescript/**/*.ts'], rules: { - 'import/no-unresolved': 'off', - 'jsdoc/require-jsdoc': 'off', + 'import/no-unresolved': [ + 'error', + { + ignore: [ + '^axios$', + '^express$', + '^fastify$', + '^fastify-plugin$', + '^node-fetch$', + '^nodemailer$', + '^poolifier$', + '^ws$' + ] + } + ], '@typescript-eslint/no-unsafe-argument': 'off', '@typescript-eslint/no-unsafe-call': 'off', - '@typescript-eslint/no-unsafe-assignment': 'off' + '@typescript-eslint/no-unsafe-return': 'off', + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unnecessary-type-assertion': 'off', + '@typescript-eslint/no-redundant-type-constituents': 'off', + '@typescript-eslint/strict-boolean-expressions': 'off', + '@typescript-eslint/return-await': 'off' } }, { - files: ['**/*.js'], - extends: ['plugin:n/recommended'] + files: ['**/*.js', '**/*.mjs'], + plugins: ['jsdoc'], + extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard'] }, { - files: ['tests/**/*.js'], + files: ['tests/**/*.js', 'tests/**/*.mjs'], rules: { 'jsdoc/require-jsdoc': 'off' } }, { - files: ['tests/pools/selection-strategies/**/*.js'], - rules: { - 'n/no-missing-require': 'off' - } - }, - { - files: ['benchmarks/**/*.js'], + files: ['benchmarks/**/*.js', 'benchmarks/**/*.mjs'], rules: { 'jsdoc/require-jsdoc': 'off' } }, { - files: ['benchmarks/versus-external-pools/**/*.js'], - rules: { - 'n/no-missing-require': 'off' - } - }, - { - files: ['examples/**/*.js'], + files: ['examples/javascript/**/*.js'], rules: { - 'n/no-missing-require': 'off', 'jsdoc/require-jsdoc': 'off' } } - ], - settings: { - jsdoc: { - mode: 'typescript' - } - } + ] })