Skip to content

Commit

Permalink
add @typescript-eslint/no-unnecessary-condition rule
Browse files Browse the repository at this point in the history
  • Loading branch information
ryota-murakami committed Aug 21, 2023
1 parent 17490b7 commit 5cd56c3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
11 changes: 9 additions & 2 deletions index.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/** @type {import("@types/eslint").Linter.Config} */
module.exports = {
env: {
browser: true,
es2021: true,
es2022: true,
jest: true,
node: true,
},
Expand Down Expand Up @@ -29,6 +30,12 @@ module.exports = {
},
],
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
'@typescript-eslint/no-unnecessary-condition': [
'error',
{
allowConstantLoopConditions: true,
},
],
'@typescript-eslint/no-unused-expressions': 'error',

// Allow foo(unuseArg, useValue) & bar(_, useValue) & { foo, ...coords } = data; https://typescript-eslint.io/rules/no-unused-vars/
Expand Down Expand Up @@ -105,7 +112,7 @@ module.exports = {
},
'import/resolver': {
node: {
extensions: ['.mjs', '.js', '.jsx', '.ts', '.tsx'],
extensions: ['.mjs', '.js', 'cjs', '.jsx', '.ts', '.tsx'],
},
typescript: {
alwaysTryTypes: true,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"inquirer": "^8.0.0"
},
"devDependencies": {
"@types/eslint": "^8.44.2",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"all-contributors-cli": "^6.26.1",
Expand Down
19 changes: 17 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"lib": ["dom", "dom.iterable", "esnext"],
"module": "es2020",
"module": "es2022",
"moduleResolution": "node",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"pretty": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2020",
"target": "ES2022",
},
}

0 comments on commit 5cd56c3

Please sign in to comment.