refactor: check for null and undefined
[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 6 env: {
54541487 7 es2022: true,
777b7824
S
8 node: true,
9 mocha: true
10 },
6d0425b4 11 parserOptions: {
54541487 12 ecmaVersion: 2022,
6d0425b4
JB
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',
30eafb1e 43 'deprecations',
5c5a1fb7 44 'ecma',
3832ad95 45 'enum',
e5a5c0fc 46 'esm',
bdaf31cd 47 'fibonacci',
7a6a0a96 48 'fs',
a76fac14 49 'inheritDoc',
5c5a1fb7 50 'jsdoc',
7a6a0a96 51 'microjob',
fe18768d 52 'mjs',
fe2f6f84 53 'num',
23ff945a 54 'os',
7a6a0a96 55 'piscina',
8d75fd5f 56 'pnpm',
a35560ba 57 'poolifier',
7a6a0a96 58 'poolify',
5c5a1fb7
S
59 'readonly',
60 'serializable',
a3809289 61 'sinon',
7a6a0a96
JB
62 'threadjs',
63 'threadwork',
7d82d90e 64 'tsconfig',
38e795c1 65 'tsdoc',
fe2f6f84 66 'typedoc',
7a6a0a96 67 'unlink',
5c5a1fb7 68 'unregister',
7a6a0a96 69 'utf8',
5c5a1fb7
S
70 'workerpool'
71 ],
72 skipIfMatch: ['^@.*', '^plugin:.*']
73 }
777b7824 74 ]
3c5eaeb9
JB
75 },
76 overrides: [
50eceb07 77 {
a17cc27a 78 files: ['**/*.ts'],
38e795c1 79 plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
815d4289 80 parser: '@typescript-eslint/parser',
f3636726 81 parserOptions: {
f3636726
JB
82 project: './tsconfig.json'
83 },
a17cc27a 84 extends: [
f3636726 85 'plugin:@typescript-eslint/eslint-recommended',
a17cc27a 86 'plugin:@typescript-eslint/recommended',
f3636726 87 'plugin:@typescript-eslint/recommended-requiring-type-checking',
3aa14de1
JB
88 'plugin:import/typescript',
89 'standard-with-typescript'
a17cc27a 90 ],
50eceb07 91 rules: {
a17cc27a
JB
92 '@typescript-eslint/no-inferrable-types': [
93 'error',
94 { ignoreProperties: true }
95 ],
c3eb346b 96 'tsdoc/syntax': 'error'
50eceb07
S
97 }
98 },
7a6a0a96
JB
99 {
100 files: ['examples/typescript/**/*.ts'],
101 rules: {
102 'import/no-unresolved': 'off',
7a6a0a96
JB
103 '@typescript-eslint/no-unsafe-argument': 'off',
104 '@typescript-eslint/no-unsafe-call': 'off',
105 '@typescript-eslint/no-unsafe-assignment': 'off'
106 }
107 },
3c5eaeb9 108 {
30eafb1e 109 files: ['**/*.js', '**/*.mjs'],
38e795c1 110 plugins: ['jsdoc'],
3aa14de1 111 extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard']
fa699c42
JB
112 },
113 {
305aeaa7
JB
114 files: ['tests/**/*.js'],
115 rules: {
116 'jsdoc/require-jsdoc': 'off'
117 }
118 },
4bf99d51
JB
119 {
120 files: ['tests/pools/selection-strategies/**/*.js'],
121 rules: {
2f8c5b5c 122 'n/no-missing-require': 'off'
4bf99d51
JB
123 }
124 },
305aeaa7
JB
125 {
126 files: ['benchmarks/**/*.js'],
fa699c42 127 rules: {
a17cc27a 128 'jsdoc/require-jsdoc': 'off'
fa699c42 129 }
583a27ce 130 },
d44e66fc
JB
131 {
132 files: ['benchmarks/versus-external-pools/**/*.js'],
133 rules: {
2f8c5b5c 134 'n/no-missing-require': 'off'
d44e66fc
JB
135 }
136 },
583a27ce
JB
137 {
138 files: ['examples/**/*.js'],
139 rules: {
2f8c5b5c 140 'n/no-missing-require': 'off',
305aeaa7
JB
141 'jsdoc/require-jsdoc': 'off'
142 }
3c5eaeb9 143 }
38e795c1 144 ]
6a6e81d0 145})