Commit | Line | Data |
---|---|---|
6a6e81d0 S |
1 | // @ts-check |
2 | const { defineConfig } = require('eslint-define-config') | |
3 | ||
4 | module.exports = defineConfig({ | |
777b7824 S |
5 | env: { |
6 | es2021: true, | |
7 | node: true, | |
8 | mocha: true | |
9 | }, | |
6d0425b4 JB |
10 | parserOptions: { |
11 | ecmaVersion: 2021, | |
12 | sourceType: 'module' | |
13 | }, | |
815d4289 | 14 | plugins: ['promise', 'prettierx', 'jsdoc', 'spellcheck'], |
777b7824 S |
15 | extends: [ |
16 | 'standard', | |
17 | 'eslint:recommended', | |
305aeaa7 JB |
18 | 'plugin:import/recommended', |
19 | 'plugin:jsdoc/recommended', | |
583a27ce | 20 | 'plugin:promise/recommended', |
6372ea67 | 21 | 'plugin:prettierx/standardx' |
777b7824 S |
22 | ], |
23 | rules: { | |
24 | 'no-void': 'off', | |
25 | ||
fa699c42 JB |
26 | 'sort-imports': [ |
27 | 'warn', | |
28 | { | |
29 | ignoreMemberSort: true, | |
50aa7901 | 30 | ignoreDeclarationSort: true |
fa699c42 | 31 | } |
5c5a1fb7 S |
32 | ], |
33 | ||
34 | 'spellcheck/spell-checker': [ | |
35 | 'warn', | |
36 | { | |
37 | skipWords: [ | |
fe2f6f84 | 38 | 'browserslist', |
e4bc7a49 | 39 | 'builtins', |
5c5a1fb7 | 40 | 'christopher', |
7a6a0a96 | 41 | 'cjs', |
74750c7f | 42 | 'comparator', |
23ff945a JB |
43 | 'cpu', |
44 | 'cpus', | |
7a6a0a96 | 45 | 'ctx', |
5c5a1fb7 | 46 | 'ecma', |
3832ad95 | 47 | 'enum', |
bdaf31cd | 48 | 'fibonacci', |
7a6a0a96 | 49 | 'fs', |
a76fac14 | 50 | 'inheritDoc', |
5c5a1fb7 | 51 | 'jsdoc', |
7a6a0a96 | 52 | 'microjob', |
fe2f6f84 | 53 | 'num', |
23ff945a | 54 | 'os', |
7a6a0a96 | 55 | 'piscina', |
a35560ba | 56 | 'poolifier', |
7a6a0a96 | 57 | 'poolify', |
5c5a1fb7 S |
58 | 'readonly', |
59 | 'serializable', | |
a3809289 | 60 | 'sinon', |
7a6a0a96 JB |
61 | 'threadjs', |
62 | 'threadwork', | |
7d82d90e | 63 | 'tsconfig', |
fe2f6f84 | 64 | 'typedoc', |
7a6a0a96 | 65 | 'unlink', |
5c5a1fb7 | 66 | 'unregister', |
7a6a0a96 | 67 | 'utf8', |
5c5a1fb7 S |
68 | 'workerpool' |
69 | ], | |
70 | skipIfMatch: ['^@.*', '^plugin:.*'] | |
71 | } | |
777b7824 | 72 | ] |
3c5eaeb9 JB |
73 | }, |
74 | overrides: [ | |
50eceb07 | 75 | { |
a17cc27a | 76 | files: ['**/*.ts'], |
815d4289 | 77 | parser: '@typescript-eslint/parser', |
f3636726 | 78 | parserOptions: { |
f3636726 JB |
79 | project: './tsconfig.json' |
80 | }, | |
815d4289 | 81 | plugins: ['@typescript-eslint'], |
a17cc27a | 82 | extends: [ |
f3636726 | 83 | 'plugin:@typescript-eslint/eslint-recommended', |
a17cc27a | 84 | 'plugin:@typescript-eslint/recommended', |
f3636726 | 85 | 'plugin:@typescript-eslint/recommended-requiring-type-checking', |
a17cc27a JB |
86 | 'plugin:import/typescript' |
87 | ], | |
50eceb07 | 88 | rules: { |
a17cc27a JB |
89 | // We have some intentionally empty functions |
90 | '@typescript-eslint/no-empty-function': 'off', | |
91 | ||
92 | '@typescript-eslint/no-inferrable-types': [ | |
93 | 'error', | |
94 | { ignoreProperties: true } | |
95 | ], | |
96 | ||
a35560ba S |
97 | 'no-useless-constructor': 'off', |
98 | ||
3832ad95 S |
99 | 'jsdoc/match-description': [ |
100 | 'warn', | |
101 | { | |
3832ad95 S |
102 | contexts: ['any'], |
103 | tags: { | |
104 | param: true, | |
105 | returns: true | |
106 | } | |
107 | } | |
108 | ], | |
50eceb07 | 109 | 'jsdoc/no-types': 'error', |
3832ad95 S |
110 | 'jsdoc/require-jsdoc': [ |
111 | 'warn', | |
112 | { | |
113 | contexts: [ | |
114 | 'ClassDeclaration', | |
115 | 'ClassProperty:not([accessibility=/(private|protected)/])', | |
116 | 'ExportNamedDeclaration:has(VariableDeclaration)', | |
117 | 'FunctionExpression', | |
118 | 'MethodDefinition:not([accessibility=/(private|protected)/]) > FunctionExpression', | |
119 | 'TSEnumDeclaration', | |
120 | 'TSInterfaceDeclaration', | |
121 | 'TSMethodSignature', | |
122 | // 'TSPropertySignature', | |
123 | 'TSTypeAliasDeclaration' | |
124 | ] | |
125 | } | |
126 | ], | |
50eceb07 S |
127 | 'jsdoc/require-param-type': 'off', |
128 | 'jsdoc/require-returns-type': 'off' | |
129 | } | |
130 | }, | |
7a6a0a96 JB |
131 | { |
132 | files: ['examples/typescript/**/*.ts'], | |
133 | rules: { | |
134 | 'import/no-unresolved': 'off', | |
135 | 'jsdoc/require-jsdoc': 'off', | |
136 | '@typescript-eslint/no-unsafe-argument': 'off', | |
137 | '@typescript-eslint/no-unsafe-call': 'off', | |
138 | '@typescript-eslint/no-unsafe-assignment': 'off' | |
139 | } | |
140 | }, | |
3c5eaeb9 | 141 | { |
e99dbb69 | 142 | files: ['**/*.js'], |
2f8c5b5c | 143 | extends: ['plugin:n/recommended'] |
fa699c42 JB |
144 | }, |
145 | { | |
305aeaa7 JB |
146 | files: ['tests/**/*.js'], |
147 | rules: { | |
148 | 'jsdoc/require-jsdoc': 'off' | |
149 | } | |
150 | }, | |
4bf99d51 JB |
151 | { |
152 | files: ['tests/pools/selection-strategies/**/*.js'], | |
153 | rules: { | |
2f8c5b5c | 154 | 'n/no-missing-require': 'off' |
4bf99d51 JB |
155 | } |
156 | }, | |
305aeaa7 JB |
157 | { |
158 | files: ['benchmarks/**/*.js'], | |
fa699c42 | 159 | rules: { |
a17cc27a | 160 | 'jsdoc/require-jsdoc': 'off' |
fa699c42 | 161 | } |
583a27ce | 162 | }, |
d44e66fc JB |
163 | { |
164 | files: ['benchmarks/versus-external-pools/**/*.js'], | |
165 | rules: { | |
2f8c5b5c | 166 | 'n/no-missing-require': 'off' |
d44e66fc JB |
167 | } |
168 | }, | |
583a27ce JB |
169 | { |
170 | files: ['examples/**/*.js'], | |
171 | rules: { | |
2f8c5b5c | 172 | 'n/no-missing-require': 'off', |
305aeaa7 JB |
173 | 'jsdoc/require-jsdoc': 'off' |
174 | } | |
3c5eaeb9 | 175 | } |
3832ad95 S |
176 | ], |
177 | settings: { | |
178 | jsdoc: { | |
179 | mode: 'typescript' | |
180 | } | |
181 | } | |
6a6e81d0 | 182 | }) |