-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
fix(linter): improve no-zero-fractions rule for member expressions and scientific notation #4793
Commits on Aug 10, 2024
-
fix(linter): improve no-zero-fractions rule for member expressions
- Added a check for parent nodes that are MemberExpressions - If a parent node is a MemberExpression, the fixed number is now wrapped in parentheses to maintain correct syntax
Configuration menu - View commit details
-
Copy full SHA for fac6271 - Browse repository at this point
Copy the full SHA fac6271View commit details -
feat(linter): improve no-zero-fractions rule
This commit enhances the no-zero-fractions rule in the unicorn linter: - Add support for scientific notation (e.g., 1e10, 1.e10) - Improve handling of member expressions - Introduce is_decimal_integer utility function - Update test cases and snapshots to reflect new behavior - Fix various edge cases in number formatting These changes make the rule more robust and consistent with the original ESLint implementation, especially for scientific notation and member expressions.
Configuration menu - View commit details
-
Copy full SHA for d518230 - Browse repository at this point
Copy the full SHA d518230View commit details -
chore(linter): Refactor
NoZeroFractions
rule for improved formattin……g and clarity - Simplified the condition that checks for decimal integers within member expressions by removing unnecessary parentheses around the formatted string. - Updated string formatting in `format_raw` function to use the shorthand `{variable}` syntax instead of `{}` with positional arguments.
Configuration menu - View commit details
-
Copy full SHA for 5e4996b - Browse repository at this point
Copy the full SHA 5e4996bView commit details
Commits on Aug 12, 2024
-
fix(linter): improve no-zero-fractions rule
- Handle special cases where a space is needed after certain keywords (return, throw, typeof) to prevent the number from being interpreted as a property access - Add tests for these special cases - Update existing tests to cover more scenarios
Configuration menu - View commit details
-
Copy full SHA for 44d9fb4 - Browse repository at this point
Copy the full SHA 44d9fb4View commit details -
fix(linter): add 'void' keyword support to no-zero-fractions rule
- Include 'void' in the list of keywords that require a space before the number to prevent misinterpretation as property access - Add test cases for 'void' keyword scenarios
Configuration menu - View commit details
-
Copy full SHA for de2cf76 - Browse repository at this point
Copy the full SHA de2cf76View commit details
Commits on Aug 13, 2024
-
refactor(linter): remove
is_decimal_integer
utility and simplify `n……o-zero-fractions` rule - Removed the `is_decimal_integer` function and related `numeric.rs` utility, as it was no longer necessary. - Simplified the `no-zero-fractions` rule by directly checking for non-dangling dots instead of using the removed utility. - Updated the logic for fixing number formatting to remove redundant checks.
Configuration menu - View commit details
-
Copy full SHA for 783a8b1 - Browse repository at this point
Copy the full SHA 783a8b1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2c81c45 - Browse repository at this point
Copy the full SHA 2c81c45View commit details
Commits on Aug 14, 2024
-
fix(unicorn/no-zero-fractions): improve handling of member expression…
…s and decimal integers - Refactored logic in the `NoZeroFractions` rule to ensure proper handling of cases where the numeric value is a decimal integer and part of a member expression. - Added a clone of the format string to avoid mutating the original `fmt`. - Introduced checks for `is_decimal_integer` and `is_member_expression` to better control the formatting of the fixed value. - Updated test cases to cover additional scenarios, including fixing fractional values like `1.010.toFixed(2)` to `1.01.toFixed(2)`.
Configuration menu - View commit details
-
Copy full SHA for 599af69 - Browse repository at this point
Copy the full SHA 599af69View commit details -
Configuration menu - View commit details
-
Copy full SHA for a35fcde - Browse repository at this point
Copy the full SHA a35fcdeView commit details -
Configuration menu - View commit details
-
Copy full SHA for bec8195 - Browse repository at this point
Copy the full SHA bec8195View commit details
Commits on Aug 15, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 5edbb19 - Browse repository at this point
Copy the full SHA 5edbb19View commit details
Commits on Aug 16, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 39e49d7 - Browse repository at this point
Copy the full SHA 39e49d7View commit details -
feat(linter): Enhance no_zero_fractions rule handling
- Add TODO for more complex token checks and semicolon handling - Prepare for special keyword cases requiring space after fixed value
Configuration menu - View commit details
-
Copy full SHA for bfa2fb5 - Browse repository at this point
Copy the full SHA bfa2fb5View commit details -
feat(linter): Enhance no_zero_fractions rule handling
- Add TODO for more complex token checks and
Configuration menu - View commit details
-
Copy full SHA for 4d4acd2 - Browse repository at this point
Copy the full SHA 4d4acd2View commit details