Fix GitHub actions run
[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:import/errors',
27 'plugin:import/warnings',
28 'plugin:promise/recommended',
29 'plugin:prettierx/standardx'
30 ],
31 rules: {
32 'no-void': 'off',
33
34 'sort-imports': [
35 'warn',
36 {
37 ignoreMemberSort: true,
38 ignoreDeclarationSort: true
39 }
40 ],
41
42 'spellcheck/spell-checker': [
43 'warn',
44 {
45 skipWords: [
46 'christopher',
47 'comparator',
48 'ecma',
49 'enum',
50 'inheritdoc',
51 'jsdoc',
52 'poolifier',
53 'readonly',
54 'serializable',
55 'unregister',
56 'workerpool'
57 ],
58 skipIfMatch: ['^@.*', '^plugin:.*']
59 }
60 ]
61 },
62 overrides: [
63 {
64 files: ['**/*.ts'],
65 extends: [
66 'plugin:jsdoc/recommended',
67 'plugin:@typescript-eslint/recommended',
68 'plugin:import/typescript'
69 ],
70 rules: {
71 // We have some intentionally empty functions
72 '@typescript-eslint/no-empty-function': 'off',
73
74 '@typescript-eslint/no-inferrable-types': [
75 'error',
76 { ignoreProperties: true }
77 ],
78
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 },
120 {
121 files: ['examples/typescript/**/*.ts'],
122 rules: {
123 'import/no-unresolved': 'off',
124 'jsdoc/require-jsdoc': 'off'
125 }
126 },
127 {
128 files: ['examples/**/*.js'],
129 rules: {
130 'node/no-missing-require': 'off'
131 }
132 }
133 ],
134 settings: {
135 jsdoc: {
136 mode: 'typescript'
137 }
138 }
139 })