Skip to content

Commit 632d8b9

Browse files
committed
Merge branch 'main' into format-component-name
# Conflicts: # packages/runtime-core/src/component.ts
2 parents 2cded6d + 8f85b6d commit 632d8b9

File tree

566 files changed

+31517
-28077
lines changed

Some content is hidden

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

566 files changed

+31517
-28077
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: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ Hi! I'm really excited that you are interested in contributing to Vue.js. Before
1717

1818
## Pull Request Guidelines
1919

20-
- Checkout a topic branch from a base branch, e.g. `main`, and merge back against that branch.
20+
- Vue core has two primary work branches: `main` and `minor`.
21+
22+
- If your pull request is a feature that adds new API surface, it should be submitted against the `minor` branch.
23+
24+
- Otherwise, it should be submitted against the `main` branch.
2125

2226
- [Make sure to tick the "Allow edits from maintainers" box](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork). This allows us to directly make minor edits / refactors and saves a lot of time.
2327

@@ -59,7 +63,7 @@ Hi! I'm really excited that you are interested in contributing to Vue.js. Before
5963

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

62-
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.
6367

6468
After cloning the repo, run:
6569

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

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

8791
## Scripts
8892

89-
**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`.
9094

9195
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".
9296

@@ -181,7 +185,7 @@ Shortcut for starting the SFC Playground in local dev mode. This provides the fa
181185

182186
### `nr dev-esm`
183187

184-
Builds and watches `vue/dist/vue-runtime.esm-bundler.js` with all deps inlined using esbuild. This is useful when debugging the ESM build in a reproductions that require real build setups: link `packages/vue` globally, then link it into the project being debugged.
188+
Builds and watches `vue/dist/vue-runtime.esm-bundler.js` with all deps inlined using esbuild. This is useful when debugging the ESM build in a reproduction that requires real build setups: link `packages/vue` globally, then link it into the project being debugged.
185189

186190
### `nr dev-compiler`
187191

0 commit comments

Comments
 (0)