Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

feat(rome_js_analyze): implements useSimpleNumberKeys #4108

Closed
wants to merge 9 commits into from

Conversation

dhrjarun
Copy link
Contributor

@dhrjarun dhrjarun commented Dec 28, 2022

Summary

It implements useSimpleNumberKeys javascript linting rule. Fixes #3888

Test Plan

cargo test --package rome_js_analyze --test spec_tests

@netlify
Copy link

netlify bot commented Dec 28, 2022

Deploy Preview for docs-rometools canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 9dfba05
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/63fcc987b7bc9d00088b1378

@dhrjarun
Copy link
Contributor Author

dhrjarun commented Jan 9, 2023

When I run cargo lintdoc, I get this error:

nursery/useSimpleNumberKeys.js:1:4 lint/nursery/useSimpleNumberKeys  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━

  ⚠ Hexadecimal number literal is not allowed here.
  
  > 1 │ ({ 0x1: 1 });
      │    ^^^
    2 │ ({ 11_1.11: "ee" });
    3 │ ({ 0o1: 1 });
  
  ℹ Safe fix: Replace 0x1 with 1
  
    1   │ - ({·0x1:·1·});
      1 │ + ({·1:·1·});
    2 2 │   ({ 11_1.11: "ee" });
    3 3 │   ({ 0o1: 1 });
  

nursery/useSimpleNumberKeys.js:2:4 lint/nursery/useSimpleNumberKeys  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━

  ⚠ Number literal with underscore is not allowed.
  
    1 │ ({ 0x1: 1 });
  > 2 │ ({ 11_1.11: "ee" });
      │    ^^^^^^^
    3 │ ({ 0o1: 1 });
    4 │ ({ 1n: 1 });
  
  ℹ Safe fix: Replace 11_1.11 with 111.11
  
    1 1 │   ({ 0x1: 1 });
    2   │ - ({·11_1.11:·"ee"·});
      2 │ + ({·111.11:·"ee"·});
    3 3 │   ({ 0o1: 1 });
    4 4 │   ({ 1n: 1 });
  

Error: failed to generate documentation pages for the following rules:
- useSimpleNumberKeys: snapshot test failed

Caused by:
    analysis returned multiple diagnostics, code snippet: 
    
    ({ 0x1: 1 });
    ({ 11_1.11: "ee" });
    ({ 0o1: 1 });
    ({ 1n: 1 });
    ({ 11_1.11: "ee" });

I am not sure what to do?

@ematipico
Copy link
Contributor

ematipico commented Jan 9, 2023

The problem is the code inside the documentation of the rule.

Each error case must contain only one diagnostic.

If you want to show multiple incorrect cases, you need to create multiple code blocks, one for each error/diagnostic. Check how other rules do that.

@dhrjarun
Copy link
Contributor Author

The problem is the code inside the documentation of the rule.

Each error case must contain only one diagnostic.

If you want to show multiple incorrect cases, you need to create multiple code blocks, one for each error/diagnostic. Check how other rules do that.

Do I need to manually write the docs?

@github-actions
Copy link

This PR is stale because it has been open 14 days with no activity.

@Conaclos
Copy link
Contributor

@dhrjarun Are you still interested in completing this contribution? Thanks for all! Have a nice day :)

@dhrjarun
Copy link
Contributor Author

@dhrjarun Are you still interested in completing this contribution? Thanks for all! Have a nice day :)

Will resolve everything by Monday

@ematipico
Copy link
Contributor

It seems that this PR got lost :( sorry @dhrjarun

Can you rebase the branch? If not, we can try doing ourselves

@dhrjarun
Copy link
Contributor Author

dhrjarun commented May 8, 2023

It seems that this PR got lost :( sorry @dhrjarun

Can you rebase the branch? If not, we can try doing ourselves

Hey @ematipico I have deleted the repo from my computer.

@ematipico
Copy link
Contributor

Closing in favour of #4447

@ematipico ematipico closed this May 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Linter Area: linter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useSimpleNumberKeys
3 participants