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

--stdin-filename requires file existence #2064

Closed
zolotov opened this issue Nov 16, 2016 · 5 comments · Fixed by #2128

Comments

@zolotov
Copy link

commented Nov 16, 2016

Describe the issue. Is it a bug or a feature request (new rule, new option, etc.)?

--stdin-filename option seems to be broken. Running stylelint via cli with the option leads to Error: ENOENT: no such file or directory in case there is no file with given name in the working directory.

Which version of stylelint are you using?

e.g. 7.4.07.5.0

Output example. Note that hey.@.css doesn't exist but it doesn't have to, since it's only a name to infer a syntax.

~  ᐅ echo '.class { color: blue }' | /usr/local/bin/node /Users/zolotov/Downloads/webstorm_sample_asset/node_modules/stylelint/dist/cli.js -f json --stdin-filename hey.@.css
Error: ENOENT: no such file or directory, stat '/Users/zolotov/hey.@.css'
    at Error (native)
@jeddy3

This comment has been minimized.

Copy link
Member

commented Nov 18, 2016

@zolotov Thank you for the report. I can replicate this.

I'll label this up as "needs investigation". Feel free to jump in and help us track this down.

@davidtheclark

This comment has been minimized.

Copy link
Contributor

commented Nov 22, 2016

@zolotov I am not able to reproduce this: I can do the same thing you mention above without any problem. Can you please provide a failing test or a reduced test case to demonstrate the problem in a reproducible manner?

@jeddy3

This comment has been minimized.

Copy link
Member

commented Nov 22, 2016

I am not able to reproduce this

I am also now unable to reproduce this with 7.6.0. Although I was able to with 7.5.0. @zolotov Please try again with 7.6.0, or, as @davidtheclark requests, provide a failing test or reduced test case.

@zolotov

This comment has been minimized.

Copy link
Author

commented Nov 23, 2016

@jeddy3 tried with 7.6.0. The same result.

Here is a set of shell command that will lead to the error:

mkdir test_project
cd test_project 
touch .stylelintrc
echo '{\n  "name": "testproject",\n  "devDependencies": {\n    "stylelint": "7.6.0"\n  }\n}' > package.json
npm install
echo '.class { color: blue }' | node node_modules/stylelint/dist/cli.js -f json --stdin-filename a.css     

E.g. here is my output, worked fine until 7.4.0.

/tmp  ᐅ mkdir test_project
/tmp  ᐅ cd test_project 
/tmp/test_project  ᐅ touch .stylelintrc
/tmp/test_project  ᐅ echo '{\n  "name": "testproject",\n  "devDependencies": {\n    "stylelint": "7.6.0"\n  }\n}' > package.json
/tmp/test_project  ᐅ npm install
npm WARN prefer global colorguard@1.2.0 should be installed with -g
testproject@ /private/tmp/test_project
└─┬ stylelint@7.6.0 
  ├─┬ autoprefixer@6.5.3 
  │ ├── browserslist@1.4.0 
  │ ├── caniuse-db@1.0.30000587 
  │ ├── normalize-range@0.1.2 
  │ └── num2fraction@1.2.2 
  ├── balanced-match@0.4.2 
  ├─┬ chalk@1.1.3 
  │ ├── ansi-styles@2.2.1 
  │ ├── escape-string-regexp@1.0.5 
  │ ├─┬ has-ansi@2.0.0 
  │ │ └── ansi-regex@2.0.0 
  │ ├── strip-ansi@3.0.1 
  │ └── supports-color@2.0.0 
  ├─┬ colorguard@1.2.0 
  │ ├── color-diff@0.1.7 
  │ ├── object-assign@4.1.0 
  │ ├─┬ pipetteur@2.0.3 
  │ │ ├── onecolor@3.0.4 
  │ │ └─┬ synesthesia@1.0.1 
  │ │   └── css-color-names@0.0.3 
  │ ├─┬ plur@2.1.2 
  │ │ └── irregular-plurals@1.2.0 
  │ ├── postcss-reporter@1.4.1 
  │ ├── text-table@0.2.0 
  │ └── yargs@1.3.3 
  ├─┬ cosmiconfig@2.1.0 
  │ ├── graceful-fs@4.1.11 
  │ ├─┬ js-yaml@3.7.0 
  │ │ ├─┬ argparse@1.0.9 
  │ │ │ └── sprintf-js@1.0.3 
  │ │ └── esprima@2.7.3 
  │ ├── minimist@1.2.0 
  │ ├── os-homedir@1.0.2 
  │ ├─┬ parse-json@2.2.0 
  │ │ └─┬ error-ex@1.3.0 
  │ │   └── is-arrayish@0.2.1 
  │ └── require-from-string@1.2.1 
  ├─┬ doiuse@2.5.0 
  │ ├─┬ css-rule-stream@1.1.0 
  │ │ └── css-tokenize@1.0.1 
  │ ├─┬ duplexer2@0.0.2 
  │ │ └─┬ readable-stream@1.1.14 
  │ │   ├── core-util-is@1.0.2 
  │ │   ├── isarray@0.0.1 
  │ │   └── string_decoder@0.10.31 
  │ ├─┬ jsonfilter@1.1.2 
  │ │ ├─┬ JSONStream@0.8.4 
  │ │ │ ├── jsonparse@0.0.5 
  │ │ │ └── through@2.3.8 
  │ │ └─┬ stream-combiner@0.2.2 
  │ │   └── duplexer@0.1.1 
  │ ├─┬ ldjson-stream@1.2.1 
  │ │ └── split2@0.2.1 
  │ ├─┬ source-map@0.4.4 
  │ │ └── amdefine@1.0.1 
  │ ├─┬ through2@0.6.5 
  │ │ ├── readable-stream@1.0.34 
  │ │ └── xtend@4.0.1 
  │ └─┬ yargs@3.32.0 
  │   ├── camelcase@2.1.1 
  │   ├─┬ cliui@3.2.0 
  │   │ ├── string-width@1.0.2 
  │   │ └─┬ wrap-ansi@2.0.0 
  │   │   └── string-width@1.0.2 
  │   ├─┬ os-locale@1.4.0 
  │   │ └─┬ lcid@1.0.0 
  │   │   └── invert-kv@1.0.0 
  │   ├─┬ string-width@1.0.2 
  │   │ ├── code-point-at@1.1.0 
  │   │ └─┬ is-fullwidth-code-point@1.0.0 
  │   │   └── number-is-nan@1.0.1 
  │   ├── window-size@0.1.4 
  │   └── y18n@3.2.1 
  ├─┬ execall@1.0.0 
  │ └─┬ clone-regexp@1.0.0 
  │   ├── is-regexp@1.0.0 
  │   └── is-supported-regexp-flag@1.0.0 
  ├── get-stdin@5.0.1 
  ├─┬ globby@6.1.0 
  │ ├─┬ array-union@1.0.2 
  │ │ └── array-uniq@1.0.3 
  │ ├─┬ glob@7.1.1 
  │ │ ├── fs.realpath@1.0.0 
  │ │ ├─┬ inflight@1.0.6 
  │ │ │ └── wrappy@1.0.2 
  │ │ ├── inherits@2.0.3 
  │ │ ├── once@1.4.0 
  │ │ └── path-is-absolute@1.0.1 
  │ ├── pify@2.3.0 
  │ └─┬ pinkie-promise@2.0.1 
  │   └── pinkie@2.0.4 
  ├── globjoin@0.1.4 
  ├── html-tags@1.1.1 
  ├── ignore@3.2.0 
  ├── known-css-properties@0.0.5 
  ├── lodash@4.17.2 
  ├── log-symbols@1.0.2 
  ├─┬ meow@3.7.0 
  │ ├── camelcase-keys@2.1.0 
  │ ├── decamelize@1.2.0 
  │ ├─┬ loud-rejection@1.6.0 
  │ │ ├─┬ currently-unhandled@0.4.1 
  │ │ │ └── array-find-index@1.0.2 
  │ │ └── signal-exit@3.0.1 
  │ ├── map-obj@1.0.1 
  │ ├─┬ normalize-package-data@2.3.5 
  │ │ ├── hosted-git-info@2.1.5 
  │ │ ├─┬ is-builtin-module@1.0.0 
  │ │ │ └── builtin-modules@1.1.1 
  │ │ ├── semver@5.3.0 
  │ │ └─┬ validate-npm-package-license@3.0.1 
  │ │   ├─┬ spdx-correct@1.0.2 
  │ │   │ └── spdx-license-ids@1.2.2 
  │ │   └── spdx-expression-parse@1.0.4 
  │ ├─┬ read-pkg-up@1.0.1 
  │ │ ├─┬ find-up@1.1.2 
  │ │ │ └── path-exists@2.1.0 
  │ │ └─┬ read-pkg@1.1.0 
  │ │   ├─┬ load-json-file@1.1.0 
  │ │   │ └─┬ strip-bom@2.0.0 
  │ │   │   └── is-utf8@0.2.1 
  │ │   └── path-type@1.1.0 
  │ ├─┬ redent@1.0.0 
  │ │ ├─┬ indent-string@2.1.0 
  │ │ │ └─┬ repeating@2.0.1 
  │ │ │   └── is-finite@1.0.2 
  │ │ └─┬ strip-indent@1.0.1 
  │ │   └── get-stdin@4.0.1 
  │ └── trim-newlines@1.0.0 
  ├─┬ multimatch@2.1.0 
  │ ├── array-differ@1.0.0 
  │ ├── arrify@1.0.1 
  │ └─┬ minimatch@3.0.3 
  │   └─┬ brace-expansion@1.1.6 
  │     └── concat-map@0.0.1 
  ├── normalize-selector@0.2.0 
  ├─┬ postcss@5.2.6 
  │ ├── js-base64@2.1.9 
  │ ├── source-map@0.5.6 
  │ └─┬ supports-color@3.1.2 
  │   └── has-flag@1.0.0 
  ├── postcss-less@0.14.0 
  ├── postcss-media-query-parser@0.2.3 
  ├── postcss-reporter@2.0.0 
  ├── postcss-resolve-nested-selector@0.1.1 
  ├── postcss-scss@0.4.0 
  ├─┬ postcss-selector-parser@2.2.2 
  │ ├── flatten@1.0.2 
  │ ├── indexes-of@1.0.1 
  │ └── uniq@1.0.1 
  ├── postcss-value-parser@3.3.0 
  ├── resolve-from@2.0.0 
  ├── specificity@0.3.0 
  ├─┬ string-width@2.0.0 
  │ └── is-fullwidth-code-point@2.0.0 
  ├── style-search@0.1.0 
  ├─┬ stylehacks@2.3.1 
  │ ├── postcss-reporter@1.4.1 
  │ ├─┬ read-file-stdin@0.2.1 
  │ │ └── gather-stream@1.0.0 
  │ └── write-file-stdout@0.0.2 
  ├── sugarss@0.2.0 
  ├── svg-tags@1.0.0 
  └─┬ table@3.8.3 
    ├─┬ ajv@4.9.0 
    │ ├── co@4.6.0 
    │ └─┬ json-stable-stringify@1.0.1 
    │   └── jsonify@0.0.0 
    ├── ajv-keywords@1.1.1 
    └── slice-ansi@0.0.4 

npm WARN testproject@ No description
npm WARN testproject@ No repository field.
npm WARN testproject@ No license field.
/tmp/test_project  ᐅ echo '.class { color: blue }' | node node_modules/stylelint/dist/cli.js -f json --stdin-filename a.css     
Error: ENOENT: no such file or directory, stat '/private/tmp/test_project/a.css'
/tmp/test_project  ᐅ 
@evilebottnawi

This comment has been minimized.

Copy link
Member

commented Nov 23, 2016

@zolotov Thanks for detailed feedback! I think I can do it today.

@davidtheclark davidtheclark self-assigned this Nov 26, 2016

davidtheclark added a commit that referenced this issue Nov 26, 2016
davidtheclark added a commit that referenced this issue Nov 27, 2016
sergesemashko pushed a commit to sergesemashko/stylelint that referenced this issue Mar 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.