8000 Add prefer optional chain rule. · video-dev/hls.js@742678c · GitHub
[go: up one dir, main page]

Skip to content

Commit 742678c

Browse files
committed
Add prefer optional chain rule.
This makes it so that TypeScript rules are applied as a override on the glob '*.ts'. Seems to be a best practice to avoid duplicate or meaningless rules running on JS. See typescript-eslint/typescript-eslint#109 (comment).
1 parent d017c03 commit 742678c

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

.eslintrc.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ module.exports = {
9191
'no-empty': 1,
9292
'no-mixed-operators': 1,
9393
'no-unused-vars': 1,
94-
'@typescript-eslint/no-unused-vars': 1,
9594
'no-console': 1,
9695
'no-fallthrough': 1,
9796
'no-case-declarations': 1,
@@ -107,12 +106,22 @@ module.exports = {
107106
'no-void': 0,
108107
'no-useless-catch': 2,
109108
'lines-between-class-members': 2,
110-
'no-prototype-builtins': 0,
111-
'@typescript-eslint/consistent-type-assertions': [ 2,
112-
{
113-
'assertionStyle': 'as',
114-
'objectLiteralTypeAssertions': 'never'
109+
'no-prototype-builtins': 0
110+
},
111+
'overrides': [
112+
{
113+
'files': ['*.ts'],
114+
'rules': {
115+
'no-unused-vars': 0,
116+
'@typescript-eslint/no-unused-vars': 1,
117+
'@typescript-eslint/prefer-optional-chain': 2,
118+
'@typescript-eslint/consistent-type-assertions': [ 2,
119+
{
120+
'assertionStyle': 'as',
121+
'objectLiteralTypeAssertions': 'never'
122+
}
123+
]
115124
}
116-
]
117-
}
125+
}
126+
]
118127
};

0 commit comments

Comments
 (0)
0