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