Cleanup eslint rules
[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 },
38e795c1 15 plugins: ['promise', 'spellcheck'],
777b7824 16 extends: [
777b7824 17 'eslint:recommended',
305aeaa7 18 'plugin:import/recommended',
78cea37e 19 'plugin:promise/recommended'
777b7824
S
20 ],
21 rules: {
fa699c42
JB
22 'sort-imports': [
23 'warn',
24 {
25 ignoreMemberSort: true,
50aa7901 26 ignoreDeclarationSort: true
fa699c42 27 }
5c5a1fb7
S
28 ],
29
30 'spellcheck/spell-checker': [
31 'warn',
32 {
33 skipWords: [
ca6c7d70 34 'benny',
fe2f6f84 35 'browserslist',
e4bc7a49 36 'builtins',
5c5a1fb7 37 'christopher',
7a6a0a96 38 'cjs',
74750c7f 39 'comparator',
23ff945a
JB
40 'cpu',
41 'cpus',
7a6a0a96 42 'ctx',
5c5a1fb7 43 'ecma',
3832ad95 44 'enum',
bdaf31cd 45 'fibonacci',
7a6a0a96 46 'fs',
a76fac14 47 'inheritDoc',
5c5a1fb7 48 'jsdoc',
7a6a0a96 49 'microjob',
fe2f6f84 50 'num',
23ff945a 51 'os',
7a6a0a96 52 'piscina',
a35560ba 53 'poolifier',
7a6a0a96 54 'poolify',
5c5a1fb7
S
55 'readonly',
56 'serializable',
a3809289 57 'sinon',
7a6a0a96
JB
58 'threadjs',
59 'threadwork',
7d82d90e 60 'tsconfig',
38e795c1 61 'tsdoc',
fe2f6f84 62 'typedoc',
7a6a0a96 63 'unlink',
5c5a1fb7 64 'unregister',
7a6a0a96 65 'utf8',
5c5a1fb7
S
66 'workerpool'
67 ],
68 skipIfMatch: ['^@.*', '^plugin:.*']
69 }
777b7824 70 ]
3c5eaeb9
JB
71 },
72 overrides: [
50eceb07 73 {
a17cc27a 74 files: ['**/*.ts'],
38e795c1 75 plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
815d4289 76 parser: '@typescript-eslint/parser',
f3636726 77 parserOptions: {
f3636726
JB
78 project: './tsconfig.json'
79 },
a17cc27a 80 extends: [
f3636726 81 'plugin:@typescript-eslint/eslint-recommended',
a17cc27a 82 'plugin:@typescript-eslint/recommended',
f3636726 83 'plugin:@typescript-eslint/recommended-requiring-type-checking',
78cea37e 84 'standard-with-typescript',
a17cc27a
JB
85 'plugin:import/typescript'
86 ],
50eceb07 87 rules: {
a17cc27a
JB
88 // We have some intentionally empty functions
89 '@typescript-eslint/no-empty-function': 'off',
90
91 '@typescript-eslint/no-inferrable-types': [
92 'error',
93 { ignoreProperties: true }
94 ],
95
a35560ba
S
96 'no-useless-constructor': 'off',
97
c3eb346b 98 'tsdoc/syntax': 'error'
50eceb07
S
99 }
100 },
7a6a0a96
JB
101 {
102 files: ['examples/typescript/**/*.ts'],
103 rules: {
104 'import/no-unresolved': 'off',
7a6a0a96
JB
105 '@typescript-eslint/no-unsafe-argument': 'off',
106 '@typescript-eslint/no-unsafe-call': 'off',
107 '@typescript-eslint/no-unsafe-assignment': 'off'
108 }
109 },
3c5eaeb9 110 {
e99dbb69 111 files: ['**/*.js'],
38e795c1
JB
112 plugins: ['jsdoc'],
113 extends: ['plugin:n/recommended', 'standard', 'plugin:jsdoc/recommended']
fa699c42
JB
114 },
115 {
305aeaa7
JB
116 files: ['tests/**/*.js'],
117 rules: {
118 'jsdoc/require-jsdoc': 'off'
119 }
120 },
4bf99d51
JB
121 {
122 files: ['tests/pools/selection-strategies/**/*.js'],
123 rules: {
2f8c5b5c 124 'n/no-missing-require': 'off'
4bf99d51
JB
125 }
126 },
305aeaa7
JB
127 {
128 files: ['benchmarks/**/*.js'],
fa699c42 129 rules: {
a17cc27a 130 'jsdoc/require-jsdoc': 'off'
fa699c42 131 }
583a27ce 132 },
d44e66fc
JB
133 {
134 files: ['benchmarks/versus-external-pools/**/*.js'],
135 rules: {
2f8c5b5c 136 'n/no-missing-require': 'off'
d44e66fc
JB
137 }
138 },
583a27ce
JB
139 {
140 files: ['examples/**/*.js'],
141 rules: {
2f8c5b5c 142 'n/no-missing-require': 'off',
305aeaa7
JB
143 'jsdoc/require-jsdoc': 'off'
144 }
3c5eaeb9 145 }
38e795c1 146 ]
6a6e81d0 147})