Skip to content

Commit b034b17

Browse files
committed
feat: implement -with-typescript config
1 parent 34f50a1 commit b034b17

File tree

213 files changed

+14084
-712
lines changed

Some content is hidden

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

213 files changed

+14084
-712
lines changed

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
# @vue/eslint-config-standard
1+
# ESLint [Shareable Configs](http://eslint.org/docs/developer-guide/shareable-configs) for [JavaScript Standard Style](http://standardjs.com) in [Vue.js](https://vuejs.org/) Projects
22

3-
> eslint-config-standard for Vue CLI
3+
[![JavaScript Style Guide - Standard Style](https://cdn.rawgit.com/standard/standard/master/badge.svg)](http://standardjs.com)
44

5-
This config is specifically designed to be used by Vue CLI setups
6-
and is not meant for outside use (it can be used but some adaptations
7-
on the user side might be needed - for details see the config file).
5+
## Usage
86

9-
A part of its design is that this config may implicitly depend on
10-
other parts of Vue CLI setups, such as `eslint-plugin-vue` being
11-
extended in the same resulting config.
7+
This repo contains 2 packages:
8+
9+
- If you are using ESLint in a JavaScript-only project, check the documentation of [`@vue/eslint-config-standard`](./packages/eslint-config-standard/)
10+
- If you are using ESLint in a TypeScript project, check the documentation of [`@vue/eslint-config-standard-with-typescript`](./packages/eslint-config-standard-with-typescript/)
11+
12+
The [`examples` folder](./examples/) contains example ESLint configurations in projects created by `create-vue` or `@vue/cli`.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require('@rushstack/eslint-patch/modern-module-resolution')
2+
3+
module.exports = {
4+
root: true,
5+
extends: [
6+
'plugin:vue/vue3-essential',
7+
'@vue/eslint-config-standard-with-typescript',
8+
'@vue/eslint-config-standard-with-typescript/allow-js-in-vue'
9+
]
10+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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?
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
3+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# create-vue-ts-allow-js-in-vue
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) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
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 [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
12+
13+
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
14+
15+
1. Disable the built-in TypeScript Extension
16+
1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
17+
2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
18+
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
19+
20+
## Customize configuration
21+
22+
See [Vite Configuration Reference](https://vitejs.dev/config/).
23+
24+
## Project Setup
25+
26+
```sh
27+
pnpm install
28+
```
29+
30+
### Compile and Hot-Reload for Development
31+
32+
```sh
33+
pnpm dev
34+
```
35+
36+
### Type-Check, Compile and Minify for Production
37+
38+
```sh
39+
pnpm build
40+
```
41+
42+
### Lint with [ESLint](https://eslint.org/)
43+
44+
```sh
45+
pnpm lint
46+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />
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>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "create-vue-ts-allow-js-in-vue",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"dev": "vite",
6+
"build": "run-p type-check build-only",
7+
"preview": "vite preview --port 4173",
8+
"build-only": "vite build",
9+
"type-check": "vue-tsc --noEmit",
10+
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
11+
},
12+
"dependencies": {
13+
"pinia": "^2.0.16",
14+
"vue": "^3.2.37",
15+
"vue-router": "^4.1.2"
16+
},
17+
"devDependencies": {
18+
"@rushstack/eslint-patch": "^1.1.0",
19+
"@types/node": "^16.11.45",
20+
"@vitejs/plugin-vue": "^3.0.1",
21+
"@vitejs/plugin-vue-jsx": "^2.0.0",
22+
"@vue/eslint-config-standard-with-typescript": "workspace:*",
23+
"@vue/tsconfig": "^0.1.3",
24+
"eslint": "^8.5.0",
25+
"eslint-plugin-vue": "^9.0.0",
26+
"npm-run-all": "^4.1.5",
27+
"typescript": "~4.7.4",
28+
"vite": "^3.0.1",
29+
"vue": "^3.2.37",
30+
"vue-tsc": "^0.38.8"
31+
}
32+
}
Binary file not shown.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<script setup>
2+
import { RouterLink, RouterView } from 'vue-router'
3+
import HelloWorld from './components/HelloWorld.vue'
4+
5+
const foo = someThing()
6+
</script>
7+
8+
<template>
9+
<header>
10+
<img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />
11+
12+
<div class="wrapper">
13+
<HelloWorld msg="You did it!" />
14+
15+
<nav>
16+
<RouterLink to="/">Home</RouterLink>
17+
<RouterLink to="/about">About</RouterLink>
18+
</nav>
19+
</div>
20+
</header>
21+
22+
<RouterView />
23+
</template>
24+
25+
<style scoped>
26+
header {
27+
line-height: 1.5;
28+
max-height: 100vh;
29+
}
30+
31+
.logo {
32+
display: block;
33+
margin: 0 auto 2rem;
34+
}
35+
36+
nav {
37+
width: 100%;
38+
font-size: 12px;
39+
text-align: center;
40+
margin-top: 2rem;
41+
}
42+
43+
nav a.router-link-exact-active {
44+
color: var(--color-text);
45+
}
46+
47+
nav a.router-link-exact-active:hover {
48+
background-color: transparent;
49+
}
50+
51+
nav a {
52+
display: inline-block;
53+
padding: 0 1rem;
54+
border-left: 1px solid var(--color-border);
55+
}
56+
57+
nav a:first-of-type {
58+
border: 0;
59+
}
60+
61+
@media (min-width: 1024px) {
62+
header {
63+
display: flex;
64+
place-items: center;
65+
padding-right: calc(var(--section-gap) / 2);
66+
}
67+
68+
.logo {
69+
margin: 0 2rem 0 0;
70+
}
71+
72+
header .wrapper {
73+
display: flex;
74+
place-items: flex-start;
75+
flex-wrap: wrap;
76+
}
77+
78+
nav {
79+
text-align: left;
80+
margin-left: -1rem;
81+
font-size: 1rem;
82+
83+
padding: 1rem 0;
84+
margin-top: 1rem;
85+
}
86+
}
87+
</style>

0 commit comments

Comments
 (0)