-
Notifications
You must be signed in to change notification settings - Fork 653
feat(rome_js_analyze): noNonoctalDecimalEscape #4618
Conversation
✅ Deploy Preview for docs-rometools canceled.Built without sensitive environment variables
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work @unvalley ! I left few suggestions to polish the code :)
crates/rome_js_analyze/Cargo.toml
Outdated
@@ -29,6 +29,7 @@ schemars = { workspace = true, optional = true } | |||
serde = { version = "1.0.136", features = ["derive"] } | |||
serde_json = { version = "1.0.74" } | |||
smallvec = { workspace = true } | |||
regex = "1.8.4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regex
is a big crate (size and compile time), and we have tried to avoid it for a long time 😅
Now, I am not saying that we shouldn't. How difficult is implementing this rule without regex
? I think it's difficult; then I believe it's time to include it.
Would you mind adding regex
to the root Cargo.toml
? We will need this crate in other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regex is a big crate (size and compile time), and we have tried to avoid it for a long time 😅
I got it and I agree with that.
Firstly, let me try to replace it without regex.
If that seems to take quite a while, I'll change the install location of the crate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced regex to lexer implementation.
https://github.com/rome/tools/pull/4618/files#diff-eba73c88dc3c490129b5341b6c656e0b2c9831ffe305f19a0c189c79fe0e682aR265
crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs
Outdated
Show resolved
Hide resolved
refactor test: parse_escape_sequences chore: codegen and ready chore: CHANGELOG.md
@ematipico @Conaclos Thank you for the review. I addressed reviewed points. Please take a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Left few suggestions, feel free to merge it whenever you want :)
Cargo.lock
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I belive these changes should be discarded. Not sure why they are here.
crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs
Outdated
Show resolved
Hide resolved
…al_escape.rs Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good :)
Summary
Closes #3989
Implement
noNonoctalDecimalEscape
Test Plan
cargo test -p rome_js_analyze -- no_nonoctal_decimal_escape
just r