build(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'
5import nodePlugin from 'eslint-plugin-n'
6import simpleImportSort from 'eslint-plugin-simple-import-sort'
7import globals from 'globals'
8import neostandard from 'neostandard'
9// eslint-disable-next-line n/no-extraneous-import
10import tseslint from 'typescript-eslint'
11
12export 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'],
ed20267e
JB
20 {
21 rules: {
22 'jsdoc/check-tag-names': ['warn', { typed: true, definedTags: ['defaultValue', 'experimental', 'typeParam'] }],
23 },
24 },
6e5d7052
JB
25 ...tseslint.config(
26 ...tseslint.configs.strictTypeChecked,
27 ...tseslint.configs.stylisticTypeChecked
28 ),
147d7c42
JB
29 ...neostandard({
30 ts: true,
31 globals: {
32 ...globals.node,
33 ...globals.mocha,
34 },
35 }),
6e5d7052
JB
36 {
37 languageOptions: {
38 parserOptions: {
39 project: true,
40 tsconfigRootDir: import.meta.dirname,
41 },
42 },
43 },
147d7c42
JB
44 {
45 plugins: {
46 'simple-import-sort': simpleImportSort,
47 },
48 rules: {
01caf779
JB
49 '@cspell/spellchecker': [
50 'warn',
51 {
52 autoFix: true,
53 cspell: {
54 words: [
55 'Alessandro',
56 'Ardizio',
57 'Benoit',
58 'IWRR',
59 'Quadflieg',
60 'neostandard',
61 'poolifier',
62 'tseslint',
63 ],
64 },
65 },
66 ],
147d7c42
JB
67 'simple-import-sort/imports': 'error',
68 'simple-import-sort/exports': 'error',
69 },
70 },
71 {
72 files: [
73 'src/pools/selection-strategies/fair-share-worker-choice-strategy.ts',
74 ],
75 rules: {
76 '@stylistic/operator-linebreak': 'off',
77 },
78 },
e56903ca 79 {
6e5d7052
JB
80 files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
81 ...tseslint.configs.disableTypeChecked,
e56903ca 82 },
6e5d7052 83 // examples specific configuration
12c527c5
JB
84 {
85 files: ['examples/**/*.ts'],
86 rules: {
afe77cf7 87 '@typescript-eslint/no-unsafe-argument': 'off',
12c527c5 88 '@typescript-eslint/no-unsafe-call': 'off',
2c0d6220 89 '@typescript-eslint/no-unsafe-return': 'off',
12c527c5
JB
90 '@typescript-eslint/no-unsafe-assignment': 'off',
91 '@typescript-eslint/no-unsafe-member-access': 'off',
2c0d6220
JB
92 '@typescript-eslint/no-unnecessary-type-assertion': 'off',
93 '@typescript-eslint/no-redundant-type-constituents': 'off',
12c527c5
JB
94 },
95 },
147d7c42 96 {
937e8172 97 files: ['examples/**/*.js', 'examples/**/*.cjs'],
147d7c42 98 rules: {
54050139
JB
99 'n/no-missing-import': [
100 'error',
101 {
102 allowModules: ['ws'],
103 },
104 ],
147d7c42
JB
105 '@typescript-eslint/no-require-imports': 'off',
106 },
107 },
6e5d7052 108 // benchmarks specific configuration
147d7c42 109 {
937e8172 110 files: ['benchmarks/**/*.cjs'],
147d7c42 111 rules: {
937e8172
JB
112 '@typescript-eslint/no-require-imports': 'off',
113 },
114 },
6e5d7052 115 // tests specific configuration
937e8172
JB
116 {
117 files: ['tests/**/*.js', 'tests/**/*.mjs', 'tests/**/*.cjs'],
118 rules: {
119 '@typescript-eslint/no-require-imports': 'off',
147d7c42
JB
120 '@typescript-eslint/no-empty-function': 'off',
121 },
122 },
123])