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', |
5c5a1fb7 | 39 | 'christopher', |
7a6a0a96 | 40 | 'cjs', |
74750c7f | 41 | 'comparator', |
23ff945a JB |
42 | 'cpu', |
43 | 'cpus', | |
7a6a0a96 | 44 | 'ctx', |
5c5a1fb7 | 45 | 'ecma', |
3832ad95 | 46 | 'enum', |
bdaf31cd | 47 | 'fibonacci', |
7a6a0a96 | 48 | 'fs', |
a76fac14 | 49 | 'inheritDoc', |
5c5a1fb7 | 50 | 'jsdoc', |
7a6a0a96 | 51 | 'microjob', |
fe2f6f84 | 52 | 'num', |
23ff945a | 53 | 'os', |
7a6a0a96 | 54 | 'piscina', |
a35560ba | 55 | 'poolifier', |
7a6a0a96 | 56 | 'poolify', |
5c5a1fb7 S |
57 | 'readonly', |
58 | 'serializable', | |
a3809289 | 59 | 'sinon', |
7a6a0a96 JB |
60 | 'threadjs', |
61 | 'threadwork', | |
7d82d90e | 62 | 'tsconfig', |
fe2f6f84 | 63 | 'typedoc', |
7a6a0a96 | 64 | 'unlink', |
5c5a1fb7 | 65 | 'unregister', |
7a6a0a96 | 66 | 'utf8', |
5c5a1fb7 S |
67 | 'workerpool' |
68 | ], | |
69 | skipIfMatch: ['^@.*', '^plugin:.*'] | |
70 | } | |
777b7824 | 71 | ] |
3c5eaeb9 JB |
72 | }, |
73 | overrides: [ | |
50eceb07 | 74 | { |
a17cc27a | 75 | files: ['**/*.ts'], |
815d4289 | 76 | parser: '@typescript-eslint/parser', |
f3636726 | 77 | parserOptions: { |
f3636726 JB |
78 | project: './tsconfig.json' |
79 | }, | |
815d4289 | 80 | plugins: ['@typescript-eslint'], |
a17cc27a | 81 | extends: [ |
f3636726 | 82 | 'plugin:@typescript-eslint/eslint-recommended', |
a17cc27a | 83 | 'plugin:@typescript-eslint/recommended', |
f3636726 | 84 | 'plugin:@typescript-eslint/recommended-requiring-type-checking', |
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 | ||
3832ad95 S |
98 | 'jsdoc/match-description': [ |
99 | 'warn', | |
100 | { | |
3832ad95 S |
101 | contexts: ['any'], |
102 | tags: { | |
103 | param: true, | |
104 | returns: true | |
105 | } | |
106 | } | |
107 | ], | |
50eceb07 | 108 | 'jsdoc/no-types': 'error', |
3832ad95 S |
109 | 'jsdoc/require-jsdoc': [ |
110 | 'warn', | |
111 | { | |
112 | contexts: [ | |
113 | 'ClassDeclaration', | |
114 | 'ClassProperty:not([accessibility=/(private|protected)/])', | |
115 | 'ExportNamedDeclaration:has(VariableDeclaration)', | |
116 | 'FunctionExpression', | |
117 | 'MethodDefinition:not([accessibility=/(private|protected)/]) > FunctionExpression', | |
118 | 'TSEnumDeclaration', | |
119 | 'TSInterfaceDeclaration', | |
120 | 'TSMethodSignature', | |
121 | // 'TSPropertySignature', | |
122 | 'TSTypeAliasDeclaration' | |
123 | ] | |
124 | } | |
125 | ], | |
50eceb07 S |
126 | 'jsdoc/require-param-type': 'off', |
127 | 'jsdoc/require-returns-type': 'off' | |
128 | } | |
129 | }, | |
7a6a0a96 JB |
130 | { |
131 | files: ['examples/typescript/**/*.ts'], | |
132 | rules: { | |
133 | 'import/no-unresolved': 'off', | |
134 | 'jsdoc/require-jsdoc': 'off', | |
135 | '@typescript-eslint/no-unsafe-argument': 'off', | |
136 | '@typescript-eslint/no-unsafe-call': 'off', | |
137 | '@typescript-eslint/no-unsafe-assignment': 'off' | |
138 | } | |
139 | }, | |
3c5eaeb9 | 140 | { |
e99dbb69 | 141 | files: ['**/*.js'], |
a17cc27a | 142 | extends: 'plugin:node/recommended' |
fa699c42 JB |
143 | }, |
144 | { | |
305aeaa7 JB |
145 | files: ['tests/**/*.js'], |
146 | rules: { | |
147 | 'jsdoc/require-jsdoc': 'off' | |
148 | } | |
149 | }, | |
4bf99d51 JB |
150 | { |
151 | files: ['tests/pools/selection-strategies/**/*.js'], | |
152 | rules: { | |
ac1417a5 | 153 | 'node/no-missing-require': 'off' |
4bf99d51 JB |
154 | } |
155 | }, | |
305aeaa7 JB |
156 | { |
157 | files: ['benchmarks/**/*.js'], | |
fa699c42 | 158 | rules: { |
a17cc27a | 159 | 'jsdoc/require-jsdoc': 'off' |
fa699c42 | 160 | } |
583a27ce JB |
161 | }, |
162 | { | |
163 | files: ['examples/**/*.js'], | |
164 | rules: { | |
305aeaa7 JB |
165 | 'node/no-missing-require': 'off', |
166 | 'jsdoc/require-jsdoc': 'off' | |
167 | } | |
3c5eaeb9 | 168 | } |
3832ad95 S |
169 | ], |
170 | settings: { | |
171 | jsdoc: { | |
172 | mode: 'typescript' | |
173 | } | |
174 | } | |
6a6e81d0 | 175 | }) |