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