From 0d8c12fa7623ed33fabc7e43bf7c03d9aca43bb7 Mon Sep 17 00:00:00 2001 From: mkotsollaris Date: Sat, 22 Apr 2023 09:02:52 -0700 Subject: [PATCH] add more test cases --- README.md | 2 +- package.json | 4 ++-- tests/no-undefined-type-declaration.test.js | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0288857..f68f0bd 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/package.json b/package.json index 7055f05..5936284 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/tests/no-undefined-type-declaration.test.js b/tests/no-undefined-type-declaration.test.js index 3ea4aec..72274ef 100644 --- a/tests/no-undefined-type-declaration.test.js +++ b/tests/no-undefined-type-declaration.test.js @@ -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 }] + } ], });