Skip to content

Commit

Permalink
add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
mkotsollaris committed Apr 22, 2023
1 parent 9d01a59 commit 0d8c12f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ESLint Plugin: eslint-plugin-no-explicit-undefined

Disallow the use of `undefined` as an explicit type in TypeScript and instead use optional chaining (`?:`) instead.
Disallow the use of `undefined` as an explicit type in TypeScript and instead use optional operator (`?`) instead.

## 📚 Rule Examples

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eslint-plugin-no-explicit-undefined",
"version": "0.0.7",
"description": "Eslint rule to prevent undefined declaration in favor of optional chaining (?:) operator in Typescript",
"version": "1.0.0",
"description": "Eslint rule to prevent undefined declaration in favor of optional parameter (?) operator in Typescript",
"main": "index.js",
"scripts": {
"test": "jest"
Expand Down
4 changes: 4 additions & 0 deletions tests/no-undefined-type-declaration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@ ruleTester.run('no-undefined-type', rule, {
code: "interface Example { prop: string | undefined; }",
errors: [{ message }],
},
{
code: "const example = (param?: string | undefined) => {}",
errors: [{ message }]
}
],
});

0 comments on commit 0d8c12f

Please sign in to comment.