Skip to content

Commit

Permalink
Add prefer optional chain rule.
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
itsjamie committed Dec 20, 2019
1 parent d017c03 commit 742678c
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ module.exports = {
'no-empty': 1,
'no-mixed-operators': 1,
'no-unused-vars': 1,
'@typescript-eslint/no-unused-vars': 1,
'no-console': 1,
'no-fallthrough': 1,
'no-case-declarations': 1,
Expand All @@ -107,12 +106,22 @@ module.exports = {
'no-void': 0,
'no-useless-catch': 2,
'lines-between-class-members': 2,
'no-prototype-builtins': 0,
'@typescript-eslint/consistent-type-assertions': [ 2,
{
'assertionStyle': 'as',
'objectLiteralTypeAssertions': 'never'
'no-prototype-builtins': 0
},
'overrides': [
{
'files': ['*.ts'],
'rules': {
'no-unused-vars': 0,
'@typescript-eslint/no-unused-vars': 1,
'@typescript-eslint/prefer-optional-chain': 2,
'@typescript-eslint/consistent-type-assertions': [ 2,
{
'assertionStyle': 'as',
'objectLiteralTypeAssertions': 'never'
}
]
}
]
}
}
]
};

0 comments on commit 742678c

Please sign in to comment.