Skip to content

Commit

Permalink
chore: improve prettier config (#4154)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 authored Jul 6, 2021
1 parent bf32b41 commit 98d95e3
Show file tree
Hide file tree
Showing 34 changed files with 71 additions and 59 deletions.
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ body:
id: logs
attributes:
label: Logs
description: "Optional if provided reproduction. Please try not to insert an image but copy paste the log text.
description: |
Optional if provided reproduction. Please try not to insert an image but copy paste the log text.
1. Run `vite` or `vite build` with the `--debug` flag.
2. Provide the error log here."
1. Run `vite` or `vite build` with the `--debug` flag.
2. Provide the error log here.
render: shell
- type: checkboxes
id: checkboxes
Expand Down
6 changes: 1 addition & 5 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"extends": [
"config:base",
"schedule:weekly",
"group:allNonMajor"
],
"extends": ["config:base", "schedule:weekly", "group:allNonMajor"],
"labels": ["dependencies"],
"ignorePaths": [
"packages/playground/**",
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
node_version: 14
fail-fast: false

name: 'Build&Test: node-${{ matrix.node_version }}, ${{ matrix.os }}'
name: "Build&Test: node-${{ matrix.node_version }}, ${{ matrix.os }}"
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:

lint:
runs-on: ubuntu-latest
name: 'Lint: node-14, ubuntu-latest'
name: "Lint: node-14, ubuntu-latest"
steps:
- uses: actions/checkout@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/issue-close-require.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Issue Close Require

on:
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"

jobs:
close-issues:
Expand All @@ -11,7 +11,7 @@ jobs:
- name: need reproduction
uses: actions-cool/issues-helper@v2.2.1
with:
actions: 'close-issues'
actions: "close-issues"
token: ${{ secrets.GITHUB_TOKEN }}
labels: 'need reproduction'
labels: "need reproduction"
inactive-day: 3
12 changes: 6 additions & 6 deletions .github/workflows/issue-labeled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@ jobs:
if: github.event.label.name == 'contribution welcome' || github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v2.2.1
with:
actions: 'create-comment, remove-labels'
actions: "create-comment, remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please provide changelog/TypeScript/documentation/test cases if needed and make sure CI passed, we will review it soon. We appreciate your effort in advance and looking forward to your contribution!
labels: 'pending triage, need reproduction'
labels: "pending triage, need reproduction"

- name: remove pending
if: github.event.label.name == 'enhancement' || github.event.label.name == 'bug' || (contains(github.event.label.name, 'pending triage') == false && startsWith(github.event.label.name, 'bug:') == true)
uses: actions-cool/issues-helper@v2.2.1
with:
actions: 'remove-labels'
actions: "remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'pending triage'
labels: "pending triage"

- name: need reproduction
if: github.event.label.name == 'need reproduction'
uses: actions-cool/issues-helper@v2.2.1
with:
actions: 'create-comment, remove-labels'
actions: "create-comment, remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. Please provide a online reproduction by [codesandbox](https://codesandbox.io/) or a minimal GitHub repository. Issues labeled by `need reproduction` will be closed if no activities in 3 days.
labels: 'pending triage'
labels: "pending triage"
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ packages/vite/dist/
packages/plugin-vue/dist/
packages/*/CHANGELOG.md
LICENSE.md
.prettierrc
.prettierignore
yarn.lock
5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

22 changes: 22 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 80,
"trailingComma": "none",
"overrides": [
{
"files": ["*.json5"],
"options": {
"singleQuote": false,
"quoteProps": "preserve"
}
},
{
"files": ["*.yml"],
"options": {
"singleQuote": false
}
}
]
}
2 changes: 1 addition & 1 deletion docs/.vitepress/theme/sponsors.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
/* special cases */
#sponsor-mux {
padding: 5px 0;
}
}
4 changes: 1 addition & 3 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,7 @@ createServer()
server: {
fs: {
// Allow serving files from one level up to the project root
allow: [
'..'
]
allow: ['..']
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/api-hmr.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ For now, calling `import.meta.hot.invalidate()` simply reloads the page.
Listen to an HMR event.
The following HMR events are dispatched by Vite automatically:
- `'vite:beforeUpdate'` when an update is about to be applied (e.g. a module will be replaced)
- `'vite:beforeFullReload'` when a full reload is about to occur
- `'vite:beforePrune'` when modules that are no longer needed are about to be pruned
- `'vite:error'` when an error occurs (e.g. syntax error)
Custom HMR events can also be sent from plugins. See [handleHotUpdate](./api-plugin#handlehotupdate) for more details.
8 changes: 4 additions & 4 deletions docs/guide/static-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,10 @@ You can quickly deploy your Vite app with Microsoft Azure [Static Web Apps](http

- An Azure account and a subscription key. You can create a [free Azure account here](https://azure.microsoft.com/free).
- Your app code pushed to [GitHub](https://github.com).
- The [SWA Extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps) in [Visual Studio Code](https://code.visualstudio.com).
- The [SWA Extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps) in [Visual Studio Code](https://code.visualstudio.com).

Install the extension in VS Code and navigate to your app root. Open the Static Web Apps extension, sign in to Azure, and click the '+' sign to create a new Static Web App. You will be prompted to designate which subscription key to use.
Install the extension in VS Code and navigate to your app root. Open the Static Web Apps extension, sign in to Azure, and click the '+' sign to create a new Static Web App. You will be prompted to designate which subscription key to use.

Follow the wizard started by the extension to give your app a name, choose a framework preset, and designate the app root (usually `/`) and built file location `/dist`. The wizard will run and will create a GitHub action in your repo in a `.github` folder.
Follow the wizard started by the extension to give your app a name, choose a framework preset, and designate the app root (usually `/`) and built file location `/dist`. The wizard will run and will create a GitHub action in your repo in a `.github` folder.

The action will work to deploy your app (watch its progress in your repo's Actions tab) and, when successfully completed, you can view your app in the address provided in the extension's progress window by clicking the 'Browse Website' button that appears when the GitHub action has run.
The action will work to deploy your app (watch its progress in your repo's Actions tab) and, when successfully completed, you can view your app in the address provided in the extension's progress window by clicking the 'Browse Website' button that appears when the GitHub action has run.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"node": ">=12.0.0"
},
"scripts": {
"format": "prettier --write .",
"lint": "eslint --ext .js,.ts packages/*/src/**",
"test": "run-s test-serve test-build",
"test-serve": "jest",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/template-lit-element-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
"vite": "^2.4.0",
"typescript": "^4.3.2"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-lit-element/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
"devDependencies": {
"vite": "^2.4.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-preact-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"typescript": "^4.3.2",
"vite": "^2.4.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"@preact/preset-vite": "^2.0.0",
"vite": "^2.4.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-react-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
"typescript": "^4.3.2",
"vite": "^2.4.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"@vitejs/plugin-react-refresh": "^1.3.1",
"vite": "^2.4.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-svelte-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
"typescript": "^4.3.2",
"vite": "^2.4.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"svelte": "^3.37.0",
"vite": "^2.4.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-vanilla-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"typescript": "^4.3.2",
"vite": "^2.4.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"devDependencies": {
"vite": "^2.4.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-vue-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"vite": "^2.4.0",
"vue-tsc": "^0.0.24"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"@vue/compiler-sfc": "^3.0.5",
"vite": "^2.4.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
<a href="https://v3.vuejs.org/" target="_blank">Vue 3 Documentation</a>
</p>

<button type="button" @click="state.count++">count is: {{ state.count }}</button>
<button type="button" @click="state.count++">
count is: {{ state.count }}
</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test hot module replacement.
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/css/glob-dep.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@test;
@test;
2 changes: 1 addition & 1 deletion packages/playground/css/glob-dep/bar.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.dir-dep-2 {
color: grey;
}
}
2 changes: 1 addition & 1 deletion packages/playground/css/glob-dep/foo.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.dir-dep {
color: grey;
}
}
3 changes: 2 additions & 1 deletion packages/playground/css/imported.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ pre {

/* test url comma separation */
.url-separated {
/* prettier-ignore */
background-image:url(images/cat.webp),url(images/dog.webp);
}
}
1 change: 0 additions & 1 deletion packages/playground/css/sass.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
@import 'css-dep'; // package w/ sass entry points
@import 'virtual-dep'; // virtual file added through importer


.sass {
/* injected via vite.config.js */
color: $injectedColor;
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/vue/AsyncComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ const forAwaitTest = async (array): Promise<void> => {
test += value
}
}
await forAwaitTest([Promise.resolve('a'), Promise.resolve('b')]).catch(() => { })
await forAwaitTest([Promise.resolve('a'), Promise.resolve('b')]).catch(() => {})
</script>
2 changes: 1 addition & 1 deletion packages/plugin-legacy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default {
plugins: [
legacy({
targets: ['ie >= 11'],
additionalLegacyPolyfills: ['regenerator-runtime/runtime']
additionalLegacyPolyfills: ['regenerator-runtime/runtime']
})
]
}
Expand Down
6 changes: 1 addition & 5 deletions packages/plugin-vue-jsx/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ function vueJsxPlugin(options = {}) {
const filter = createFilter(include || /\.[jt]sx$/, exclude)

if (filter(id)) {
const plugins = [
importMeta,
[jsx, babelPluginOptions],
...babelPlugins
]
const plugins = [importMeta, [jsx, babelPluginOptions], ...babelPlugins]
if (id.endsWith('.tsx')) {
plugins.push([
require('@babel/plugin-transform-typescript'),
Expand Down

0 comments on commit 98d95e3

Please sign in to comment.