Apply dependencies update. (#331)
[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 'plugin:prettierx/@typescript-eslint'
33 ],
34 rules: {
35 'no-void': 'off',
36
37 // We have some intentionally empty functions
38 '@typescript-eslint/no-empty-function': 'off',
39
40 '@typescript-eslint/no-inferrable-types': [
41 'error',
42 { ignoreProperties: true }
43 ],
44
45 'sort-imports': [
46 'warn',
47 {
48 ignoreMemberSort: true,
49 ignoreDeclarationSort: true
50 }
51 ],
52
53 'spellcheck/spell-checker': [
54 'warn',
55 {
56 skipWords: [
57 'christopher',
58 'comparator',
59 'ecma',
60 'enum',
61 'inheritdoc',
62 'jsdoc',
63 'pioardi',
64 'poolifier',
65 'readonly',
66 'serializable',
67 'unregister',
68 'workerpool'
69 ],
70 skipIfMatch: ['^@.*', '^plugin:.*']
71 }
72 ]
73 },
74 overrides: [
75 {
76 files: ['src/**/*.ts'],
77 extends: 'plugin:jsdoc/recommended',
78 rules: {
79 'no-useless-constructor': 'off',
80
81 'jsdoc/match-description': [
82 'warn',
83 {
84 mainDescription:
85 '/^[A-Z`].+?(\\.|:)(\\n\\n.*((\\n{1,2}- .+)|(_.+_)|`.+`|\\n\\n---))?$/us',
86 matchDescription: '^[A-Z`].+(\\.|`.+`)$',
87 contexts: ['any'],
88 tags: {
89 param: true,
90 returns: true
91 }
92 }
93 ],
94 'jsdoc/no-types': 'error',
95 'jsdoc/require-jsdoc': [
96 'warn',
97 {
98 contexts: [
99 'ClassDeclaration',
100 'ClassProperty:not([accessibility=/(private|protected)/])',
101 'ExportNamedDeclaration:has(VariableDeclaration)',
102 'FunctionExpression',
103 'MethodDefinition:not([accessibility=/(private|protected)/]) > FunctionExpression',
104 'TSEnumDeclaration',
105 'TSInterfaceDeclaration',
106 'TSMethodSignature',
107 // 'TSPropertySignature',
108 'TSTypeAliasDeclaration'
109 ]
110 }
111 ],
112 'jsdoc/require-param-type': 'off',
113 'jsdoc/require-returns-type': 'off'
114 }
115 },
116 {
117 files: ['*.js'],
118 extends: 'plugin:node/recommended',
119 rules: {
120 '@typescript-eslint/no-unused-vars': 'off',
121 '@typescript-eslint/no-var-requires': 'off'
122 }
123 },
124 {
125 files: ['examples/typescript/**/*.ts'],
126 rules: {
127 'import/no-unresolved': 'off'
128 }
129 },
130 {
131 files: ['examples/**/*.js'],
132 rules: {
133 'node/no-missing-require': 'off'
134 }
135 }
136 ],
137 settings: {
138 jsdoc: {
139 mode: 'typescript'
140 }
141 }
142 })