Skip to content

Commit ce6dbfa

Browse files
committed
Merge branch 'main' into feat/app-effect-scope
# Conflicts: # packages/runtime-core/__tests__/apiCreateApp.spec.ts
2 parents d1fccaa + a41c5f1 commit ce6dbfa

File tree

519 files changed

+23388
-25410
lines changed

Some content is hidden

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

519 files changed

+23388
-25410
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
dist
3+
temp
4+
coverage

.eslintrc.cjs

Lines changed: 65 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,57 @@
1-
/* eslint-disable no-restricted-globals */
2-
1+
const { builtinModules } = require('node:module')
32
const DOMGlobals = ['window', 'document']
43
const NodeGlobals = ['module', 'require']
54

5+
const banConstEnum = {
6+
selector: 'TSEnumDeclaration[const=true]',
7+
message:
8+
'Please use non-const enums. This project automatically inlines enums.',
9+
}
10+
11+
/**
12+
* @type {import('eslint-define-config').ESLintConfig}
13+
*/
614
module.exports = {
715
parser: '@typescript-eslint/parser',
816
parserOptions: {
9-
sourceType: 'module'
17+
sourceType: 'module',
1018
},
11-
plugins: ['jest'],
19+
plugins: ['jest', 'import', '@typescript-eslint'],
1220
rules: {
1321
'no-debugger': 'error',
1422
// most of the codebase are expected to be env agnostic
1523
'no-restricted-globals': ['error', ...DOMGlobals, ...NodeGlobals],
1624

1725
'no-restricted-syntax': [
1826
'error',
27+
banConstEnum,
1928
// since we target ES2015 for baseline support, we need to forbid object
2029
// rest spread usage in destructure as it compiles into a verbose helper.
2130
'ObjectPattern > RestElement',
2231
// tsc compiles assignment spread into Object.assign() calls, but esbuild
2332
// still generates verbose helpers, so spread assignment is also prohiboted
2433
'ObjectExpression > SpreadElement',
25-
'AwaitExpression'
26-
]
34+
'AwaitExpression',
35+
],
36+
'sort-imports': ['error', { ignoreDeclarationSort: true }],
37+
38+
'import/no-nodejs-modules': [
39+
'error',
40+
{ allow: builtinModules.map(mod => `node:${mod}`) },
41+
],
42+
// This rule enforces the preference for using '@ts-expect-error' comments in TypeScript
43+
// code to indicate intentional type errors, improving code clarity and maintainability.
44+
'@typescript-eslint/prefer-ts-expect-error': 'error',
45+
// Enforce the use of 'import type' for importing types
46+
'@typescript-eslint/consistent-type-imports': [
47+
'error',
48+
{
49+
fixStyle: 'inline-type-imports',
50+
disallowTypeAnnotations: false,
51+
},
52+
],
53+
// Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers
54+
'@typescript-eslint/no-import-type-side-effects': 'error',
2755
},
2856
overrides: [
2957
// tests, no restrictions (runs in Node / jest with jsdom)
@@ -33,56 +61,66 @@ module.exports = {
3361
'no-restricted-globals': 'off',
3462
'no-restricted-syntax': 'off',
3563
'jest/no-disabled-tests': 'error',
36-
'jest/no-focused-tests': 'error'
37-
}
64+
'jest/no-focused-tests': 'error',
65+
},
3866
},
3967
// shared, may be used in any env
4068
{
41-
files: ['packages/shared/**'],
69+
files: ['packages/shared/**', '.eslintrc.cjs'],
4270
rules: {
43-
'no-restricted-globals': 'off'
44-
}
71+
'no-restricted-globals': 'off',
72+
},
4573
},
4674
// Packages targeting DOM
4775
{
4876
files: ['packages/{vue,vue-compat,runtime-dom}/**'],
4977
rules: {
50-
'no-restricted-globals': ['error', ...NodeGlobals]
51-
}
78+
'no-restricted-globals': ['error', ...NodeGlobals],
79+
},
5280
},
5381
// Packages targeting Node
5482
{
55-
files: [
56-
'packages/{compiler-sfc,compiler-ssr,server-renderer,reactivity-transform}/**'
57-
],
83+
files: ['packages/{compiler-sfc,compiler-ssr,server-renderer}/**'],
5884
rules: {
5985
'no-restricted-globals': ['error', ...DOMGlobals],
60-
'no-restricted-syntax': 'off'
61-
}
86+
'no-restricted-syntax': ['error', banConstEnum],
87+
},
6288
},
6389
// Private package, browser only + no syntax restrictions
6490
{
6591
files: ['packages/template-explorer/**', 'packages/sfc-playground/**'],
6692
rules: {
6793
'no-restricted-globals': ['error', ...NodeGlobals],
68-
'no-restricted-syntax': 'off'
69-
}
94+
'no-restricted-syntax': ['error', banConstEnum],
95+
},
7096
},
7197
// JavaScript files
7298
{
7399
files: ['*.js', '*.cjs'],
74100
rules: {
75101
// We only do `no-unused-vars` checks for js files, TS files are checked by TypeScript itself.
76-
'no-unused-vars': ['error', { vars: 'all', args: 'none' }]
77-
}
102+
'no-unused-vars': ['error', { vars: 'all', args: 'none' }],
103+
},
78104
},
79105
// Node scripts
80106
{
81-
files: ['scripts/**', '*.{js,ts}', 'packages/**/index.js'],
107+
files: [
108+
'scripts/**',
109+
'./*.{js,ts}',
110+
'packages/*/*.js',
111+
'packages/vue/*/*.js',
112+
],
82113
rules: {
83114
'no-restricted-globals': 'off',
84-
'no-restricted-syntax': 'off'
85-
}
86-
}
87-
]
115+
'no-restricted-syntax': ['error', banConstEnum],
116+
},
117+
},
118+
// Import nodejs modules in compiler-sfc
119+
{
120+
files: ['packages/compiler-sfc/src/**'],
121+
rules: {
122+
'import/no-nodejs-modules': ['error', { allow: builtinModules }],
123+
},
124+
},
125+
],
88126
}

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# update prettier & eslint config (#9162)
2+
bfe6b459d3a0ce6168611ee1ac7e6e789709df9d

.github/contributing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Hi! I'm really excited that you are interested in contributing to Vue.js. Before
6363

6464
You will need [Node.js](https://nodejs.org) **version 18.12+**, and [PNPM](https://pnpm.io) **version 8+**.
6565

66-
We also recommend installing [ni](https://github.com/antfu/ni) to help switching between repos using different package managers. `ni` also provides the handy `nr` command which running npm scripts easier.
66+
We also recommend installing [@antfu/ni](https://github.com/antfu/ni) to help switching between repos using different package managers. `ni` also provides the handy `nr` command which running npm scripts easier.
6767

6868
After cloning the repo, run:
6969

@@ -86,11 +86,11 @@ The project uses [simple-git-hooks](https://github.com/toplenboren/simple-git-ho
8686

8787
- Type check the entire project
8888
- Automatically format changed files using Prettier
89-
- Verify commit message format (logic in `scripts/verifyCommit.js`)
89+
- Verify commit message format (logic in `scripts/verify-commit.js`)
9090

9191
## Scripts
9292

93-
**The examples below will be using the `nr` command from the [ni](https://github.com/antfu/ni) package.** You can also use plain `npm run`, but you will need to pass all additional arguments after the command after an extra `--`. For example, `nr build runtime --all` is equivalent to `npm run build -- runtime --all`.
93+
**The examples below will be using the `nr` command from the [@antfu/ni](https://github.com/antfu/ni) package.** You can also use plain `npm run`, but you will need to pass all additional arguments after the command after an extra `--`. For example, `nr build runtime --all` is equivalent to `npm run build -- runtime --all`.
9494

9595
The `run-s` and `run-p` commands found in some scripts are from [npm-run-all](https://github.com/mysticatea/npm-run-all) for orchestrating multiple scripts. `run-s` means "run in sequence" while `run-p` means "run in parallel".
9696

.github/renovate.json5

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,35 @@
77
packageRules: [
88
{
99
depTypeList: ['peerDependencies'],
10-
enabled: false
10+
enabled: false,
1111
},
1212
{
1313
groupName: 'test',
1414
matchPackageNames: ['vitest', 'jsdom', 'puppeteer'],
15-
matchPackagePrefixes: ['@vitest']
15+
matchPackagePrefixes: ['@vitest'],
1616
},
1717
{
1818
groupName: 'playground',
1919
matchFileNames: [
2020
'packages/sfc-playground/package.json',
21-
'packages/template-explorer/package.json'
22-
]
21+
'packages/template-explorer/package.json',
22+
],
2323
},
2424
{
2525
groupName: 'compiler',
2626
matchPackageNames: ['magic-string'],
27-
matchPackagePrefixes: ['@babel', 'postcss']
27+
matchPackagePrefixes: ['@babel', 'postcss'],
2828
},
2929
{
3030
groupName: 'build',
3131
matchPackageNames: ['vite', 'terser'],
32-
matchPackagePrefixes: ['rollup', 'esbuild', '@rollup', '@vitejs']
32+
matchPackagePrefixes: ['rollup', 'esbuild', '@rollup', '@vitejs'],
3333
},
3434
{
3535
groupName: 'lint',
3636
matchPackageNames: ['simple-git-hooks', 'lint-staged'],
37-
matchPackagePrefixes: ['@typescript-eslint', 'eslint', 'prettier']
38-
}
37+
matchPackagePrefixes: ['@typescript-eslint', 'eslint', 'prettier'],
38+
},
3939
],
4040
ignoreDeps: [
4141
'vue',
@@ -45,6 +45,6 @@
4545
'typescript',
4646

4747
// ESM only
48-
'estree-walker'
49-
]
48+
'estree-walker',
49+
],
5050
}

.github/workflows/autofix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ jobs:
3030
- name: Run prettier
3131
run: pnpm run format
3232

33-
- uses: autofix-ci/action@bee19d72e71787c12ca0f29de72f2833e437e4c9
33+
- uses: autofix-ci/action@ea32e3a12414e6d3183163c3424a7d7a8631ad84

.github/workflows/ci.yml

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,31 +58,6 @@ jobs:
5858
- name: Run ssr unit tests
5959
run: pnpm run test-unit server-renderer
6060

61-
benchmarks:
62-
runs-on: ubuntu-latest
63-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
64-
env:
65-
PUPPETEER_SKIP_DOWNLOAD: 'true'
66-
steps:
67-
- uses: actions/checkout@v4
68-
69-
- name: Install pnpm
70-
uses: pnpm/action-setup@v2
71-
72-
- name: Install Node.js
73-
uses: actions/setup-node@v4
74-
with:
75-
node-version-file: '.node-version'
76-
cache: 'pnpm'
77-
78-
- run: pnpm install
79-
80-
- name: Run benchmarks
81-
uses: CodSpeedHQ/action@v2
82-
with:
83-
run: pnpm vitest bench --run
84-
token: ${{ secrets.CODSPEED_TOKEN }}
85-
8661
e2e-test:
8762
runs-on: ubuntu-latest
8863
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
@@ -110,6 +85,9 @@ jobs:
11085
- name: Run e2e tests
11186
run: pnpm run test-e2e
11287

88+
- name: verify treeshaking
89+
run: node scripts/verify-treeshaking.js
90+
11391
lint-and-test-dts:
11492
runs-on: ubuntu-latest
11593
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
@@ -137,3 +115,28 @@ jobs:
137115

138116
- name: Run type declaration tests
139117
run: pnpm run test-dts
118+
119+
# benchmarks:
120+
# runs-on: ubuntu-latest
121+
# if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
122+
# env:
123+
# PUPPETEER_SKIP_DOWNLOAD: 'true'
124+
# steps:
125+
# - uses: actions/checkout@v4
126+
127+
# - name: Install pnpm
128+
# uses: pnpm/action-setup@v2
129+
130+
# - name: Install Node.js
131+
# uses: actions/setup-node@v4
132+
# with:
133+
# node-version-file: '.node-version'
134+
# cache: 'pnpm'
135+
136+
# - run: pnpm install
137+
138+
# - name: Run benchmarks
139+
# uses: CodSpeedHQ/action@v2
140+
# with:
141+
# run: pnpm vitest bench --run
142+
# token: ${{ secrets.CODSPEED_TOKEN }}

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
dist
2+
*.md
3+
*.html
4+
pnpm-lock.yaml

.prettierrc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
semi: false
2-
singleQuote: true
3-
printWidth: 80
4-
trailingComma: 'none'
5-
arrowParens: 'avoid'
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"arrowParens": "avoid"
5+
}

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"console": "integratedTerminal",
2222
"sourceMaps": true,
2323
"windows": {
24-
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
24+
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
2525
}
2626
}
2727
]

0 commit comments

Comments
 (0)