Skip to content

Commit caab6a5

Browse files
chore: update linters and add react hooks eslint rule (#489)
1 parent 2297706 commit caab6a5

File tree

3 files changed

+57
-59
lines changed

3 files changed

+57
-59
lines changed

.eslintrc.js

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ module.exports = {
55
extends: [
66
'plugin:@typescript-eslint/recommended',
77
'plugin:@typescript-eslint/recommended-requiring-type-checking',
8-
'plugin:react/recommended'
8+
'plugin:react/recommended',
9+
'prettier'
910
],
1011
parser: '@typescript-eslint/parser',
1112
parserOptions: {
1213
project: 'tsconfig.json',
1314
sourceType: 'module'
1415
},
15-
plugins: ['@typescript-eslint', '@typescript-eslint/tslint', 'prefer-arrow'],
16+
plugins: ['@typescript-eslint', '@typescript-eslint/tslint', 'prefer-arrow', 'react-hooks'],
1617
settings: {
1718
react: {
1819
version: 'detect'
@@ -64,45 +65,31 @@ module.exports = {
6465
'@typescript-eslint/triple-slash-reference': 'error',
6566
'@typescript-eslint/type-annotation-spacing': 'off',
6667
'@typescript-eslint/unified-signatures': 'error',
67-
'arrow-parens': ['off', 'as-needed'],
68+
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
69+
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
6870
camelcase: [
6971
'error',
7072
{
7173
allow: ['sap_fiori_3', 'sap_fiori_3_dark', 'sap_belize', 'sap_belize_hcb', 'sap_belize_hcw']
7274
}
7375
],
74-
'comma-dangle': 'error',
7576
complexity: 'off',
7677
'constructor-super': 'error',
77-
curly: ['error', 'multi-line'],
7878
'dot-notation': 'error',
79-
'eol-last': 'off',
8079
eqeqeq: ['error', 'smart'],
8180
'guard-for-in': 'error',
8281
'id-match': 'error',
83-
'linebreak-style': 'off',
8482
'max-classes-per-file': ['error', 1],
85-
'max-len': [
86-
'warn',
87-
{
88-
ignorePattern: '^//',
89-
code: 120
90-
}
91-
],
92-
'new-parens': 'off',
93-
'newline-per-chained-call': 'off',
9483
'no-bitwise': 'error',
9584
'no-caller': 'error',
9685
'no-cond-assign': 'error',
9786
'no-console': 'error',
9887
'no-debugger': 'error',
9988
'no-empty': 'error',
10089
'no-eval': 'error',
101-
'no-extra-semi': 'off',
10290
'no-fallthrough': 'off',
10391
'no-invalid-this': 'off',
10492
'no-irregular-whitespace': 'off',
105-
'no-multiple-empty-lines': 'off',
10693
'no-new-wrappers': 'error',
10794
'no-shadow': [
10895
'error',
@@ -111,7 +98,6 @@ module.exports = {
11198
}
11299
],
113100
'no-throw-literal': 'error',
114-
'no-trailing-spaces': 'off',
115101
'no-undef-init': 'error',
116102
'no-underscore-dangle': 'error',
117103
'no-unsafe-finally': 'error',
@@ -122,14 +108,12 @@ module.exports = {
122108
'one-var': ['error', 'never'],
123109
'prefer-arrow/prefer-arrow-functions': 'error',
124110
'prefer-const': 'error',
125-
'quote-props': ['error', 'as-needed'],
126111
radix: 'off',
127112
'react/jsx-no-bind': 'error',
128113
'react/jsx-key': 'error',
129114
'react/jsx-boolean-value': 'error',
130115
'react/no-string-refs': 'error',
131116
'react/self-closing-comp': 'error',
132-
'space-before-function-paren': 'off',
133117
'spaced-comment': 'error',
134118
'use-isnan': 'error',
135119
'valid-typeof': 'off',

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
"@types/react": "^16.9.34",
4646
"@types/react-dom": "^16.9.6",
4747
"@types/sinon": "^9.0.0",
48-
"@typescript-eslint/eslint-plugin": "^2.27.0",
49-
"@typescript-eslint/eslint-plugin-tslint": "^2.27.0",
50-
"@typescript-eslint/parser": "^2.27.0",
48+
"@typescript-eslint/eslint-plugin": "^2.31.0",
49+
"@typescript-eslint/eslint-plugin-tslint": "^2.31.0",
50+
"@typescript-eslint/parser": "^2.31.0",
5151
"@ui5/webcomponents-tools": "^1.0.0-rc.6",
5252
"babel-code-frame": "^6.26.0",
5353
"babel-loader": "^8.1.0",
@@ -59,8 +59,10 @@
5959
"enzyme-adapter-react-16": "^1.15.2",
6060
"enzyme-to-json": "^3.4.4",
6161
"eslint": "^6.8.0",
62-
"eslint-plugin-prefer-arrow": "^1.2.0",
62+
"eslint-config-prettier": "^6.11.0",
63+
"eslint-plugin-prefer-arrow": "^1.2.1",
6364
"eslint-plugin-react": "^7.18.3",
65+
"eslint-plugin-react-hooks": "^4.0.0",
6466
"glob": "^7.1.6",
6567
"google-closure-compiler": "^20200406.0.0",
6668
"husky": "^4.2.5",
@@ -87,7 +89,7 @@
8789
"sinon": "^9.0.2",
8890
"targz": "^1.0.1",
8991
"tmp": "^0.1.0",
90-
"tslint": "^6.1.1",
92+
"tslint": "^6.1.2",
9193
"typescript": "^3.8.3"
9294
},
9395
"resolutions": {

yarn.lock

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4095,48 +4095,48 @@
40954095
dependencies:
40964096
"@types/node" "*"
40974097

4098-
"@typescript-eslint/eslint-plugin-tslint@^2.27.0":
4099-
version "2.27.0"
4100-
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin-tslint/-/eslint-plugin-tslint-2.27.0.tgz#ae8c051d8c807375388ab1b1a276d8acdd24942a"
4101-
integrity sha512-CokhcCffPm3wsQN/Q+xxIzmf0+1+y2YmV/6jKuoOjvExTJVn/kVHE5CHYmJoDWEXJNBgA0+bCOSVHIEn3nfhPw==
4098+
"@typescript-eslint/eslint-plugin-tslint@^2.31.0":
4099+
version "2.31.0"
4100+
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin-tslint/-/eslint-plugin-tslint-2.31.0.tgz#cc2a273c07b5f8c1591c556f73a71b75bd23497d"
4101+
integrity sha512-1FLgLRgpi3ssz8nuZ+57kS7DJEEwVSaQ6XC5FSSF2eEFYPrlgyV4Vqrte2AyiS/IPi1eJjzYo/2Bl3qwE02oqw==
41024102
dependencies:
4103-
"@typescript-eslint/experimental-utils" "2.27.0"
4103+
"@typescript-eslint/experimental-utils" "2.31.0"
41044104
lodash "^4.17.15"
41054105

4106-
"@typescript-eslint/eslint-plugin@^2.27.0":
4107-
version "2.27.0"
4108-
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.27.0.tgz#e479cdc4c9cf46f96b4c287755733311b0d0ba4b"
4109-
integrity sha512-/my+vVHRN7zYgcp0n4z5A6HAK7bvKGBiswaM5zIlOQczsxj/aiD7RcgD+dvVFuwFaGh5+kM7XA6Q6PN0bvb1tw==
4106+
"@typescript-eslint/eslint-plugin@^2.31.0":
4107+
version "2.31.0"
4108+
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.31.0.tgz#942c921fec5e200b79593c71fafb1e3f57aa2e36"
4109+
integrity sha512-iIC0Pb8qDaoit+m80Ln/aaeu9zKQdOLF4SHcGLarSeY1gurW6aU4JsOPMjKQwXlw70MvWKZQc6S2NamA8SJ/gg==
41104110
dependencies:
4111-
"@typescript-eslint/experimental-utils" "2.27.0"
4111+
"@typescript-eslint/experimental-utils" "2.31.0"
41124112
functional-red-black-tree "^1.0.1"
41134113
regexpp "^3.0.0"
41144114
tsutils "^3.17.1"
41154115

4116-
"@typescript-eslint/experimental-utils@2.27.0":
4117-
version "2.27.0"
4118-
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.27.0.tgz#801a952c10b58e486c9a0b36cf21e2aab1e9e01a"
4119-
integrity sha512-vOsYzjwJlY6E0NJRXPTeCGqjv5OHgRU1kzxHKWJVPjDYGbPgLudBXjIlc+OD1hDBZ4l1DLbOc5VjofKahsu9Jw==
4116+
"@typescript-eslint/experimental-utils@2.31.0":
4117+
version "2.31.0"
4118+
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.31.0.tgz#a9ec514bf7fd5e5e82bc10dcb6a86d58baae9508"
4119+
integrity sha512-MI6IWkutLYQYTQgZ48IVnRXmLR/0Q6oAyJgiOror74arUMh7EWjJkADfirZhRsUMHeLJ85U2iySDwHTSnNi9vA==
41204120
dependencies:
41214121
"@types/json-schema" "^7.0.3"
4122-
"@typescript-eslint/typescript-estree" "2.27.0"
4122+
"@typescript-eslint/typescript-estree" "2.31.0"
41234123
eslint-scope "^5.0.0"
41244124
eslint-utils "^2.0.0"
41254125

4126-
"@typescript-eslint/parser@^2.27.0":
4127-
version "2.27.0"
4128-
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.27.0.tgz#d91664335b2c46584294e42eb4ff35838c427287"
4129-
integrity sha512-HFUXZY+EdwrJXZo31DW4IS1ujQW3krzlRjBrFRrJcMDh0zCu107/nRfhk/uBasO8m0NVDbBF5WZKcIUMRO7vPg==
4126+
"@typescript-eslint/parser@^2.31.0":
4127+
version "2.31.0"
4128+
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.31.0.tgz#beddd4e8efe64995108b229b2862cd5752d40d6f"
4129+
integrity sha512-uph+w6xUOlyV2DLSC6o+fBDzZ5i7+3/TxAsH4h3eC64tlga57oMb96vVlXoMwjR/nN+xyWlsnxtbDkB46M2EPQ==
41304130
dependencies:
41314131
"@types/eslint-visitor-keys" "^1.0.0"
4132-
"@typescript-eslint/experimental-utils" "2.27.0"
4133-
"@typescript-eslint/typescript-estree" "2.27.0"
4132+
"@typescript-eslint/experimental-utils" "2.31.0"
4133+
"@typescript-eslint/typescript-estree" "2.31.0"
41344134
eslint-visitor-keys "^1.1.0"
41354135

4136-
"@typescript-eslint/typescript-estree@2.27.0":
4137-
version "2.27.0"
4138-
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.27.0.tgz#a288e54605412da8b81f1660b56c8b2e42966ce8"
4139-
integrity sha512-t2miCCJIb/FU8yArjAvxllxbTiyNqaXJag7UOpB5DVoM3+xnjeOngtqlJkLRnMtzaRcJhe3CIR9RmL40omubhg==
4136+
"@typescript-eslint/typescript-estree@2.31.0":
4137+
version "2.31.0"
4138+
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.31.0.tgz#ac536c2d46672aa1f27ba0ec2140d53670635cfd"
4139+
integrity sha512-vxW149bXFXXuBrAak0eKHOzbcu9cvi6iNcJDzEtOkRwGHxJG15chiAQAwhLOsk+86p9GTr/TziYvw+H9kMaIgA==
41404140
dependencies:
41414141
debug "^4.1.1"
41424142
eslint-visitor-keys "^1.1.0"
@@ -8754,6 +8754,13 @@ eslint-config-airbnb-base@^13.1.0:
87548754
object.assign "^4.1.0"
87558755
object.entries "^1.1.0"
87568756

8757+
eslint-config-prettier@^6.11.0:
8758+
version "6.11.0"
8759+
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz#f6d2238c1290d01c859a8b5c1f7d352a0b0da8b1"
8760+
integrity sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA==
8761+
dependencies:
8762+
get-stdin "^6.0.0"
8763+
87578764
eslint-import-resolver-node@^0.3.2:
87588765
version "0.3.3"
87598766
resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.3.tgz#dbaa52b6b2816b50bc6711af75422de808e98404"
@@ -8788,10 +8795,15 @@ eslint-plugin-import@^2.14.0:
87888795
read-pkg-up "^2.0.0"
87898796
resolve "^1.12.0"
87908797

8791-
eslint-plugin-prefer-arrow@^1.2.0:
8792-
version "1.2.0"
8793-
resolved "https://registry.yarnpkg.com/eslint-plugin-prefer-arrow/-/eslint-plugin-prefer-arrow-1.2.0.tgz#55f07b07e308f441c09e53a77ad12448ce1b7c29"
8794-
integrity sha512-/iaWpfc6CsGNG/OSElmN1/hZP9WG/EnxoCIFcJHT1utRqk8FRQYoyX7xWHo2O03p/9I2dw2lSNsVOYbpfNSsZQ==
8798+
eslint-plugin-prefer-arrow@^1.2.1:
8799+
version "1.2.1"
8800+
resolved "https://registry.yarnpkg.com/eslint-plugin-prefer-arrow/-/eslint-plugin-prefer-arrow-1.2.1.tgz#9e2943cdae4476e41f94f50dd7a250f267db6865"
8801+
integrity sha512-CPAvdTGG0YbFAJrUKdRBrOJ0X1I7jTtF5VIM4m2Bw1/A2jrhfUeUAcPy4pAEB5DNaUuDqc59f3pKTeiVeamS1A==
8802+
8803+
eslint-plugin-react-hooks@^4.0.0:
8804+
version "4.0.0"
8805+
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.0.0.tgz#81196b990043cde339e25c6662aeebe32ac52d01"
8806+
integrity sha512-YKBY+kilK5wrwIdQnCF395Ya6nDro3EAMoe+2xFkmyklyhF16fH83TrQOo9zbZIDxBsXFgBbywta/0JKRNFDkw==
87958807

87968808
eslint-plugin-react@^7.18.3:
87978809
version "7.19.0"
@@ -19658,10 +19670,10 @@ tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
1965819670
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35"
1965919671
integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==
1966019672

19661-
tslint@^6.1.1:
19662-
version "6.1.1"
19663-
resolved "https://registry.yarnpkg.com/tslint/-/tslint-6.1.1.tgz#ac03fbd17f85bfefaae348b353b25a88efe10cde"
19664-
integrity sha512-kd6AQ/IgPRpLn6g5TozqzPdGNZ0q0jtXW4//hRcj10qLYBaa3mTUU2y2MCG+RXZm8Zx+KZi0eA+YCrMyNlF4UA==
19673+
tslint@^6.1.2:
19674+
version "6.1.2"
19675+
resolved "https://registry.yarnpkg.com/tslint/-/tslint-6.1.2.tgz#2433c248512cc5a7b2ab88ad44a6b1b34c6911cf"
19676+
integrity sha512-UyNrLdK3E0fQG/xWNqAFAC5ugtFyPO4JJR1KyyfQAyzR8W0fTRrC91A8Wej4BntFzcvETdCSDa/4PnNYJQLYiA==
1966519677
dependencies:
1966619678
"@babel/code-frame" "^7.0.0"
1966719679
builtin-modules "^1.1.1"

0 commit comments

Comments
 (0)