Skip to content
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

[lint.Plugin] !== is parsed as != #28397

Closed
phaux opened this issue Mar 5, 2025 · 2 comments · Fixed by #28403
Closed

[lint.Plugin] !== is parsed as != #28397

phaux opened this issue Mar 5, 2025 · 2 comments · Fixed by #28403
Assignees
Labels
lint Issues related to deno lint

Comments

@phaux
Copy link

phaux commented Mar 5, 2025

Version: canary

import { assertEquals } from "jsr:@std/[email protected]";

Deno.test("not-eq", () => {
  const diagnostics = Deno.lint.runPlugin(
    {
      name: "test",
      rules: {
        "rule": {
          create: (ctx) => ({
            BinaryExpression(node) {
              console.log(node);
              if (node.operator === "!==") {
                ctx.report({ node, message: "Unexpected !==" });
              }
            },
          }),
        },
      },
    },
    "test.ts",
    "1 !== 2",
  );
  assertEquals(diagnostics.length, 1);
});

Run with deno test.

@phaux
Copy link
Author

phaux commented Mar 5, 2025

Also I just realized node is optional in arguments to report but it crashes if you forget it. nevermind, that's because there's also range

@marvinhagemeister
Copy link
Contributor

Thanks for reporting these issues! Opened PRs to fix these and they should be merged soon.

@marvinhagemeister marvinhagemeister added the lint Issues related to deno lint label Mar 5, 2025
@marvinhagemeister marvinhagemeister self-assigned this Mar 5, 2025
marvinhagemeister added a commit that referenced this issue Mar 5, 2025
That's an emberassing typo. The `!==` operator was wrongly converted to
`!=`.

Fixes #28397
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lint Issues related to deno lint
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants