-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patheslint.config.base.mjs
More file actions
52 lines (49 loc) · 1.54 KB
/
eslint.config.base.mjs
File metadata and controls
52 lines (49 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintConfigPrettier from 'eslint-config-prettier';
import globals from 'globals';
/**
* Base ESLint flat config for TypeScript packages (gateway, logger)
* @param {string} tsconfigPath - Path to tsconfig.eslint.json
* @param {string} tsconfigRootDir - Root directory for tsconfig resolution (use import.meta.dirname)
* @param {object} options - Additional options
* @param {string[]} [options.ignores] - Additional patterns to ignore
*/
export function createBaseConfig(tsconfigPath, tsconfigRootDir, options = {}) {
const ignores = [
'node_modules/**',
'dist/**',
'build/**',
'**/*.js',
'**/*.mjs',
...(options.ignores || []),
];
return tseslint.config(
{ ignores },
eslint.configs.recommended,
...tseslint.configs.recommended,
{
files: ['**/*.ts'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: tsconfigPath,
tsconfigRootDir,
sourceType: 'module',
},
globals: { ...globals.node, ...globals.es2020 },
},
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
},
},
eslintConfigPrettier,
);
}
export { eslint, tseslint, eslintConfigPrettier, globals };