Improve jsdoc comments (#175)
[poolifier.git] / .eslintrc.js
1 module.exports = {
2 env: {
3 es2021: true,
4 node: true,
5 mocha: true
6 },
7 parser: '@typescript-eslint/parser',
8 parserOptions: {
9 ecmaVersion: 2020,
10 sourceType: 'module'
11 },
12 plugins: [
13 '@typescript-eslint',
14 'promise',
15 'prettierx',
16 'jsdoc',
17 'spellcheck'
18 ],
19 extends: [
20 'standard',
21 'eslint:recommended',
22 'plugin:@typescript-eslint/recommended',
23 'plugin:import/errors',
24 'plugin:import/warnings',
25 'plugin:import/typescript',
26 'plugin:promise/recommended',
27 'plugin:prettierx/standardx',
28 'plugin:prettierx/@typescript-eslint'
29 ],
30 rules: {
31 'no-void': 'off',
32
33 // We have some intentionally empty functions
34 '@typescript-eslint/no-empty-function': 'off',
35
36 '@typescript-eslint/no-inferrable-types': [
37 'error',
38 { ignoreProperties: true }
39 ],
40
41 'sort-imports': [
42 'warn',
43 {
44 ignoreMemberSort: true,
45 ignoreDeclarationSort: true
46 }
47 ],
48
49 'spellcheck/spell-checker': [
50 'warn',
51 {
52 skipWords: [
53 'poolifier',
54 'christopher',
55 'ecma',
56 'enum',
57 'jsdoc',
58 'pioardi',
59 'readonly',
60 'serializable',
61 'unregister',
62 'workerpool'
63 ],
64 skipIfMatch: ['^@.*', '^plugin:.*']
65 }
66 ]
67 },
68 overrides: [
69 {
70 files: ['src/**/*.ts'],
71 extends: 'plugin:jsdoc/recommended',
72 rules: {
73 'jsdoc/match-description': [
74 'warn',
75 {
76 mainDescription:
77 '/^[A-Z`].+?(\\.|:)(\\n\\n.*((\\n{1,2}- .+)|(_.+_)|`.+`|\\n\\n---))?$/us',
78 matchDescription: '^[A-Z`].+(\\.|`.+`)$',
79 contexts: ['any'],
80 tags: {
81 param: true,
82 returns: true
83 }
84 }
85 ],
86 'jsdoc/no-types': 'error',
87 'jsdoc/require-jsdoc': [
88 'warn',
89 {
90 contexts: [
91 'ClassDeclaration',
92 'ClassProperty:not([accessibility=/(private|protected)/])',
93 'ExportNamedDeclaration:has(VariableDeclaration)',
94 'FunctionExpression',
95 'MethodDefinition:not([accessibility=/(private|protected)/]) > FunctionExpression',
96 'TSEnumDeclaration',
97 'TSInterfaceDeclaration',
98 'TSMethodSignature',
99 // 'TSPropertySignature',
100 'TSTypeAliasDeclaration'
101 ]
102 }
103 ],
104 'jsdoc/require-param-type': 'off',
105 'jsdoc/require-returns-type': 'off'
106 }
107 },
108 {
109 files: ['*.js'],
110 extends: 'plugin:node/recommended',
111 rules: {
112 '@typescript-eslint/no-unused-vars': 'off',
113 '@typescript-eslint/no-var-requires': 'off'
114 }
115 },
116 {
117 files: ['examples/typescript/**/*.ts'],
118 rules: {
119 'import/no-unresolved': 'off'
120 }
121 },
122 {
123 files: ['examples/**/*.js'],
124 rules: {
125 'node/no-missing-require': 'off'
126 }
127 }
128 ],
129 settings: {
130 jsdoc: {
131 mode: 'typescript'
132 }
133 }
134 }