Cleanup eslint rules
[poolifier.git] / .eslintrc.js
... / ...
CommitLineData
1// @ts-check
2const { defineConfig } = require('eslint-define-config')
3
4module.exports = defineConfig({
5 root: true,
6 env: {
7 es2021: true,
8 node: true,
9 mocha: true
10 },
11 parserOptions: {
12 ecmaVersion: 2021,
13 sourceType: 'module'
14 },
15 plugins: ['promise', 'spellcheck'],
16 extends: [
17 'eslint:recommended',
18 'plugin:import/recommended',
19 'plugin:promise/recommended'
20 ],
21 rules: {
22 'sort-imports': [
23 'warn',
24 {
25 ignoreMemberSort: true,
26 ignoreDeclarationSort: true
27 }
28 ],
29
30 'spellcheck/spell-checker': [
31 'warn',
32 {
33 skipWords: [
34 'benny',
35 'browserslist',
36 'builtins',
37 'christopher',
38 'cjs',
39 'comparator',
40 'cpu',
41 'cpus',
42 'ctx',
43 'ecma',
44 'enum',
45 'fibonacci',
46 'fs',
47 'inheritDoc',
48 'jsdoc',
49 'microjob',
50 'num',
51 'os',
52 'piscina',
53 'poolifier',
54 'poolify',
55 'readonly',
56 'serializable',
57 'sinon',
58 'threadjs',
59 'threadwork',
60 'tsconfig',
61 'tsdoc',
62 'typedoc',
63 'unlink',
64 'unregister',
65 'utf8',
66 'workerpool'
67 ],
68 skipIfMatch: ['^@.*', '^plugin:.*']
69 }
70 ]
71 },
72 overrides: [
73 {
74 files: ['**/*.ts'],
75 plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
76 parser: '@typescript-eslint/parser',
77 parserOptions: {
78 project: './tsconfig.json'
79 },
80 extends: [
81 'plugin:@typescript-eslint/eslint-recommended',
82 'plugin:@typescript-eslint/recommended',
83 'plugin:@typescript-eslint/recommended-requiring-type-checking',
84 'standard-with-typescript',
85 'plugin:import/typescript'
86 ],
87 rules: {
88 // We have some intentionally empty functions
89 '@typescript-eslint/no-empty-function': 'off',
90
91 '@typescript-eslint/no-inferrable-types': [
92 'error',
93 { ignoreProperties: true }
94 ],
95
96 'no-useless-constructor': 'off',
97
98 'tsdoc/syntax': 'error'
99 }
100 },
101 {
102 files: ['examples/typescript/**/*.ts'],
103 rules: {
104 'import/no-unresolved': 'off',
105 '@typescript-eslint/no-unsafe-argument': 'off',
106 '@typescript-eslint/no-unsafe-call': 'off',
107 '@typescript-eslint/no-unsafe-assignment': 'off'
108 }
109 },
110 {
111 files: ['**/*.js'],
112 plugins: ['jsdoc'],
113 extends: ['plugin:n/recommended', 'standard', 'plugin:jsdoc/recommended']
114 },
115 {
116 files: ['tests/**/*.js'],
117 rules: {
118 'jsdoc/require-jsdoc': 'off'
119 }
120 },
121 {
122 files: ['tests/pools/selection-strategies/**/*.js'],
123 rules: {
124 'n/no-missing-require': 'off'
125 }
126 },
127 {
128 files: ['benchmarks/**/*.js'],
129 rules: {
130 'jsdoc/require-jsdoc': 'off'
131 }
132 },
133 {
134 files: ['benchmarks/versus-external-pools/**/*.js'],
135 rules: {
136 'n/no-missing-require': 'off'
137 }
138 },
139 {
140 files: ['examples/**/*.js'],
141 rules: {
142 'n/no-missing-require': 'off',
143 'jsdoc/require-jsdoc': 'off'
144 }
145 }
146 ]
147})