-
Notifications
You must be signed in to change notification settings - Fork 649
feat(rome_js_analyze): noPrototypeBuiltins
#4101
Conversation
✅ Deploy Preview for docs-rometools ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
crates/rome_js_analyze/src/analyzers/nursery/no_prototype_builtins.rs
Outdated
Show resolved
Hide resolved
| foo?.hasOwnProperty(bar); | ||
| (foo?.hasOwnProperty)("bar"); | ||
| foo?.["hasOwnProperty"]("bar"); | ||
| (foo?.[`hasOwnProperty`])("bar"); No newline at end of file |
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 created test cases based on ESLint test cases.
I didn't add a test for:
String.raw`foo.bar["propertyIsEnumerable"]('baz')`Honestly, I couldn't find out how to recreate JsCallExpression from the token foo.bar["propertyIsEnumerable"]('baz'). If I should handle the case, please tell me the way...
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 think we can skip it for now, if you think it requires another PR to add this case.
crates/rome_js_analyze/src/analyzers/nursery/no_prototype_builtins.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_prototype_builtins.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_prototype_builtins.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_prototype_builtins.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_prototype_builtins.rs
Outdated
Show resolved
Hide resolved
| foo?.hasOwnProperty(bar); | ||
| (foo?.hasOwnProperty)("bar"); | ||
| foo?.["hasOwnProperty"]("bar"); | ||
| (foo?.[`hasOwnProperty`])("bar"); No newline at end of file |
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 think we can skip it for now, if you think it requires another PR to add this case.
crates/rome_js_analyze/src/analyzers/nursery/no_prototype_builtins.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_prototype_builtins.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/analyzers/nursery/no_prototype_builtins.rs
Outdated
Show resolved
Hide resolved
|
@ematipico Thanks for reviewing, I updated the PR. |
chore: just codegen test: update snapshot and docs chore: cargo fmt chore: just codegen chore: fix indent test: update note for hasOwn chore: just codegen docs: update for note about hasOwn Update crates/rome_js_analyze/src/analyzers/nursery/no_prototype_builtins.rs Co-authored-by: Emanuele Stoppa <[email protected]> Update crates/rome_js_analyze/src/analyzers/nursery/no_prototype_builtins.rs Co-authored-by: Emanuele Stoppa <[email protected]> Update crates/rome_js_analyze/src/analyzers/nursery/no_prototype_builtins.rs Co-authored-by: Emanuele Stoppa <[email protected]> Update crates/rome_js_analyze/src/analyzers/nursery/no_prototype_builtins.rs Co-authored-by: Emanuele Stoppa <[email protected]> Update crates/rome_js_analyze/src/analyzers/nursery/no_prototype_builtins.rs Co-authored-by: Emanuele Stoppa <[email protected]>
test: update snapshot chore: just codegen
chore: cargo fmt
Closes #3979
Summary
Implement a rule
noPrototypeBuiltins.hasOwn()instead ofhasOwnProperty()Test Plan
cargo test -p rome_js_analyze -- no_prototype_builtinsDocumentation
[ ] I will create a new PR to update the documentationjust codegen