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