Add fair sharing worker choice strategy
[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 'unregister',
53 'workerpool'
54 ],
55 skipIfMatch: ['^@.*', '^plugin:.*']
56 }
57 ]
58 },
59 overrides: [
60 {
61 files: ['**/*.ts'],
62 parser: '@typescript-eslint/parser',
63 parserOptions: {
64 project: './tsconfig.json'
65 },
66 plugins: ['@typescript-eslint'],
67 extends: [
68 'plugin:@typescript-eslint/eslint-recommended',
69 'plugin:@typescript-eslint/recommended',
70 'plugin:@typescript-eslint/recommended-requiring-type-checking',
71 'plugin:import/typescript'
72 ],
73 rules: {
74 // We have some intentionally empty functions
75 '@typescript-eslint/no-empty-function': 'off',
76
77 '@typescript-eslint/no-inferrable-types': [
78 'error',
79 { ignoreProperties: true }
80 ],
81
82 'no-useless-constructor': 'off',
83
84 'jsdoc/match-description': [
85 'warn',
86 {
87 contexts: ['any'],
88 tags: {
89 param: true,
90 returns: true
91 }
92 }
93 ],
94 'jsdoc/no-types': 'error',
95 'jsdoc/require-jsdoc': [
96 'warn',
97 {
98 contexts: [
99 'ClassDeclaration',
100 'ClassProperty:not([accessibility=/(private|protected)/])',
101 'ExportNamedDeclaration:has(VariableDeclaration)',
102 'FunctionExpression',
103 'MethodDefinition:not([accessibility=/(private|protected)/]) > FunctionExpression',
104 'TSEnumDeclaration',
105 'TSInterfaceDeclaration',
106 'TSMethodSignature',
107 // 'TSPropertySignature',
108 'TSTypeAliasDeclaration'
109 ]
110 }
111 ],
112 'jsdoc/require-param-type': 'off',
113 'jsdoc/require-returns-type': 'off'
114 }
115 },
116 {
117 files: ['**/*.js'],
118 extends: 'plugin:node/recommended'
119 },
120 {
121 files: ['tests/**/*.js'],
122 rules: {
123 'jsdoc/require-jsdoc': 'off'
124 }
125 },
126 {
127 files: ['tests/pools/selection-strategies/**/*.js'],
128 rules: {
129 'node/no-missing-require': 'off',
130 'jsdoc/require-jsdoc': '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 })