-
-
Notifications
You must be signed in to change notification settings - Fork 781
fix(linter): false positive in iframe-missing-sandbox
#6819
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): false positive in iframe-missing-sandbox
#6819
Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
CodSpeed Performance ReportMerging #6819 will not alter performanceComparing Summary
|
crates/oxc_linter/src/utils/react.rs
Outdated
| expr => expr.is_specific_member_access( | ||
| ctx.settings().react.pragma.as_ref().map_or("React", |pragma| pragma.as_str()), | ||
| "createElement", | ||
| ), |
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.
There are also some false positive:
const createElement = document.createElement
createElement('iframe')
const React = myReact
React.createElement('iframe')Can we port isDestructuredFromPragmaImport here? we can ignore the require part for this issue.
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.
This might be a bit complicated, so let's focus on resolving the issue first, and we can improve the related code afterwards.
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.
Or not add ctx.settings().react.pragma for this issue:
oxc/crates/oxc_linter/src/utils/react.rs
Line 147 in 6f22538
| const PRAGMA: &str = "React"; |
40ba4e6 to
cc15346
Compare
…m/shulaoda/oxc into fix/linter-iframe-missing-sandbox
| "rootDir": [] | ||
| }, | ||
| "react": { | ||
| "pragma": "React", |
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.
Why not keep same with ESLint config file?
| /// This configuration is aligned with ESLint v8's configuration schema (`eslintrc.json`). |
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 keep. Pragma is in settings.react.
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.
form_components and link_components don't seem to be in react but we designed them this way from the beginning.
// <https://github.com/jsx-eslint/eslint-plugin-react#configuration-legacy-eslintrc->
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema)]
#[cfg_attr(test, derive(PartialEq))]
pub struct ReactPluginSettings {
#[serde(default = "default_pragma")]
pub pragma: CompactStr,
#[serde(default)]
#[serde(rename = "formComponents")]
form_components: Vec<CustomComponent>,
#[serde(default)]
#[serde(rename = "linkComponents")]
link_components: Vec<CustomComponent>,
// TODO: More properties should be added
}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.
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.
My fault, I missed this. Seems a simple way to fix this issue has merged.
|
Close in favor of #6872 |
closes #6750
According to
eslint-plugin-react, it seems that we should also search for// @jsx pragmain the source code.