Closed mashirozx closed 2 years ago
// package.json
{
"name": "eula",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "12.0.4",
"react": "17.0.2",
"react-dom": "17.0.2"
},
"devDependencies": {
"@types/node": "16.11.10",
"@types/react": "17.0.36",
"eslint": "8.3.0",
"eslint-config-next": "12.0.4",
"typescript": "4.5.2"
}
}
//.eslintrc.js
const off = 'off'
const error = 'error'
const warn = 'warn'
module.exports = {
env: {
browser: true,
es2021: true,
node: true
},
parserOptions: {
ecmaVersion: 2021
},
extends: ['next/core-web-vitals'],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? warn : off,
'no-debugger': process.env.NODE_ENV === 'production' ? warn : off,
'@typescript-eslint/ban-types': off,
'@typescript-eslint/explicit-module-boundary-types': off,
'@typescript-eslint/member-delimiter-style': [
error,
{
multiline: {
delimiter: 'none'
},
singleline: {
delimiter: 'comma'
}
}
],
'@typescript-eslint/no-explicit-any': off,
'space-before-function-paren': off
}
}
Simply, a yarn create next-app --typescript
project.
And when I downgrade eslint to 7.23.0, it shows :
[Error - 下午5:43:25] TypeError [ERR_INVALID_ARG_VALUE]: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
at createRequire (internal/modules/cjs/loader.js:1222:13)
at Object.resolve (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\shared\relative-module-resolver.js:28:20)
at Object.ModuleResolver.resolve (C:\Users\ASUS\Documents\eula\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:201:44)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:1017:39)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:203:43)
at C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:908:33
at Array.reduce (<anonymous>)
at ConfigArrayFactory._loadPlugins (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:904:22)
at ConfigArrayFactory._normalizeObjectConfigDataBody (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:725:44)
at _normalizeObjectConfigDataBody.next (<anonymous>)
@mashirozx does the validation happen correctly when you use eslint in the terminal. If this is the case can you please provide me with a GitHub repository I can clone that demos what you are experiencing.
Hello, here's the repository: https://git.moezx.cc/mashiro/eula
FYI: Windows 10 Nodejs 16
Actually for me both the terminal and the VS Code extension result in the same problems:
and in the terminal
eula\pages\api\hello.ts
1:1 error Definition for rule '@typescript-eslint/member-delimiter-style' was not found @typescript-eslint/member-delimiter-style
✖ 1 problem (1 error, 0 warnings)
Thanks. But in my vscode, I can even not see the eslint errors LAL
Full log
[Info - 上午9:59:33] ESLint server is starting
[Info - 上午9:59:34] ESLint server running in node v14.16.0
[Info - 上午9:59:37] ESLint server is running.
[Info - 上午10:00:32] ESLint library loaded from: C:\Users\ASUS\Documents\eula\node_modules\eslint\lib\api.js
(node:23716) UnhandledPromiseRejectionWarning: Error: Failed to load plugin 'html' declared in 'CLIOptions': Cannot find module 'eslint-plugin-html'
Require stack:
- C:\Users\ASUS\Documents\eula\__placeholder__.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:934:15)
at Function.resolve (internal/modules/cjs/helpers.js:94:19)
at Object.resolve (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\shared\relative-module-resolver.js:28:50)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:1017:39)
at C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:908:33
at Array.reduce (<anonymous>)
at ConfigArrayFactory._loadPlugins (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:904:22)
at ConfigArrayFactory._normalizeObjectConfigDataBody (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:725:44)
at _normalizeObjectConfigDataBody.next (<anonymous>)
at ConfigArrayFactory._normalizeObjectConfigData (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:665:20)
(Use `Code --trace-warnings ...` to show where the warning was created)
(node:23716) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:23716) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:23716) UnhandledPromiseRejectionWarning: Error: Failed to load plugin 'html' declared in 'CLIOptions': Cannot find module 'eslint-plugin-html'
Require stack:
- C:\Users\ASUS\Documents\eula\__placeholder__.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:934:15)
at Function.resolve (internal/modules/cjs/helpers.js:94:19)
at Object.resolve (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\shared\relative-module-resolver.js:28:50)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:1017:39)
at C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:908:33
at Array.reduce (<anonymous>)
at ConfigArrayFactory._loadPlugins (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:904:22)
at ConfigArrayFactory._normalizeObjectConfigDataBody (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:725:44)
at _normalizeObjectConfigDataBody.next (<anonymous>)
at ConfigArrayFactory._normalizeObjectConfigData (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:665:20)
(node:23716) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
[Error - 上午10:02:34] Request textDocument/codeAction failed.
Message: Request textDocument/codeAction failed with message: Failed to load plugin 'html' declared in 'CLIOptions': Cannot find module 'eslint-plugin-html'
Require stack:
- C:\Users\ASUS\Documents\eula\__placeholder__.js
Code: -32603
(node:23716) UnhandledPromiseRejectionWarning: Error: Failed to load plugin 'html' declared in 'CLIOptions': Cannot find module 'eslint-plugin-html'
Require stack:
- C:\Users\ASUS\Documents\eula\__placeholder__.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:934:15)
at Function.resolve (internal/modules/cjs/helpers.js:94:19)
at Object.resolve (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\shared\relative-module-resolver.js:28:50)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:1017:39)
at C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:908:33
at Array.reduce (<anonymous>)
at ConfigArrayFactory._loadPlugins (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:904:22)
at ConfigArrayFactory._normalizeObjectConfigDataBody (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:725:44)
at _normalizeObjectConfigDataBody.next (<anonymous>)
at ConfigArrayFactory._normalizeObjectConfigData (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:665:20)
(node:23716) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)
(node:23716) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
at createRequire (internal/modules/cjs/loader.js:1222:13)
at Object.resolve (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\shared\relative-module-resolver.js:28:20)
at Object.ModuleResolver.resolve (C:\Users\ASUS\Documents\eula\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:201:44)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:1017:39)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:203:43)
at C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:908:33
at Array.reduce (<anonymous>)
at ConfigArrayFactory._loadPlugins (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:904:22)
at ConfigArrayFactory._normalizeObjectConfigDataBody (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:725:44)
at _normalizeObjectConfigDataBody.next (<anonymous>)
(node:23716) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)
[Error - 上午10:02:49] Request textDocument/codeAction failed.
Message: Request textDocument/codeAction failed with message: Failed to load plugin 'html' declared in 'CLIOptions': The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
Code: -32603
[Error - 上午10:10:18] Request textDocument/codeAction failed.
Message: Request textDocument/codeAction failed with message: Failed to load plugin 'html' declared in 'CLIOptions': The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
Code: -32603
(node:23716) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
at createRequire (internal/modules/cjs/loader.js:1222:13)
at Object.resolve (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\shared\relative-module-resolver.js:28:20)
at Object.ModuleResolver.resolve (C:\Users\ASUS\Documents\eula\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:201:44)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:1017:39)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:203:43)
at C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:908:33
at Array.reduce (<anonymous>)
at ConfigArrayFactory._loadPlugins (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:904:22)
at ConfigArrayFactory._normalizeObjectConfigDataBody (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:725:44)
at _normalizeObjectConfigDataBody.next (<anonymous>)
(node:23716) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)
(node:23716) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
at createRequire (internal/modules/cjs/loader.js:1222:13)
at Object.resolve (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\shared\relative-module-resolver.js:28:20)
at Object.ModuleResolver.resolve (C:\Users\ASUS\Documents\eula\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:201:44)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:1017:39)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:203:43)
at C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:908:33
at Array.reduce (<anonymous>)
at ConfigArrayFactory._loadPlugins (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:904:22)
at ConfigArrayFactory._normalizeObjectConfigDataBody (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:725:44)
at _normalizeObjectConfigDataBody.next (<anonymous>)
(node:23716) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 12)
(node:23716) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
at createRequire (internal/modules/cjs/loader.js:1222:13)
at Object.resolve (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\shared\relative-module-resolver.js:28:20)
at Object.ModuleResolver.resolve (C:\Users\ASUS\Documents\eula\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:201:44)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:1017:39)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:203:43)
at C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:908:33
at Array.reduce (<anonymous>)
at ConfigArrayFactory._loadPlugins (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:904:22)
at ConfigArrayFactory._normalizeObjectConfigDataBody (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:725:44)
at _normalizeObjectConfigDataBody.next (<anonymous>)
(node:23716) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 13)
(node:23716) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
at createRequire (internal/modules/cjs/loader.js:1222:13)
at Object.resolve (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\shared\relative-module-resolver.js:28:20)
at Object.ModuleResolver.resolve (C:\Users\ASUS\Documents\eula\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:201:44)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:1017:39)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:203:43)
at C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:908:33
at Array.reduce (<anonymous>)
at ConfigArrayFactory._loadPlugins (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:904:22)
at ConfigArrayFactory._normalizeObjectConfigDataBody (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:725:44)
at _normalizeObjectConfigDataBody.next (<anonymous>)
(node:23716) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 14)
[Error - 上午10:10:27] Request textDocument/codeAction failed.
Message: Request textDocument/codeAction failed with message: Failed to load plugin 'html' declared in 'CLIOptions': The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
Code: -32603
(node:23716) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
at createRequire (internal/modules/cjs/loader.js:1222:13)
at Object.resolve (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\shared\relative-module-resolver.js:28:20)
at Object.ModuleResolver.resolve (C:\Users\ASUS\Documents\eula\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:201:44)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:1017:39)
at ConfigArrayFactory._loadPlugin (C:\Users\ASUS\Documents\eula\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:203:43)
at C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:908:33
at Array.reduce (<anonymous>)
at ConfigArrayFactory._loadPlugins (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:904:22)
at ConfigArrayFactory._normalizeObjectConfigDataBody (C:\Users\ASUS\Documents\eula\node_modules\@eslint\eslintrc\lib\config-array-factory.js:725:44)
at _normalizeObjectConfigDataBody.next (<anonymous>)
(node:23716) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 15)
yarn lint
works
vscode
Version: 1.62.3 (user setup)
Commit: ccbaa2d27e38e5afa3e5c21c1c7bef4657064247
Date: 2021-11-17T08:11:14.551Z
Electron: 13.5.2
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19042
eslint
When I try to open an old project (ESLint works fine previously), it also throws this error
[Info - 上午10:33:47] ESLint server is starting
[Info - 上午10:33:50] ESLint server running in node v14.16.0
[Info - 上午10:33:50] ESLint server is running.
[Info - 上午10:33:57] ESLint library loaded from: C:\Users\ASUS\Documents\vue3-composition-admin\node_modules\eslint\lib\api.js
[Error - 上午10:34:24]
Failed to load plugin 'html' declared in 'CLIOptions': Cannot find module 'eslint-plugin-html'
Require stack:
- C:\Users\ASUS\Documents\vue3-composition-admin\__placeholder__.js
Happened while validating C:\Users\ASUS\Documents\vue3-composition-admin\src\utils\https.ts
This can happen for a couple of reasons:
1. The plugin name is spelled incorrectly in an ESLint configuration file (e.g. .eslintrc).
2. If ESLint is installed globally, then make sure 'eslint-plugin-html' is installed globally as well.
3. If ESLint is installed locally, then 'eslint-plugin-html' isn't installed correctly.
Consider running eslint --debug C:\Users\ASUS\Documents\vue3-composition-admin\src\utils\https.ts from a terminal to obtain a trace about the configuration files used.
What I did these days is that I upgraded NodeJS in Windows environment from v14 to v16.
I didn't use the eslint-plugin-html plugin in both project.
Works fine after reinstall vscode
settings.json: "eslint.options": { "overrideConfig": { "env": { "browser": true, "es6": true }, "parserOptions": { "ecmaVersion": 2020, "sourceType": "module", "ecmaFeatures": { "jsx": true } }, "rules": { "no-debugger": "off" } } },