Merge branch 'master' into combined-prs-branch
[poolifier.git] / .eslintrc.cjs
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 'browserslist',
43 'builtins',
44 'christopher',
45 'cjs',
46 'cloneable',
47 'comparator',
48 'cpu',
49 'cpus',
50 'cryptographically',
51 'ctx',
52 'deprecations',
53 'deque',
54 'dequeue',
55 'dequeued',
56 'deregisters',
57 'dts',
58 'ecma',
59 'elu',
60 'enqueue',
61 'enum',
62 'errored',
63 'esm',
64 'fastify',
65 'fibonacci',
66 'fp',
67 'fs',
68 'func',
69 'inheritDoc',
70 'javascript',
71 'jsdoc',
72 'linebreak',
73 'localhost',
74 'microjob',
75 'mjs',
76 'nodemailer',
77 'npx',
78 'num',
79 'os',
80 'perf',
81 'piscina',
82 'pnpm',
83 'poolifier',
84 'prepend',
85 'prepends',
86 'readdir',
87 'readonly',
88 'req',
89 'resize',
90 'sinon',
91 'smtp',
92 'threadjs',
93 'threadwork',
94 'tinypool',
95 'tsconfig',
96 'tsdoc',
97 'typedoc',
98 'unlink',
99 'unref',
100 'utf8',
101 'workerpool',
102 'ws',
103 'wss',
104 'wwr'
105 ],
106 skipIfMatch: ['^@.*', '^plugin:.*']
107 }
108 ]
109 },
110 overrides: [
111 {
112 files: ['**/*.ts'],
113 plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
114 parser: '@typescript-eslint/parser',
115 parserOptions: {
116 project: './tsconfig.json'
117 },
118 extends: [
119 'plugin:@typescript-eslint/strict-type-checked',
120 'plugin:@typescript-eslint/stylistic-type-checked',
121 'plugin:import/typescript',
122 'standard-with-typescript'
123 ],
124 rules: {
125 'operator-linebreak': 'off',
126 'tsdoc/syntax': 'warn'
127 }
128 },
129 {
130 files: ['examples/typescript/**/*.ts'],
131 rules: {
132 'import/no-unresolved': [
133 'error',
134 {
135 ignore: [
136 '^axios$',
137 '^express$',
138 '^fastify$',
139 '^fastify-plugin$',
140 '^node-fetch$',
141 '^nodemailer$',
142 '^poolifier$',
143 '^ws$'
144 ]
145 }
146 ],
147 '@typescript-eslint/no-unsafe-argument': 'off',
148 '@typescript-eslint/no-unsafe-call': 'off',
149 '@typescript-eslint/no-unsafe-return': 'off',
150 '@typescript-eslint/no-unsafe-assignment': 'off',
151 '@typescript-eslint/no-unsafe-member-access': 'off',
152 '@typescript-eslint/no-unnecessary-type-assertion': 'off',
153 '@typescript-eslint/no-redundant-type-constituents': 'off',
154 '@typescript-eslint/strict-boolean-expressions': 'off',
155 '@typescript-eslint/return-await': 'off',
156 '@typescript-eslint/no-non-null-assertion': 'off'
157 }
158 },
159 {
160 files: ['**/*.cjs', '**/*.js', '**/*.mjs'],
161 plugins: ['jsdoc'],
162 extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard']
163 },
164 {
165 files: ['tests/**/*.cjs', 'tests/**/*.js', 'tests/**/*.mjs'],
166 rules: {
167 'jsdoc/require-jsdoc': 'off'
168 }
169 },
170 {
171 files: [
172 'benchmarks/**/*.cjs',
173 'benchmarks/**/*.js',
174 'benchmarks/**/*.mjs'
175 ],
176 rules: {
177 'jsdoc/require-jsdoc': 'off'
178 }
179 },
180 {
181 files: ['examples/javascript/**/*.cjs', 'examples/javascript/**/*.js'],
182 rules: {
183 'jsdoc/require-jsdoc': 'off'
184 }
185 }
186 ]
187 })