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

[restrict-plus-operands] rule doesn't support bigint #309

Closed
novemberborn opened this issue Feb 22, 2019 · 2 comments · Fixed by #344 or #310
Closed

[restrict-plus-operands] rule doesn't support bigint #309

novemberborn opened this issue Feb 22, 2019 · 2 comments · Fixed by #344 or #310
Labels
bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@novemberborn
Copy link

Repro

{
  "plugins": ["@typescript-eslint"],
  "rules": {
    "@typescript-eslint/restrict-plus-operands": "error"
  }
}
1n + 1n

Expected Result

No errors.

Actual Result

The operands are not numbers, but they're bigints which are still addable without type conversion.

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 1.4.0
@typescript-eslint/parser 1.4.0
TypeScript 3.2.1
ESLint X.Y.Z
node X.Y.Z
npm X.Y.Z
@novemberborn novemberborn added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Feb 22, 2019
@armano2 armano2 added bug Something isn't working and removed triage Waiting for maintainers to take a look labels Feb 22, 2019
@bradzacher bradzacher changed the title [restrict-plus-operands] no bigint support [restrict-plus-operands] rule doesn't support bigint Feb 23, 2019
@webschik
Copy link
Contributor

Hi!

I've created a PR with the fix #310.

@novemberborn
Copy link
Author

This fixes 1n + 2n but not BigInt(1) + 2n or const foo = 1n; foo + 2n.

"bigint" should be mentioned in the error messages. (Yes I can PR that one. Not sure about the type checking for the other use cases.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
3 participants