From 4372bcd160d92c2cc1618a093826b74f238cdb78 Mon Sep 17 00:00:00 2001 From: "lam.pt" Date: Fri, 29 Aug 2025 09:44:23 +0700 Subject: [PATCH] =?UTF-8?q?Xo=C3=A1=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- error.js | 44 ------------------------------------------- error.jsx | 44 ------------------------------------------- error.php | 37 ------------------------------------ error.ts | 56 ------------------------------------------------------- error.tsx | 48 ----------------------------------------------- test.txt | 1 - 6 files changed, 230 deletions(-) delete mode 100644 error.js delete mode 100644 error.jsx delete mode 100644 error.php delete mode 100644 error.ts delete mode 100644 error.tsx delete mode 100644 test.txt diff --git a/error.js b/error.js deleted file mode 100644 index b8db645..0000000 --- a/error.js +++ /dev/null @@ -1,44 +0,0 @@ -// Basic JS file with review issues - -import React, { useState } from 'react'; - -// 1. Component không dùng prop types -function Demo(props) { - // 2. State không khởi tạo đúng kiểu - const [count, setCount] = useState('0'); // Nên là số - - // 3. Hàm không dùng - function unusedFunc() { - return 'unused'; - } - - // 4. Truy cập props không tồn tại - const name = props.username; - - // 5. Render mảng không có key - const arr = [1,2,3]; - const list = arr.map(item =>
  • {item}
  • ); - - // 6. Inline style sai cú pháp - const style = { color: 'red', fontWeight: 500 }; - - // 7. Sử dụng biến chưa khai báo - let result = value + 1; - - // 8. Sử dụng setState sai - setCount(count++); - - // 9. Return nhiều phần tử không bọc Fragment - return ( -
    - Test - {list} - -

    {name}

    -
    -

    Unwrapped

    - ) // Không bọc Fragment -} - -// 10. Export sai kiểu -export { Demo }; diff --git a/error.jsx b/error.jsx deleted file mode 100644 index ea26867..0000000 --- a/error.jsx +++ /dev/null @@ -1,44 +0,0 @@ -// Basic JSX file with review issues - -import React, { useState } from 'react'; - -// 1. Component không dùng prop types -function MyComponent(props) { - // 2. State không khởi tạo đúng kiểu - const [count, setCount] = useState('0'); // Nên là số - - // 3. Hàm không dùng - function unusedFunc() { - return 'unused'; - } - - // 4. Truy cập props không tồn tại - const name = props.username; - - // 5. Render mảng không có key - const arr = [1,2,3]; - const list = arr.map(item =>
  • {item}
  • ); - - // 6. Inline style sai cú pháp - const style = { color: 'red', fontWeight: 500 }; - - // 7. Sử dụng biến chưa khai báo - let result = value + 1; - - // 8. Sử dụng setState sai - setCount(count++); - - // 9. Return nhiều phần tử không bọc Fragment - return ( -
    - Test - {list} - -

    {name}

    -
    -

    Unwrapped

    - ) // Không bọc Fragment -} - -// 10. Export sai kiểu -export { MyComponent }; diff --git a/error.php b/error.php deleted file mode 100644 index 8592bf9..0000000 --- a/error.php +++ /dev/null @@ -1,37 +0,0 @@ -db->createCommand("SELECT * FROM user WHERE id = $id")->queryOne(); - - // 4. Không kiểm tra null - echo $user['name']; - - // 5. Không dùng CSRF cho form - echo '
    '; - - // 6. Không validate dữ liệu - $model = new \app\models\User(); - $model->name = $_POST['name']; - $model->save(); - - // 7. Hardcode đường dẫn - require_once('/var/www/html/config.php'); - - // 8. Không đóng kết nối DB - // 9. Không xử lý exception - throw new Exception('Error!'); - - // 10. Hàm trả về giá trị không đúng - return true; - } -} diff --git a/error.ts b/error.ts deleted file mode 100644 index 5ac9ee2..0000000 --- a/error.ts +++ /dev/null @@ -1,56 +0,0 @@ -// Basic TypeScript file with review issues - -function add(a: number, b: number): number { - return a + b // Missing semicolon, no type safety for return -} - -const result = add('1', 2); // Passing string instead of number -console.log(result) - -// 1. Unused variable -let unusedVar: string; - -// 2. Function with wrong return type -function getString(): number { - return "hello" // Should return number -} - -// 3. Variable declared but never used -let neverUsed = 123; - -// 4. Type assertion error -let x: any = "abc"; -let y: number = x as number; // Wrong assertion - -// 5. Shadowed variable -let a = 5; -function shadow() { - let a = "shadowed"; - return a; -} - -// 6. Function missing return type -function noReturnType() { - return true; -} - -// 7. Incorrect interface usage -interface User { - name: string; - age: number; -} -const user: User = { name: "A", age: "20" }; // age should be number - -// 8. Array with mixed types -const arr: number[] = [1, "2", 3]; - -// 9. Unreachable code -function unreachable() { - return 1; - console.log("This will never run"); -} - -// 10. Using 'any' type unnecessarily -function useAny(a: any, b: any): any { - return a + b; -} diff --git a/error.tsx b/error.tsx deleted file mode 100644 index d303a26..0000000 --- a/error.tsx +++ /dev/null @@ -1,48 +0,0 @@ -// Basic TSX file with review issues - -import React, { useState } from 'react'; - -// 1. Không dùng prop types hoặc interface cho props -type Props = { title?: string }; -function App(props: Props) { - // 2. State sai kiểu - const [count, setCount] = useState(0); // Nên là number - - // 3. Hàm không dùng - function unusedFunc(): string { - return 'unused'; - } - - // 4. Truy cập props không tồn tại - const name = props.username; - - // 5. Render mảng không có key - const arr = [1,2,3]; - const list = arr.map(item =>
  • {item}
  • ); - - // 6. Inline style sai cú pháp - const style = { color: 'red', fontWeight: 500 }; - - // 7. Sử dụng biến chưa khai báo - let result = value + 1; - - // 8. Sử dụng setState sai - setCount(count++); - - // 9. Return nhiều phần tử không bọc Fragment - return ( -
    - Hello World - {list} - -

    {name}

    -
    -

    Unwrapped

    - ) // Không bọc Fragment -} - -// 10. Export sai kiểu -export { App }; - -// 11. Unused variable -const unused = 123; diff --git a/test.txt b/test.txt deleted file mode 100644 index 2a02d41..0000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -TEST