Last active
September 30, 2020 14:45
-
-
Save leeliwei930/a6c7115d1712cccf2804c2cb3f5fcc50 to your computer and use it in GitHub Desktop.
Vue 3 - My TypeScript Development Environment Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.eslintrc.js | |
*.config.js | |
*.config.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"env": { | |
"browser": true, | |
"es6": true | |
}, | |
"extends": [ | |
"plugin:vue/vue3-recommended", | |
"plugin:@typescript-eslint/recommended", | |
"airbnb-typescript/base" | |
], | |
"globals": { | |
"Atomics": "readonly", | |
"SharedArrayBuffer": "readonly" | |
}, | |
"parser": "vue-eslint-parser", | |
"parserOptions": { | |
"ecmaVersion": 2018, | |
"parser": "@typescript-eslint/parser", | |
"sourceType": "module", | |
"project": "tsconfig.json", | |
"tsconfigRootDir": "./", | |
"extraFileExtensions": [ ".vue" ] | |
}, | |
"plugins": [ | |
"vue", | |
"@typescript-eslint" | |
], | |
"rules": { | |
}, | |
"settings": { | |
"import/resolver": { | |
"alias": { | |
"map": [ | |
["@classes", "./src/classes/"] | |
], | |
"extensions": [".ts", ".js", ".jsx", ".json"] | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"env": { | |
"browser": true, | |
"es6": true | |
}, | |
"extends": [ | |
"plugin:vue/vue3-recommended", | |
"plugin:@typescript-eslint/recommended", | |
"airbnb-typescript/base" | |
], | |
"globals": { | |
"Atomics": "readonly", | |
"SharedArrayBuffer": "readonly" | |
}, | |
"parser": "vue-eslint-parser", | |
"parserOptions": { | |
"ecmaVersion": 2018, | |
"parser": "@typescript-eslint/parser", | |
"sourceType": "module", | |
"project": "tsconfig.json", | |
"tsconfigRootDir": "./", | |
"extraFileExtensions": [ ".vue" ] | |
}, | |
"plugins": [ | |
"vue", | |
"@typescript-eslint" | |
], | |
"rules": { | |
}, | |
"settings": { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template lang="pug"> | |
img(alt="Vue logo" src="./assets/logo.png") | |
HelloWorld(msg="Hello Vue 3.0 + Vite") | |
</template> | |
<script lang="ts> | |
import HelloWorld from './components/HelloWorld.vue' | |
export default { | |
name: 'App', | |
components: { | |
HelloWorld | |
} | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@tailwind base; | |
@tailwind components; | |
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createApp } from 'vue'; | |
import App from './App.vue'; | |
import './index.css'; | |
createApp(App).mount('#app'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const autoprefixer = require('autoprefixer'); | |
const tailwindcss = require('tailwindcss'); | |
const postcssnested = require('postcss-nested'); | |
module.exports = { | |
plugins: [ | |
tailwindcss, | |
postcssnested({ bubble: ['screen', 'variants', 'responsive']}), | |
autoprefixer, | |
], | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface User { | |
id: string, | |
email: string | |
} | |
interface Profile extends User { | |
avatar: string, | |
firstname: string, | |
lastname: string | |
} | |
export { User, Profile }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module '*.vue' { | |
import { defineComponent } from 'vue'; | |
const component: ReturnType<typeof defineComponent>; | |
export default component; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compilerOptions": { | |
"target": "esnext", | |
"module": "esnext", | |
"strict": true, | |
"jsx": "preserve", | |
"importHelpers": true, | |
"moduleResolution": "node", | |
"experimentalDecorators": true, | |
"allowJs": true, | |
"skipLibCheck": true, | |
"esModuleInterop": true, | |
"allowSyntheticDefaultImports": true, | |
"sourceMap": true, | |
"baseUrl": ".", | |
"types": [ | |
"webpack-env", | |
"jest" | |
], | |
"paths": { | |
"@/*": [ | |
"src/*" | |
], | |
"@classes/*" :[ | |
"src/classes/*" | |
] | |
}, | |
"lib": [ | |
"esnext", | |
"dom", | |
"dom.iterable", | |
"scripthost" | |
] | |
}, | |
"include": [ | |
"src/**/*.ts", | |
"src/**/*.tsx", | |
"src/**/*.vue", | |
"tests/**/*.ts", | |
"tests/**/*.tsx" | |
], | |
"exclude": [ | |
"node_modules" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { UserConfig } from 'vite' | |
import tsResolver from 'vite-tsconfig-paths' | |
const config: UserConfig = { | |
resolvers: [tsResolver], | |
} | |
export default config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment