🔧 配置 prettier (#515)

*  添加开发依赖 prettier

* 🎨 格式化
This commit is contained in:
呵呵です
2024-11-01 01:45:56 +08:00
committed by GitHub
parent 1173c39e7a
commit 194fed24c9
9 changed files with 90 additions and 58 deletions

View File

@@ -3,7 +3,7 @@ name: Release CI
on:
push:
tags:
- "*"
- '*'
jobs:
release:
@@ -19,10 +19,10 @@ jobs:
with:
enable-cache: true
- name: "Set up Python"
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
python-version-file: '.python-version'
- run: uv sync
shell: bash

View File

@@ -14,10 +14,10 @@ jobs:
with:
enable-cache: true
- name: "Set up Python"
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
python-version-file: '.python-version'
- run: uv sync
shell: bash

View File

@@ -9,14 +9,14 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 'CodeQL'
on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '17 6 * * 5'
@@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
language: ['python']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
@@ -52,7 +52,6 @@ jobs:
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild

View File

@@ -42,7 +42,7 @@ This project uses [Tarina](https://github.com/ArcletProject/Tarina) for internat
#### Adding a New Language
1. Navigate to the `./nonebot_plugin_tetris_stats/i18n/` directory.
2. Run `tarina-lang create {language_code}` * Please note that the language code should preferably follow the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) standard.
2. Run `tarina-lang create {language_code}` \* Please note that the language code should preferably follow the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) standard.
3. Edit the generated `./nonebot_plugin_tetris_stats/i18n/{language_code}.json` file.
#### Updating an Existing Language

View File

@@ -24,7 +24,7 @@ uv sync
1. 代码静态检查使用 [ruff](https://docs.astral.sh/ruff/)你可以为你的ide安装对应插件来使用也可以在命令行使用`ruff check ./nonebot_plugin_tetris_stats/`来检查代码。
2. 代码格式化使用 [ruff](https://docs.astral.sh/ruff/)你可以为你的ide安装对应插件来使用也可以在命令行使用`ruff format ./nonebot_plugin_tetris_stats/`来格式化代码。
3. 类型检查同时使用 [basedpyright](https://docs.basedpyright.com/latest/) 和 [mypy](https://www.mypy-lang.org/)你可以为你的ide安装对应插件来使用。
也可以在命令行使用下面的命令来检查代码:
也可以在命令行使用下面的命令来检查代码:
```bash
# basedpyright
@@ -41,7 +41,7 @@ mypy ./nonebot_plugin_tetris_stats/
#### 添加新的语言
1. 进入 `./nonebot_plugin_tetris_stats/i18n/` 目录。
2. 运行 `tarina-lang create {语言代码}` * 请注意,语言代码最好符合 [IETF语言标签](https://zh.wikipedia.org/wiki/IETF%E8%AF%AD%E8%A8%80%E6%A0%87%E7%AD%BE) 的规范。
2. 运行 `tarina-lang create {语言代码}` \* 请注意,语言代码最好符合 [IETF语言标签](https://zh.wikipedia.org/wiki/IETF%E8%AF%AD%E8%A8%80%E6%A0%87%E7%AD%BE) 的规范。
3. 编辑生成的 `./nonebot_plugin_tetris_stats/i18n/{语言代码}.json` 文件。
#### 更新已有语言

11
package.json Normal file
View File

@@ -0,0 +1,11 @@
{
"prettier": {
"singleQuote": true,
"printWidth": 120,
"tabWidth": 2,
"endOfLine": "lf"
},
"devDependencies": {
"prettier": "^3.3.3"
}
}

22
pnpm-lock.yaml generated Normal file
View File

@@ -0,0 +1,22 @@
lockfileVersion: '9.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
importers:
.:
devDependencies:
prettier:
specifier: ^3.3.3
version: 3.3.3
packages:
prettier@3.3.3:
resolution:
{ integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== }
engines: { node: '>=14' }
hasBin: true
snapshots:
prettier@3.3.3: {}