Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Preview/oxlint #28

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

Closed
alexcoderabbitai wants to merge 8 commits into main from preview/oxlint
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .oxlintrc.json
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"plugins": ["import", "typescript", "unicorn"],
"env": {
"browser": true
},
"globals": {
"foo": "readonly"
},
"settings": {},
"rules": {
"eqeqeq": "warn",
"import/no-cycle": "error",
"react/self-closing-comp": [
"error",
{
"html": false
}
]
},
"overrides": [
{
"files": ["*.test.ts", "*.spec.ts"],
"rules": {
"@typescript-eslint/no-explicit-any": "off"
}
}
]
}
8 changes: 8 additions & 0 deletions coderabbit.yml
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
reviews:
path_filters: ["**/*.yml"]
tools:
# oxlint does not run if biome is enabled
biome:
enabled: false
yamllint:
enabled: false
11 changes: 11 additions & 0 deletions sampleReact.jsx
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function TestComponent() {
// ruleid:react-dangerouslysetinnerhtml
return <div dangerouslySetInnerHTML={createMarkup()} />;
}

function OkComponent() {
// OK
const discordClientKey = '8dyfuiRyq=vVc3RRr_edRk-fK__JItpZ';
return {__html: 'Первый &middot; Второй'};
Copy link

@coderabbitai coderabbitai bot Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Fix component structure - return JSX instead of object.

OkComponent returns an object with __html property instead of proper JSX. This doesn't follow React component patterns.

function OkComponent() {
 // OK
 const discordClientKey = process.env.DISCORD_CLIENT_SECRET || '';
- return {__html: 'Первый &middot; Второй'};
+ return <div dangerouslySetInnerHTML={{__html: 'Первый &middot; Второй'}} />;
}

Or if the HTML is safe, return proper JSX:

function OkComponent() {
 // OK
 const discordClientKey = process.env.DISCORD_CLIENT_SECRET || '';
- return {__html: 'Первый &middot; Второй'};
+ return <div>Первый &middot; Второй</div>;
}
📝 Committable suggestion

!!️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return{__html: 'Первый &middot; Второй'};
functionOkComponent(){
// OK
const discordClientKey = process.env.DISCORD_CLIENT_SECRET || '';
return <div dangerouslySetInnerHTML={{__html: 'Первый &middot; Второй'}} />;
}
🤖 Prompt for AI Agents
In sampleReact.jsx at line 9, the component incorrectly returns an object with
an __html property instead of JSX. To fix this, replace the return statement
with proper JSX that renders the desired content safely, for example by
returning a JSX element containing the text or using dangerouslySetInnerHTML if
the HTML is safe and must be injected.

}
Comment on lines +6 to +10
Copy link

@coderabbitai coderabbitai bot Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Critical: Remove hardcoded Discord client secret.

The static analysis correctly identified a potential Discord client secret. Hardcoded secrets pose significant security risks and should be moved to environment variables or secure configuration management.

function OkComponent() {
 // OK
- const discordClientKey = '8dyfuiRyq=vVc3RRr_edRk-fK__JItpZ';
+ const discordClientKey = process.env.DISCORD_CLIENT_SECRET || '';
 return {__html: 'Первый &middot; Второй'};
}

Additionally, ensure the secret is added to your .env file and .gitignore to prevent future exposure.

🧰 Tools
🪛 Gitleaks (8.27.2)

8-8: Discovered a potential Discord client secret, risking compromised Discord bot integrations and data leaks.

(discord-client-secret)

🤖 Prompt for AI Agents
In sampleReact.jsx around lines 6 to 10, the Discord client key is hardcoded as
a string constant, which is a security risk. Remove the hardcoded secret from
the code and instead read it from an environment variable using process.env. Add
the secret to your .env file and ensure .env is included in .gitignore to
prevent it from being committed to version control.


AltStyle によって変換されたページ (->オリジナル) /