Skip to content

Commit 4b9f98b

Browse files
authored
Merge branch 'main' into fix/6593
2 parents 81a3288 + fe5d919 commit 4b9f98b

File tree

572 files changed

+33977
-28742
lines changed

Some content is hidden

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

572 files changed

+33977
-28742
lines changed

.eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
dist
3+
temp
4+
coverage

.eslintrc.cjs

+75-29
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,130 @@
1+
const { builtinModules } = require('node:module')
12
const DOMGlobals = ['window', 'document']
23
const NodeGlobals = ['module', 'require']
34

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+
*/
414
module.exports = {
515
parser: '@typescript-eslint/parser',
616
parserOptions: {
7-
sourceType: 'module'
17+
sourceType: 'module',
818
},
9-
plugins: ['jest'],
19+
plugins: ['jest', 'import', '@typescript-eslint'],
1020
rules: {
1121
'no-debugger': 'error',
12-
'no-unused-vars': [
13-
'error',
14-
// we are only using this rule to check for unused arguments since TS
15-
// catches unused variables but not args.
16-
{ varsIgnorePattern: '.*', args: 'none' }
17-
],
22+
'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
1823
// most of the codebase are expected to be env agnostic
1924
'no-restricted-globals': ['error', ...DOMGlobals, ...NodeGlobals],
2025

2126
'no-restricted-syntax': [
2227
'error',
28+
banConstEnum,
2329
// since we target ES2015 for baseline support, we need to forbid object
2430
// rest spread usage in destructure as it compiles into a verbose helper.
2531
'ObjectPattern > RestElement',
2632
// tsc compiles assignment spread into Object.assign() calls, but esbuild
2733
// still generates verbose helpers, so spread assignment is also prohiboted
2834
'ObjectExpression > SpreadElement',
29-
'AwaitExpression'
30-
]
35+
'AwaitExpression',
36+
],
37+
'sort-imports': ['error', { ignoreDeclarationSort: true }],
38+
39+
'import/no-nodejs-modules': [
40+
'error',
41+
{ allow: builtinModules.map(mod => `node:${mod}`) },
42+
],
43+
// This rule enforces the preference for using '@ts-expect-error' comments in TypeScript
44+
// code to indicate intentional type errors, improving code clarity and maintainability.
45+
'@typescript-eslint/prefer-ts-expect-error': 'error',
46+
// Enforce the use of 'import type' for importing types
47+
'@typescript-eslint/consistent-type-imports': [
48+
'error',
49+
{
50+
fixStyle: 'inline-type-imports',
51+
disallowTypeAnnotations: false,
52+
},
53+
],
54+
// Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers
55+
'@typescript-eslint/no-import-type-side-effects': 'error',
3156
},
3257
overrides: [
3358
// tests, no restrictions (runs in Node / jest with jsdom)
3459
{
3560
files: ['**/__tests__/**', 'packages/dts-test/**'],
3661
rules: {
62+
'no-console': 'off',
3763
'no-restricted-globals': 'off',
3864
'no-restricted-syntax': 'off',
3965
'jest/no-disabled-tests': 'error',
40-
'jest/no-focused-tests': 'error'
41-
}
66+
'jest/no-focused-tests': 'error',
67+
},
4268
},
4369
// shared, may be used in any env
4470
{
45-
files: ['packages/shared/**'],
71+
files: ['packages/shared/**', '.eslintrc.cjs'],
4672
rules: {
47-
'no-restricted-globals': 'off'
48-
}
73+
'no-restricted-globals': 'off',
74+
},
4975
},
5076
// Packages targeting DOM
5177
{
5278
files: ['packages/{vue,vue-compat,runtime-dom}/**'],
5379
rules: {
54-
'no-restricted-globals': ['error', ...NodeGlobals]
55-
}
80+
'no-restricted-globals': ['error', ...NodeGlobals],
81+
},
5682
},
5783
// Packages targeting Node
5884
{
59-
files: [
60-
'packages/{compiler-sfc,compiler-ssr,server-renderer,reactivity-transform}/**'
61-
],
85+
files: ['packages/{compiler-sfc,compiler-ssr,server-renderer}/**'],
6286
rules: {
6387
'no-restricted-globals': ['error', ...DOMGlobals],
64-
'no-restricted-syntax': 'off'
65-
}
88+
'no-restricted-syntax': ['error', banConstEnum],
89+
},
6690
},
6791
// Private package, browser only + no syntax restrictions
6892
{
6993
files: ['packages/template-explorer/**', 'packages/sfc-playground/**'],
7094
rules: {
7195
'no-restricted-globals': ['error', ...NodeGlobals],
72-
'no-restricted-syntax': 'off'
73-
}
96+
'no-restricted-syntax': ['error', banConstEnum],
97+
'no-console': 'off',
98+
},
99+
},
100+
// JavaScript files
101+
{
102+
files: ['*.js', '*.cjs'],
103+
rules: {
104+
// We only do `no-unused-vars` checks for js files, TS files are checked by TypeScript itself.
105+
'no-unused-vars': ['error', { vars: 'all', args: 'none' }],
106+
},
74107
},
75108
// Node scripts
76109
{
77-
files: ['scripts/**', '*.{js,ts}', 'packages/**/index.js'],
110+
files: [
111+
'scripts/**',
112+
'./*.{js,ts}',
113+
'packages/*/*.js',
114+
'packages/vue/*/*.js',
115+
],
78116
rules: {
79117
'no-restricted-globals': 'off',
80-
'no-restricted-syntax': 'off'
81-
}
82-
}
83-
]
118+
'no-restricted-syntax': ['error', banConstEnum],
119+
'no-console': 'off',
120+
},
121+
},
122+
// Import nodejs modules in compiler-sfc
123+
{
124+
files: ['packages/compiler-sfc/src/**'],
125+
rules: {
126+
'import/no-nodejs-modules': ['error', { allow: builtinModules }],
127+
},
128+
},
129+
],
84130
}

.git-blame-ignore-revs

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

.github/contributing.md

+9-5
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)