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