X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=.eslintrc.js;h=ae288a7c0ae81acc761208fa7045df0dce0e5eef;hb=12ae3210477b0c54380db24470ff3b0e78926bd8;hp=6c710303838f3cfbcbb05084ea11b739872fbe61;hpb=50aa790189f6423c52ea72198380dbe93c025e40;p=poolifier.git diff --git a/.eslintrc.js b/.eslintrc.js index 6c710303..ae288a7c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,60 +1,149 @@ -module.exports = { +// @ts-check +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', 'prettierx'], + plugins: ['promise', 'spellcheck'], extends: [ - 'standard', 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:import/errors', - 'plugin:import/warnings', - 'plugin:import/typescript', - 'plugin:prettierx/standardx', - 'plugin:prettierx/@typescript-eslint', - 'prettier', - 'prettier/standard', - 'prettier/@typescript-eslint' + 'plugin:import/recommended', + 'plugin:promise/recommended' ], rules: { - 'no-void': 'off', - - // We have some intentionally empty functions - '@typescript-eslint/no-empty-function': 'off', - - '@typescript-eslint/no-inferrable-types': [ - 'error', - { ignoreProperties: true } - ], - 'sort-imports': [ 'warn', { ignoreMemberSort: true, ignoreDeclarationSort: true } + ], + + 'spellcheck/spell-checker': [ + 'warn', + { + skipWords: [ + 'Benoit', + 'benny', + 'browserslist', + 'builtins', + 'christopher', + 'cjs', + 'comparator', + 'cpu', + 'cpus', + 'ctx', + 'deprecations', + 'dequeue', + 'ecma', + 'enqueue', + 'enum', + 'esm', + 'fibonacci', + 'fs', + 'inheritDoc', + 'jsdoc', + 'microjob', + 'mjs', + 'num', + 'os', + 'piscina', + 'pnpm', + 'poolifier', + 'poolify', + 'readonly', + 'resize', + 'serializable', + 'sinon', + 'threadjs', + 'threadwork', + 'tsconfig', + 'tsdoc', + 'typedoc', + 'unlink', + 'unregister', + 'utf8', + 'workerpool' + ], + skipIfMatch: ['^@.*', '^plugin:.*'] + } ] }, overrides: [ { - files: ['*.js'], + files: ['**/*.ts'], + plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'], + parser: '@typescript-eslint/parser', + parserOptions: { + project: './tsconfig.json' + }, + extends: [ + 'plugin:@typescript-eslint/eslint-recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'plugin:import/typescript', + 'standard-with-typescript' + ], + rules: { + '@typescript-eslint/no-inferrable-types': [ + 'error', + { ignoreProperties: true } + ], + 'tsdoc/syntax': 'warn' + } + }, + { + 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', '**/*.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'], + rules: { + 'jsdoc/require-jsdoc': 'off' + } + }, + { + files: ['benchmarks/versus-external-pools/**/*.js'], rules: { - '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/no-var-requires': 'off' + 'n/no-missing-require': 'off' } }, { - files: ['examples/typescript/*.ts'], + files: ['examples/**/*.js'], rules: { - 'import/no-unresolved': 'off' + 'n/no-missing-require': 'off', + 'jsdoc/require-jsdoc': 'off' } } ] -} +})