build: reenable eslint type checking
[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
JB
78 // examples specific configuration
79 // {
80 // files: ['examples/**/*.ts'],
81 // rules: {
82 // 'no-undef': 'off',
83 // },
84 // },
147d7c42 85 {
937e8172 86 files: ['examples/**/*.js', 'examples/**/*.cjs'],
147d7c42 87 rules: {
54050139
JB
88 'n/no-missing-import': [
89 'error',
90 {
91 allowModules: ['ws'],
92 },
93 ],
147d7c42
JB
94 '@typescript-eslint/no-require-imports': 'off',
95 },
96 },
6e5d7052 97 // benchmarks specific configuration
147d7c42 98 {
937e8172 99 files: ['benchmarks/**/*.cjs'],
147d7c42 100 rules: {
937e8172
JB
101 '@typescript-eslint/no-require-imports': 'off',
102 },
103 },
6e5d7052 104 // tests specific configuration
937e8172
JB
105 {
106 files: ['tests/**/*.js', 'tests/**/*.mjs', 'tests/**/*.cjs'],
107 rules: {
108 '@typescript-eslint/no-require-imports': 'off',
147d7c42
JB
109 '@typescript-eslint/no-empty-function': 'off',
110 },
111 },
112])