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 | }, | |
10 | parser: '@typescript-eslint/parser', | |
11 | parserOptions: { | |
fa699c42 | 12 | ecmaVersion: 2020, |
e06dcd52 S |
13 | sourceType: 'module', |
14 | warnOnUnsupportedTypeScriptVersion: false | |
777b7824 | 15 | }, |
5c5a1fb7 S |
16 | plugins: [ |
17 | '@typescript-eslint', | |
18 | 'promise', | |
19 | 'prettierx', | |
20 | 'jsdoc', | |
21 | 'spellcheck' | |
22 | ], | |
777b7824 S |
23 | extends: [ |
24 | 'standard', | |
25 | 'eslint:recommended', | |
fa699c42 JB |
26 | 'plugin:import/errors', |
27 | 'plugin:import/warnings', | |
583a27ce | 28 | 'plugin:promise/recommended', |
6372ea67 | 29 | 'plugin:prettierx/standardx' |
777b7824 S |
30 | ], |
31 | rules: { | |
32 | 'no-void': 'off', | |
33 | ||
fa699c42 JB |
34 | 'sort-imports': [ |
35 | 'warn', | |
36 | { | |
37 | ignoreMemberSort: true, | |
50aa7901 | 38 | ignoreDeclarationSort: true |
fa699c42 | 39 | } |
5c5a1fb7 S |
40 | ], |
41 | ||
42 | 'spellcheck/spell-checker': [ | |
43 | 'warn', | |
44 | { | |
45 | skipWords: [ | |
5c5a1fb7 | 46 | 'christopher', |
74750c7f | 47 | 'comparator', |
5c5a1fb7 | 48 | 'ecma', |
3832ad95 | 49 | 'enum', |
a35560ba | 50 | 'inheritdoc', |
5c5a1fb7 | 51 | 'jsdoc', |
a35560ba | 52 | 'poolifier', |
5c5a1fb7 S |
53 | 'readonly', |
54 | 'serializable', | |
55 | 'unregister', | |
56 | 'workerpool' | |
57 | ], | |
58 | skipIfMatch: ['^@.*', '^plugin:.*'] | |
59 | } | |
777b7824 | 60 | ] |
3c5eaeb9 JB |
61 | }, |
62 | overrides: [ | |
50eceb07 | 63 | { |
a17cc27a JB |
64 | files: ['**/*.ts'], |
65 | extends: [ | |
66 | 'plugin:jsdoc/recommended', | |
67 | 'plugin:@typescript-eslint/recommended', | |
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 | { | |
84 | mainDescription: | |
85 | '/^[A-Z`].+?(\\.|:)(\\n\\n.*((\\n{1,2}- .+)|(_.+_)|`.+`|\\n\\n---))?$/us', | |
86 | matchDescription: '^[A-Z`].+(\\.|`.+`)$', | |
87 | contexts: ['any'], | |
88 | tags: { | |
89 | param: true, | |
90 | returns: true | |
91 | } | |
92 | } | |
93 | ], | |
50eceb07 | 94 | 'jsdoc/no-types': 'error', |
3832ad95 S |
95 | 'jsdoc/require-jsdoc': [ |
96 | 'warn', | |
97 | { | |
98 | contexts: [ | |
99 | 'ClassDeclaration', | |
100 | 'ClassProperty:not([accessibility=/(private|protected)/])', | |
101 | 'ExportNamedDeclaration:has(VariableDeclaration)', | |
102 | 'FunctionExpression', | |
103 | 'MethodDefinition:not([accessibility=/(private|protected)/]) > FunctionExpression', | |
104 | 'TSEnumDeclaration', | |
105 | 'TSInterfaceDeclaration', | |
106 | 'TSMethodSignature', | |
107 | // 'TSPropertySignature', | |
108 | 'TSTypeAliasDeclaration' | |
109 | ] | |
110 | } | |
111 | ], | |
50eceb07 S |
112 | 'jsdoc/require-param-type': 'off', |
113 | 'jsdoc/require-returns-type': 'off' | |
114 | } | |
115 | }, | |
3c5eaeb9 | 116 | { |
e99dbb69 | 117 | files: ['**/*.js'], |
a17cc27a | 118 | extends: 'plugin:node/recommended' |
fa699c42 JB |
119 | }, |
120 | { | |
583a27ce | 121 | files: ['examples/typescript/**/*.ts'], |
fa699c42 | 122 | rules: { |
a17cc27a JB |
123 | 'import/no-unresolved': 'off', |
124 | 'jsdoc/require-jsdoc': 'off' | |
fa699c42 | 125 | } |
583a27ce JB |
126 | }, |
127 | { | |
128 | files: ['examples/**/*.js'], | |
129 | rules: { | |
130 | 'node/no-missing-require': 'off' | |
131 | } | |
3c5eaeb9 | 132 | } |
3832ad95 S |
133 | ], |
134 | settings: { | |
135 | jsdoc: { | |
136 | mode: 'typescript' | |
137 | } | |
138 | } | |
6a6e81d0 | 139 | }) |