X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=.eslintrc.js;h=40f952b098ffe8c6fa993f7272c2b60060fc88fd;hb=0628df39eb1eb95630d08d9759a83c750a34ff7e;hp=738e7df94c87ec612a42acc67b43dff4fbd6a048;hpb=50eceb07c3713782d1d6bbe49d3fe47318e45c93;p=poolifier.git diff --git a/.eslintrc.js b/.eslintrc.js index 738e7df9..40f952b0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,74 +1,190 @@ -module.exports = { +const { defineConfig } = require('eslint-define-config') + +module.exports = defineConfig({ + root: true, env: { - es2021: true, + es2022: true, node: true, mocha: true }, - parser: '@typescript-eslint/parser', parserOptions: { - ecmaVersion: 2020, + ecmaVersion: 2022, sourceType: 'module' }, - plugins: ['@typescript-eslint', 'promise', 'prettierx', 'jsdoc'], + plugins: ['promise', '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' + 'plugin:import/recommended', + 'plugin:promise/recommended' ], + settings: { + 'import/resolver': { + typescript: { + project: './tsconfig.json' + } + } + }, rules: { - 'no-void': 'off', - - // We have some intentionally empty functions - '@typescript-eslint/no-empty-function': 'off', - - '@typescript-eslint/no-inferrable-types': [ + 'sort-imports': [ 'error', - { ignoreProperties: true } + { + ignoreDeclarationSort: true + } ], + 'import/order': 'error', - 'sort-imports': [ + 'spellcheck/spell-checker': [ 'warn', { - ignoreMemberSort: true, - ignoreDeclarationSort: true + skipWords: [ + 'axios', + 'benoit', + 'benny', + 'browserslist', + 'builtins', + 'christopher', + 'cjs', + 'cloneable', + 'comparator', + 'cpu', + 'cpus', + 'cryptographically', + 'ctx', + 'deprecations', + 'deque', + 'dequeue', + 'dequeued', + 'ecma', + 'elu', + 'enqueue', + 'enum', + 'errored', + 'esm', + 'fastify', + 'fibonacci', + 'fp', + 'fs', + 'inheritDoc', + 'javascript', + 'jsdoc', + 'localhost', + 'microjob', + 'mjs', + 'nodemailer', + 'npx', + 'num', + 'os', + 'perf', + 'piscina', + 'pnpm', + 'poolifier', + 'prepend', + 'prepends', + 'readdir', + 'readonly', + 'req', + 'resize', + 'sinon', + 'smtp', + 'threadjs', + 'threadwork', + 'tinypool', + 'tsconfig', + 'tsdoc', + 'typedoc', + 'unlink', + 'unref', + 'unregister', + 'utf8', + 'webcrypto', + 'workerpool', + 'ws', + 'wss', + 'wwr' + ], + skipIfMatch: ['^@.*', '^plugin:.*'] } ] }, overrides: [ { - files: ['src/**/*.ts'], - extends: 'plugin:jsdoc/recommended', + files: ['**/*.ts'], + plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'], + parser: '@typescript-eslint/parser', + parserOptions: { + project: './tsconfig.json' + }, + extends: [ + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'plugin:import/typescript', + 'standard-with-typescript' + ], rules: { - 'jsdoc/no-types': 'error', - 'jsdoc/require-param-type': 'off', - 'jsdoc/require-returns-type': 'off' + '@typescript-eslint/no-inferrable-types': [ + 'error', + { ignoreProperties: true } + ], + 'tsdoc/syntax': 'warn' } }, { - files: ['*.js'], - extends: 'plugin:node/recommended', + files: ['examples/typescript/**/*.ts'], rules: { - '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/no-var-requires': 'off' + 'import/no-unresolved': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + '@typescript-eslint/no-unsafe-call': '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: ['examples/typescript/**/*.ts'], + files: ['**/*.js', '**/*.mjs'], + plugins: ['jsdoc'], + extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard'] + }, + { + files: ['tests/**/*.js'], + rules: { + 'jsdoc/require-jsdoc': 'off' + } + }, + { + files: ['tests/pools/selection-strategies/**/*.js'], + rules: { + 'n/no-missing-require': 'off' + } + }, + { + files: ['benchmarks/**/*.js', 'benchmarks/**/*.mjs'], + rules: { + 'jsdoc/require-jsdoc': 'off' + } + }, + { + files: ['benchmarks/versus-external-pools/**/*.js'], + rules: { + 'n/no-missing-require': 'off' + } + }, + { + files: ['benchmarks/versus-external-pools/**/*.mjs'], rules: { + 'n/no-missing-import': 'off', 'import/no-unresolved': 'off' } }, { - files: ['examples/**/*.js'], + files: ['examples/javascript/**/*.js'], rules: { - 'node/no-missing-require': 'off' + 'n/no-missing-require': 'off', + 'jsdoc/require-jsdoc': 'off' } } ] -} +})