-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.mjs
More file actions
77 lines (73 loc) · 2.28 KB
/
eslint.config.mjs
File metadata and controls
77 lines (73 loc) · 2.28 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { existsSync, readdirSync } from 'node:fs';
import { resolve } from 'path';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
const tsProjectFiles = new Set([resolve(process.cwd(), 'tsconfig.json')]);
const testsConfigFile = resolve(process.cwd(), 'tsconfig.tests.json');
if (existsSync(testsConfigFile)) {
// Only include the tests config when it exists in the current workspace.
tsProjectFiles.add(testsConfigFile);
}
const packagesDir = resolve(process.cwd(), 'packages');
if (existsSync(packagesDir)) {
for (const entry of readdirSync(packagesDir, { withFileTypes: true })) {
if (!entry.isDirectory()) {
continue;
}
const pkgDir = resolve(packagesDir, entry.name);
const pkgConfig = resolve(pkgDir, 'tsconfig.json');
if (existsSync(pkgConfig)) {
tsProjectFiles.add(pkgConfig);
}
const pkgTestsConfig = resolve(pkgDir, 'tsconfig.tests.json');
if (existsSync(pkgTestsConfig)) {
tsProjectFiles.add(pkgTestsConfig);
}
}
}
const tsProjectFileList = Array.from(tsProjectFiles);
const sharedParserOptions = {
ecmaVersion: 2022,
sourceType: 'module',
project: tsProjectFileList,
tsconfigRootDir: process.cwd(),
};
export default [
{
ignores: [
'node_modules',
'dist',
'packages/*/node_modules',
'packages/*/dist',
'**/tests/generated/**',
'packages/sql-contract/src/**/*.d.ts',
],
},
{
files: ['**/*.ts'],
languageOptions: {
parser: typescriptParser,
parserOptions: sharedParserOptions,
},
plugins: {
'@typescript-eslint': typescriptEslint,
},
rules: {
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'class',
format: ['PascalCase'],
},
{
selector: 'function',
format: ['camelCase'],
},
{
selector: 'method',
format: ['camelCase'],
},
],
},
},
];