refactor: move javascript examples in their own folder
[poolifier.git] / .eslintrc.js
1 const { defineConfig } = require('eslint-define-config')
2
3 module.exports = defineConfig({
4 root: true,
5 env: {
6 es2022: true,
7 node: true,
8 mocha: true
9 },
10 parserOptions: {
11 ecmaVersion: 2022,
12 sourceType: 'module'
13 },
14 plugins: ['promise', 'spellcheck'],
15 extends: [
16 'eslint:recommended',
17 'plugin:import/recommended',
18 'plugin:promise/recommended'
19 ],
20 settings: {
21 'import/resolver': {
22 typescript: {
23 project: './tsconfig.eslint.json'
24 }
25 }
26 },
27 rules: {
28 'sort-imports': [
29 'error',
30 {
31 ignoreDeclarationSort: true
32 }
33 ],
34 'import/order': 'error',
35
36 'spellcheck/spell-checker': [
37 'warn',
38 {
39 skipWords: [
40 'benoit',
41 'benny',
42 'browserslist',
43 'builtins',
44 'christopher',
45 'cjs',
46 'cloneable',
47 'comparator',
48 'cpu',
49 'cpus',
50 'ctx',
51 'deprecations',
52 'dequeue',
53 'dequeued',
54 'ecma',
55 'elu',
56 'enqueue',
57 'enum',
58 'errored',
59 'esm',
60 'fibonacci',
61 'fs',
62 'inheritDoc',
63 'jsdoc',
64 'microjob',
65 'mjs',
66 'num',
67 'os',
68 'perf',
69 'piscina',
70 'pnpm',
71 'poolifier',
72 'poolify',
73 'readonly',
74 'resize',
75 'sinon',
76 'threadjs',
77 'threadwork',
78 'tinypool',
79 'tsconfig',
80 'tsdoc',
81 'typedoc',
82 'unlink',
83 'unref',
84 'unregister',
85 'utf8',
86 'workerpool',
87 'wwr'
88 ],
89 skipIfMatch: ['^@.*', '^plugin:.*']
90 }
91 ]
92 },
93 overrides: [
94 {
95 files: ['**/*.ts'],
96 plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
97 parser: '@typescript-eslint/parser',
98 parserOptions: {
99 project: './tsconfig.eslint.json'
100 },
101 extends: [
102 'plugin:@typescript-eslint/recommended',
103 'plugin:@typescript-eslint/recommended-requiring-type-checking',
104 'plugin:import/typescript',
105 'standard-with-typescript'
106 ],
107 rules: {
108 '@typescript-eslint/no-inferrable-types': [
109 'error',
110 { ignoreProperties: true }
111 ],
112 'tsdoc/syntax': 'warn'
113 }
114 },
115 {
116 files: ['examples/typescript/**/*.ts'],
117 rules: {
118 'import/no-unresolved': 'off',
119 '@typescript-eslint/no-unsafe-argument': 'off',
120 '@typescript-eslint/no-unsafe-call': 'off',
121 '@typescript-eslint/no-unsafe-assignment': 'off',
122 '@typescript-eslint/no-unsafe-member-access': 'off',
123 '@typescript-eslint/no-unnecessary-type-assertion': 'off',
124 '@typescript-eslint/restrict-template-expressions': 'off'
125 }
126 },
127 {
128 files: ['**/*.js', '**/*.mjs'],
129 plugins: ['jsdoc'],
130 extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard']
131 },
132 {
133 files: ['tests/**/*.js'],
134 rules: {
135 'jsdoc/require-jsdoc': 'off'
136 }
137 },
138 {
139 files: ['tests/pools/selection-strategies/**/*.js'],
140 rules: {
141 'n/no-missing-require': 'off'
142 }
143 },
144 {
145 files: ['benchmarks/**/*.js', 'benchmarks/**/*.mjs'],
146 rules: {
147 'jsdoc/require-jsdoc': 'off'
148 }
149 },
150 {
151 files: ['benchmarks/versus-external-pools/**/*.js'],
152 rules: {
153 'n/no-missing-require': 'off'
154 }
155 },
156 {
157 files: ['benchmarks/versus-external-pools/**/*.mjs'],
158 rules: {
159 'n/no-missing-import': 'off',
160 'import/no-unresolved': 'off'
161 }
162 },
163 {
164 files: ['examples/javascript/**/*.js'],
165 rules: {
166 'n/no-missing-require': 'off',
167 'jsdoc/require-jsdoc': 'off'
168 }
169 }
170 ]
171 })