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