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