chore: bump volta node version
[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'],
6e5d7052
JB
20 ...tseslint.config(
21 ...tseslint.configs.strictTypeChecked,
22 ...tseslint.configs.stylisticTypeChecked
23 ),
147d7c42
JB
24 ...neostandard({
25 ts: true,
26 globals: {
27 ...globals.node,
28 ...globals.mocha,
29 },
30 }),
6e5d7052
JB
31 {
32 languageOptions: {
33 parserOptions: {
34 project: true,
35 tsconfigRootDir: import.meta.dirname,
36 },
37 },
38 },
147d7c42
JB
39 {
40 plugins: {
41 'simple-import-sort': simpleImportSort,
42 },
43 rules: {
01caf779
JB
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 ],
147d7c42
JB
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 },
e56903ca 74 {
6e5d7052
JB
75 files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
76 ...tseslint.configs.disableTypeChecked,
e56903ca 77 },
6e5d7052 78 // examples specific configuration
12c527c5
JB
79 {
80 files: ['examples/**/*.ts'],
81 rules: {
afe77cf7 82 '@typescript-eslint/no-unsafe-argument': 'off',
12c527c5 83 '@typescript-eslint/no-unsafe-call': 'off',
2c0d6220 84 '@typescript-eslint/no-unsafe-return': 'off',
12c527c5
JB
85 '@typescript-eslint/no-unsafe-assignment': 'off',
86 '@typescript-eslint/no-unsafe-member-access': 'off',
2c0d6220
JB
87 '@typescript-eslint/no-unnecessary-type-assertion': 'off',
88 '@typescript-eslint/no-redundant-type-constituents': 'off',
12c527c5
JB
89 },
90 },
147d7c42 91 {
937e8172 92 files: ['examples/**/*.js', 'examples/**/*.cjs'],
147d7c42 93 rules: {
54050139
JB
94 'n/no-missing-import': [
95 'error',
96 {
97 allowModules: ['ws'],
98 },
99 ],
147d7c42
JB
100 '@typescript-eslint/no-require-imports': 'off',
101 },
102 },
6e5d7052 103 // benchmarks specific configuration
147d7c42 104 {
937e8172 105 files: ['benchmarks/**/*.cjs'],
147d7c42 106 rules: {
937e8172
JB
107 '@typescript-eslint/no-require-imports': 'off',
108 },
109 },
6e5d7052 110 // tests specific configuration
937e8172
JB
111 {
112 files: ['tests/**/*.js', 'tests/**/*.mjs', 'tests/**/*.cjs'],
113 rules: {
114 '@typescript-eslint/no-require-imports': 'off',
147d7c42
JB
115 '@typescript-eslint/no-empty-function': 'off',
116 },
117 },
118])