Instrument the code at development build for istanbul (#347)
[poolifier.git] / .eslintrc.js
CommitLineData
6a6e81d0
S
1// @ts-check
2const { defineConfig } = require('eslint-define-config')
3
4module.exports = defineConfig({
777b7824
S
5 env: {
6 es2021: true,
7 node: true,
8 mocha: true
9 },
10 parser: '@typescript-eslint/parser',
11 parserOptions: {
fa699c42 12 ecmaVersion: 2020,
e06dcd52
S
13 sourceType: 'module',
14 warnOnUnsupportedTypeScriptVersion: false
777b7824 15 },
5c5a1fb7
S
16 plugins: [
17 '@typescript-eslint',
18 'promise',
19 'prettierx',
20 'jsdoc',
21 'spellcheck'
22 ],
777b7824
S
23 extends: [
24 'standard',
25 'eslint:recommended',
26 'plugin:@typescript-eslint/recommended',
fa699c42
JB
27 'plugin:import/errors',
28 'plugin:import/warnings',
29 'plugin:import/typescript',
583a27ce 30 'plugin:promise/recommended',
777b7824 31 'plugin:prettierx/standardx',
583a27ce 32 'plugin:prettierx/@typescript-eslint'
777b7824
S
33 ],
34 rules: {
35 'no-void': 'off',
36
777b7824
S
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 }
fa699c42
JB
43 ],
44
45 'sort-imports': [
46 'warn',
47 {
48 ignoreMemberSort: true,
50aa7901 49 ignoreDeclarationSort: true
fa699c42 50 }
5c5a1fb7
S
51 ],
52
53 'spellcheck/spell-checker': [
54 'warn',
55 {
56 skipWords: [
5c5a1fb7 57 'christopher',
74750c7f 58 'comparator',
5c5a1fb7 59 'ecma',
3832ad95 60 'enum',
a35560ba 61 'inheritdoc',
5c5a1fb7 62 'jsdoc',
3832ad95 63 'pioardi',
a35560ba 64 'poolifier',
5c5a1fb7
S
65 'readonly',
66 'serializable',
67 'unregister',
68 'workerpool'
69 ],
70 skipIfMatch: ['^@.*', '^plugin:.*']
71 }
777b7824 72 ]
3c5eaeb9
JB
73 },
74 overrides: [
50eceb07
S
75 {
76 files: ['src/**/*.ts'],
77 extends: 'plugin:jsdoc/recommended',
78 rules: {
a35560ba
S
79 'no-useless-constructor': 'off',
80
3832ad95
S
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 ],
50eceb07 94 'jsdoc/no-types': 'error',
3832ad95
S
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 ],
50eceb07
S
112 'jsdoc/require-param-type': 'off',
113 'jsdoc/require-returns-type': 'off'
114 }
115 },
3c5eaeb9
JB
116 {
117 files: ['*.js'],
583a27ce 118 extends: 'plugin:node/recommended',
3c5eaeb9 119 rules: {
fa699c42 120 '@typescript-eslint/no-unused-vars': 'off',
3c5eaeb9
JB
121 '@typescript-eslint/no-var-requires': 'off'
122 }
fa699c42
JB
123 },
124 {
583a27ce 125 files: ['examples/typescript/**/*.ts'],
fa699c42
JB
126 rules: {
127 'import/no-unresolved': 'off'
128 }
583a27ce
JB
129 },
130 {
131 files: ['examples/**/*.js'],
132 rules: {
133 'node/no-missing-require': 'off'
134 }
3c5eaeb9 135 }
3832ad95
S
136 ],
137 settings: {
138 jsdoc: {
139 mode: 'typescript'
140 }
141 }
6a6e81d0 142})