Skip to content
Merged
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
4 changes: 3 additions & 1 deletion apps/oxlint/fixtures/tsgolint/await-thenable.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
await 12;
await 12;

export {};
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
declare function bar(): void;
const foo = () => void bar();
const foo = () => void bar();

export {};
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
type T1 = 'A' | 'A';
type T1 = 'A' | 'A';

export {};
2 changes: 2 additions & 0 deletions apps/oxlint/fixtures/tsgolint/no-floating-promises.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
const promise = new Promise((resolve, _reject) => resolve("value"));
promise;

export {};
4 changes: 3 additions & 1 deletion apps/oxlint/fixtures/tsgolint/no-for-in-array.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const arr = [1, 2, 3];
for (const i in arr) {
console.log(arr[i]);
}
}

export {};
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function foo(): void {
return;
}
void foo();
void foo();

export {};
4 changes: 3 additions & 1 deletion apps/oxlint/fixtures/tsgolint/no-mixed-enums.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
enum Status {
Open = 1,
Closed = 'closed',
}
}

export {}
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
const str1 = `Hello world`;
const str1 = `Hello world`;

export {};
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
const str: string = 'hello';
const redundant = str as string;
const redundant = str as string;

export {};
4 changes: 3 additions & 1 deletion apps/oxlint/fixtures/tsgolint/no-unsafe-argument.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
declare const anyValue: any;
function takesString(str: string): void {}
takesString(anyValue);
takesString(anyValue);

export {};
4 changes: 3 additions & 1 deletion apps/oxlint/fixtures/tsgolint/no-unsafe-assignment.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
declare const anyValue: any;
const str: string = anyValue;
const str: string = anyValue;

export {};
4 changes: 3 additions & 1 deletion apps/oxlint/fixtures/tsgolint/no-unsafe-call.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
declare const anyValue: any;
anyValue();
anyValue();

export {};
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ enum Color {
Red = 'red',
Blue = 'blue',
}
const comparison = Status.Open === Color.Red;
const comparison = Status.Open === Color.Red;

export {};
4 changes: 3 additions & 1 deletion apps/oxlint/fixtures/tsgolint/no-unsafe-member-access.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
declare const anyValue: any;
anyValue.foo;
anyValue.foo;

export {};
4 changes: 3 additions & 1 deletion apps/oxlint/fixtures/tsgolint/no-unsafe-return.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
declare const anyValue: any;
function getString(): string {
return anyValue;
}
}

export {};
4 changes: 3 additions & 1 deletion apps/oxlint/fixtures/tsgolint/no-unsafe-type-assertion.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
declare const value: unknown;
const str = value as any;
const str = value as any;

export {};
4 changes: 3 additions & 1 deletion apps/oxlint/fixtures/tsgolint/no-unsafe-unary-minus.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
declare const value: any;
const result1 = -value;
const result1 = -value;

export {};
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
declare const value: string | null;
const result1 = value as string;
const result1 = value as string;

export {};
2 changes: 2 additions & 0 deletions apps/oxlint/fixtures/tsgolint/non-tsgolint.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
debugger;

export {};
4 changes: 3 additions & 1 deletion apps/oxlint/fixtures/tsgolint/only-throw-error.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
throw 'error';
throw 'error';

export {};
2 changes: 2 additions & 0 deletions apps/oxlint/fixtures/tsgolint/prefer-includes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ if (items.indexOf(1) !== -1) {

if (/test/.test(text)) {
}

export {};
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
const numbers = [1, 2, 3];
const sum = numbers.reduce((acc, val) => acc + val, 0) as number;
const sum = numbers.reduce((acc, val) => acc + val, 0) as number;

export {};
4 changes: 3 additions & 1 deletion apps/oxlint/fixtures/tsgolint/promise-function-async.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
declare function fetch(url: string): Promise<Response>;
function fetchData(): Promise<string> {
return fetch('/api/data').then(res => res.text());
}
}

export {};
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
const numbers = [3, 1, 4, 1, 5];
numbers.sort();
numbers.sort();

export {};
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
declare const obj: object;
const str1 = `Value: ${obj}`;
const str1 = `Value: ${obj}`;

export {};
4 changes: 3 additions & 1 deletion apps/oxlint/fixtures/tsgolint/return-await.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ declare interface User { id: number; }
declare function getUser(): Promise<User>;
async function fetchUser(): Promise<User> {
return getUser();
}
}

export {};
2 changes: 2 additions & 0 deletions apps/oxlint/fixtures/tsgolint/strict-boolean-expressions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const str = 'hello';
if (str) {
}

export {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ function handleStatus(status: Status) {
case 'approved':
return 'Request approved';
}
}
}

export {};
6 changes: 3 additions & 3 deletions apps/oxlint/fixtures/tsgolint/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "es2016",
"lib": ["ES2024"],
"module": "commonjs",
"target": "es2024",
"lib": ["ES2024", "DOM"],
"module": "es2022",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
Expand Down
2 changes: 2 additions & 0 deletions apps/oxlint/fixtures/tsgolint_disable_directives/unused.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ myPromise
/* eslint-disable @typescript-eslint/no-floating-promises */
const x = 1 + 2
/* eslint-enable @typescript-eslint/no-floating-promises */

export {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ arguments: --type-aware --silent
working directory: fixtures/tsgolint
----------

Found 0 warnings and 57 errors.
Found 0 warnings and 49 errors.
Finished in <variable>ms on 44 files using 1 threads.
----------
CLI result: LintFoundErrors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ working directory: fixtures/tsgolint
1 | const promise = new Promise((resolve, _reject) => resolve("value"));
2 | promise;
: ^^^^^^^^
3 |
`----
help: The promise must end with a call to .catch, or end with a call to .then with a rejection handler, or be explicitly marked as ignored with the `void` operator.

x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\eslint(no-debugger)]8;;\: `debugger` statement is not allowed
,-[non-tsgolint.ts:1:1]
1 | debugger;
: ^^^^^^^^^
2 |
`----
help: Remove the debugger statement

Expand Down
Loading
Loading