Add a script to sync sonar properties
[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',
305aeaa7
JB
26 'plugin:import/recommended',
27 'plugin:jsdoc/recommended',
583a27ce 28 'plugin:promise/recommended',
6372ea67 29 'plugin:prettierx/standardx'
777b7824
S
30 ],
31 rules: {
32 'no-void': 'off',
33
fa699c42
JB
34 'sort-imports': [
35 'warn',
36 {
37 ignoreMemberSort: true,
50aa7901 38 ignoreDeclarationSort: true
fa699c42 39 }
5c5a1fb7
S
40 ],
41
42 'spellcheck/spell-checker': [
43 'warn',
44 {
45 skipWords: [
5c5a1fb7 46 'christopher',
74750c7f 47 'comparator',
5c5a1fb7 48 'ecma',
3832ad95 49 'enum',
a35560ba 50 'inheritdoc',
5c5a1fb7 51 'jsdoc',
a35560ba 52 'poolifier',
5c5a1fb7
S
53 'readonly',
54 'serializable',
55 'unregister',
56 'workerpool'
57 ],
58 skipIfMatch: ['^@.*', '^plugin:.*']
59 }
777b7824 60 ]
3c5eaeb9
JB
61 },
62 overrides: [
50eceb07 63 {
a17cc27a
JB
64 files: ['**/*.ts'],
65 extends: [
a17cc27a
JB
66 'plugin:@typescript-eslint/recommended',
67 'plugin:import/typescript'
68 ],
50eceb07 69 rules: {
a17cc27a
JB
70 // We have some intentionally empty functions
71 '@typescript-eslint/no-empty-function': 'off',
72
73 '@typescript-eslint/no-inferrable-types': [
74 'error',
75 { ignoreProperties: true }
76 ],
77
a35560ba
S
78 'no-useless-constructor': 'off',
79
3832ad95
S
80 'jsdoc/match-description': [
81 'warn',
82 {
90a9a10f
JB
83 // mainDescription:
84 // '/^[A-Z`].+?(\\.|:)(\\n\\n.*((\\n{1,2}- .+)|(_.+_)|`.+`|\\n\\n---))?$/us',
85 // matchDescription: '^[A-Z`].+(\\.|`.+`)$',
3832ad95
S
86 contexts: ['any'],
87 tags: {
88 param: true,
89 returns: true
90 }
91 }
92 ],
50eceb07 93 'jsdoc/no-types': 'error',
3832ad95
S
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 ],
50eceb07
S
111 'jsdoc/require-param-type': 'off',
112 'jsdoc/require-returns-type': 'off'
113 }
114 },
3c5eaeb9 115 {
e99dbb69 116 files: ['**/*.js'],
a17cc27a 117 extends: 'plugin:node/recommended'
fa699c42
JB
118 },
119 {
305aeaa7
JB
120 files: ['tests/**/*.js'],
121 rules: {
122 'jsdoc/require-jsdoc': 'off'
123 }
124 },
125 {
126 files: ['benchmarks/**/*.js'],
fa699c42 127 rules: {
a17cc27a 128 'jsdoc/require-jsdoc': 'off'
fa699c42 129 }
583a27ce
JB
130 },
131 {
132 files: ['examples/**/*.js'],
133 rules: {
305aeaa7
JB
134 'node/no-missing-require': 'off',
135 'jsdoc/require-jsdoc': 'off'
136 }
137 },
138 {
139 files: ['examples/typescript/**/*.ts'],
140 rules: {
141 'import/no-unresolved': 'off',
142 'jsdoc/require-jsdoc': 'off'
583a27ce 143 }
3c5eaeb9 144 }
3832ad95
S
145 ],
146 settings: {
147 jsdoc: {
148 mode: 'typescript'
149 }
150 }
6a6e81d0 151})