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 | { | |
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 | } | |
3c5eaeb9 | 131 | } |
3832ad95 S |
132 | ], |
133 | settings: { | |
134 | jsdoc: { | |
135 | mode: 'typescript' | |
136 | } | |
137 | } | |
6a6e81d0 | 138 | }) |