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

Add '--absolute-config' for an absolute config path #5692

Closed
jtrv opened this issue Nov 4, 2021 · 7 comments
Closed

Add '--absolute-config' for an absolute config path #5692

jtrv opened this issue Nov 4, 2021 · 7 comments
Labels
status: needs clarification triage needs clarification from author

Comments

@jtrv
Copy link

jtrv commented Nov 4, 2021

What is the problem you're trying to solve?

--config seems to always use a relative path for the config file, so if you want to do something like --config='~/.config/.stylintrc' you will get an error because the file currentWorkingDirectory/~/.config/.stylintrc could not be found.

What solution would you like to see?

I want to be able to use a an absolute path for the config file from the cli with --absolute-config='~/.config/.stylintrc'

@alexander-akait
Copy link
Member

I don't think we need this, something wrong in your environments, --config works fine with relative and absolute configurations

@jtrv
Copy link
Author

jtrv commented Nov 5, 2021

Here is an example of the command I'm running and the output:

# ~/projectecho public/css/slider.css | stylelint --fix --config='/home/user/.config/.stylelintrc'  --stdin-filename='public/css/slider.css'
Error: ENOENT: no such file or directory, open '/home/user/project/home/user/.config/.stylelintrc'

@jtrv
Copy link
Author

jtrv commented Nov 5, 2021

would this be linked to #4521 ?

@ybiquitous
Copy link
Member

@JacobTravers I am wondering if your reproduction code should be the following: 🤔

  • echocat
  • Needless --fix
  • Missing --stdin
  • ~/ is a shell feature, so split --config and ~/.config/.stylintrc with a whitespace
cat public/css/slider.css | stylelint --config ~/.config/.stylintrc --stdin --stdin-filename public/css/slider.css

@ybiquitous ybiquitous added the status: needs clarification triage needs clarification from author label Nov 7, 2021
@jtrv jtrv closed this as completed Nov 8, 2021
@jtrv jtrv reopened this Nov 8, 2021
@jtrv
Copy link
Author

jtrv commented Nov 8, 2021

Sorry my mistake, I was using cat but accidentally wrote echo when I tested it outside of my editor config in the shell. However I ran the script exactly as you wrote it, and it broke exactly in the way I described before, I also tried replacing ~ with $HOME and /home/user. I am on Arch Linux using fish-shell, but I tested the script in bash, and sh as well with the same results.

$ cat public/css/slider.css | stylelint --config ~/.config/.stylintrc --stdin --stdin-filename public/css/slider.css
Error: ENOENT: no such file or directory, open '/home/user/project/home/user/.config/.stylintrc'

(edit: sorry for the accidental close/reopen)

@ybiquitous
Copy link
Member

@JacobTravers Umm..., I cannot reproduce the error still. 🤔

My code:

$ node_modules/.bin/stylelint --version
14.0.1

$ cat /tmp/a.css
a{}

$ cat ~/.config/.stylelintrc
rules:
  block-no-empty: true

$ cat /tmp/a.css | node_modules/.bin/stylelint --config ~/.config/.stylelintrc --stdin --stdin-filename a.c
ss

a.css
 1:2  ✖  Unexpected empty block  block-no-empty
  • Node.js v17.0.1
  • macOS Big Sur

@jtrv
Copy link
Author

jtrv commented Nov 9, 2021

Sorry i'm dislexic, it looks like the command i was using this whole time had .stylintrc in the same way you had it here #5692 (comment). it looks to be working now, closing this issue. Thanks for your time and help anyways, my apologies for the mistake.

@jtrv jtrv closed this as completed Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs clarification triage needs clarification from author
Development

No branches or pull requests

3 participants