From 0042b52935434d69669e0d351ee4e8a34f35aa5e Mon Sep 17 00:00:00 2001 From: jtl959 Date: Thu, 20 Aug 2026 10:57:58 +0800 Subject: [PATCH] update naming convention in AGENTS.md --- agents/AGENTS.md | 16 ++++---- dcloud-renew/package-lock.json | 73 ---------------------------------- 2 files changed, 8 insertions(+), 81 deletions(-) delete mode 100644 dcloud-renew/package-lock.json diff --git a/agents/AGENTS.md b/agents/AGENTS.md index 4d7dc05..b49d558 100644 --- a/agents/AGENTS.md +++ b/agents/AGENTS.md @@ -25,15 +25,15 @@ - 总是尽量采用有意义的完整单词,而不是 A, B, i, k 这样的单个字母。 - 类名、模块名、仓库名、等等较大范围名称:CamelCase, 例如 `Creation`, `CommonTools`。 - 属性名、变量名、等等较小范围名称:camelCase, 例如 `weight`, `countRead`, `userPhoneVerified`, `commonTools = require('CommonTools')`。 -- 常量名:UPPERCASE_SEPERATED_BY_UNDERSCORE,例如 `ERROR_USER_OFFLINE`。 -- 方法、函数名:do_something(),即小写动词开头+下划线分隔,例如 `update_user_avatar()`。可以使用 camelCase 作为组成部分,例如 `get_userName()` 以和 变量名 `userName` 保持一致。 +- 常量名:UPPERCASE_SEPARATED_BY_UNDERSCORE,例如 `ERROR_USER_OFFLINE`。 +- 方法、函数名:动词开头的 camelCase,例如 `updateUserAvatar()`, `getUserName()`。 +- HTML/CSS 的 class、id 名:kebab-case(dash 分隔),例如 `user-center`, `card-header`;JS 中通过 CSS Modules 访问样式时仍用 camelCase(如 `styles.userCenter`),两者由工具自动转换。 - 目录和文件名: - - 首先,如果用来绑定某个名称的具体内容,目录或文件名应当跟随这个名称本身。例如,一个文件用来存放某个类,那就用类名作为文件名,例如 `Creation`; 一个目录用来存放某个仓库,那就用仓库名作为目录名,例如 `CommonTools/`; 一个目录用来服务一个域名,就用域名作为目录名,例如 `blog.tic.cc`; 一个文件用来记录某个日期,就用日期作为目录名,例如 `20260801` - - 其次,如果已有流行的规范或惯例,就遵循这种命名格式。例如,`AGENTS.md`, `.gitignore`, `blog`。 - - 最后,如果上述规则都不适用,就遵循 camelCase 格式来命名目录或文件,例如 `source`, `frontend`, `userCenter.html`。 - - 上述规则是特意不使用 - 或 \_ 来分隔,因为 - - abc-xyz 在编辑器中双击不会被识别成一整个名称,并且有时在命名了文件后,又发现需要把文件和某个名称绑定起来,而这个名称通常是不应该含有 `-` 的。 - - abc_xyz 虽然容易目视识别,但是大幅度增加了名称长度。 + - 首先,我的主规则是用 camelCase 命名目录或文件,例如 `source`, `frontend`, `userCenter.vue`。 + - 其次,如果用来绑定某个名称的具体内容,目录或文件名应当跟随这个名称本身。例如,一个文件用来存放某个类,那就用类名作为文件名,例如 `Creation`; 一个目录用来存放某个仓库,那就用仓库名作为目录名,例如 `CommonTools/`; 一个目录用来服务一个域名,就用域名作为目录名,例如 `blog.tic.cc`; 一个文件用来记录某个日期,就用日期作为文件名,例如 `20260801`。 + - 最后,当与流行的规范或惯例有强烈冲突时,遵循该流行惯例。例如,`AGENTS.md`, `.gitignore`。 + - 注意,目录、文件名仅大小写不同的(如 `userCenter` 与 `usercenter`)禁止在同一层级同时出现,以避免跨平台冲突,。 +- 存量代码保持既有命名,不强制迁移;新增代码遵循本规范。 ## 主动交互 diff --git a/dcloud-renew/package-lock.json b/dcloud-renew/package-lock.json deleted file mode 100644 index 6a7db7b..0000000 --- a/dcloud-renew/package-lock.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "dcloud-renew", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "dcloud-renew", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "dotenv": "^17.4.2", - "playwright": "^1.62.0" - } - }, - "node_modules/dotenv": { - "version": "17.4.2", - "resolved": "https://registry.npmmirror.com/dotenv/-/dotenv-17.4.2.tgz", - "integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://dotenvx.com" - } - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/playwright": { - "version": "1.62.0", - "resolved": "https://registry.npmmirror.com/playwright/-/playwright-1.62.0.tgz", - "integrity": "sha512-Z14dG305dgaLu6foB1TXQagFiW8JfSUIUaUuPaKQ6NtBPKF1P/qXcqfh6c6K/icPqdy37JmjbiBXf6JNg6Sylw==", - "license": "Apache-2.0", - "dependencies": { - "playwright-core": "1.62.0" - }, - "bin": { - "playwright": "cli.js" - }, - "engines": { - "node": ">=20" - }, - "optionalDependencies": { - "fsevents": "2.3.2" - } - }, - "node_modules/playwright-core": { - "version": "1.62.0", - "resolved": "https://registry.npmmirror.com/playwright-core/-/playwright-core-1.62.0.tgz", - "integrity": "sha512-nsNRyq0r2zsG8AcRHWknc9QRA5XCueC7gWMrs+Gx2tlZn9hcl8zudfh00lhJPY1DE7NmZ6bDsT9g2yey8mXljA==", - "license": "Apache-2.0", - "bin": { - "playwright-core": "cli.js" - }, - "engines": { - "node": ">=20" - } - } - } -}