Cleanups
[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 'browserslist',
39 'christopher',
40 'comparator',
41 'cpu',
42 'cpus',
43 'ecma',
44 'enum',
45 'fibonacci',
46 'inheritDoc',
47 'jsdoc',
48 'num',
49 'os',
50 'poolifier',
51 'readonly',
52 'serializable',
53 'sinon',
54 'tsconfig',
55 'typedoc',
56 'unregister',
57 'workerpool'
58 ],
59 skipIfMatch: ['^@.*', '^plugin:.*']
60 }
61 ]
62 },
63 overrides: [
64 {
65 files: ['**/*.ts'],
66 parser: '@typescript-eslint/parser',
67 parserOptions: {
68 project: './tsconfig.json'
69 },
70 plugins: ['@typescript-eslint'],
71 extends: [
72 'plugin:@typescript-eslint/eslint-recommended',
73 'plugin:@typescript-eslint/recommended',
74 'plugin:@typescript-eslint/recommended-requiring-type-checking',
75 'plugin:import/typescript'
76 ],
77 rules: {
78 // We have some intentionally empty functions
79 '@typescript-eslint/no-empty-function': 'off',
80
81 '@typescript-eslint/no-inferrable-types': [
82 'error',
83 { ignoreProperties: true }
84 ],
85
86 'no-useless-constructor': 'off',
87
88 'jsdoc/match-description': [
89 'warn',
90 {
91 contexts: ['any'],
92 tags: {
93 param: true,
94 returns: true
95 }
96 }
97 ],
98 'jsdoc/no-types': 'error',
99 'jsdoc/require-jsdoc': [
100 'warn',
101 {
102 contexts: [
103 'ClassDeclaration',
104 'ClassProperty:not([accessibility=/(private|protected)/])',
105 'ExportNamedDeclaration:has(VariableDeclaration)',
106 'FunctionExpression',
107 'MethodDefinition:not([accessibility=/(private|protected)/]) > FunctionExpression',
108 'TSEnumDeclaration',
109 'TSInterfaceDeclaration',
110 'TSMethodSignature',
111 // 'TSPropertySignature',
112 'TSTypeAliasDeclaration'
113 ]
114 }
115 ],
116 'jsdoc/require-param-type': 'off',
117 'jsdoc/require-returns-type': 'off'
118 }
119 },
120 {
121 files: ['**/*.js'],
122 extends: 'plugin:node/recommended'
123 },
124 {
125 files: ['tests/**/*.js'],
126 rules: {
127 'jsdoc/require-jsdoc': 'off'
128 }
129 },
130 {
131 files: ['tests/pools/selection-strategies/**/*.js'],
132 rules: {
133 'node/no-missing-require': 'off'
134 }
135 },
136 {
137 files: ['benchmarks/**/*.js'],
138 rules: {
139 'jsdoc/require-jsdoc': 'off'
140 }
141 },
142 {
143 files: ['examples/**/*.js'],
144 rules: {
145 'node/no-missing-require': 'off',
146 'jsdoc/require-jsdoc': 'off'
147 }
148 }
149 ],
150 settings: {
151 jsdoc: {
152 mode: 'typescript'
153 }
154 }
155 })