a5a0075e24e5f8acb9686ccf579174e97419b6ff
[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 'christopher',
54 'ecma',
55 'enum',
56 'inheritdoc',
57 'jsdoc',
58 'pioardi',
59 'poolifier',
60 'readonly',
61 'serializable',
62 'unregister',
63 'workerpool'
64 ],
65 skipIfMatch: ['^@.*', '^plugin:.*']
66 }
67 ]
68 },
69 overrides: [
70 {
71 files: ['src/**/*.ts'],
72 extends: 'plugin:jsdoc/recommended',
73 rules: {
74 'no-useless-constructor': 'off',
75
76 'jsdoc/match-description': [
77 'warn',
78 {
79 mainDescription:
80 '/^[A-Z`].+?(\\.|:)(\\n\\n.*((\\n{1,2}- .+)|(_.+_)|`.+`|\\n\\n---))?$/us',
81 matchDescription: '^[A-Z`].+(\\.|`.+`)$',
82 contexts: ['any'],
83 tags: {
84 param: true,
85 returns: true
86 }
87 }
88 ],
89 'jsdoc/no-types': 'error',
90 'jsdoc/require-jsdoc': [
91 'warn',
92 {
93 contexts: [
94 'ClassDeclaration',
95 'ClassProperty:not([accessibility=/(private|protected)/])',
96 'ExportNamedDeclaration:has(VariableDeclaration)',
97 'FunctionExpression',
98 'MethodDefinition:not([accessibility=/(private|protected)/]) > FunctionExpression',
99 'TSEnumDeclaration',
100 'TSInterfaceDeclaration',
101 'TSMethodSignature',
102 // 'TSPropertySignature',
103 'TSTypeAliasDeclaration'
104 ]
105 }
106 ],
107 'jsdoc/require-param-type': 'off',
108 'jsdoc/require-returns-type': 'off'
109 }
110 },
111 {
112 files: ['*.js'],
113 extends: 'plugin:node/recommended',
114 rules: {
115 '@typescript-eslint/no-unused-vars': 'off',
116 '@typescript-eslint/no-var-requires': 'off'
117 }
118 },
119 {
120 files: ['examples/typescript/**/*.ts'],
121 rules: {
122 'import/no-unresolved': 'off'
123 }
124 },
125 {
126 files: ['examples/**/*.js'],
127 rules: {
128 'node/no-missing-require': 'off'
129 }
130 }
131 ],
132 settings: {
133 jsdoc: {
134 mode: 'typescript'
135 }
136 }
137 }