260322:1648 Correct Coresspondence / Doing RFA / Correct CI
This commit is contained in:
@@ -4,35 +4,35 @@
|
||||
|
||||
```javascript
|
||||
// ESLint v9 (flat config)
|
||||
import js from "@eslint/js";
|
||||
import tseslint from "typescript-eslint";
|
||||
import js from '@eslint/js';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
export default [
|
||||
js.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
|
||||
{
|
||||
files: ["**/*.ts", "**/*.tsx"],
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
rules: {
|
||||
// 🔴 CRITICAL RULES
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
"no-console": "error",
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
'no-console': 'error',
|
||||
|
||||
// 🔥 UUID MISUSE DETECTION
|
||||
"no-restricted-syntax": [
|
||||
"error",
|
||||
'no-restricted-syntax': [
|
||||
'error',
|
||||
{
|
||||
selector: "CallExpression[callee.name='parseInt']",
|
||||
message: "❌ parseInt() is forbidden (UUID risk)",
|
||||
message: '❌ parseInt() is forbidden (UUID risk)',
|
||||
},
|
||||
{
|
||||
selector: "UnaryExpression[operator='+']",
|
||||
message: "❌ +value is forbidden (UUID risk)",
|
||||
message: '❌ +value is forbidden (UUID risk)',
|
||||
},
|
||||
],
|
||||
|
||||
// 🟡 GOOD PRACTICE
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -58,8 +58,7 @@ export default [
|
||||
```ts
|
||||
// utils/uuid-guard.ts
|
||||
export const assertUuid = (value: string) => {
|
||||
const uuidRegex =
|
||||
/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
||||
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
||||
|
||||
if (!uuidRegex.test(value)) {
|
||||
throw new Error(`Invalid UUID: ${value}`);
|
||||
@@ -214,16 +213,16 @@ jobs:
|
||||
|
||||
## 🔴 CI Blocker จริง
|
||||
|
||||
* UUID misuse → fail
|
||||
* console.log → fail
|
||||
* any → fail
|
||||
* test fail → fail
|
||||
- UUID misuse → fail
|
||||
- console.log → fail
|
||||
- any → fail
|
||||
- test fail → fail
|
||||
|
||||
## 🟡 Dev Experience ดีขึ้น
|
||||
|
||||
* lint auto fix
|
||||
* pre-commit กันพลาด
|
||||
* CI คุมมาตรฐาน
|
||||
- lint auto fix
|
||||
- pre-commit กันพลาด
|
||||
- CI คุมมาตรฐาน
|
||||
|
||||
---
|
||||
|
||||
@@ -231,11 +230,11 @@ jobs:
|
||||
|
||||
คุณตอนนี้มีครบ:
|
||||
|
||||
| ระบบ | สถานะ |
|
||||
| ---------- | ------------------ |
|
||||
| ระบบ | สถานะ |
|
||||
| ---------- | ------------------- |
|
||||
| Rules | ✅ v2 optimized |
|
||||
| ESLint | ✅ enforce จริง |
|
||||
| Pre-commit | ✅ กันพลาด |
|
||||
| ESLint | ✅ enforce จริง |
|
||||
| Pre-commit | ✅ กันพลาด |
|
||||
| CI/CD | ✅ production-ready |
|
||||
|
||||
---
|
||||
@@ -252,7 +251,7 @@ jobs:
|
||||
|
||||
👉 พิมพ์มา:
|
||||
|
||||
* `scan repo`
|
||||
* หรือ `security audit`
|
||||
- `scan repo`
|
||||
- หรือ `security audit`
|
||||
|
||||
ผมจะลุยต่อให้ระดับ enterprise จริง ๆ 👍
|
||||
|
||||
Reference in New Issue
Block a user