mirror of
https://github.com/vuejs/core.git
synced 2024-11-22 04:51:10 +00:00
chore: more descriptive eslint error messages for restricted syntax
This commit is contained in:
parent
2ae908d00c
commit
b11dab99d1
@ -26,13 +26,23 @@ module.exports = {
|
||||
'no-restricted-syntax': [
|
||||
'error',
|
||||
banConstEnum,
|
||||
// since we target ES2015 for baseline support, we need to forbid object
|
||||
// rest spread usage in destructure as it compiles into a verbose helper.
|
||||
'ObjectPattern > RestElement',
|
||||
// tsc compiles assignment spread into Object.assign() calls, but esbuild
|
||||
// still generates verbose helpers, so spread assignment is also prohiboted
|
||||
'ObjectExpression > SpreadElement',
|
||||
'AwaitExpression',
|
||||
{
|
||||
selector: 'ObjectPattern > RestElement',
|
||||
message:
|
||||
'Our output target is ES2016, and object rest spread results in ' +
|
||||
'verbose helpers and should be avoided.',
|
||||
},
|
||||
{
|
||||
selector: 'ObjectExpression > SpreadElement',
|
||||
message:
|
||||
'esbuild transpiles object spread into very verbose inline helpers.\n' +
|
||||
'Please use the `extend` helper from @vue/shared instead.',
|
||||
},
|
||||
{
|
||||
selector: 'AwaitExpression',
|
||||
message:
|
||||
'Our output target is ES2016, so async/await syntax should be avoided.',
|
||||
},
|
||||
],
|
||||
'sort-imports': ['error', { ignoreDeclarationSort: true }],
|
||||
|
||||
|
@ -331,7 +331,7 @@ function createConfig(format, output, plugins = []) {
|
||||
tsconfig: path.resolve(__dirname, 'tsconfig.json'),
|
||||
sourceMap: output.sourcemap,
|
||||
minify: false,
|
||||
target: isServerRenderer || isCJSBuild ? 'es2019' : 'es2015',
|
||||
target: isServerRenderer || isCJSBuild ? 'es2019' : 'es2016',
|
||||
define: resolveDefine(),
|
||||
}),
|
||||
...resolveNodePlugins(),
|
||||
@ -367,7 +367,7 @@ function createMinifiedConfig(/** @type {PackageFormat} */ format) {
|
||||
terser({
|
||||
module: /^esm/.test(format),
|
||||
compress: {
|
||||
ecma: 2015,
|
||||
ecma: 2016,
|
||||
pure_getters: true,
|
||||
},
|
||||
safari10: true,
|
||||
|
Loading…
Reference in New Issue
Block a user