CHANGELOG.md: 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 },
815d4289 15 plugins: ['promise', 'prettierx', 'jsdoc', 'spellcheck'],
777b7824
S
16 extends: [
17 'standard',
18 'eslint:recommended',
305aeaa7
JB
19 'plugin:import/recommended',
20 'plugin:jsdoc/recommended',
583a27ce 21 'plugin:promise/recommended',
6372ea67 22 'plugin:prettierx/standardx'
777b7824
S
23 ],
24 rules: {
25 'no-void': 'off',
26
fa699c42
JB
27 'sort-imports': [
28 'warn',
29 {
30 ignoreMemberSort: true,
50aa7901 31 ignoreDeclarationSort: true
fa699c42 32 }
5c5a1fb7
S
33 ],
34
35 'spellcheck/spell-checker': [
36 'warn',
37 {
38 skipWords: [
fe2f6f84 39 'browserslist',
e4bc7a49 40 'builtins',
5c5a1fb7 41 'christopher',
7a6a0a96 42 'cjs',
74750c7f 43 'comparator',
23ff945a
JB
44 'cpu',
45 'cpus',
7a6a0a96 46 'ctx',
5c5a1fb7 47 'ecma',
3832ad95 48 'enum',
bdaf31cd 49 'fibonacci',
7a6a0a96 50 'fs',
a76fac14 51 'inheritDoc',
5c5a1fb7 52 'jsdoc',
7a6a0a96 53 'microjob',
fe2f6f84 54 'num',
23ff945a 55 'os',
7a6a0a96 56 'piscina',
a35560ba 57 'poolifier',
7a6a0a96 58 'poolify',
5c5a1fb7
S
59 'readonly',
60 'serializable',
a3809289 61 'sinon',
7a6a0a96
JB
62 'threadjs',
63 'threadwork',
7d82d90e 64 'tsconfig',
fe2f6f84 65 'typedoc',
7a6a0a96 66 'unlink',
5c5a1fb7 67 'unregister',
7a6a0a96 68 'utf8',
5c5a1fb7
S
69 'workerpool'
70 ],
71 skipIfMatch: ['^@.*', '^plugin:.*']
72 }
777b7824 73 ]
3c5eaeb9
JB
74 },
75 overrides: [
50eceb07 76 {
a17cc27a 77 files: ['**/*.ts'],
815d4289 78 parser: '@typescript-eslint/parser',
f3636726 79 parserOptions: {
f3636726
JB
80 project: './tsconfig.json'
81 },
815d4289 82 plugins: ['@typescript-eslint'],
a17cc27a 83 extends: [
f3636726 84 'plugin:@typescript-eslint/eslint-recommended',
a17cc27a 85 'plugin:@typescript-eslint/recommended',
f3636726 86 'plugin:@typescript-eslint/recommended-requiring-type-checking',
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'],
2f8c5b5c 144 extends: ['plugin:n/recommended']
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})