Files
Huáng JùnliàngandGitHub e2fd7d7bcf Bundle more packages (#17938)
* chore: bundle babel-cli and babel-node

* chore: bundle babel-helper-builder-react-jsx

* refactor: unify extra entrypoints handling

* chore: bundle babel-helper-transform-fixture-test-runner

* chore: bundle babel-helper-fixtures

* build: bundle babel-helpers

* build: bundle babel-build-external-helpers

* refactor: reuse pkgJSON in PackageInfo

* refactor: skip inputs path normalization

* build: bundle babel-eslint-parser

* fixup babel-helpers

* revert babel-cli bin changes

* update npm-ignore generators

* cleanup outdated comments

* test(eslint): avoid private sub imports

* chore: bundle babel-eslint-*

* chore: bundle babel-register

* chore: skip rollup for private packages
2026-04-22 19:47:42 -04:00

38 lines
1.0 KiB
JavaScript

import plugin from "../../lib/index.js";
import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester.js";
const rule = plugin.rules["no-unused-expressions"];
const ruleTester = new RuleTester();
ruleTester.run("@babel/no-unused-expressions", rule, {
valid: [
"let a = do { if (foo) { foo.bar; } }",
"let a = do { foo; }",
"let a = do { let b = 2; foo; }",
"let a = do { (foo + 1); }",
"let a = do { if (foo) { if (foo.bar) { foo.bar; } } }",
"let a = do { if (foo) { if (foo.bar) { foo.bar; } else if (foo.baz) { foo.baz; } } }",
"foo.bar?.();",
],
invalid: [
{
code: "let a = do { foo; let b = 2; }",
errors: [
{
message:
"Expected an assignment or function call and instead saw an expression.",
},
],
},
{
code: "let a = do { if (foo) { foo.bar } else { a; bar.foo } }",
errors: [
{
message:
"Expected an assignment or function call and instead saw an expression.",
},
],
},
],
});