Skip to content

fix(plugins/x): 'no-leaked-conditional-rendering' report empty string, closes #853 #857

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"eslint-import-resolver-oxc": "^0.4.0",
"eslint-plugin-better-mutation": "^1.5.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-eslint-plugin": "^6.3.1",
"eslint-plugin-eslint-plugin": "^6.3.2",
"eslint-plugin-import-x": "^4.4.2",
"eslint-plugin-jsdoc": "^50.5.0",
"eslint-plugin-perfectionist": "^3.9.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@ import rule, { RULE_NAME } from "./no-leaked-conditional-rendering";

ruleTesterWithTypes.run(RULE_NAME, rule, {
invalid: [
{
code: /* tsx */ `
/// <reference types="react" />
/// <reference types="react-dom" />

const a = <>{"" && <Something />}</>;
`,
errors: [
{ messageId: "noLeakedConditionalRendering" },
],
},
{
code: /* tsx */ `
/// <reference types="react" />
/// <reference types="react-dom" />

const someString = "";
const a = <>{someString && <Something />}</>;
`,
errors: [
{ messageId: "noLeakedConditionalRendering" },
],
},
{
code: /* tsx */ `
/// <reference types="react" />
Expand Down Expand Up @@ -400,7 +423,7 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {

const a = <>
{0 ? <Foo /> : null}
{'' && <Foo />}
{'0' && <Foo />}
{NaN ? <Foo /> : null}
</>
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const allowedVariants = [
"nullish",
"object",
"string",
"falsy string",
"falsy boolean",
"truthy bigint",
"truthy boolean",
Expand Down
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

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