fix: fix ESM and CommonJS exports
[poolifier.git] / .eslintrc.js
1 // @ts-check
2 const { defineConfig } = require('eslint-define-config')
3
4 module.exports = defineConfig({
5 root: true,
6 env: {
7 es2022: true,
8 node: true,
9 mocha: true
10 },
11 parserOptions: {
12 ecmaVersion: 2022,
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 'esm',
46 'fibonacci',
47 'fs',
48 'inheritDoc',
49 'jsdoc',
50 'microjob',
51 'mjs',
52 'num',
53 'os',
54 'piscina',
55 'poolifier',
56 'poolify',
57 'readonly',
58 'serializable',
59 'sinon',
60 'threadjs',
61 'threadwork',
62 'tsconfig',
63 'tsdoc',
64 'typedoc',
65 'unlink',
66 'unregister',
67 'utf8',
68 'workerpool'
69 ],
70 skipIfMatch: ['^@.*', '^plugin:.*']
71 }
72 ]
73 },
74 overrides: [
75 {
76 files: ['**/*.ts'],
77 plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
78 parser: '@typescript-eslint/parser',
79 parserOptions: {
80 project: './tsconfig.json'
81 },
82 extends: [
83 'plugin:@typescript-eslint/eslint-recommended',
84 'plugin:@typescript-eslint/recommended',
85 'plugin:@typescript-eslint/recommended-requiring-type-checking',
86 'plugin:import/typescript',
87 'standard-with-typescript'
88 ],
89 rules: {
90 '@typescript-eslint/no-inferrable-types': [
91 'error',
92 { ignoreProperties: true }
93 ],
94 'tsdoc/syntax': 'error'
95 }
96 },
97 {
98 files: ['examples/typescript/**/*.ts'],
99 rules: {
100 'import/no-unresolved': 'off',
101 '@typescript-eslint/no-unsafe-argument': 'off',
102 '@typescript-eslint/no-unsafe-call': 'off',
103 '@typescript-eslint/no-unsafe-assignment': 'off'
104 }
105 },
106 {
107 files: ['**/*.js'],
108 plugins: ['jsdoc'],
109 extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard']
110 },
111 {
112 files: ['tests/**/*.js'],
113 rules: {
114 'jsdoc/require-jsdoc': 'off'
115 }
116 },
117 {
118 files: ['tests/pools/selection-strategies/**/*.js'],
119 rules: {
120 'n/no-missing-require': 'off'
121 }
122 },
123 {
124 files: ['benchmarks/**/*.js'],
125 rules: {
126 'jsdoc/require-jsdoc': 'off'
127 }
128 },
129 {
130 files: ['benchmarks/versus-external-pools/**/*.js'],
131 rules: {
132 'n/no-missing-require': 'off'
133 }
134 },
135 {
136 files: ['examples/**/*.js'],
137 rules: {
138 'n/no-missing-require': 'off',
139 'jsdoc/require-jsdoc': 'off'
140 }
141 }
142 ]
143 })