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