Apply dependencies update
[poolifier.git] / .eslintrc.js
CommitLineData
6a6e81d0
S
1// @ts-check
2const { defineConfig } = require('eslint-define-config')
3
4module.exports = defineConfig({
97c16550 5 root: true,
777b7824
S
6 env: {
7 es2021: true,
8 node: true,
9 mocha: true
10 },
6d0425b4
JB
11 parserOptions: {
12 ecmaVersion: 2021,
13 sourceType: 'module'
14 },
78cea37e 15 plugins: ['promise', 'jsdoc', 'spellcheck'],
777b7824 16 extends: [
777b7824 17 'eslint:recommended',
305aeaa7
JB
18 'plugin:import/recommended',
19 'plugin:jsdoc/recommended',
78cea37e 20 'plugin:promise/recommended'
777b7824
S
21 ],
22 rules: {
23 'no-void': 'off',
24
fa699c42
JB
25 'sort-imports': [
26 'warn',
27 {
28 ignoreMemberSort: true,
50aa7901 29 ignoreDeclarationSort: true
fa699c42 30 }
5c5a1fb7
S
31 ],
32
33 'spellcheck/spell-checker': [
34 'warn',
35 {
36 skipWords: [
ca6c7d70 37 'benny',
fe2f6f84 38 'browserslist',
e4bc7a49 39 'builtins',
5c5a1fb7 40 'christopher',
7a6a0a96 41 'cjs',
74750c7f 42 'comparator',
23ff945a
JB
43 'cpu',
44 'cpus',
7a6a0a96 45 'ctx',
5c5a1fb7 46 'ecma',
3832ad95 47 'enum',
bdaf31cd 48 'fibonacci',
7a6a0a96 49 'fs',
a76fac14 50 'inheritDoc',
5c5a1fb7 51 'jsdoc',
7a6a0a96 52 'microjob',
fe2f6f84 53 'num',
23ff945a 54 'os',
7a6a0a96 55 'piscina',
a35560ba 56 'poolifier',
7a6a0a96 57 'poolify',
5c5a1fb7
S
58 'readonly',
59 'serializable',
a3809289 60 'sinon',
7a6a0a96
JB
61 'threadjs',
62 'threadwork',
7d82d90e 63 'tsconfig',
fe2f6f84 64 'typedoc',
7a6a0a96 65 'unlink',
5c5a1fb7 66 'unregister',
7a6a0a96 67 'utf8',
5c5a1fb7
S
68 'workerpool'
69 ],
70 skipIfMatch: ['^@.*', '^plugin:.*']
71 }
777b7824 72 ]
3c5eaeb9
JB
73 },
74 overrides: [
50eceb07 75 {
a17cc27a 76 files: ['**/*.ts'],
815d4289 77 parser: '@typescript-eslint/parser',
f3636726 78 parserOptions: {
f3636726
JB
79 project: './tsconfig.json'
80 },
815d4289 81 plugins: ['@typescript-eslint'],
a17cc27a 82 extends: [
f3636726 83 'plugin:@typescript-eslint/eslint-recommended',
a17cc27a 84 'plugin:@typescript-eslint/recommended',
f3636726 85 'plugin:@typescript-eslint/recommended-requiring-type-checking',
78cea37e 86 'standard-with-typescript',
a17cc27a
JB
87 'plugin:import/typescript'
88 ],
50eceb07 89 rules: {
a17cc27a
JB
90 // We have some intentionally empty functions
91 '@typescript-eslint/no-empty-function': 'off',
92
93 '@typescript-eslint/no-inferrable-types': [
94 'error',
95 { ignoreProperties: true }
96 ],
97
a35560ba
S
98 'no-useless-constructor': 'off',
99
3832ad95
S
100 'jsdoc/match-description': [
101 'warn',
102 {
3832ad95
S
103 contexts: ['any'],
104 tags: {
105 param: true,
106 returns: true
107 }
108 }
109 ],
50eceb07 110 'jsdoc/no-types': 'error',
3832ad95
S
111 'jsdoc/require-jsdoc': [
112 'warn',
113 {
114 contexts: [
115 'ClassDeclaration',
116 'ClassProperty:not([accessibility=/(private|protected)/])',
117 'ExportNamedDeclaration:has(VariableDeclaration)',
118 'FunctionExpression',
119 'MethodDefinition:not([accessibility=/(private|protected)/]) > FunctionExpression',
120 'TSEnumDeclaration',
121 'TSInterfaceDeclaration',
122 'TSMethodSignature',
123 // 'TSPropertySignature',
124 'TSTypeAliasDeclaration'
125 ]
126 }
127 ],
50eceb07
S
128 'jsdoc/require-param-type': 'off',
129 'jsdoc/require-returns-type': 'off'
130 }
131 },
7a6a0a96
JB
132 {
133 files: ['examples/typescript/**/*.ts'],
134 rules: {
135 'import/no-unresolved': 'off',
136 'jsdoc/require-jsdoc': 'off',
137 '@typescript-eslint/no-unsafe-argument': 'off',
138 '@typescript-eslint/no-unsafe-call': 'off',
139 '@typescript-eslint/no-unsafe-assignment': 'off'
140 }
141 },
3c5eaeb9 142 {
e99dbb69 143 files: ['**/*.js'],
78cea37e 144 extends: ['plugin:n/recommended', 'standard']
fa699c42
JB
145 },
146 {
305aeaa7
JB
147 files: ['tests/**/*.js'],
148 rules: {
149 'jsdoc/require-jsdoc': 'off'
150 }
151 },
4bf99d51
JB
152 {
153 files: ['tests/pools/selection-strategies/**/*.js'],
154 rules: {
2f8c5b5c 155 'n/no-missing-require': 'off'
4bf99d51
JB
156 }
157 },
305aeaa7
JB
158 {
159 files: ['benchmarks/**/*.js'],
fa699c42 160 rules: {
a17cc27a 161 'jsdoc/require-jsdoc': 'off'
fa699c42 162 }
583a27ce 163 },
d44e66fc
JB
164 {
165 files: ['benchmarks/versus-external-pools/**/*.js'],
166 rules: {
2f8c5b5c 167 'n/no-missing-require': 'off'
d44e66fc
JB
168 }
169 },
583a27ce
JB
170 {
171 files: ['examples/**/*.js'],
172 rules: {
2f8c5b5c 173 'n/no-missing-require': 'off',
305aeaa7
JB
174 'jsdoc/require-jsdoc': 'off'
175 }
3c5eaeb9 176 }
3832ad95
S
177 ],
178 settings: {
179 jsdoc: {
180 mode: 'typescript'
181 }
182 }
6a6e81d0 183})