From c610d9550741249717d26984aec4465ea7bd850e Mon Sep 17 00:00:00 2001 From: "Xin Du (Clark)" Date: Sun, 7 Mar 2021 12:40:05 +0000 Subject: [PATCH] chore(deps): upgrade to @nuxtjs/eslint-config v6 (#8942) --- package.json | 4 +- packages/cli/test/unit/run.test.js | 2 +- packages/server/src/middleware/error.js | 3 +- packages/server/test/listener.test.js | 8 +- packages/server/test/middleware/error.test.js | 2 +- packages/utils/src/resolve.js | 1 + packages/webpack/src/plugins/vue/client.js | 2 +- yarn.lock | 92 ++++++++----------- 8 files changed, 48 insertions(+), 66 deletions(-) diff --git a/package.json b/package.json index b9929077ff..29a771d998 100644 --- a/package.json +++ b/package.json @@ -36,8 +36,8 @@ "@babel/core": "^7.13.8", "@babel/preset-env": "^7.13.9", "@ls-lint/ls-lint": "^1.9.2", - "@nuxtjs/eslint-config": "^5.0.0", - "@nuxtjs/eslint-config-typescript": "^5.0.0", + "@nuxtjs/eslint-config": "^6.0.0", + "@nuxtjs/eslint-config-typescript": "^6.0.0", "@rollup/plugin-alias": "^3.1.2", "@rollup/plugin-commonjs": "^17.1.0", "@rollup/plugin-json": "^4.1.0", diff --git a/packages/cli/test/unit/run.test.js b/packages/cli/test/unit/run.test.js index 0b99bd18d7..0aaa9780f2 100644 --- a/packages/cli/test/unit/run.test.js +++ b/packages/cli/test/unit/run.test.js @@ -56,7 +56,7 @@ describe('run', () => { test('throws error if external command not found', async () => { execa.mockImplementationOnce(() => { - const e = new Error() + const e = new Error('ENOENT') e.exitCode = 2 e.exitName = 'ENOENT' throw e diff --git a/packages/server/src/middleware/error.js b/packages/server/src/middleware/error.js index 9603281b84..b7c9c88876 100644 --- a/packages/server/src/middleware/error.js +++ b/packages/server/src/middleware/error.js @@ -83,8 +83,7 @@ const normalizeError = (_error, { srcDir, rootDir, buildDir }) => { _error = { message: '' } } - const error = new Error() - error.message = _error.message + const error = new Error(_error.message) error.name = _error.name error.statusCode = _error.statusCode || 500 error.headers = _error.headers diff --git a/packages/server/test/listener.test.js b/packages/server/test/listener.test.js index 860daaf146..b6c01c78ca 100644 --- a/packages/server/test/listener.test.js +++ b/packages/server/test/listener.test.js @@ -327,7 +327,7 @@ describe('server: listener', () => { listener.host = 'localhost' listener.port = 3000 - const addressInUse = new Error() + const addressInUse = new Error('server error') addressInUse.code = 'EADDRINUSE' expect(listener.serverErrorHandler(addressInUse)).rejects.toThrow('Address `localhost:3000` is already in use.') }) @@ -336,7 +336,7 @@ describe('server: listener', () => { const listener = new Listener({}) listener.socket = 'nuxt.socket' - const addressInUse = new Error() + const addressInUse = new Error('server error') addressInUse.code = 'EADDRINUSE' expect(listener.serverErrorHandler(addressInUse)).rejects.toThrow('Address `nuxt.socket` is already in use.') }) @@ -348,7 +348,7 @@ describe('server: listener', () => { listener.close = jest.fn(() => Promise.resolve()) listener.listen = jest.fn() - const addressInUse = new Error() + const addressInUse = new Error('server error') addressInUse.code = 'EADDRINUSE' await listener.serverErrorHandler(addressInUse) @@ -372,7 +372,7 @@ describe('server: listener', () => { } } - const addressInUse = new Error() + const addressInUse = new Error('server error') addressInUse.code = 'EADDRINUSE' await listener.serverErrorHandler(addressInUse).catch(() => { }) diff --git a/packages/server/test/middleware/error.test.js b/packages/server/test/middleware/error.test.js index 92421f37a6..c39cba9f71 100644 --- a/packages/server/test/middleware/error.test.js +++ b/packages/server/test/middleware/error.test.js @@ -69,7 +69,7 @@ describe('server: errorMiddleware', () => { expect(ctx.res.setHeader).nthCalledWith(3, 'Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate') expect(ctx.res.setHeader).nthCalledWith(4, 'Custom-Header', 'test') expect(params.resources.errorTemplate).toBeCalledTimes(1) - expect(params.resources.errorTemplate).toBeCalledWith({ status: 500 }) + expect(params.resources.errorTemplate).toBeCalledWith({ message: '', status: 500 }) expect(ctx.res.end).toBeCalledTimes(1) expect(ctx.res.end).toBeCalledWith('error template', 'utf-8') }) diff --git a/packages/utils/src/resolve.js b/packages/utils/src/resolve.js index 22e7593bc5..6bbdbb5a6c 100644 --- a/packages/utils/src/resolve.js +++ b/packages/utils/src/resolve.js @@ -86,6 +86,7 @@ export function defineAlias (src, target, prop, opts = {}) { warned = true consola.warn({ message: `'${prop}' is deprecated'`, + // eslint-disable-next-line unicorn/error-message additional: new Error().stack.split('\n').splice(2).join('\n') }) } diff --git a/packages/webpack/src/plugins/vue/client.js b/packages/webpack/src/plugins/vue/client.js index be08d91872..386154382b 100644 --- a/packages/webpack/src/plugins/vue/client.js +++ b/packages/webpack/src/plugins/vue/client.js @@ -92,7 +92,7 @@ export default class VueSSRClientPlugin { // Find all asset modules associated with the same chunk assetModules.forEach((m) => { - if (m.chunks.some(id => id === cid)) { + if (m.chunks.includes(cid)) { files.push.apply(files, m.assets.map(fileToIndex)) } }) diff --git a/yarn.lock b/yarn.lock index f40a9be91b..12b907d442 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1941,28 +1941,28 @@ rc9 "^1.2.0" std-env "^2.2.1" -"@nuxtjs/eslint-config-typescript@^5.0.0": - version "5.0.0" - resolved "https://registry.npmjs.org/@nuxtjs/eslint-config-typescript/-/eslint-config-typescript-5.0.0.tgz#060c1402e559b1df78c8c19b2f5a873eac53cab2" - integrity sha512-jw6h/WsdPc5i5l+a3DmEdpoAbFE4Tt7X6DBdXY7gfAsZ6bfzjoMzoHYaAmUk2tWkRDZmYvP6YANkbvi3X3pPAg== +"@nuxtjs/eslint-config-typescript@^6.0.0": + version "6.0.0" + resolved "https://registry.npmjs.org/@nuxtjs/eslint-config-typescript/-/eslint-config-typescript-6.0.0.tgz#e3ea273edf2dfcb176a9f28ca1a95870a6c21cd8" + integrity sha512-oQm0ZmWdHNf8TKWbSUhwniarCX590oHnxuArvwApLDaaNaw0m4TL5+rpARMCVtlS33YhJ/Le+GaeyS5HeVt19A== dependencies: - "@nuxtjs/eslint-config" "5.0.0" - "@typescript-eslint/eslint-plugin" "^4.7.0" - "@typescript-eslint/parser" "^4.7.0" + "@nuxtjs/eslint-config" "6.0.0" + "@typescript-eslint/eslint-plugin" "^4.16.1" + "@typescript-eslint/parser" "^4.16.1" -"@nuxtjs/eslint-config@5.0.0", "@nuxtjs/eslint-config@^5.0.0": - version "5.0.0" - resolved "https://registry.npmjs.org/@nuxtjs/eslint-config/-/eslint-config-5.0.0.tgz#d66143ee4ada9d944de0bfbe2d7e4693a2e20d60" - integrity sha512-xoi0CPpFj4hOTz5xMiqGK314276gOmI+8W+3tgybqsKiKQBFXe1IOUjHzsuGqkS44iGy+GmmrwA387ojvKnhkQ== +"@nuxtjs/eslint-config@6.0.0", "@nuxtjs/eslint-config@^6.0.0": + version "6.0.0" + resolved "https://registry.npmjs.org/@nuxtjs/eslint-config/-/eslint-config-6.0.0.tgz#bf8b7b1f72fc9080ba2a6c71f2447d4166d374e3" + integrity sha512-DQLyMS+A1lPeo3ajMEISz8rPzCU4DTIKQtv9HRy1A3w5583dXcbHMQzNg3qGHoTPJ/FzM1+WhV8Ak3+gQ+9uoQ== dependencies: - eslint-config-standard "^16.0.1" + eslint-config-standard "^16.0.2" eslint-plugin-import "^2.22.1" - eslint-plugin-jest "^24.1.3" + eslint-plugin-jest "^24.1.7" eslint-plugin-node "^11.1.0" - eslint-plugin-promise "^4.2.1" + eslint-plugin-promise "^4.3.1" eslint-plugin-standard "^4.1.0" - eslint-plugin-unicorn "^23.0.0" - eslint-plugin-vue "^7.1.0" + eslint-plugin-unicorn "^28.0.2" + eslint-plugin-vue "^7.7.0" "@nuxtjs/youch@^4.2.3": version "4.2.3" @@ -2584,7 +2584,7 @@ dependencies: "@types/node" "*" -"@typescript-eslint/eslint-plugin@^4.16.1", "@typescript-eslint/eslint-plugin@^4.7.0": +"@typescript-eslint/eslint-plugin@^4.16.1": version "4.16.1" resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.16.1.tgz#2caf6a79dd19c3853b8d39769a27fccb24e4e651" integrity sha512-SK777klBdlkUZpZLC1mPvyOWk9yAFCWmug13eAjVQ4/Q1LATE/NbcQL1xDHkptQkZOLnPmLUA1Y54m8dqYwnoQ== @@ -2610,7 +2610,7 @@ eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/parser@^4.16.1", "@typescript-eslint/parser@^4.7.0": +"@typescript-eslint/parser@^4.16.1": version "4.16.1" resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.16.1.tgz#3bbd3234dd3c5b882b2bcd9899bc30e1e1586d2a" integrity sha512-/c0LEZcDL5y8RyI1zLcmZMvJrsR6SM1uetskFkoh3dvqDKVXPsXI+wFB/CbVw7WkEyyTKobC1mUNp/5y6gRvXg== @@ -5495,15 +5495,7 @@ escodegen@^1.14.1: optionalDependencies: source-map "~0.6.1" -eslint-ast-utils@^1.1.0: - version "1.1.0" - resolved "https://registry.npmjs.org/eslint-ast-utils/-/eslint-ast-utils-1.1.0.tgz#3d58ba557801cfb1c941d68131ee9f8c34bd1586" - integrity sha512-otzzTim2/1+lVrlH19EfQQJEhVJSu0zOb9ygb3iapN6UlyaDtyRq4b5U1FuW0v1lRa9Fp/GJyHkSwm6NqABgCA== - dependencies: - lodash.get "^4.4.2" - lodash.zip "^4.2.0" - -eslint-config-standard@^16.0.1: +eslint-config-standard@^16.0.2: version "16.0.2" resolved "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-16.0.2.tgz#71e91727ac7a203782d0a5ca4d1c462d14e234f6" integrity sha512-fx3f1rJDsl9bY7qzyX8SAtP8GBSk6MfXFaTfaGgk12aAYW4gJSyRm7dM790L6cbXv63fvjY4XeSzXnb4WM+SKw== @@ -5560,10 +5552,10 @@ eslint-plugin-import@^2.22.1: resolve "^1.17.0" tsconfig-paths "^3.9.0" -eslint-plugin-jest@^24.1.3: - version "24.1.5" - resolved "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.1.5.tgz#1e866a9f0deac587d0a3d5d7cefe99815a580de2" - integrity sha512-FIP3lwC8EzEG+rOs1y96cOJmMVpdFNreoDJv29B5vIupVssRi8zrSY3QadogT0K3h1Y8TMxJ6ZSAzYUmFCp2hg== +eslint-plugin-jest@^24.1.7: + version "24.1.7" + resolved "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.1.7.tgz#77cb4e88ec2559721aa083a5905ef9e27fa12059" + integrity sha512-p5Dk/Rgiv+ThxguYl96dj7Hqkow09dwSH1G5ALKdREM4pHO1V1xP0N6/myzoquD3z4h+1YPYHzM+g7Fd0xyaXg== dependencies: "@typescript-eslint/experimental-utils" "^4.0.1" @@ -5579,7 +5571,7 @@ eslint-plugin-node@^11.1.0: resolve "^1.10.1" semver "^6.1.0" -eslint-plugin-promise@^4.2.1: +eslint-plugin-promise@^4.3.1: version "4.3.1" resolved "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.3.1.tgz#61485df2a359e03149fdafc0a68b0e030ad2ac45" integrity sha512-bY2sGqyptzFBDLh/GMbAxfdJC+b0f23ME63FOE4+Jao0oZ3E1LEwFtWJX/1pGMJLiTtrSSern2CRM/g+dfc0eQ== @@ -5589,26 +5581,26 @@ eslint-plugin-standard@^4.1.0: resolved "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.1.0.tgz#0c3bf3a67e853f8bbbc580fb4945fbf16f41b7c5" integrity sha512-ZL7+QRixjTR6/528YNGyDotyffm5OQst/sGxKDwGb9Uqs4In5Egi4+jbobhqJoyoCM6/7v/1A5fhQ7ScMtDjaQ== -eslint-plugin-unicorn@^23.0.0: - version "23.0.0" - resolved "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-23.0.0.tgz#b2820212874735f9d91ecc8678b263ecfa6cf5f6" - integrity sha512-Vabo3cjl6cjyhcf+76CdQEY6suOFzK0Xh3xo0uL9VDYrDJP5+B6PjV0tHTYm82WZmFWniugFJM3ywHSNYTi/ZQ== +eslint-plugin-unicorn@^28.0.2: + version "28.0.2" + resolved "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-28.0.2.tgz#ab9884ebae04590ecd9c1c294330d889a74b7c37" + integrity sha512-k4AoFP7n8/oq6lBXkdc9Flid6vw2B8j7aXFCxgzJCyKvmaKrCUFb1TFPhG9eSJQFZowqmymMPRtl8oo9NKLUbw== dependencies: ci-info "^2.0.0" clean-regexp "^1.0.0" - eslint-ast-utils "^1.1.0" - eslint-template-visitor "^2.2.1" + eslint-template-visitor "^2.2.2" eslint-utils "^2.1.0" - import-modules "^2.0.0" + eslint-visitor-keys "^2.0.0" + import-modules "^2.1.0" lodash "^4.17.20" pluralize "^8.0.0" read-pkg-up "^7.0.1" - regexp-tree "^0.1.21" + regexp-tree "^0.1.22" reserved-words "^0.1.2" safe-regex "^2.1.1" - semver "^7.3.2" + semver "^7.3.4" -eslint-plugin-vue@^7.1.0: +eslint-plugin-vue@^7.7.0: version "7.7.0" resolved "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-7.7.0.tgz#a90df4595e670821bf243bd2750ededdb74948b8" integrity sha512-mYz4bpLGv5jx6YG/GvKkqbGSfV7uma2u1P3mLA41Q5vQl8W1MeuTneB8tfsLq6xxxesFubcrOC0BZBJ5R+eaCQ== @@ -5642,7 +5634,7 @@ eslint-scope@^5.0.0, eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-template-visitor@^2.2.1: +eslint-template-visitor@^2.2.2: version "2.3.2" resolved "https://registry.npmjs.org/eslint-template-visitor/-/eslint-template-visitor-2.3.2.tgz#b52f96ff311e773a345d79053ccc78275bbc463d" integrity sha512-3ydhqFpuV7x1M9EK52BPNj6V0Kwu0KKkcIAfpUhwHbR8ocRln/oUHgfxQupY8O1h4Qv/POHDumb/BwwNfxbtnA== @@ -7033,7 +7025,7 @@ import-local@^3.0.2: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" -import-modules@^2.0.0: +import-modules@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/import-modules/-/import-modules-2.1.0.tgz#abe7df297cb6c1f19b57246eb8b8bd9664b6d8c2" integrity sha512-8HEWcnkbGpovH9yInoisxaSoIg9Brbul+Ju3Kqe2UsYDUBJD/iQjSgEj0zPcTDPKfPp2fs5xlv1i+JSye/m1/A== @@ -8360,11 +8352,6 @@ lodash.debounce@^4.0.8: resolved "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= -lodash.get@^4.4.2: - version "4.4.2" - resolved "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" - integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= - lodash.ismatch@^4.4.0: version "4.4.0" resolved "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" @@ -8405,11 +8392,6 @@ lodash.uniq@^4.5.0: resolved "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash.zip@^4.2.0: - version "4.2.0" - resolved "https://registry.npmjs.org/lodash.zip/-/lodash.zip-4.2.0.tgz#ec6662e4896408ed4ab6c542a3990b72cc080020" - integrity sha1-7GZi5IlkCO1KtsVCo5kLcswIACA= - lodash@4.17.21, lodash@^4.15.0, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.5: version "4.17.21" resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" @@ -11194,7 +11176,7 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexp-tree@^0.1.21, regexp-tree@~0.1.1: +regexp-tree@^0.1.22, regexp-tree@~0.1.1: version "0.1.23" resolved "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.23.tgz#8a8ce1cc5e971acef62213a7ecdb1f6e18a1f1b2" integrity sha512-+7HWfb4Bvu8Rs2eQTUIpX9I/PlQkYOuTNbRpKLJlQpSgwSkzFYh+pUj0gtvglnOZLKB6YgnIgRuJ2/IlpL48qw==