Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
reviews:
path_filters: ["**/*","*.*"]
tools:
biome:
enabled: false
oxc:
enabled: true
5 changes: 5 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"all": "error"
}
}
35 changes: 35 additions & 0 deletions oxc1.js
Original file line number Diff line number Diff 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 deletions oxc1.test
Original file line number Diff line number Diff 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 deletions oxc3.test
Original file line number Diff line number Diff 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 deletions oxc5.js
Original file line number Diff line number Diff 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"