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 init doesn't support most environments #3553

Closed
dlandis opened this Issue Aug 27, 2015 · 8 comments

Comments

Projects
None yet
4 participants
@dlandis
Copy link

dlandis commented Aug 27, 2015

Hi,

I just ran eslint --init and the question:

? Where will your code run? Browser

Can it also offer commonjs in the menu? That way there won't be errors during the first run saying "require" is not defined.

v1.2.1

@eslintbot

This comment has been minimized.

Copy link

eslintbot commented Aug 27, 2015

Thanks for the issue! We get a lot of issues, so this message is automatically posted to each one to help you check that you've included all of the information we need to help you.

Reporting a bug? Please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. The source code that caused the problem
  3. The configuration you're using (for the rule or your entire config file)
  4. The actual ESLint output complete with line numbers

Requesting a new rule? Please be sure to include:

  1. The use case for the rule - what is it trying to prevent or flag?
  2. Whether the rule is trying to prevent an error or is purely stylistic
  3. Why you believe this rule is generic enough to be included

Requesting a feature? Please be sure to include:

  1. The problem you want to solve (don't mention the solution)
  2. Your take on the correct solution to problem

Including this information in your issue helps us to triage it and get you a response as quickly as possible.

Thanks!

@eslintbot eslintbot added the triage label Aug 27, 2015

@nzakas

This comment has been minimized.

Copy link
Member

nzakas commented Aug 27, 2015

Since it's a checklist, we can probably add this without too much pain. I'd still like to keep the list fairly small so as not to overwhelm people.

@nzakas nzakas added enhancement cli accepted and removed triage labels Aug 27, 2015

@ilyavolodin

This comment has been minimized.

Copy link
Member

ilyavolodin commented Aug 28, 2015

Actually, I don't think I agree. The question is phrased as follows: "Where will your code run?". There is not such JavaScript environment as CommonJS, as in, your code can't run inside CommonJS. You might be using CommonJS. So either we need to rephrase that question, or we shouldn't add CommonJS to the list.

@dlandis

This comment has been minimized.

Copy link
Author

dlandis commented Aug 28, 2015

@ilyavolodin

What about something like:

? Which environments are your scripts designed to run in?

That is a very slight modification of the documentation here:

Environments - which environments your script is designed to run in. Each environment brings with it a certain set of predefined global variables.

I think to be more grammatically correct it would be:

? In which environments are your scripts designed to run?

Calling CommonJS an environment though does seem to ubiquitous throughout the documentation.

@nzakas

This comment has been minimized.

Copy link
Member

nzakas commented Aug 28, 2015

@ilyavolodin good point.

@dlandis I think the trick here is that people don't necessarily know what "environment" means until they are very familiar with ESLint.

Maybe if someone selected Browser, we can ask an additional question about using CommonJS?

@dlandis

This comment has been minimized.

Copy link
Author

dlandis commented Aug 28, 2015

@nzakas Personally, I would probably just keep it simple with a flat, multi-selectable list of environments.

I wasn't familiar with eslint until yesterday and didn't know precisely what an "environment" was (and I still don't :)), but I was able to intuit what it was basically asking.

@ilyavolodin

This comment has been minimized.

Copy link
Member

ilyavolodin commented Aug 28, 2015

@dlandis That was my point, right now the question is phrased in such a way that everyone can understand it. It's pretty easy to answer "Where will your code run", it's much harder to answer "What environments do you want to use in your code". Maybe we should split it up into separate questions, one for where the code will run, the other for libraries you are going to use.

@nzakas

This comment has been minimized.

Copy link
Member

nzakas commented Aug 28, 2015

This is what I'm saying: If someone selects only "Browser", let's just add a question "Are you using CommonJS?" If someone selects "Node", we can skip the question.

@gyandeeps gyandeeps closed this in 5050768 Dec 29, 2015

nzakas added a commit that referenced this issue Dec 29, 2015

Merge pull request #4824 from eslint/issue3553
Update: Ask for `commonjs` under config init (fixes #3553)

@eslint eslint bot locked and limited conversation to collaborators Feb 7, 2018

@eslint eslint bot added the archived due to age label Feb 7, 2018

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