routie dev init since i didn't adhere to any proper guidance up until now
This commit is contained in:
@@ -0,0 +1 @@
|
||||
tsconfig.*.json linguist-language=jsonc
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
This document explains how to perform the project's maintenance tasks.
|
||||
|
||||
### Creating a new release
|
||||
|
||||
Anyone with write access to the repository can request a new release. To do so, follow these steps:
|
||||
|
||||
1. Run `npm version <patch|minor|major>` locally to bump the version number and create a new commit / tag.
|
||||
2. Push the commit and tag to the repository by running `git push --follow-tags`.
|
||||
3. The release will be automatically published to npm by GitHub Actions once approved by an administrator.
|
||||
4. Go to <https://github.com/vuejs/tsconfig/releases/new> and create a new release with the tag that was just created. Describe the notable changes in the release notes.
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
|
||||
|
||||
jobs:
|
||||
release:
|
||||
# Use Publish environment for deployment protection
|
||||
environment: Publish
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
# Ensure npm 11.5.1 or later is installed
|
||||
- name: Update npm
|
||||
run: npm install -g npm@latest
|
||||
- run: npm publish
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022-present vuejs
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
# `@vue/tsconfig`
|
||||
|
||||
TSConfigs for Vue projects to extend.
|
||||
|
||||
Requires TypeScript >= 5.8. For TypeScript v4.5 to v4.9, please use [v0.1.x](https://www.npmjs.com/package/@vue/tsconfig/v/0.1.3). For TypeScript v5.0 to v5.7, please use [v0.7.x](https://www.npmjs.com/package/@vue/tsconfig/v/0.7.0).
|
||||
Requires Vue.js >= 3.4.
|
||||
|
||||
[See below for the breaking changes in v0.3.x.](#migrating-from-typescript--50)
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm add -D @vue/tsconfig
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Add one of the available configurations to your `tsconfig.json`:
|
||||
|
||||
### The Base Configuration (Runtime-agnostic)
|
||||
|
||||
```json
|
||||
"extends": "@vue/tsconfig/tsconfig.json"
|
||||
```
|
||||
|
||||
### Configuration for Browser Environment
|
||||
|
||||
```json
|
||||
"extends": "@vue/tsconfig/tsconfig.dom.json"
|
||||
```
|
||||
|
||||
### Configuration for Node Environments
|
||||
|
||||
First install the base tsconfig and types for the Node.js version you are targeting, for example:
|
||||
|
||||
```sh
|
||||
npm add -D @tsconfig/node24 @types/node@24
|
||||
```
|
||||
|
||||
If you are not using any bundlers, the Node.js code doesn't rely on any Vue/Vite-specific features, then these would be enough, you may not need to extend the Vue TSConfig:
|
||||
|
||||
```json
|
||||
"extends": "@tsconfig/node24/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"types": ["node"]
|
||||
}
|
||||
```
|
||||
|
||||
Otherwise, if you are trying to use Vue components in Node.js environments (e.g. Server Side Rendering, Vitest, etc.), you will need to extend the Vue TSConfig along with the Node.js TSConfig:
|
||||
|
||||
```json
|
||||
"extends": [
|
||||
"@tsconfig/node24/tsconfig.json",
|
||||
"@vue/tsconfig/tsconfig.json"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"types": ["node"]
|
||||
}
|
||||
```
|
||||
|
||||
Make sure to place `@vue/tsconfig/tsconfig.json` *after* `@tsconfig/node24/tsconfig.json` so that it takes precedence.
|
||||
|
||||
## Emitting Declaration Files
|
||||
|
||||
As most Vue projects are built with bundlers, the default Vue TSConfig does not emit declaration files. If you are building a library or a component library, you can enable declaration file emitting by also extending `@vue/tsconfig/tsconfig.lib.json` in your `tsconfig.json`:
|
||||
|
||||
```json
|
||||
"extends": [
|
||||
"@vue/tsconfig/tsconfig.dom.json",
|
||||
"@vue/tsconfig/tsconfig.lib.json"
|
||||
]
|
||||
```
|
||||
|
||||
## Migrating from TypeScript < 5.0
|
||||
|
||||
- The usage of base `tsconfig.json` is unchanged.
|
||||
- `tsconfig.web.json` is now renamed to `tsconfig.dom.json`, to align with `@vue/runtime-dom` and `@vue/compiler-dom`.
|
||||
- `tsconfig.node.json` is removed, please read the [Node.js section](#configuration-for-node-environments) above for Node.js usage.
|
||||
|
||||
Some configurations have been updated, which might affect your projects:
|
||||
|
||||
- `moduleResolution` changed from `node` to [`bundler`](https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#moduleresolution-bundler). This aligns more closely to the actual resolution rules in modern bundlers like Vite. However, some existing code may be broken under this new mode
|
||||
- Most notably, it implies [`"resolvePackageJsonExports": true`](https://www.typescriptlang.org/tsconfig#resolvePackageJsonExports) by default, so it prefers the [`exports` field of `package.json` files](https://nodejs.org/api/packages.html#exports) when resolving a third party module.
|
||||
- Some third party packages may not have this field set up correctly, but the bugs were previously hidden by the `node` mode.
|
||||
- Some notable packages include `vue-i18n@9.2.2`, `vuetify@3.2.3`, `v-calendar@3.0.3`, etc.
|
||||
- While `vue-i18n` [has fixed this issue in v9.3 beta](https://github.com/intlify/vue-i18n-next/issues/1327#issuecomment-1539491735), and vuetify [will solve the issue in v3.3](https://github.com/vuetifyjs/vuetify/commit/5e08832fabe80ddc839907d13c7279a091ddfee5), other packages may not be so quick to fix. In that case, you can override the `compilerOptions.resolvePackageJsonExports` option to `false` in your `tsconfig.json` to temporarily work around the issue.
|
||||
- But we encourage you to submit PRs to these packages to fix the bugs, so that we can all move forward to the new resolution mode. You can use tools like [`publint`](https://publint.dev/) and [Are the types wrong?](https://arethetypeswrong.github.io/) to help you find and debug the issues.
|
||||
- Another small breaking change is that `--moduleResolution bundler` does not support resolution of `require` calls. In TypeScript files, this means the `import mod = require("foo”)` syntax is forbidden.
|
||||
- The `lib` option in `tsconfig.dom.json` now includes `ES2022` by default.
|
||||
- Previously it was ES2016, which was the lowest ES version that Vue 3 supports.
|
||||
- Vite 4 transpiles down to ES2020 by default, and Vite 7 transpiles down to baseline. The defaults are to align with the build tool.
|
||||
- This change won't throw any new errors on your existing code, but if you are targeting old browsers and want TypeScript to throw errors on newer features used, you can override the `lib` option in your `tsconfig.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["ES2016", "DOM", "DOM.Iterable"]
|
||||
}
|
||||
}
|
||||
```
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "@vue/tsconfig",
|
||||
"version": "0.9.1",
|
||||
"description": "A base TSConfig for working with Vue.js",
|
||||
"main": "tsconfig.json",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/tsconfig.git"
|
||||
},
|
||||
"keywords": [
|
||||
"vue",
|
||||
"tsconfig"
|
||||
],
|
||||
"author": "Haoqun Jiang <npm@haoqun.me>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/tsconfig/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/tsconfig#readme",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"provenance": true
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": ">= 5.8",
|
||||
"vue": "^3.4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
},
|
||||
"vue": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
// Target ES2022 to align with Vite.
|
||||
// <https://vite.dev/config/build-options.html#build-target>
|
||||
// Support for newer versions of language built-ins are
|
||||
// left for the users to include, because that would require:
|
||||
// - either the project doesn't need to support older versions of browsers;
|
||||
// - or the project has properly included the necessary polyfills.
|
||||
"ES2022",
|
||||
|
||||
"DOM",
|
||||
"DOM.Iterable"
|
||||
|
||||
// No `ScriptHost` because Vue 3 dropped support for IE
|
||||
],
|
||||
|
||||
// Set to empty to avoid accidental inclusion of unwanted types,
|
||||
// e.g. the Node.js types that would pollute the global scope.
|
||||
// It's the default value in TS 6+, too.
|
||||
"types": []
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
// Most non-library projects don't need to emit declarations.
|
||||
// So we add this option by default to make the config more friendly to most users.
|
||||
"noEmit": true,
|
||||
|
||||
// As long as you are using a build tool, we recommend you to author and ship in ES modules.
|
||||
// Even if you are targeting Node.js, because
|
||||
// - `CommonJS` is too outdated
|
||||
// - the ecosystem hasn't fully caught up with `Node16`/`NodeNext`
|
||||
// This recommendation includes environments like Vitest, Vite Config File, Vite SSR, etc.
|
||||
"module": "ESNext",
|
||||
|
||||
// We expect users to use bundlers.
|
||||
// So here we enable some resolution features that are only available in bundlers.
|
||||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
// Even files without `import` or `export` are treated as modules.
|
||||
// It helps to avoid mysterious errors such as `Cannot redeclare block-scoped variable 'name`.
|
||||
// https://www.totaltypescript.com/cannot-redeclare-block-scoped-variable#solution-3-your-module-isnt-a-module
|
||||
"moduleDetection": "force",
|
||||
|
||||
// Required in Vue projects
|
||||
"jsx": "preserve",
|
||||
"jsxImportSource": "vue",
|
||||
|
||||
// `"noImplicitThis": true` is part of `strict`
|
||||
// Added again here in case some users decide to disable `strict`.
|
||||
// This enables stricter inference for data properties on `this`.
|
||||
"noImplicitThis": true,
|
||||
// Strict mode is on by default in TS 6+
|
||||
"strict": true,
|
||||
|
||||
// This option is part of the recommended tsconfig as of TS 5.9.
|
||||
// Commented out for now. It's hard to land in the current ecosystem.
|
||||
// Needs more consensus before moving forward.
|
||||
// "exactOptionalPropertyTypes": true,
|
||||
|
||||
// <https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#verbatimmodulesyntax>
|
||||
// Any imports or exports without a type modifier are left around. This is important for `<script setup>`.
|
||||
// Anything that uses the type modifier is dropped entirely.
|
||||
"verbatimModuleSyntax": true,
|
||||
|
||||
// A few notes:
|
||||
// - Vue 3 supports ES2016+
|
||||
// - For Vite, the actual compilation target is determined by the
|
||||
// `build.target` option in the Vite config.
|
||||
// So don't change the `target` field here. It has to be
|
||||
// at least `ES2020` for dynamic `import()`s and `import.meta` to work correctly.
|
||||
// - If you are not using Vite, feel free to overwrite the `target` field.
|
||||
"target": "ESNext",
|
||||
// For spec compliance.
|
||||
// `true` by default if the `target` is `ES2020` or higher.
|
||||
// Explicitly set it to `true` here in case some users want to overwrite the `target`.
|
||||
"useDefineForClassFields": true,
|
||||
|
||||
// Recommended
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"libReplacement": false,
|
||||
// See <https://github.com/vuejs/vue-cli/pull/5688>
|
||||
"skipLibCheck": true,
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
// Emit declaration files for the library.
|
||||
"noEmit": false,
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
|
||||
// Libraries generally require more strict type accuracy.
|
||||
// For example, its types must be compatible with the Vue types.
|
||||
// So we don't want to skip the type checking of its dependencies.
|
||||
"skipLibCheck": false,
|
||||
|
||||
// See <https://www.semver-ts.org/formal-spec/5-compiler-considerations.html#strictness>
|
||||
// Part of the recommended tsconfig as of TS 5.9.
|
||||
// Flags starting with `no` are likely to have false positives,
|
||||
// So they are not suitable for existing codebases, but are recommended for new codebases,
|
||||
// as well as libraries that need to be more strict about their types.
|
||||
// See also <https://github.com/vuejs/tsconfig/issues/38#issuecomment-3524621112> for more discussion.
|
||||
"noUncheckedIndexedAccess": true,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user