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

How to defined multiple file extensions #442

Closed
alanrubin opened this issue Mar 2, 2016 · 7 comments

Comments

@alanrubin
Copy link

commented Mar 2, 2016

First thanks for the great package.

Not sure this a newbie question but I'm trying to run standard for different file extensions (js, jsx and es6). I know js and jsx comes configured by default but how do I configure it to run for all those 3 extensions ?

I have tried to run the below command but get an error.

$: standard webpack/**/*(.js|.jsx|.es6)

Thanks !

@alanrubin

This comment has been minimized.

Copy link
Author

commented Mar 2, 2016

Ok found the solution. The above command syntax works for running in command line but when running as an npm task, you should declare each file extension separately such as:

Inside package.json
scripts: { "lint": "standard ./webpack/**/*.js ./webpack/**/*.jsx ./webpack/**/*.es6" }

otherwise it won't work. Is that something we want to document ? If yes I can create a PR.

@dcousens dcousens added the question label Mar 2, 2016

@LinusU

This comment has been minimized.

Copy link
Member

commented Mar 2, 2016

Have you tried standard webpack/**/*.{js,jsx,es6}

edit: ,

@rstacruz

This comment has been minimized.

Copy link
Member

commented Mar 2, 2016

Actually the bash expansion syntax is {js,jsx,es6} -- try that!

On Wednesday, March 2, 2016, Linus Unnebäck notifications@github.com
wrote:

Have you tried standard webpack/*/.{js|jsx|es6}


Reply to this email directly or view it on GitHub
#442 (comment).

@alanrubin

This comment has been minimized.

Copy link
Author

commented Mar 2, 2016

So actually the solution I though was working is not. If I run "npm run lint", only js and jsx files are expected but es6 are ignored. As you suggested I have tried to configure the lint task as

script: { "lint": "standard webpack/**/*.{js|jsx|es6}" }

but still getting the error below. Any ideas ?

`➜ app git:(apply-standardjs) ✗ npm run lint

my@0.0.1 lint /Users/alanrubin/app
standard webpack/*/.{js|jsx|es6}

sh: jsx: command not found
sh: es6}: command not found

npm ERR! Darwin 14.5.0
npm ERR! argv "/Users/alanrubin/.nvm/versions/node/v5.0.0/bin/node" "/Users/alanrubin/.nvm/versions/node/v5.0.0/bin/npm" "run" "lint"
npm ERR! node v5.0.0
npm ERR! npm v3.3.6
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! app@0.0.1 lint: standard webpack/**/*.{js|jsx|es6}
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the app@0.0.1 lint script 'standard webpack//*.{js|jsx|es6}'.
npm ERR! This is most likely a problem with the app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! standard webpack/
/*.{js|jsx|es6}
npm ERR! You can get their info via:
npm ERR! npm owner ls app
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/alanrubin/app/npm-debug.log
`

@LinusU

This comment has been minimized.

Copy link
Member

commented Mar 2, 2016

@alanrubin use comma instead of pipe, my fault...

@alanrubin

This comment has been minimized.

Copy link
Author

commented Mar 2, 2016

Works ! It should be script: { "lint": "standard webpack/**/*.{js,jsx,es6}" }. But now I have another problem... the syntax for searching in any level "**" only looks one level below not in any level deeper. What should be the syntax to search for files in any level ? (In the command line "/**/*" syntax works).

I realise that this could be a off topic question but I'm very grateful if you could help, could not find any reference to this anywhere.

@feross

This comment has been minimized.

Copy link
Member

commented Mar 7, 2016

@alanrubin Try wrapping another set of quotes around the file path:

script: { "lint": "standard 'webpack/**/*.{js,jsx,es6}'" }

Otherwise I think bash does expansion for you, but you want to actually pass through the ** to standard.

@feross feross closed this Mar 7, 2016

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
5 participants
You can’t perform that action at this time.