Skip to content

Commit dfd53b6

Browse files
committed
Merge branch 'main' into fix/5168
2 parents 3e28ec3 + ca84316 commit dfd53b6

File tree

573 files changed

+33640
-28706
lines changed

Some content is hidden

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

573 files changed

+33640
-28706
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

+69-27
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,130 @@
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',
22+
'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
1423
// most of the codebase are expected to be env agnostic
1524
'no-restricted-globals': ['error', ...DOMGlobals, ...NodeGlobals],
1625

1726
'no-restricted-syntax': [
1827
'error',
28+
banConstEnum,
1929
// since we target ES2015 for baseline support, we need to forbid object
2030
// rest spread usage in destructure as it compiles into a verbose helper.
2131
'ObjectPattern > RestElement',
2232
// tsc compiles assignment spread into Object.assign() calls, but esbuild
2333
// still generates verbose helpers, so spread assignment is also prohiboted
2434
'ObjectExpression > SpreadElement',
25-
'AwaitExpression'
26-
]
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',
2756
},
2857
overrides: [
2958
// tests, no restrictions (runs in Node / jest with jsdom)
3059
{
3160
files: ['**/__tests__/**', 'packages/dts-test/**'],
3261
rules: {
62+
'no-console': 'off',
3363
'no-restricted-globals': 'off',
3464
'no-restricted-syntax': 'off',
3565
'jest/no-disabled-tests': 'error',
36-
'jest/no-focused-tests': 'error'
37-
}
66+
'jest/no-focused-tests': 'error',
67+
},
3868
},
3969
// shared, may be used in any env
4070
{
41-
files: ['packages/shared/**'],
71+
files: ['packages/shared/**', '.eslintrc.cjs'],
4272
rules: {
43-
'no-restricted-globals': 'off'
44-
}
73+
'no-restricted-globals': 'off',
74+
},
4575
},
4676
// Packages targeting DOM
4777
{
4878
files: ['packages/{vue,vue-compat,runtime-dom}/**'],
4979
rules: {
50-
'no-restricted-globals': ['error', ...NodeGlobals]
51-
}
80+
'no-restricted-globals': ['error', ...NodeGlobals],
81+
},
5282
},
5383
// Packages targeting Node
5484
{
55-
files: [
56-
'packages/{compiler-sfc,compiler-ssr,server-renderer,reactivity-transform}/**'
57-
],
85+
files: ['packages/{compiler-sfc,compiler-ssr,server-renderer}/**'],
5886
rules: {
5987
'no-restricted-globals': ['error', ...DOMGlobals],
60-
'no-restricted-syntax': 'off'
61-
}
88+
'no-restricted-syntax': ['error', banConstEnum],
89+
},
6290
},
6391
// Private package, browser only + no syntax restrictions
6492
{
6593
files: ['packages/template-explorer/**', 'packages/sfc-playground/**'],
6694
rules: {
6795
'no-restricted-globals': ['error', ...NodeGlobals],
68-
'no-restricted-syntax': 'off'
69-
}
96+
'no-restricted-syntax': ['error', banConstEnum],
97+
'no-console': 'off',
98+
},
7099
},
71100
// JavaScript files
72101
{
73102
files: ['*.js', '*.cjs'],
74103
rules: {
75104
// 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-
}
105+
'no-unused-vars': ['error', { vars: 'all', args: 'none' }],
106+
},
78107
},
79108
// Node scripts
80109
{
81-
files: ['scripts/**', '*.{js,ts}', 'packages/**/index.js'],
110+
files: [
111+
'scripts/**',
112+
'./*.{js,ts}',
113+
'packages/*/*.js',
114+
'packages/vue/*/*.js',
115+
],
82116
rules: {
83117
'no-restricted-globals': 'off',
84-
'no-restricted-syntax': 'off'
85-
}
86-
}
87-
]
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+
],
88130
}

.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)