Skip to content

Commit

Permalink
chore: format & check with prettier (#5869)
Browse files Browse the repository at this point in the history
  • Loading branch information
ydcjeff committed Nov 28, 2021
1 parent 5c07cec commit c344865
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -91,3 +91,6 @@ jobs:
- name: Lint
run: pnpm run lint

- name: Check formatting
run: pnpm prettier --check .
7 changes: 6 additions & 1 deletion docs/config/index.md
Expand Up @@ -238,7 +238,12 @@ export default defineConfig(async ({ command, mode }) => {
/**
* default: null
*/
localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | null
localsConvention?:
| 'camelCase'
| 'camelCaseOnly'
| 'dashes'
| 'dashesOnly'
| null
}
```

Expand Down
1 change: 0 additions & 1 deletion docs/guide/api-plugin.md
Expand Up @@ -40,7 +40,6 @@ Vite convention for virtual modules is to prefix the user-facing path with `virt

Note that modules directly derived from a real file, as in the case of a script module in a Single File Component (like a .vue or .svelte SFC) don't need to follow this convention. SFCs generally generate a set of submodules when processed but the code in these can be mapped back to the filesystem. Using `\0` for these submodules would prevent sourcemaps from working correctly.


## Plugins config

Users will add plugins to the project `devDependencies` and configure them using the `plugins` array option.
Expand Down
@@ -1,2 +1 @@
<h1>unicode-path</h1>

2 changes: 1 addition & 1 deletion packages/playground/resolve/config-dep.js
@@ -1,3 +1,3 @@
module.exports = {
a: 1
}
}
2 changes: 1 addition & 1 deletion packages/playground/resolve/vite.config.js
Expand Up @@ -2,7 +2,7 @@ const virtualFile = '@virtual-file'
const virtualId = '\0' + virtualFile

const customVirtualFile = '@custom-virtual-file'
const { a } = require('./config-dep');
const { a } = require('./config-dep')

module.exports = {
resolve: {
Expand Down
5 changes: 4 additions & 1 deletion packages/playground/ssr-vue/src/pages/Home.vue
Expand Up @@ -9,7 +9,10 @@
<p class="inter">this will be styled with a font-face</p>
<p class="import-meta-url">{{ state.url }}</p>
<p class="protocol">{{ state.protocol }}</p>
<div>encrypted message: <p class="encrypted-msg">{{ encryptedMsg }}</p></div>
<div>
encrypted message:
<p class="encrypted-msg">{{ encryptedMsg }}</p>
</div>

<ImportType />
</template>
Expand Down
4 changes: 1 addition & 3 deletions packages/plugin-vue/src/main.ts
Expand Up @@ -269,9 +269,7 @@ async function genScriptCode(
scriptCode = compiler.rewriteDefault(
script.content,
'_sfc_main',
script.lang === 'ts'
? ['typescript']
: undefined
script.lang === 'ts' ? ['typescript'] : undefined
)
map = script.map
} else {
Expand Down
6 changes: 1 addition & 5 deletions packages/vite/src/node/plugins/asset.ts
Expand Up @@ -98,11 +98,7 @@ export function assetPlugin(config: ResolvedConfig): Plugin {
const file = getAssetFilename(hash, config) || this.getFileName(hash)
registerAssetToChunk(chunk, file)
const outputFilepath = config.base + file + postfix
s.overwrite(
match.index,
match.index + full.length,
outputFilepath
)
s.overwrite(match.index, match.index + full.length, outputFilepath)
}

if (s) {
Expand Down
14 changes: 9 additions & 5 deletions packages/vite/src/node/plugins/css.ts
Expand Up @@ -1002,12 +1002,16 @@ function loadPreprocessor(lang: PreprocessLang, root: string): any {
return (loadedPreprocessors[lang] = require(resolved))
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
throw new Error(`Preprocessor dependency "${lang}" not found. Did you install it?`);
throw new Error(
`Preprocessor dependency "${lang}" not found. Did you install it?`
)
} else {
const message = new Error(`Preprocessor dependency "${lang}" failed to load:\n${e.message}`);
message.stack = e.stack + '\n' + message.stack;
throw message;
}
const message = new Error(
`Preprocessor dependency "${lang}" failed to load:\n${e.message}`
)
message.stack = e.stack + '\n' + message.stack
throw message
}
}
}

Expand Down

0 comments on commit c344865

Please sign in to comment.