Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension does not do anything #159

Closed
KuznetsovRoman opened this issue Mar 27, 2023 · 3 comments
Closed

Extension does not do anything #159

KuznetsovRoman opened this issue Mar 27, 2023 · 3 comments

Comments

@KuznetsovRoman
Copy link

KuznetsovRoman commented Mar 27, 2023

Describe the bug

A clear and concise description of what the bug is.

I installed the extension and copy-pasted .vscode/settings.json from example to my next typescript project, but when i save the file or launch Format Document (With Prettier ESLint is choosed) nothing happens. I added a stroke:

const test = {qwertyuiopasdfghjkl: {qwertyuiopasdfghjkl: {qwertyuiopasdfghjkl: {qwertyuiopasdfghjkl: {qwertyuiopasdfghjkl: {qwertyuiopasdfghjkl:{qwertyuiopasdfghjkl:{qwertyuiopasdfghjkl:{qwertyuiopasdfghjkl:"qwertyuiopasdfghjkl"}}}}}}}}};

and tried to run the extension on the file, expecting it would unwrap the object, like manual npx prettier --write . does, but nothing changes. Output log only says Incorrect type. Expected "boolean". [Ln 8, Col 45], but using true/false instead of "true"/"false" does not help. Another prettier extension works, but after deleting it, Prettier Eslint doesn't work anyway.

To Reproduce

Steps to reproduce the behavior:

  1. Install eslint, prettier, @typescript-eslint/parser with versions above
  2. Install the extension
  3. Create .vscode/settings.json from the example: https://pastebin.com/2j5AWn3U
  4. Restart Visual Studio
  5. Create a file with content:
const test = {qwertyuiopasdfghjkl: {qwertyuiopasdfghjkl: {qwertyuiopasdfghjkl: {qwertyuiopasdfghjkl: {qwertyuiopasdfghjkl: {qwertyuiopasdfghjkl:{qwertyuiopasdfghjkl:{qwertyuiopasdfghjkl:{qwertyuiopasdfghjkl:"qwertyuiopasdfghjkl"}}}}}}}}};
  1. Press "save" or use Format Document command

Expected behavior
The statement turns into:

const test = {
    qwertyuiopasdfghjkl: {
        qwertyuiopasdfghjkl: {
            qwertyuiopasdfghjkl: {
                qwertyuiopasdfghjkl: {
                    qwertyuiopasdfghjkl: {
                        qwertyuiopasdfghjkl: {
                            qwertyuiopasdfghjkl: {
                                qwertyuiopasdfghjkl: { qwertyuiopasdfghjkl: "qwertyuiopasdfghjkl" },
                            },
                        },
                    },
                },
            },
        },
    },
};

like after launching npx prettier --write . manually

Example Project

package versions:

"@typescript-eslint/parser": "5.30.5",
"@typescript-eslint/eslint-plugin": "5.30.5",
"eslint": "8.19.0",
"prettier": "2.7.1",
"typescript": "4.7.4",
"eslint-config-next": "^12.2.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.2.3",
"eslint-plugin-next": "^0.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-only-warn": "^1.0.3",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.30.1",

.vscode/settings.json: https://pastebin.com/CjH8qjFC
.eslintrc.json: https://pastebin.com/tgrK3yPp
.prettierrc.json: https://pastebin.com/wwdzzc1X
tsconfig.json: https://pastebin.com/X64McuVu

Versions:

  • VS Code Prettier ESLint extension [5.1.0]
  • Visual Studio Code: [1.76.2]
  • Node: 18.14.0
  • Package Manager: npm 9.3.1
  • prettier: 2.7.1
  • eslint: 8.19.0

System Specifications (please complete the following information):

  • OS: [MacOS Monterey 12.2]
  • Processor: [Apple M1 Pro]
  • RAM Size: [32 GB]
@rcoates-isu
Copy link

What output do you see for ESLint-Prettier in the terminal?

@KuznetsovRoman
Copy link
Author

What output do you see for ESLint-Prettier in the terminal?

Error: Failed to load plugin 'react-hooks' declared in 'CLIOptions': The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received '' 
TypeError: Failed to load plugin 'react-hooks' declared in 'CLIOptions': The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
	at new NodeError (node:internal/errors:371:5)
	at createRequire (node:internal/modules/cjs/loader:1281:13)
	at Object.resolve (/Users/kroman512/my-project/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2325:16)
	at ModuleResolver.resolve (/Users/kroman512/my-project/node_modules/@rushstack/eslint-patch/lib/modern-module-resolution.js:201:44)
	at ConfigArrayFactory._loadPlugin (/Users/kroman512/my-project/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3376:33)
	at ConfigArrayFactory._loadPlugin (/Users/kroman512/my-project/node_modules/@rushstack/eslint-patch/lib/modern-module-resolution.js:203:43)
	at /Users/kroman512/my-project/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3267:33
	at Array.reduce (<anonymous>)
	at ConfigArrayFactory._loadPlugins (/Users/kroman512/my-project/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3263:22)
	at ConfigArrayFactory._normalizeObjectConfigDataBody (/Users/kroman512/my-project/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3063:44)
	at _normalizeObjectConfigDataBody.next (<anonymous>)
	at ConfigArrayFactory._normalizeObjectConfigData (/Users/kroman512/my-project/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3003:20)
	at _normalizeObjectConfigData.next (<anonymous>)
	at ConfigArrayFactory.create (/Users/kroman512/my-project/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2798:16)
	at createCLIConfigArray (/Users/kroman512/my-project/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3608:47)
	at CascadingConfigArrayFactory.clearCache (/Users/kroman512/my-project/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3780:32)
	at new ESLint (/Users/kroman512/my-project/node_modules/eslint/lib/eslint/eslint.js:448:32)
	at $me (/Users/kroman512/.vscode/extensions/rvest.vs-code-prettier-eslint-5.1.0/dist/extension.js:185:69)
	at /Users/kroman512/.vscode/extensions/rvest.vs-code-prettier-eslint-5.1.0/dist/extension.js:193:700
	at zme (/Users/kroman512/.vscode/extensions/rvest.vs-code-prettier-eslint-5.1.0/dist/extension.js:185:1432)

@KuznetsovRoman
Copy link
Author

KuznetsovRoman commented Mar 30, 2023

#42 seems related

Looks like the problem is in @rushstack/eslint-patch package

#72 (comment) solved the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants