diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..410abe1a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,7 @@ +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +charset = utf-8 diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 1164e7c8..f034dabb 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -1,8 +1,11 @@ name: Prettier Action on: + push: + branches: [main] pull_request: branches: [main] + permissions: contents: write @@ -11,24 +14,24 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - if: github.event.pull_request.head.repo.full_name == 'XTLS/Xray-docs-next' + if: github.event_name == 'push' uses: actions/checkout@v6 with: ref: ${{ github.head_ref }} - name: Checkout - if: github.event.pull_request.head.repo.full_name != 'XTLS/Xray-docs-next' + if: github.event_name == 'pull_request' uses: actions/checkout@v6 with: fetch-depth: 2 - name: Prettify code - if: github.event.pull_request.head.repo.full_name == 'XTLS/Xray-docs-next' + if: github.event_name == 'push' uses: creyD/prettier_action@v4.6 with: - prettier_options: --write **/*.{js,ts,md,vue} + prettier_options: --write **/*.{mjs,mts,css,vue,md} - name: Prettify code dry run - if: github.event.pull_request.head.repo.full_name != 'XTLS/Xray-docs-next' + if: github.event_name == 'pull_request' uses: creyD/prettier_action@v4.6 with: - prettier_options: --write **/*.{js,ts,md,vue} + prettier_options: --write **/*.{mjs,mts,css,vue,md} only_changed: true dry: true diff --git a/.prettierignore b/.prettierignore index c2658d7d..020e7e66 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1,7 @@ +# Node.JS node_modules/ + +# VitePress +.vitepress/dist/ +.vitepress/cache/ +.vitepress/.generated/ diff --git a/.prettierrc b/.prettierrc index 247be9a4..7fff5370 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,10 +1,5 @@ { -overrides: [ - { - files: ['**/*.jsonc', '**/*.md'], - options: { - trailingComma: 'none', - } - } -] -} \ No newline at end of file + "semi": false, + "trailingComma": "none", + "printWidth": 75 +}