This repository has been archived by the owner on May 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
.eslintrc.js
142 lines (123 loc) · 3.53 KB
/
.eslintrc.js
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/**
* Copyright (c) 2022, Oracle and/or its affiliates.
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
*/
// eslint-disable-next-line import/no-extraneous-dependencies
const baseStyleRules = require('eslint-config-airbnb-base/rules/style').rules;
const dangleRules = baseStyleRules['no-underscore-dangle'];
module.exports = {
env: {
browser: true,
// es2021: true, // Environment key "es2021" is unknown
node: true,
},
extends: [
'eslint-config-airbnb-base',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 12,
sourceType: 'module',
},
plugins: [
'@typescript-eslint',
'header',
],
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.component'],
},
},
},
// rules for all files (*.ts are overritten below)
//
rules: {
'linebreak-style': 0,
// our own rules
'no-empty-function': ['error', { allow: ['constructors'] }],
'@typescript-eslint/naming-convention': 'warn',
'header/header': [
2,
'block',
[
'*',
{
pattern: ' \\* Copyright \\(c\\) (\\d{4}, )+Oracle and/or its affiliates\\.',
},
' * Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/',
' ',
],
],
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'class-methods-use-this': 'off',
'no-underscore-dangle': [
dangleRules[0],
{
...dangleRules[1],
},
],
'import/default': 'error',
'import/namespace': 'error',
'import/imports-first': 'error',
},
overrides: [
{
files: ['*.ts'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
rules: {
'linebreak-style': 0,
'no-unused-vars': ['error', { vars: 'all', args: 'none', ignoreRestSiblings: true }],
'no-useless-constructor': 'off',
// IMPORT
'import/prefer-default-export': 'off',
// TYPESCRIPT
'@typescript-eslint/adjacent-overload-signatures': 'error',
// '@typescript-eslint/class-name-casing': 'error', // no longer valid
'@typescript-eslint/member-delimiter-style': 'error',
'@typescript-eslint/member-ordering': [
'error',
{
default: [
'public-field',
'private-field',
'constructor',
'public-method',
'private-method',
],
},
],
'@typescript-eslint/no-array-constructor': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{ vars: 'all', args: 'none', ignoreRestSiblings: true },
],
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'variable',
format: [],
},
],
},
},
],
};