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