ae288a7c0ae81acc761208fa7045df0dce0e5eef
[poolifier.git] / .eslintrc.js
1 // @ts-check
2 const { defineConfig } = require('eslint-define-config')
3
4 module.exports = defineConfig({
5 root: true,
6 env: {
7 es2022: true,
8 node: true,
9 mocha: true
10 },
11 parserOptions: {
12 ecmaVersion: 2022,
13 sourceType: 'module'
14 },
15 plugins: ['promise', 'spellcheck'],
16 extends: [
17 'eslint:recommended',
18 'plugin:import/recommended',
19 'plugin:promise/recommended'
20 ],
21 rules: {
22 'sort-imports': [
23 'warn',
24 {
25 ignoreMemberSort: true,
26 ignoreDeclarationSort: true
27 }
28 ],
29
30 'spellcheck/spell-checker': [
31 'warn',
32 {
33 skipWords: [
34 'Benoit',
35 'benny',
36 'browserslist',
37 'builtins',
38 'christopher',
39 'cjs',
40 'comparator',
41 'cpu',
42 'cpus',
43 'ctx',
44 'deprecations',
45 'dequeue',
46 'ecma',
47 'enqueue',
48 'enum',
49 'esm',
50 'fibonacci',
51 'fs',
52 'inheritDoc',
53 'jsdoc',
54 'microjob',
55 'mjs',
56 'num',
57 'os',
58 'piscina',
59 'pnpm',
60 'poolifier',
61 'poolify',
62 'readonly',
63 'resize',
64 'serializable',
65 'sinon',
66 'threadjs',
67 'threadwork',
68 'tsconfig',
69 'tsdoc',
70 'typedoc',
71 'unlink',
72 'unregister',
73 'utf8',
74 'workerpool'
75 ],
76 skipIfMatch: ['^@.*', '^plugin:.*']
77 }
78 ]
79 },
80 overrides: [
81 {
82 files: ['**/*.ts'],
83 plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
84 parser: '@typescript-eslint/parser',
85 parserOptions: {
86 project: './tsconfig.json'
87 },
88 extends: [
89 'plugin:@typescript-eslint/eslint-recommended',
90 'plugin:@typescript-eslint/recommended',
91 'plugin:@typescript-eslint/recommended-requiring-type-checking',
92 'plugin:import/typescript',
93 'standard-with-typescript'
94 ],
95 rules: {
96 '@typescript-eslint/no-inferrable-types': [
97 'error',
98 { ignoreProperties: true }
99 ],
100 'tsdoc/syntax': 'warn'
101 }
102 },
103 {
104 files: ['examples/typescript/**/*.ts'],
105 rules: {
106 'import/no-unresolved': 'off',
107 '@typescript-eslint/no-unsafe-argument': 'off',
108 '@typescript-eslint/no-unsafe-call': 'off',
109 '@typescript-eslint/no-unsafe-assignment': 'off'
110 }
111 },
112 {
113 files: ['**/*.js', '**/*.mjs'],
114 plugins: ['jsdoc'],
115 extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard']
116 },
117 {
118 files: ['tests/**/*.js'],
119 rules: {
120 'jsdoc/require-jsdoc': 'off'
121 }
122 },
123 {
124 files: ['tests/pools/selection-strategies/**/*.js'],
125 rules: {
126 'n/no-missing-require': 'off'
127 }
128 },
129 {
130 files: ['benchmarks/**/*.js'],
131 rules: {
132 'jsdoc/require-jsdoc': 'off'
133 }
134 },
135 {
136 files: ['benchmarks/versus-external-pools/**/*.js'],
137 rules: {
138 'n/no-missing-require': 'off'
139 }
140 },
141 {
142 files: ['examples/**/*.js'],
143 rules: {
144 'n/no-missing-require': 'off',
145 'jsdoc/require-jsdoc': 'off'
146 }
147 }
148 ]
149 })