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