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 | }, | |
815d4289 | 10 | plugins: ['promise', 'prettierx', 'jsdoc', 'spellcheck'], |
777b7824 S |
11 | extends: [ |
12 | 'standard', | |
13 | 'eslint:recommended', | |
305aeaa7 JB |
14 | 'plugin:import/recommended', |
15 | 'plugin:jsdoc/recommended', | |
583a27ce | 16 | 'plugin:promise/recommended', |
6372ea67 | 17 | 'plugin:prettierx/standardx' |
777b7824 S |
18 | ], |
19 | rules: { | |
20 | 'no-void': 'off', | |
21 | ||
fa699c42 JB |
22 | 'sort-imports': [ |
23 | 'warn', | |
24 | { | |
25 | ignoreMemberSort: true, | |
50aa7901 | 26 | ignoreDeclarationSort: true |
fa699c42 | 27 | } |
5c5a1fb7 S |
28 | ], |
29 | ||
30 | 'spellcheck/spell-checker': [ | |
31 | 'warn', | |
32 | { | |
33 | skipWords: [ | |
5c5a1fb7 | 34 | 'christopher', |
74750c7f | 35 | 'comparator', |
5c5a1fb7 | 36 | 'ecma', |
3832ad95 | 37 | 'enum', |
bdaf31cd | 38 | 'fibonacci', |
a35560ba | 39 | 'inheritdoc', |
5c5a1fb7 | 40 | 'jsdoc', |
a35560ba | 41 | 'poolifier', |
5c5a1fb7 S |
42 | 'readonly', |
43 | 'serializable', | |
a3809289 | 44 | 'sinon', |
5c5a1fb7 S |
45 | 'unregister', |
46 | 'workerpool' | |
47 | ], | |
48 | skipIfMatch: ['^@.*', '^plugin:.*'] | |
49 | } | |
777b7824 | 50 | ] |
3c5eaeb9 JB |
51 | }, |
52 | overrides: [ | |
50eceb07 | 53 | { |
a17cc27a | 54 | files: ['**/*.ts'], |
815d4289 | 55 | parser: '@typescript-eslint/parser', |
f3636726 JB |
56 | parserOptions: { |
57 | ecmaVersion: 2020, | |
58 | sourceType: 'module', | |
59 | project: './tsconfig.json' | |
60 | }, | |
815d4289 | 61 | plugins: ['@typescript-eslint'], |
a17cc27a | 62 | extends: [ |
f3636726 | 63 | 'plugin:@typescript-eslint/eslint-recommended', |
a17cc27a | 64 | 'plugin:@typescript-eslint/recommended', |
f3636726 | 65 | 'plugin:@typescript-eslint/recommended-requiring-type-checking', |
a17cc27a JB |
66 | 'plugin:import/typescript' |
67 | ], | |
50eceb07 | 68 | rules: { |
a17cc27a JB |
69 | // We have some intentionally empty functions |
70 | '@typescript-eslint/no-empty-function': 'off', | |
71 | ||
72 | '@typescript-eslint/no-inferrable-types': [ | |
73 | 'error', | |
74 | { ignoreProperties: true } | |
75 | ], | |
76 | ||
a35560ba S |
77 | 'no-useless-constructor': 'off', |
78 | ||
3832ad95 S |
79 | 'jsdoc/match-description': [ |
80 | 'warn', | |
81 | { | |
3832ad95 S |
82 | contexts: ['any'], |
83 | tags: { | |
84 | param: true, | |
85 | returns: true | |
86 | } | |
87 | } | |
88 | ], | |
50eceb07 | 89 | 'jsdoc/no-types': 'error', |
3832ad95 S |
90 | 'jsdoc/require-jsdoc': [ |
91 | 'warn', | |
92 | { | |
93 | contexts: [ | |
94 | 'ClassDeclaration', | |
95 | 'ClassProperty:not([accessibility=/(private|protected)/])', | |
96 | 'ExportNamedDeclaration:has(VariableDeclaration)', | |
97 | 'FunctionExpression', | |
98 | 'MethodDefinition:not([accessibility=/(private|protected)/]) > FunctionExpression', | |
99 | 'TSEnumDeclaration', | |
100 | 'TSInterfaceDeclaration', | |
101 | 'TSMethodSignature', | |
102 | // 'TSPropertySignature', | |
103 | 'TSTypeAliasDeclaration' | |
104 | ] | |
105 | } | |
106 | ], | |
50eceb07 S |
107 | 'jsdoc/require-param-type': 'off', |
108 | 'jsdoc/require-returns-type': 'off' | |
109 | } | |
110 | }, | |
3c5eaeb9 | 111 | { |
e99dbb69 | 112 | files: ['**/*.js'], |
a17cc27a | 113 | extends: 'plugin:node/recommended' |
fa699c42 JB |
114 | }, |
115 | { | |
305aeaa7 JB |
116 | files: ['tests/**/*.js'], |
117 | rules: { | |
118 | 'jsdoc/require-jsdoc': 'off' | |
119 | } | |
120 | }, | |
121 | { | |
122 | files: ['benchmarks/**/*.js'], | |
fa699c42 | 123 | rules: { |
a17cc27a | 124 | 'jsdoc/require-jsdoc': 'off' |
fa699c42 | 125 | } |
583a27ce JB |
126 | }, |
127 | { | |
128 | files: ['examples/**/*.js'], | |
129 | rules: { | |
305aeaa7 JB |
130 | 'node/no-missing-require': 'off', |
131 | 'jsdoc/require-jsdoc': 'off' | |
132 | } | |
3c5eaeb9 | 133 | } |
3832ad95 S |
134 | ], |
135 | settings: { | |
136 | jsdoc: { | |
137 | mode: 'typescript' | |
138 | } | |
139 | } | |
6a6e81d0 | 140 | }) |