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