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

eslint-godaddy-react fails to run on Windows. #44

Closed
gisenberg opened this issue Apr 18, 2017 · 9 comments
Closed

eslint-godaddy-react fails to run on Windows. #44

gisenberg opened this issue Apr 18, 2017 · 9 comments

Comments

@gisenberg
Copy link
Contributor

Minimal repro here: https://github.com/gisenberg/eslint-godaddy-react-repro
node: v6.0.0
npm: v3.8.6

When running eslint-godaddy-react on Windows, the script execution fails. Example output below:

gdlint:

C:\Users\gisenberg\git\eslint-godaddy-react-repro (master) (eslint-godaddy-react-repro@1.0.0)
λ npm run gdlint

> eslint-godaddy-react-repro@1.0.0 gdlint C:\Users\gisenberg\git\eslint-godaddy-react-repro
> eslint-godaddy-react src/

C:\Users\gisenberg\git\eslint-godaddy-react-repro\node_modules\.bin\eslint.CMD:1
(function (exports, require, module, __filename, __dirname) { @IF EXIST "%~dp0\node.exe" (

SyntaxError: Unexpected token ILLEGAL
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:511:25)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at C:\Users\gisenberg\git\eslint-godaddy-react-repro\node_modules\eslint-config-godaddy\cli.js:41:7
    at C:\Users\gisenberg\git\eslint-godaddy-react-repro\node_modules\which\which.js:87:20

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "gdlint"
npm ERR! node v6.0.0
npm ERR! npm  v3.8.6
npm ERR! code ELIFECYCLE
npm ERR! eslint-godaddy-react-repro@1.0.0 gdlint: `eslint-godaddy-react src/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the eslint-godaddy-react-repro@1.0.0 gdlint script 'eslint-godaddy-react src/'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the eslint-godaddy-react-repro package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     eslint-godaddy-react src/
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs eslint-godaddy-react-repro
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls eslint-godaddy-react-repro
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\gisenberg\git\eslint-godaddy-react-repro\npm-debug.log

eslint:

C:\Users\gisenberg\git\eslint-godaddy-react-repro (master) (eslint-godaddy-react-repro@1.0.0)
λ npm run eslint

> eslint-godaddy-react-repro@1.0.0 eslint C:\Users\gisenberg\git\eslint-godaddy-react-repro
> eslint src/

C:\Users\gisenberg\git\eslint-godaddy-react-repro (master) (eslint-godaddy-react-repro@1.0.0)
λ
@indexzero
Copy link
Contributor

Known issue. Would accept PR. Solution is to strip /\.CMD$/i from resolved in this code path via which: https://github.com/godaddy/javascript/blob/master/packages/eslint-config-godaddy/cli.js#L39

@gisenberg
Copy link
Contributor Author

gisenberg commented Apr 18, 2017

The fix isn't that easy, I don't think. I believe that code makes the assumption that it's going to be requiring JavaScript, but stripping the .CMD still gets you a file that looks like this:

#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

case `uname` in
    *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac

if [ -x "$basedir/node" ]; then
  "$basedir/node"  "$basedir/../eslint/bin/eslint.js" "$@"
  ret=$?
else
  node  "$basedir/../eslint/bin/eslint.js" "$@"
  ret=$?
fi
exit $ret

@rxmarbles
Copy link
Member

Curious thought I looked at this yesterday and agree w/ @gisenberg that it doesn't seem to be as simple as stripping .CMD. I'd be happy to dig deeper fix this if no one is willing to tackle it. thoughts @indexzero

@rxmarbles
Copy link
Member

@indexzero nvm @gisenberg and I are going to pair up to tackle this issue 😁

@DullReferenceException
Copy link

DullReferenceException commented Nov 15, 2017

Is that script really the best way to go anyway? It seems that just creating the appropriate .eslintrc and running eslint directly would work just as well. That has been highly effective in my projects. Now that we have easy-to-consume configs, .eslintrc can be as simple as:

{
  "root": true,
  "extends": "godaddy"
}

...and then integrations with IDEs, etc., will work without any extra tools.

@indexzero
Copy link
Contributor

Goal is to have --fix on everywhere. There may be other ways to shave that yak though.

@rxmarbles
Copy link
Member

Just realized i never worked on this 😞

@gingur
Copy link
Contributor

gingur commented Nov 13, 2019

Just ran into this, temp fix is to just change eslint-godaddy to eslint --fix in my script and include a .eslintrc as @DullReferenceException described.

@rxmarbles
Copy link
Member

Closing this for now as there is a workaround w/ out needing to investigate. If there is enough chatter on here we can revisit

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

No branches or pull requests

6 participants