11fb2803e0eac7e59ca325948ae07cfc521a07a3
[poolifier.git] / .eslintrc.js
1 // @ts-check
2 const { defineConfig } = require('eslint-define-config')
3
4 module.exports = defineConfig({
5 env: {
6 es2021: true,
7 node: true,
8 mocha: true
9 },
10 parserOptions: {
11 ecmaVersion: 2021,
12 sourceType: 'module'
13 },
14 plugins: ['promise', 'prettierx', 'jsdoc', 'spellcheck'],
15 extends: [
16 'standard',
17 'eslint:recommended',
18 'plugin:import/recommended',
19 'plugin:jsdoc/recommended',
20 'plugin:promise/recommended',
21 'plugin:prettierx/standardx'
22 ],
23 rules: {
24 'no-void': 'off',
25
26 'sort-imports': [
27 'warn',
28 {
29 ignoreMemberSort: true,
30 ignoreDeclarationSort: true
31 }
32 ],
33
34 'spellcheck/spell-checker': [
35 'warn',
36 {
37 skipWords: [
38 'christopher',
39 'comparator',
40 'cpu',
41 'cpus',
42 'ecma',
43 'enum',
44 'fibonacci',
45 'inheritDoc',
46 'jsdoc',
47 'os',
48 'poolifier',
49 'readonly',
50 'serializable',
51 'sinon',
52 'tsconfig',
53 'unregister',
54 'workerpool'
55 ],
56 skipIfMatch: ['^@.*', '^plugin:.*']
57 }
58 ]
59 },
60 overrides: [
61 {
62 files: ['**/*.ts'],
63 parser: '@typescript-eslint/parser',
64 parserOptions: {
65 project: './tsconfig.json'
66 },
67 plugins: ['@typescript-eslint'],
68 extends: [
69 'plugin:@typescript-eslint/eslint-recommended',
70 'plugin:@typescript-eslint/recommended',
71 'plugin:@typescript-eslint/recommended-requiring-type-checking',
72 'plugin:import/typescript'
73 ],
74 rules: {
75 // We have some intentionally empty functions
76 '@typescript-eslint/no-empty-function': 'off',
77
78 '@typescript-eslint/no-inferrable-types': [
79 'error',
80 { ignoreProperties: true }
81 ],
82
83 'no-useless-constructor': 'off',
84
85 'jsdoc/match-description': [
86 'warn',
87 {
88 contexts: ['any'],
89 tags: {
90 param: true,
91 returns: true
92 }
93 }
94 ],
95 'jsdoc/no-types': 'error',
96 'jsdoc/require-jsdoc': [
97 'warn',
98 {
99 contexts: [
100 'ClassDeclaration',
101 'ClassProperty:not([accessibility=/(private|protected)/])',
102 'ExportNamedDeclaration:has(VariableDeclaration)',
103 'FunctionExpression',
104 'MethodDefinition:not([accessibility=/(private|protected)/]) > FunctionExpression',
105 'TSEnumDeclaration',
106 'TSInterfaceDeclaration',
107 'TSMethodSignature',
108 // 'TSPropertySignature',
109 'TSTypeAliasDeclaration'
110 ]
111 }
112 ],
113 'jsdoc/require-param-type': 'off',
114 'jsdoc/require-returns-type': 'off'
115 }
116 },
117 {
118 files: ['**/*.js'],
119 extends: 'plugin:node/recommended'
120 },
121 {
122 files: ['tests/**/*.js'],
123 rules: {
124 'jsdoc/require-jsdoc': 'off'
125 }
126 },
127 {
128 files: ['tests/pools/selection-strategies/**/*.js'],
129 rules: {
130 'node/no-missing-require': 'off'
131 }
132 },
133 {
134 files: ['benchmarks/**/*.js'],
135 rules: {
136 'jsdoc/require-jsdoc': 'off'
137 }
138 },
139 {
140 files: ['examples/**/*.js'],
141 rules: {
142 'node/no-missing-require': 'off',
143 'jsdoc/require-jsdoc': 'off'
144 }
145 }
146 ],
147 settings: {
148 jsdoc: {
149 mode: 'typescript'
150 }
151 }
152 })