X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=.eslintrc.js;h=72a5f46faeb93e62aaee7a0c1e014c5027f3a655;hb=7a923e5bc16ae3524c51bedd70c65ce6cc556fdc;hp=fd8a538debf25f98ba377117efa8caf9fd582e72;hpb=ca6c7d70082311f3cc503090cf507ce36582b9b6;p=poolifier.git diff --git a/.eslintrc.js b/.eslintrc.js index fd8a538d..72a5f46f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,71 +1,90 @@ -// @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', 'jsdoc', 'spellcheck'], + plugins: ['promise', 'spellcheck'], extends: [ 'eslint:recommended', 'plugin:import/recommended', - 'plugin:jsdoc/recommended', 'plugin:promise/recommended' ], + settings: { + 'import/resolver': { + typescript: { + project: './tsconfig.eslint.json' + } + } + }, rules: { - 'no-void': 'off', - 'sort-imports': [ - 'warn', + 'error', { - ignoreMemberSort: true, ignoreDeclarationSort: true } ], + 'import/order': 'error', 'spellcheck/spell-checker': [ 'warn', { skipWords: [ + 'benoit', 'benny', 'browserslist', 'builtins', 'christopher', 'cjs', + 'cloneable', 'comparator', 'cpu', 'cpus', 'ctx', + 'deprecations', + 'dequeue', + 'dequeued', 'ecma', + 'elu', + 'enqueue', 'enum', + 'errored', + 'esm', 'fibonacci', 'fs', 'inheritDoc', 'jsdoc', 'microjob', + 'mjs', 'num', 'os', + 'perf', 'piscina', + 'pnpm', 'poolifier', 'poolify', 'readonly', - 'serializable', + 'resize', 'sinon', 'threadjs', 'threadwork', + 'tinypool', 'tsconfig', + 'tsdoc', 'typedoc', 'unlink', + 'unref', 'unregister', 'utf8', - 'workerpool' + 'workerpool', + 'wwr' ], skipIfMatch: ['^@.*', '^plugin:.*'] } @@ -74,74 +93,41 @@ module.exports = defineConfig({ overrides: [ { files: ['**/*.ts'], + plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'], parser: '@typescript-eslint/parser', parserOptions: { - project: './tsconfig.json' + project: './tsconfig.eslint.json' }, - plugins: ['@typescript-eslint'], extends: [ - 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended-requiring-type-checking', - 'standard-with-typescript', - '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', '@typescript-eslint/no-unsafe-argument': 'off', '@typescript-eslint/no-unsafe-call': 'off', - '@typescript-eslint/no-unsafe-assignment': 'off' + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unnecessary-type-assertion': 'off', + '@typescript-eslint/restrict-template-expressions': 'off' } }, { - files: ['**/*.js'], - extends: ['plugin:n/recommended', 'standard'] + files: ['**/*.js', '**/*.mjs'], + plugins: ['jsdoc'], + extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard'] }, { files: ['tests/**/*.js'], @@ -156,7 +142,7 @@ module.exports = defineConfig({ } }, { - files: ['benchmarks/**/*.js'], + files: ['benchmarks/**/*.js', 'benchmarks/**/*.mjs'], rules: { 'jsdoc/require-jsdoc': 'off' } @@ -168,16 +154,18 @@ module.exports = defineConfig({ } }, { - files: ['examples/**/*.js'], + files: ['benchmarks/versus-external-pools/**/*.mjs'], + rules: { + 'n/no-missing-import': 'off', + 'import/no-unresolved': 'off' + } + }, + { + files: ['examples/javascript/**/*.js'], rules: { 'n/no-missing-require': 'off', 'jsdoc/require-jsdoc': 'off' } } - ], - settings: { - jsdoc: { - mode: 'typescript' - } - } + ] })