Skip to content

Commit

Permalink
Create ESlint typescript config file for rules like @typescript-eslin…
Browse files Browse the repository at this point in the history
…t/prefer-optional-chain (#422)
  • Loading branch information
eddeee888 committed Apr 21, 2024
1 parent 1cba729 commit 2f6f4f0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-ravens-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@theguild/eslint-config": patch
---

Fix @typescript-eslint/prefer-optional-chain causing eslint to fail if .js files are not included in tsconfig
1 change: 0 additions & 1 deletion packages/eslint-config/src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ module.exports = {

'prefer-object-has-own': 'error',
'logical-assignment-operators': ['error', 'always', { enforceForIfStatements: true }],
'@typescript-eslint/prefer-optional-chain': 'error',

yoda: 'error',
'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }],
Expand Down
4 changes: 1 addition & 3 deletions packages/eslint-config/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ module.exports = {
},
{
files: TS_FILE,
rules: {
'@typescript-eslint/consistent-type-assertions': 'error',
},
extends: './typescript',
},
{
files: ['*.c{j,t}s'],
Expand Down
7 changes: 7 additions & 0 deletions packages/eslint-config/src/typescript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
rules: {
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
},
};

0 comments on commit 2f6f4f0

Please sign in to comment.