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

Define globals only for a specific directory #462

Closed
ilearnio opened this issue Mar 18, 2016 · 1 comment

Comments

@ilearnio
Copy link

commented Mar 18, 2016

I have src/client and src/server directories in my project. The one is for the client side (WebPack), the second one is for a Node backend. On the backend, I am using some global variables (e.g ROOT_DIR), that I don't have on the client. How do I tell standard to allow to use these globals only on the backend?

My package.json config for standard looks like so:

"standard": {
    "parser": "babel-eslint",
    "globals": [
      "ENV",
      "IS_CLIENT",
      "IS_SERVER"
    ],
    "ignore": [
      "node_modules/**"
    ]
  }

It would be nice to have something like .standardrc that might be placed into any children directory and would inherit settings from other .standardrc files that are located in parent directories. But it seems it only supports for a single package.json and doesn't look back for other parents package.jsons. I tried to create a src/server/package.json and it works but that way I need to duplicate all the settings and then add some more options. It might go as a temporal solution, but it so hackish to create a package.json​ everywhere I need to add some option to standard. It's there for a different purpose – for Node's NPM

@feross

This comment has been minimized.

Copy link
Member

commented Mar 19, 2016

Your options are:

  1. Don't worry about users using the globals that don't exist in one environment. Linters aren't going to catch 100% of errors anyway.
  2. Use eslint directly. That way you can use .eslintrc files and make things as complicated as you want.

Standard isn't going to add .standardrc files, sorry. The whole reason standard was created was to avoid littering your project with configuration files.

@feross feross added the question label Mar 19, 2016

@feross feross closed this Mar 19, 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.
2 participants
You can’t perform that action at this time.