refactor: renable standard JS linter rules
[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 'localhost',
73 'microjob',
74 'mjs',
75 'nodemailer',
76 'npx',
77 'num',
78 'os',
79 'perf',
80 'piscina',
81 'pnpm',
82 'poolifier',
83 'prepend',
84 'prepends',
85 'readdir',
86 'readonly',
87 'req',
88 'resize',
89 'sinon',
90 'smtp',
91 'threadjs',
92 'threadwork',
93 'tinypool',
94 'tsconfig',
95 'tsdoc',
96 'typedoc',
97 'unlink',
98 'unref',
99 'utf8',
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 'operator-linebreak': 'off',
125 'tsdoc/syntax': 'warn'
126 }
127 },
128 {
129 files: ['examples/typescript/**/*.ts'],
130 rules: {
131 'import/no-unresolved': [
132 'error',
133 {
134 ignore: [
135 '^axios$',
136 '^express$',
137 '^fastify$',
138 '^fastify-plugin$',
139 '^node-fetch$',
140 '^nodemailer$',
141 '^poolifier$',
142 '^ws$'
143 ]
144 }
145 ],
146 '@typescript-eslint/no-unsafe-argument': 'off',
147 '@typescript-eslint/no-unsafe-call': 'off',
148 '@typescript-eslint/no-unsafe-return': 'off',
149 '@typescript-eslint/no-unsafe-assignment': 'off',
150 '@typescript-eslint/no-unsafe-member-access': 'off',
151 '@typescript-eslint/no-unnecessary-type-assertion': 'off',
152 '@typescript-eslint/no-redundant-type-constituents': 'off',
153 '@typescript-eslint/strict-boolean-expressions': 'off',
154 // '@typescript-eslint/return-await': 'off',
155 '@typescript-eslint/no-non-null-assertion': 'off'
156 }
157 },
158 {
159 files: ['**/*.cjs', '**/*.js', '**/*.mjs'],
160 plugins: ['jsdoc'],
161 extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard']
162 },
163 {
164 files: ['tests/**/*.cjs', 'tests/**/*.js', 'tests/**/*.mjs'],
165 rules: {
166 'jsdoc/require-jsdoc': 'off'
167 }
168 },
169 {
170 files: [
171 'benchmarks/**/*.cjs',
172 'benchmarks/**/*.js',
173 'benchmarks/**/*.mjs'
174 ],
175 rules: {
176 'jsdoc/require-jsdoc': 'off'
177 }
178 },
179 {
180 files: ['examples/javascript/**/*.cjs', 'examples/javascript/**/*.js'],
181 rules: {
182 'jsdoc/require-jsdoc': 'off'
183 }
184 }
185 ]
186 })