Movatterモバイル変換


[0]ホーム

URL:


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#84

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
alexcoderabbitai wants to merge2 commits intomain
base:main
Choose a base branch
Loading
frompreview/oxlint
Open
Show file tree
Hide file tree
Changes fromall 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
7 changes: 7 additions & 0 deletions.coderabbit.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
reviews:
path_filters: ["**/*","*.*"]
tools:
biome:
enabled: false
oxc:
enabled: true
5 changes: 5 additions & 0 deletions.oxlintrc.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
{
"rules": {
"all": "error"
}
}
35 changes: 35 additions & 0 deletionsoxc1.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
// Redeclared variable (error)
let value = 1;
let value = 2;

// Duplicate function parameters (error)
function duplicateParams(a, a) {
console.log(a);
}

// Constant reassignment (error)
const constVar = 123;
constVar = 456;

// Invalid left-hand assignment (error)
function invalidAssignment() {
42 = x;
}

// Reserved keyword as identifier (error)
let for = 'reserved keyword';

// Using 'await' outside async function (error)
await fetch('https://example.com');

// Duplicate key in object literal (error)
const obj = {
key: 1,
key: 2
};

// Illegal break statement (error)
break;

// Illegal return statement outside function (error)
return 42;
84 changes: 84 additions & 0 deletionsoxc1.test
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
// Unused variable
function unusedVariableDemo() {
let unusedVar = 'this is never used';
}

// Unreachable code after return
function unreachableCode() {
return true;
console.log('This is unreachable');
}

// Missing semicolon
function missingSemicolon() {
console.log('Missing semicolon here')
}

// Redeclared variable
function redeclareVariable() {
let value = 1;
let value = 2; // Redeclaration error
}

// Incorrect equality comparison (use strict equality)
function incorrectEquality(a) {
if (a == null) {
console.log('Use strict equality instead.');
}
}

// Empty block
if (true) {}

// Console statement (assuming no-console rule active)
console.log('Console logging should be flagged.');

// Shadowed variable names
let shadowVar = 'outer';
function shadowVariable() {
let shadowVar = 'inner'; // shadows outer variable
console.log(shadowVar);
}

// Use of var instead of let/const
function varUsage() {
var legacyVar = 123;
return legacyVar;
}

// Improper indentation
function indentation() {
console.log('Improper indentation');
}

// Trailing spaces
function trailingSpace() {
return 42;
}

// Mixed spaces and tabs
function mixedSpacesTabs() {
console.log('Mixed indentation with tabs and spaces');
}

// Undefined variable
function undefinedVariable() {
console.log(nonExistentVar);
}

// unused variable
function unusedVarExample() {
const unusedVariable = "unused";
}

// unreachable code
function unreachableExample() {
return;
console.log("unreachable");
}

// missing semicolon
console.log("semicolon missing")

// redeclared variable
let duplicateVar
106 changes: 106 additions & 0 deletionsoxc3.test
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
// Explicit any type
function explicitAny(a: any): any {
return a;
}

// Redeclared variable
let foo = 123;
let foo = 456;

// Duplicate parameters
function duplicateParams(a: number, a: number) {
return a;
}

// Constant reassignment
const MY_CONST = 'value';
MY_CONST = 'newValue';

// Invalid assignment
function invalidAssignment() {
true = false;
}

// Reserved keywords as identifiers
const class = 'illegal';

// Unreachable code
function unreachable(): number {
return 1;
console.log("never reached");
}

// Misuse of async/await
await Promise.resolve();

// Invalid usage of enum
enum Colors {
Red,
Green,
Red
}

// Empty interface
interface EmptyInterface {}

// Empty function body
function emptyFunction() {}

// Illegal use of break
break;

// Illegal use of continue
continue;

// Illegal return outside function
return 123;

// Unused variable
let unusedVar: number = 5;

// Use before definition
console.log(undeclaredVar);

// Duplicate object literal keys
const myObject = {
name: 'John',
name: 'Doe'
};

// Function overload conflict
function overloadConflict(a: string): void;
function overloadConflict(a: number): number;
function overloadConflict(a: string | number) {
return a;
}
function overloadConflict(a: boolean) {
return a;
}

// Type assertion with no effect
let someNum = 123 as number;

// Useless cast
let uselessCast = "hello" as any as string;

// Shadowed variable
let shadow = 1;
function shadowVar() {
let shadow = 2;
return shadow;
}

// Illegal trailing commas
const illegalTrailingComma = {
foo: "bar",
};

// Promise without await or catch
async function promiseIssue() {
Promise.resolve();
}

// Misuse of generics
function genericMisuse<T>(x: T) {
return x.invalidProperty;
}
41 changes: 41 additions & 0 deletionsoxc5.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
// unused variable
const unusedVar = 42

// equality without type checking
if (unusedVar == "42") {
console.log("Bad equality!")
}

// explicit any usage (TypeScript)
function doSomethingBad(param) {
console.log(param)
}

// using debugger statement
debugger;

// deeply nested and complex function
function complexFunction(a, b, c, d, e) {
if (a) {
if (b) {
if (c) {
if (d) {
if (e) {
console.log("Nested madness!");
}
}
}
}
}
}

// console logging directly (not allowed)
console.log("Direct logging")

// function declared but never used
function unusedFunction() {
return "Never called!"
}

// badly named variables
let X = "badly named"

[8]ページ先頭

©2009-2025 Movatter.jp