forked from xtermjs/xterm.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.naming.mjs
More file actions
71 lines (67 loc) · 2.35 KB
/
Copy patheslint.config.naming.mjs
File metadata and controls
71 lines (67 loc) · 2.35 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
// @ts-check
import tseslint from 'typescript-eslint';
const ignores = [
'addons/*/src/third-party/*.ts',
'**/out/*',
'**/out-test/*',
'**/out-esbuild/*',
'**/out-esbuild-test/*',
'**/inwasm-sdks/*',
'**/node_modules',
'**/*.js',
'**/*.mjs'
];
const namingConventionMain = [
'warn',
{ selector: 'default', format: ['camelCase'], filter: { regex: '^[a-z]', match: true } },
{ selector: 'variable', format: ['camelCase', 'UPPER_CASE'] },
{ selector: 'variable', filter: '^I.+Service$', format: ['PascalCase'], prefix: ['I'] },
{ selector: 'memberLike', modifiers: ['private'], format: ['camelCase'], leadingUnderscore: 'require' },
{ selector: 'memberLike', modifiers: ['protected'], format: ['camelCase'], leadingUnderscore: 'require' },
{ selector: 'enumMember', format: ['UPPER_CASE'] },
{ selector: 'property', modifiers: ['public'], format: ['camelCase', 'UPPER_CASE'], filter: { regex: '^[a-z]', match: true } },
{ selector: 'method', modifiers: ['public'], format: ['camelCase', 'UPPER_CASE'], custom: { regex: '^on[A-Z].+', match: false } },
{ selector: 'method', modifiers: ['private'], format: ['camelCase'], leadingUnderscore: 'require', custom: { regex: '^on[A-Z].+', match: false } },
{ selector: 'method', modifiers: ['protected'], format: ['camelCase'], leadingUnderscore: 'require', custom: { regex: '^on[A-Z].+', match: false } },
{ selector: 'typeLike', format: ['PascalCase'] },
{ selector: 'interface', format: ['PascalCase'], prefix: ['I'] }
];
const namingConventionTypings = [
'warn',
{ selector: 'typeLike', format: ['PascalCase'] },
{ selector: 'interface', format: ['PascalCase'], prefix: ['I'] }
];
export default tseslint.config(
{
ignores
},
{
files: ['**/*.ts'],
ignores: ['typings/**/*.d.ts', 'addons/**/typings/**'],
plugins: {
'@typescript-eslint': tseslint.plugin
},
languageOptions: {
parser: tseslint.parser,
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname
}
},
rules: {
'@typescript-eslint/naming-convention': namingConventionMain
}
},
{
files: ['typings/**/*.d.ts'],
plugins: {
'@typescript-eslint': tseslint.plugin
},
languageOptions: {
parser: tseslint.parser
},
rules: {
'@typescript-eslint/naming-convention': namingConventionTypings
}
}
);