build: cleanup TS configuration
[poolifier.git] / .eslintrc.js
1 const { defineConfig } = require('eslint-define-config')
2
3 module.exports = defineConfig({
4 root: true,
5 env: {
6 es2022: true,
7 node: true,
8 mocha: true
9 },
10 parserOptions: {
11 ecmaVersion: 2022,
12 sourceType: 'module'
13 },
14 plugins: ['promise', 'spellcheck'],
15 extends: [
16 'eslint:recommended',
17 'plugin:import/recommended',
18 'plugin:promise/recommended'
19 ],
20 settings: {
21 'import/resolver': {
22 typescript: {
23 project: './tsconfig.json'
24 }
25 }
26 },
27 rules: {
28 'sort-imports': [
29 'error',
30 {
31 ignoreDeclarationSort: true
32 }
33 ],
34 'import/order': 'error',
35
36 'spellcheck/spell-checker': [
37 'warn',
38 {
39 skipWords: [
40 'axios',
41 'benoit',
42 'benny',
43 'browserslist',
44 'builtins',
45 'christopher',
46 'cjs',
47 'cloneable',
48 'comparator',
49 'cpu',
50 'cpus',
51 'cryptographically',
52 'ctx',
53 'deprecations',
54 'deque',
55 'dequeue',
56 'dequeued',
57 'ecma',
58 'elu',
59 'enqueue',
60 'enum',
61 'errored',
62 'esm',
63 'fastify',
64 'fibonacci',
65 'fp',
66 'fs',
67 'inheritDoc',
68 'javascript',
69 'jsdoc',
70 'localhost',
71 'microjob',
72 'mjs',
73 'nodemailer',
74 'npx',
75 'num',
76 'os',
77 'perf',
78 'piscina',
79 'pnpm',
80 'poolifier',
81 'prepend',
82 'prepends',
83 'readdir',
84 'readonly',
85 'req',
86 'resize',
87 'sinon',
88 'smtp',
89 'threadjs',
90 'threadwork',
91 'tinypool',
92 'tsconfig',
93 'tsdoc',
94 'typedoc',
95 'unlink',
96 'unref',
97 'unregister',
98 'utf8',
99 'webcrypto',
100 'workerpool',
101 'ws',
102 'wss',
103 'wwr'
104 ],
105 skipIfMatch: ['^@.*', '^plugin:.*']
106 }
107 ]
108 },
109 overrides: [
110 {
111 files: ['**/*.ts'],
112 plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
113 parser: '@typescript-eslint/parser',
114 parserOptions: {
115 project: './tsconfig.json'
116 },
117 extends: [
118 'plugin:@typescript-eslint/recommended',
119 'plugin:@typescript-eslint/recommended-requiring-type-checking',
120 'plugin:import/typescript',
121 'standard-with-typescript'
122 ],
123 rules: {
124 '@typescript-eslint/no-inferrable-types': [
125 'error',
126 { ignoreProperties: true }
127 ],
128 'tsdoc/syntax': 'warn'
129 }
130 },
131 {
132 files: ['examples/typescript/**/*.ts'],
133 rules: {
134 'import/no-unresolved': 'off',
135 '@typescript-eslint/no-unsafe-argument': 'off',
136 '@typescript-eslint/no-unsafe-call': 'off',
137 '@typescript-eslint/no-unsafe-return': 'off',
138 '@typescript-eslint/no-unsafe-assignment': 'off',
139 '@typescript-eslint/no-unsafe-member-access': 'off',
140 '@typescript-eslint/no-unnecessary-type-assertion': 'off',
141 '@typescript-eslint/no-redundant-type-constituents': 'off',
142 '@typescript-eslint/strict-boolean-expressions': 'off',
143 '@typescript-eslint/return-await': 'off'
144 }
145 },
146 {
147 files: ['**/*.js', '**/*.mjs'],
148 plugins: ['jsdoc'],
149 extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard']
150 },
151 {
152 files: ['tests/**/*.js'],
153 rules: {
154 'jsdoc/require-jsdoc': 'off'
155 }
156 },
157 {
158 files: ['tests/pools/selection-strategies/**/*.js'],
159 rules: {
160 'n/no-missing-require': 'off'
161 }
162 },
163 {
164 files: ['benchmarks/**/*.js', 'benchmarks/**/*.mjs'],
165 rules: {
166 'jsdoc/require-jsdoc': 'off'
167 }
168 },
169 {
170 files: ['benchmarks/versus-external-pools/**/*.js'],
171 rules: {
172 'n/no-missing-require': 'off'
173 }
174 },
175 {
176 files: ['benchmarks/versus-external-pools/**/*.mjs'],
177 rules: {
178 'n/no-missing-import': 'off',
179 'import/no-unresolved': 'off'
180 }
181 },
182 {
183 files: ['examples/javascript/**/*.js'],
184 rules: {
185 'n/no-missing-require': 'off',
186 'jsdoc/require-jsdoc': 'off'
187 }
188 }
189 ]
190 })