refactor: use eslint plugin to sort imports
[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 rules: {
21 'sort-imports': [
22 'error',
23 {
24 ignoreDeclarationSort: true
25 }
26 ],
27 'import/order': 'error',
28
29 'spellcheck/spell-checker': [
30 'warn',
31 {
32 skipWords: [
33 'Benoit',
34 'benny',
35 'browserslist',
36 'builtins',
37 'christopher',
38 'cjs',
39 'comparator',
40 'cpu',
41 'cpus',
42 'ctx',
43 'deprecations',
44 'dequeue',
45 'ecma',
46 'enqueue',
47 'enum',
48 'errored',
49 'esm',
50 'fibonacci',
51 'fs',
52 'inheritDoc',
53 'jsdoc',
54 'microjob',
55 'mjs',
56 'num',
57 'os',
58 'piscina',
59 'pnpm',
60 'poolifier',
61 'poolify',
62 'readonly',
63 'resize',
64 'serializable',
65 'sinon',
66 'threadjs',
67 'threadwork',
68 'tsconfig',
69 'tsdoc',
70 'typedoc',
71 'unlink',
72 'unregister',
73 'utf8',
74 'workerpool',
75 'wwr'
76 ],
77 skipIfMatch: ['^@.*', '^plugin:.*']
78 }
79 ]
80 },
81 overrides: [
82 {
83 files: ['**/*.ts'],
84 plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
85 parser: '@typescript-eslint/parser',
86 parserOptions: {
87 project: './tsconfig.eslint.json'
88 },
89 extends: [
90 'plugin:@typescript-eslint/eslint-recommended',
91 'plugin:@typescript-eslint/recommended',
92 'plugin:@typescript-eslint/recommended-requiring-type-checking',
93 'plugin:import/typescript',
94 'standard-with-typescript'
95 ],
96 rules: {
97 '@typescript-eslint/no-inferrable-types': [
98 'error',
99 { ignoreProperties: true }
100 ],
101 'tsdoc/syntax': 'warn'
102 }
103 },
104 {
105 files: ['examples/typescript/**/*.ts'],
106 rules: {
107 'import/no-unresolved': 'off',
108 '@typescript-eslint/no-unsafe-argument': 'off',
109 '@typescript-eslint/no-unsafe-call': 'off',
110 '@typescript-eslint/no-unsafe-assignment': 'off'
111 }
112 },
113 {
114 files: ['**/*.js', '**/*.mjs'],
115 plugins: ['jsdoc'],
116 extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard']
117 },
118 {
119 files: ['tests/**/*.js'],
120 rules: {
121 'jsdoc/require-jsdoc': 'off'
122 }
123 },
124 {
125 files: ['tests/pools/selection-strategies/**/*.js'],
126 rules: {
127 'n/no-missing-require': 'off'
128 }
129 },
130 {
131 files: ['benchmarks/**/*.js'],
132 rules: {
133 'jsdoc/require-jsdoc': 'off'
134 }
135 },
136 {
137 files: ['benchmarks/versus-external-pools/**/*.js'],
138 rules: {
139 'n/no-missing-require': 'off'
140 }
141 },
142 {
143 files: ['examples/**/*.js'],
144 rules: {
145 'n/no-missing-require': 'off',
146 'jsdoc/require-jsdoc': 'off'
147 }
148 }
149 ]
150 })