chore: v4.0.14
[poolifier.git] / eslint.config.js
1 import cspellConfigs from '@cspell/eslint-plugin/configs'
2 import js from '@eslint/js'
3 import { defineFlatConfig } from 'eslint-define-config'
4 import jsdoc from 'eslint-plugin-jsdoc'
5 import nodePlugin from 'eslint-plugin-n'
6 import simpleImportSort from 'eslint-plugin-simple-import-sort'
7 import globals from 'globals'
8 import neostandard from 'neostandard'
9 // eslint-disable-next-line n/no-extraneous-import
10 import tseslint from 'typescript-eslint'
11
12 export default defineFlatConfig([
13 {
14 ignores: ['docs/**', '**/dist/**', 'lib/**', 'outputs/**'],
15 },
16 cspellConfigs.recommended,
17 js.configs.recommended,
18 ...nodePlugin.configs['flat/mixed-esm-and-cjs'],
19 jsdoc.configs['flat/recommended-typescript'],
20 ...tseslint.config(
21 ...tseslint.configs.strictTypeChecked,
22 ...tseslint.configs.stylisticTypeChecked
23 ),
24 ...neostandard({
25 ts: true,
26 globals: {
27 ...globals.node,
28 ...globals.mocha,
29 },
30 }),
31 {
32 languageOptions: {
33 parserOptions: {
34 project: true,
35 tsconfigRootDir: import.meta.dirname,
36 },
37 },
38 },
39 {
40 plugins: {
41 'simple-import-sort': simpleImportSort,
42 },
43 rules: {
44 '@cspell/spellchecker': [
45 'warn',
46 {
47 autoFix: true,
48 cspell: {
49 words: [
50 'Alessandro',
51 'Ardizio',
52 'Benoit',
53 'IWRR',
54 'Quadflieg',
55 'neostandard',
56 'poolifier',
57 'tseslint',
58 ],
59 },
60 },
61 ],
62 'simple-import-sort/imports': 'error',
63 'simple-import-sort/exports': 'error',
64 },
65 },
66 {
67 files: [
68 'src/pools/selection-strategies/fair-share-worker-choice-strategy.ts',
69 ],
70 rules: {
71 '@stylistic/operator-linebreak': 'off',
72 },
73 },
74 {
75 files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
76 ...tseslint.configs.disableTypeChecked,
77 },
78 // examples specific configuration
79 {
80 files: ['examples/**/*.ts'],
81 rules: {
82 '@typescript-eslint/no-unsafe-argument': 'off',
83 '@typescript-eslint/no-unsafe-call': 'off',
84 '@typescript-eslint/no-unsafe-return': 'off',
85 '@typescript-eslint/no-unsafe-assignment': 'off',
86 '@typescript-eslint/no-unsafe-member-access': 'off',
87 '@typescript-eslint/no-unnecessary-type-assertion': 'off',
88 '@typescript-eslint/no-redundant-type-constituents': 'off',
89 },
90 },
91 {
92 files: ['examples/**/*.js', 'examples/**/*.cjs'],
93 rules: {
94 'n/no-missing-import': [
95 'error',
96 {
97 allowModules: ['ws'],
98 },
99 ],
100 '@typescript-eslint/no-require-imports': 'off',
101 },
102 },
103 // benchmarks specific configuration
104 {
105 files: ['benchmarks/**/*.cjs'],
106 rules: {
107 '@typescript-eslint/no-require-imports': 'off',
108 },
109 },
110 // tests specific configuration
111 {
112 files: ['tests/**/*.js', 'tests/**/*.mjs', 'tests/**/*.cjs'],
113 rules: {
114 '@typescript-eslint/no-require-imports': 'off',
115 '@typescript-eslint/no-empty-function': 'off',
116 },
117 },
118 ])