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

[Bug]: Setting the path to Stylelint fails #446

Closed
1 task done
mlbiche opened this issue Feb 27, 2023 · 2 comments
Closed
1 task done

[Bug]: Setting the path to Stylelint fails #446

mlbiche opened this issue Feb 27, 2023 · 2 comments
Labels
type: bug a problem with a feature or rule

Comments

@mlbiche
Copy link

mlbiche commented Feb 27, 2023

How did you encounter this bug?

I am setting up Stylelint in a project using pnpm workspaces. Stylelint is installed within a workspace (sub-directory). Setting the path to the package in the stylelintPath config prevent the extension to start.

Link to Minimal Reproducible Example

https://github.com/mlbiche/stylelint-repro

Code Snippet

No response

Stylelint Configuration

No response

Extension Configuration

{
  "stylelint.stylelintPath": "packages/lint/node_modules/.bin/stylelint"
}

The config is available in the reproduction repository.

Actual Behaviour

When opening VSCode, the following error pops up

[Error - 6:24:50 PM] [language-server] Failed to load Stylelint from "stylelintPath": packages/lint/node_modules/.bin/stylelint. | error: {"name":"SyntaxError","message":"missing ) after argument list","stack":"[...path to my workspace]/packages/lint/node_modules/.bin/stylelint:2
basedir=$(dirname \"$(echo \"$0\" | sed -e 's,\\\\,/,g')\")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1039:15)
    at Module._compile (node:internal/modules/cjs/loader:1074:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:829:12)
    at c._load (node:electron/js2c/asar_bundle:5:13343)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at lR.oR (/Users/thibaud/.vscode-oss/extensions/stylelint.vscode-stylelint-1.2.4-universal/dist/start-server.js:70:36260)"}

As the extension does not load correctly, when I open src/style.css file no Stylelint error is raised.

Expected Behaviour

The rule no-empty-source should fail in src/style.css file as it is by running pnpm -F src lint:style

Logs

No response

Stylelint Version

v15.2.0

vscode-stylelint Version

v1.2.4

Node.js Version

v19.7.0

Operating System

macOS 12.6.3

Windows Subsystem for Linux

No response

Code of Conduct

  • I agree to follow vscode-stylelint's Code of Conduct
@ota-meshi
Copy link
Member

Specify the stylelint module path instead of the executable file in the stylelintPath option. In other words, specify the root directory of stylelint or the main javascript path.

https://github.com/stylelint/vscode-stylelint#stylelintstylelintpath

@mlbiche
Copy link
Author

mlbiche commented Feb 28, 2023

Han, sorry for the trouble 😬 Cheers !

@mlbiche mlbiche closed this as completed Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug a problem with a feature or rule
Projects
None yet
Development

No branches or pull requests

2 participants