Merge branch 'master' of github.com:poolifier/poolifier
[poolifier.git] / .eslintrc.js
... / ...
CommitLineData
1const { defineConfig } = require('eslint-define-config')
2
3module.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.eslint.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 'benoit',
41 'benny',
42 'browserslist',
43 'builtins',
44 'christopher',
45 'cjs',
46 'cloneable',
47 'comparator',
48 'cpu',
49 'cpus',
50 'ctx',
51 'deprecations',
52 'dequeue',
53 'dequeued',
54 'ecma',
55 'elu',
56 'enqueue',
57 'enum',
58 'errored',
59 'esm',
60 'fastify',
61 'fibonacci',
62 'fp',
63 'fs',
64 'inheritDoc',
65 'jsdoc',
66 'microjob',
67 'mjs',
68 'num',
69 'os',
70 'perf',
71 'piscina',
72 'pnpm',
73 'poolifier',
74 'poolify',
75 'readonly',
76 'req',
77 'resize',
78 'sinon',
79 'threadjs',
80 'threadwork',
81 'tinypool',
82 'tsconfig',
83 'tsdoc',
84 'typedoc',
85 'unlink',
86 'unref',
87 'unregister',
88 'utf8',
89 'workerpool',
90 'wwr'
91 ],
92 skipIfMatch: ['^@.*', '^plugin:.*']
93 }
94 ]
95 },
96 overrides: [
97 {
98 files: ['**/*.ts'],
99 plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
100 parser: '@typescript-eslint/parser',
101 parserOptions: {
102 project: './tsconfig.eslint.json'
103 },
104 extends: [
105 'plugin:@typescript-eslint/recommended',
106 'plugin:@typescript-eslint/recommended-requiring-type-checking',
107 'plugin:import/typescript',
108 'standard-with-typescript'
109 ],
110 rules: {
111 '@typescript-eslint/no-inferrable-types': [
112 'error',
113 { ignoreProperties: true }
114 ],
115 'tsdoc/syntax': 'warn'
116 }
117 },
118 {
119 files: ['examples/typescript/**/*.ts'],
120 rules: {
121 'import/no-unresolved': 'off',
122 '@typescript-eslint/no-unsafe-argument': 'off',
123 '@typescript-eslint/no-unsafe-call': 'off',
124 '@typescript-eslint/no-unsafe-return': 'off',
125 '@typescript-eslint/no-unsafe-assignment': 'off',
126 '@typescript-eslint/no-unsafe-member-access': 'off',
127 '@typescript-eslint/no-unnecessary-type-assertion': 'off',
128 '@typescript-eslint/strict-boolean-expressions': 'off',
129 '@typescript-eslint/restrict-template-expressions': 'off',
130 '@typescript-eslint/return-await': 'off'
131 }
132 },
133 {
134 files: ['**/*.js', '**/*.mjs'],
135 plugins: ['jsdoc'],
136 extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard']
137 },
138 {
139 files: ['tests/**/*.js'],
140 rules: {
141 'jsdoc/require-jsdoc': 'off'
142 }
143 },
144 {
145 files: ['tests/pools/selection-strategies/**/*.js'],
146 rules: {
147 'n/no-missing-require': 'off'
148 }
149 },
150 {
151 files: ['benchmarks/**/*.js', 'benchmarks/**/*.mjs'],
152 rules: {
153 'jsdoc/require-jsdoc': 'off'
154 }
155 },
156 {
157 files: ['benchmarks/versus-external-pools/**/*.js'],
158 rules: {
159 'n/no-missing-require': 'off'
160 }
161 },
162 {
163 files: ['benchmarks/versus-external-pools/**/*.mjs'],
164 rules: {
165 'n/no-missing-import': 'off',
166 'import/no-unresolved': 'off'
167 }
168 },
169 {
170 files: ['examples/javascript/**/*.js'],
171 rules: {
172 'n/no-missing-require': 'off',
173 'jsdoc/require-jsdoc': 'off'
174 }
175 }
176 ]
177})