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