Merge dependabot/npm_and_yarn/examples/typescript/http-server-pool/fastify-cluster...
[poolifier.git] / eslint.config.js
1 import cspellConfigs from '@cspell/eslint-plugin/configs'
2 import js from '@eslint/js'
3 import { defineFlatConfig } from 'eslint-define-config'
4 import jsdoc from 'eslint-plugin-jsdoc'
5 import nodePlugin from 'eslint-plugin-n'
6 import simpleImportSort from 'eslint-plugin-simple-import-sort'
7 import globals from 'globals'
8 import neostandard from 'neostandard'
9 // eslint-disable-next-line n/no-extraneous-import
10 import tseslint from 'typescript-eslint'
11
12 export 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'],
20 {
21 rules: {
22 'jsdoc/check-tag-names': ['warn', { typed: true, definedTags: ['defaultValue', 'experimental', 'typeParam'] }],
23 },
24 },
25 ...tseslint.config(
26 ...tseslint.configs.strictTypeChecked,
27 ...tseslint.configs.stylisticTypeChecked
28 ),
29 ...neostandard({
30 ts: true,
31 globals: {
32 ...globals.node,
33 ...globals.mocha,
34 },
35 }),
36 {
37 languageOptions: {
38 parserOptions: {
39 project: true,
40 tsconfigRootDir: import.meta.dirname,
41 },
42 },
43 },
44 {
45 plugins: {
46 'simple-import-sort': simpleImportSort,
47 },
48 rules: {
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 ],
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 },
79 {
80 files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
81 ...tseslint.configs.disableTypeChecked,
82 },
83 // examples specific configuration
84 {
85 files: ['examples/**/*.ts'],
86 rules: {
87 '@typescript-eslint/no-unsafe-argument': 'off',
88 '@typescript-eslint/no-unsafe-call': 'off',
89 '@typescript-eslint/no-unsafe-return': 'off',
90 '@typescript-eslint/no-unsafe-assignment': 'off',
91 '@typescript-eslint/no-unsafe-member-access': 'off',
92 '@typescript-eslint/no-unnecessary-type-assertion': 'off',
93 '@typescript-eslint/no-redundant-type-constituents': 'off',
94 },
95 },
96 {
97 files: ['examples/**/*.js', 'examples/**/*.cjs'],
98 rules: {
99 'n/no-missing-import': [
100 'error',
101 {
102 allowModules: ['ws'],
103 },
104 ],
105 '@typescript-eslint/no-require-imports': 'off',
106 },
107 },
108 // benchmarks specific configuration
109 {
110 files: ['benchmarks/**/*.cjs'],
111 rules: {
112 '@typescript-eslint/no-require-imports': 'off',
113 },
114 },
115 // tests specific configuration
116 {
117 files: ['tests/**/*.js', 'tests/**/*.mjs', 'tests/**/*.cjs'],
118 rules: {
119 '@typescript-eslint/no-require-imports': 'off',
120 '@typescript-eslint/no-empty-function': 'off',
121 },
122 },
123 ])