Commit | Line | Data |
---|---|---|
147d7c42 JB |
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' | |
97231086 | 5 | import perfectionist from 'eslint-plugin-perfectionist' |
147d7c42 | 6 | import globals from 'globals' |
42ae5f0f | 7 | import neostandard, { plugins } from 'neostandard' |
147d7c42 JB |
8 | |
9 | export default defineFlatConfig([ | |
10 | { | |
11 | ignores: ['docs/**', '**/dist/**', 'lib/**', 'outputs/**'], | |
12 | }, | |
13 | cspellConfigs.recommended, | |
14 | js.configs.recommended, | |
42ae5f0f JB |
15 | plugins.promise.configs['flat/recommended'], |
16 | ...plugins.n.configs['flat/mixed-esm-and-cjs'], | |
147d7c42 | 17 | jsdoc.configs['flat/recommended-typescript'], |
ed20267e JB |
18 | { |
19 | rules: { | |
fe6df285 JB |
20 | 'jsdoc/check-tag-names': [ |
21 | 'warn', | |
22 | { | |
fe6df285 | 23 | definedTags: ['defaultValue', 'experimental', 'typeParam'], |
97231086 | 24 | typed: true, |
fe6df285 JB |
25 | }, |
26 | ], | |
ed20267e JB |
27 | }, |
28 | }, | |
cf549e06 | 29 | ...plugins['typescript-eslint'].config( |
d234cbcb | 30 | { |
495c6451 JB |
31 | extends: [ |
32 | ...plugins['typescript-eslint'].configs.strictTypeChecked, | |
33 | ...plugins['typescript-eslint'].configs.stylisticTypeChecked, | |
34 | ], | |
d234cbcb JB |
35 | languageOptions: { |
36 | parserOptions: { | |
37 | projectService: true, | |
38 | tsconfigRootDir: import.meta.dirname, | |
39 | }, | |
6e5d7052 | 40 | }, |
495c6451 JB |
41 | }, |
42 | { | |
43 | files: ['**/*.js', '**/*.mjs', '**/*.cjs'], | |
44 | ...plugins['typescript-eslint'].configs.disableTypeChecked, | |
d234cbcb JB |
45 | } |
46 | ), | |
147d7c42 | 47 | { |
147d7c42 | 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', | |
01caf779 JB |
62 | ], |
63 | }, | |
64 | }, | |
65 | ], | |
147d7c42 JB |
66 | }, |
67 | }, | |
97231086 | 68 | perfectionist.configs['recommended-natural'], |
2d5b1257 | 69 | ...neostandard({ |
2d5b1257 JB |
70 | globals: { |
71 | ...globals.mocha, | |
72 | }, | |
97231086 | 73 | ts: true, |
2d5b1257 | 74 | }), |
147d7c42 JB |
75 | { |
76 | files: [ | |
77 | 'src/pools/selection-strategies/fair-share-worker-choice-strategy.ts', | |
78 | ], | |
79 | rules: { | |
80 | '@stylistic/operator-linebreak': 'off', | |
81 | }, | |
82 | }, | |
6e5d7052 | 83 | // examples specific configuration |
12c527c5 JB |
84 | { |
85 | files: ['examples/**/*.ts'], | |
86 | rules: { | |
97231086 JB |
87 | '@typescript-eslint/no-redundant-type-constituents': 'off', |
88 | '@typescript-eslint/no-unnecessary-type-assertion': 'off', | |
afe77cf7 | 89 | '@typescript-eslint/no-unsafe-argument': 'off', |
12c527c5 | 90 | '@typescript-eslint/no-unsafe-assignment': 'off', |
97231086 | 91 | '@typescript-eslint/no-unsafe-call': 'off', |
12c527c5 | 92 | '@typescript-eslint/no-unsafe-member-access': 'off', |
97231086 | 93 | '@typescript-eslint/no-unsafe-return': 'off', |
9aefa1a0 | 94 | '@typescript-eslint/restrict-template-expressions': 'off', |
97231086 | 95 | '@typescript-eslint/return-await': 'off', |
12c527c5 JB |
96 | }, |
97 | }, | |
147d7c42 | 98 | { |
937e8172 | 99 | files: ['examples/**/*.js', 'examples/**/*.cjs'], |
147d7c42 | 100 | rules: { |
97231086 | 101 | '@typescript-eslint/no-require-imports': 'off', |
54050139 JB |
102 | 'n/no-missing-import': [ |
103 | 'error', | |
104 | { | |
105 | allowModules: ['ws'], | |
106 | }, | |
107 | ], | |
147d7c42 JB |
108 | }, |
109 | }, | |
6e5d7052 | 110 | // benchmarks specific configuration |
147d7c42 | 111 | { |
937e8172 | 112 | files: ['benchmarks/**/*.cjs'], |
147d7c42 | 113 | rules: { |
937e8172 JB |
114 | '@typescript-eslint/no-require-imports': 'off', |
115 | }, | |
116 | }, | |
6e5d7052 | 117 | // tests specific configuration |
937e8172 JB |
118 | { |
119 | files: ['tests/**/*.js', 'tests/**/*.mjs', 'tests/**/*.cjs'], | |
120 | rules: { | |
147d7c42 | 121 | '@typescript-eslint/no-empty-function': 'off', |
97231086 | 122 | '@typescript-eslint/no-require-imports': 'off', |
147d7c42 JB |
123 | }, |
124 | }, | |
125 | ]) |