We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
no-new-array
Currently, when we know the argument is a number, we can auto fix the problem.
But only work for simple cases, we should also smart enough to know cases like new Array(Math.min(unkown1, unknown2)) is calling with a number.
new Array(Math.min(unkown1, unknown2))
The following are numbers:
Math
Number(unkown)
Number.parseInt
Number.parseFloat
parseInt
unicorn/prefer-number-properties
BinaryExpression
-
*
/
%
+
string
AssignmentOperator
-=
*=
/=
%=
unknown ++
unknown --
++ unknown
-- unknown
UnaryOperator
+unknown
-unknown
~unknown
This will also make other rules like no-new-buffer auto-fix more cases.
no-new-buffer
The text was updated successfully, but these errors were encountered:
This is now accepted.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Currently, when we know the argument is a number, we can auto fix the problem.
But only work for simple cases, we should also smart enough to know cases like
new Array(Math.min(unkown1, unknown2))
is calling with a number.The following are numbers:
Math
method calls, andMath
propertiesNumber(unkown)
Number.parseInt
/Number.parseFloat
(globalparseInt
already checked byunicorn/prefer-number-properties
)BinaryExpression
s (-
,*
,/
,%
), but NOT+
operator, it could bestring
AssignmentOperator
s (-=
,*=
,/=
,%=
)unknown ++
,unknown --
,++ unknown
,-- unknown
UnaryOperator
s (+unknown
,-unknown
,~unknown
)This will also make other rules like
no-new-buffer
auto-fix more cases.The text was updated successfully, but these errors were encountered: