一律標上,但即便是 public(default)也要標上
錯誤:
myProp: number;
myFunction(): void { }
正確:
public myProp: number;
public myFunction(): void { }
空白 4 格
結尾一律加上分號 (;)
一律採小駝峰式 lowerCamelCase
public MyProp: number;
public myProp: number;
一律採小駝峰式 lowerCamelCase
public MyFunction(): void { }
public myFunction(): void { }
一律標上回傳值,包含 (void)
大括弧({})開頭空格不換行,結尾換行(若無實作可不換行)
錯誤:
public myFunction(): void
{
略
}
正確:
public myFunction(): void {
略
}
public myFunction(): void { } // 無實作
括弧(())開頭空格
大括弧({})若僅執行單行依然必須加,開頭空格不換行,結尾換行
錯誤:
if (略)
{
}
else
{
}
switch(略){
}
正確:
if (略)
console.log(略); // 單行可不加大括弧
if (略) {
}
else {
}
switch (略) {
略
}
錯誤:
let a :number , b:number;
public myFunction(a : number ,b: number): void { 略 }
c = a +b;
正確:
let a: number, b: number;
public myFunction(a: number, b: number): void { 略 }
c = a + b;
由 ESLint v2.4.4 落實 coding style
{
"root": true,
"env": {
"browser": true,
"node": true,
"es2021": true
},
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
},
"extends": [
"eslint:recommended"
],
"ignorePatterns": [
"dist/**/*",
"libs/**/*",
"node_modules/**/*",
"gameLibs/**/*",
"webpack/**/*",
"Dump.ts"
],
"overrides": [
{
"files": [
"*.ts",
"*.tsx"
],
"extends": [
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-function": "off",
"no-console": "warn",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "default",
"format": [
"camelCase"
]
},
{
"selector": "variableLike",
"format": [
"camelCase"
]
},
{
"selector": "variable",
"format": [
"camelCase"
]
},
{
"selector": "variable",
"format": null,
"modifiers": [
"destructured"
]
},
{
"selector": "classProperty",
"format": [
"camelCase",
"UPPER_CASE",
"snake_case"
],
"leadingUnderscore": "allowSingleOrDouble"
},
{
"selector": "parameter",
"format": [
"camelCase"
],
"leadingUnderscore": "allow"
},
{
"selector": "memberLike",
"format": [
"camelCase"
]
},
{
"selector": "typeLike",
"format": [
"PascalCase"
]
},
{
"selector": "typeParameter",
"format": [
"PascalCase"
]
},
{
"selector": "interface",
"format": [
"PascalCase"
]
},
{
"selector": "enumMember",
"format": [
"UPPER_CASE"
]
}
]
}
}
],
"rules": {
"no-unused-vars": "off",
"no-empty-function": "off",
"no-multiple-empty-lines": [
"error",
{
"max": 1,
"maxBOF": 0,
"maxEOF": 0
}
],
"curly": "error",
"brace-style": [
"error",
"stroustrup"
],
"eqeqeq": "error",
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
],
"no-var": "error",
"eol-last": "error",
"dot-notation": "error"
}
}
公告
pixi彈性化較大, 較能適應系統面彈性需求(直橫版, 風格換皮之類)cocos 暫無概念, 保守看待(可能需要拆分多專案處理)
Apr 25, 2024人資系統 NuEIP 點我前往 <font color = #FF0000>上下班打卡</font>、行政通知、公司組織圖等等 通訊軟體 Mattermost 官網下載 公司通訊軟體 開發軟體 TortoiseSVN 官網下載
Nov 8, 2023快速檢查 circular dependency 透過 madge 套件 列出文字版內容只列出透過相對路徑 import 的 module (src 可替換成其他路徑或指定檔案)npx madge src --extensions ts 只列出循環依賴的項目--circular 讀取 tsconfig (可解析 alias)--ts-config ./tsconfig.json 將循環依賴關係圖像化(輸出 svg 或 dot)
Mar 21, 2023雜症目錄 雜症1:使用 eui.List 進行排序時,發生 item 排序位置不符合預期 雜症2:UI元件在大尺寸的螢幕下,呈現全黑的畫面 雜症3:新增 Skin 和 Component code 後,啟動遊戲會出現 Component 初始化錯誤訊息 雜症1 問題描述 :::danger 使用 eui.List 進行排序時,發生 item 排序位置不符合預期 :::
Sep 29, 2022or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up