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

Presets? #245

Closed
kevinSuttle opened this issue Dec 8, 2015 · 17 comments
Closed

Presets? #245

kevinSuttle opened this issue Dec 8, 2015 · 17 comments

Comments

@kevinSuttle
Copy link

Thinking about editorconfig/editorconfig-core-js#30, it would be handy to have a collection of presets.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@xuhdev
Copy link
Member

xuhdev commented Dec 8, 2015

Can you explain a bit more? I don't understand your point on the js package (p.s. I'm not familiar with js)

@kevinSuttle
Copy link
Author

So, instead of having a separate .eslintrc file, there are defined presets that can be leveraged via custom configuration objects in package.json, [like Gemfile, requirements.txt, etc., but for JS].

Example from airbnb: https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb

package.json

eslintConfig
{
   "extends": "airbnb/base"
}

@sindresorhus
Copy link
Member

👍 !!

I have this .editorconfig file duplicated in hundreds of repos...

@kevinSuttle
Copy link
Author

☝️ Yep. That's exactly the problem I'm hoping to solve.

@xuhdev
Copy link
Member

xuhdev commented Dec 9, 2015

It makes sense for me. This seems like a editorconfig-core-js specific issue.... Can we move the discussion there?

@kevinSuttle
Copy link
Author

@sindresorhus
Copy link
Member

It's not specific to JS. That was just an example. For presets to be actually usable, they need to be supported by all EditorConfig implementations, not just the JS one. It should work even if I for example use the EditorConfig Sublime plugin.

I'm thinking:

# .editorconfig
extends = path/to/folder/containing/editorconfig/file

(Putting EditorConfig config into package.json should be a separate issue, on this issue tracker, as it also pertains to all implementation).

@sindresorhus sindresorhus reopened this Dec 10, 2015
@kevinSuttle
Copy link
Author

@sindresorhus I'm all for consolidation. What about a global in ~/.config/editorconfig?

@sindresorhus
Copy link
Member

@kevinSuttle That doesn't really solve my issue of having to put an .editorconfig file in every repo. The point is that other users follows it, not me. You can already put a .editorconfig file in ~/ if you don't put root = true in your local .editorconfig files.

@kevinSuttle
Copy link
Author

Ah, I did not know that. I was thinking more of the global ~/.gitignore and ~/.npmrc so an .editorconfig file doesn't have to be present in every repo.

But I see your point about ensuring others follow suit and apply the same settings when the repo is distributed.

@xuhdev
Copy link
Member

xuhdev commented Dec 11, 2015

I agree with @sindresorhus , it is exactly the reason we don't support a "global" configuration file.

@sindresorhus If we have an "extends" or "include" instruction, is the package.json issue still relevant?

@kevinSuttle
Copy link
Author

@xuhdev Yes. See above #245 (comment)

@sindresorhus
Copy link
Member

If we have an "extends" or "include" instruction, is the package.json issue still relevant?

Yes, but that's a discussion for a different issue, but tl;dr; I have so many metafiles (.editorconfig, .gitignore, .gitattributes, etc) in my repos and I would like to reduce that number. Would be nice if I could define EditorConfig config in package.json instead of an .editorconfig file, since I almost always have a package.json file in my repos. Many other tools supports this.

@jpolo
Copy link

jpolo commented Sep 14, 2018

One useful usecase could be to commit a "company" wide editorconfig so it is not global for the computer but just the company repos.
For a node project the common way would be to publish an npm package containing the editorconfig preset and to add an extends/include/whatever instruction in the .editorconfig file to 'node_modules/mycompany-editorconfig/.editorconfig'

@openjck
Copy link

openjck commented Aug 22, 2024

Is this a duplicate of #236?

@cxw42
Copy link
Member

cxw42 commented Aug 26, 2024

If @sindresorhus indeed reopened the issue for #245 (comment), then, yes, it looks like a duplicate of #236.

@cxw42
Copy link
Member

cxw42 commented Oct 19, 2024

Hearing nothing to the contrary, I am going to re-close this as duplicate to keep the discussion centralized in #236.

@cxw42 cxw42 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2024
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