Skip to content

Commit 31d1ca4

Browse files
committed
feat: fixes and a few more examples
1 parent f1d244f commit 31d1ca4

File tree

310 files changed

+14521
-680
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

310 files changed

+14521
-680
lines changed

.eslintrc.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ A part of its design is that this config may implicitly depend on
1212
other parts of `create-vue` setups, such as `eslint-plugin-vue` being
1313
extended in the same resulting config.
1414

15-
> Note: the current version doesn't support the legacy `.eslintrc*` configuraion format. For that you need to use version 9 or earlier. See the [corresponding README](https://www.npmjs.com/package/@vue/eslint-config-typescript/v/legacy-eslintrc) for more usage instructions.
15+
> [!NOTE]
16+
> The current version doesn't support the legacy `.eslintrc*` configuraion format. For that you need to use version 9 or earlier. See the [corresponding README](https://www.npmjs.com/package/@vue/eslint-config-typescript/v/legacy-eslintrc) for more usage instructions.
1617
1718
## Installation
1819

@@ -36,7 +37,7 @@ import vueTsEslintConfig from "@vue/eslint-config-typescript";
3637
export default [
3738
...pluginVue.configs["flat/essential"],
3839
...vueTsEslintConfig(),
39-
}]
40+
]
4041
```
4142

4243
The above configuration enables [the essential rules for Vue 3](https://eslint.vuejs.org/rules/#priority-a-essential-error-prevention) and [the recommended rules for TypeScript](https://typescript-eslint.io/rules/?=recommended).
@@ -54,14 +55,15 @@ export default [
5455
...pluginVue.configs["flat/essential"],
5556

5657
...vueTsEslintConfig({
57-
// Supports all the recommended configurations in https://typescript-eslint.io/users/configs#recommended-configurations
58+
// Optional: extend additional configurations from `typescript-eslint`.
59+
// Supports all the configurations in https://typescript-eslint.io/users/configs#recommended-configurations
5860
extends: [
5961
// By default, only the recommended rules are enabled.
6062
"recommended",
6163
// You can also manually enable the stylistic rules.
6264
// "stylistic",
6365

64-
// The ones with `-type-checked` are not yet tested.
66+
// [!NOTE] The ones with `-type-checked` are not yet tested.
6567

6668
// Other utility configurations, such as `eslint-recommended`,
6769
// are also extendable here. But we don't recommend using them directly.
@@ -72,24 +74,24 @@ export default [
7274
supportedScriptLangs: {
7375
ts: true,
7476

75-
// [Discouraged]
77+
// [!DISCOURAGED]
7678
// Set to `true` to allow plain `<script>` or `<script setup>` blocks.
7779
// This might result-in false positive or negatives in some rules for `.vue` files.
7880
// Note you also need to configure `allowJs: true` in corresponding `tsconfig.json` files.
7981
js: false,
8082

81-
// [Strongly discouraged]
83+
// [!STRONGLY DISCOURAGED]
8284
// Set to `true` to allow `<script lang="tsx">` blocks.
8385
// This would be in conflict with all type-aware rules.
8486
tsx: false,
8587

86-
// [Strongly discouraged]
88+
// [!STRONGLY DISCOURAGED]
8789
// Set to `true` to allow `<script lang="jsx">` blocks.
8890
// This would be in conflict with all type-aware rules and may result in false positives.
8991
jsx: false,
9092
},
9193

92-
// [Not yet implemented]
94+
// [!NOT YET IMPLEMENTED]
9395
// <https://github.com/vuejs/eslint-plugin-vue/issues/1910#issuecomment-1819993961>
9496
// Optional: the root directory to resolve the `.vue` files, defaults to `process.cwd()`.
9597
//

examples/allow-js/.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
.DS_Store
12+
dist
13+
dist-ssr
14+
coverage
15+
*.local
16+
17+
/cypress/videos/
18+
/cypress/screenshots/
19+
20+
# Editor directories and files
21+
.vscode/*
22+
!.vscode/extensions.json
23+
.idea
24+
*.suo
25+
*.ntvs*
26+
*.njsproj
27+
*.sln
28+
*.sw?
29+
30+
*.tsbuildinfo
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"Vue.volar",
4+
"dbaeumer.vscode-eslint"
5+
]
6+
}

examples/allow-js/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# allow-js
2+
3+
This template should help get you started developing with Vue 3 in Vite.
4+
5+
## Recommended IDE Setup
6+
7+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
8+
9+
## Type Support for `.vue` Imports in TS
10+
11+
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
12+
13+
## Customize configuration
14+
15+
See [Vite Configuration Reference](https://vitejs.dev/config/).
16+
17+
## Project Setup
18+
19+
```sh
20+
npm install
21+
```
22+
23+
### Compile and Hot-Reload for Development
24+
25+
```sh
26+
npm run dev
27+
```
28+
29+
### Type-Check, Compile and Minify for Production
30+
31+
```sh
32+
npm run build
33+
```
34+
35+
### Lint with [ESLint](https://eslint.org/)
36+
37+
```sh
38+
npm run lint
39+
```

examples/allow-js/env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

examples/allow-js/eslint.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import pluginVue from "eslint-plugin-vue";
2+
import vueTsEslintConfig from "@vue/eslint-config-typescript";
3+
4+
export default [
5+
...pluginVue.configs["flat/essential"],
6+
...vueTsEslintConfig({
7+
supportedScriptLangs: {
8+
ts: true,
9+
js: true
10+
}
11+
}),
12+
]

examples/allow-js/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<link rel="icon" href="/favicon.ico">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Vite App</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.ts"></script>
12+
</body>
13+
</html>

examples/allow-js/package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "allow-js",
3+
"version": "0.0.0",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "run-p type-check \"build-only {@}\" --",
9+
"preview": "vite preview",
10+
"build-only": "vite build",
11+
"type-check": "vue-tsc --build --force",
12+
"lint": "eslint . --fix"
13+
},
14+
"dependencies": {
15+
"vue": "^3.5.6"
16+
},
17+
"devDependencies": {
18+
"@tsconfig/node20": "^20.1.4",
19+
"@types/node": "^20.16.5",
20+
"@vitejs/plugin-vue": "^5.1.4",
21+
"@vue/eslint-config-typescript": "workspace:*",
22+
"@vue/tsconfig": "^0.5.1",
23+
"eslint": "^9.10.0",
24+
"eslint-plugin-vue": "^9.28.0",
25+
"npm-run-all2": "^6.2.3",
26+
"typescript": "~5.5.4",
27+
"vite": "^5.4.6",
28+
"vue-tsc": "^2.1.6"
29+
}
30+
}

examples/allow-js/public/favicon.ico

4.19 KB
Binary file not shown.

0 commit comments

Comments
 (0)