gustavnikolaj / linter-js-standard-engine

Linter plugin for Standard Engine based linters.
ISC License
10 stars 6 forks source link

feature: default linter #52

Closed joshyrobot closed 7 years ago

joshyrobot commented 7 years ago

Sometimes I create new projects to mess around in, with no intentions of moving them to production. I think a simple option such as "Default linter" could help by eliminating the need for any linter to be specified.

gustavnikolaj commented 7 years ago

If you install standard the plugin will auto detect it.

The reason I wrote this plugin was to avoid having the linters included in the plugin. They will get out of date and out of sync with what is installed in the projects you work on that have linters as dependencies. I guess this usecase you have is the trade-off for that design choice.

I think this suggestion is a little too niché to justify the feature, but I understand that it can be a bit annoying.

Are you using a linter that is not included in the auto-detected list of linters, and if so, would including it lessen the need for this request?

novemberborn commented 7 years ago

I assume you'd want to configure this in the package settings? Would the linter still be local to your project, or perhaps a global installation? Note that we don't ship any linters with this package.

There are default linters that are recognized without needing to be configured. If you use a sufficiently public linter perhaps we can add it to that list? (By "sufficiently public" I mean, not like @novemberborn/as-i-preach which I use on my own projects.)


Heh, @gustavnikolaj just responded along similar lines. No harm in me hitting also the green Comment button though 😉

joshyrobot commented 7 years ago

I mean if your just editing a quick file thats not in a project, a default linter could be used. But from what I read, it doesn't look like that planned at all. Oh well, thanks for responding!

novemberborn commented 7 years ago

@JoshyRobot yea, this package intentionally doesn't ship with a linter.

joshyrobot commented 7 years ago

what if it did something like use a globally installed linter? like if someone globally installed something like standard with npm this package could be configured to use it.

gustavnikolaj commented 7 years ago

The node runtime we run the resolved linter in, is the one provided by electron (or atom if you will), which is different from the one you you installed the module with, thus we would not be able to resolve it automatically.

If you have a single node.js version installed on your system, it might seem like a trivial task to find the globally installed linters - but there's at least a few problems to it. First off, we could encounter more than one compatible linter. Secondly, the installation path and the location for globally installed modules are going to be different, at least between operating systems, but probably also different between installation methods (e.g. different package managers on linux distros, or homebrew vs manual installation on osx, or .msi installation vs nuget installation on windows). Adding something like nvm to the mix makes it even worse.

Auto detecting the fallback is not a feasible option in my opinion, so it would have to be based on the user setting the path to the globally installed module in the settings for the plugin. It could work, but I think it is a little too much work than I think is justified for what I consider a pretty niche feature. I mean, if it's just a quick little example that is not going to end up in a package, is linting really that important? The price tag on the feature is disproportionally high compared to the use case and the chance that people needing it will actually find it.

If you disagree with my opinion on this and you can convince @novemberborn, I won't stand in the way of a PR. :-)

whaaaley commented 7 years ago

@gustavnikolaj Having an option for a default linter with a global installation path would be great imo. Other linters I use with Atom have this option. linter-sass-lint and linter-js-standard both have this option.

gustavnikolaj commented 7 years ago

@whaaaley I appreciate the need and want for this feature, but as I said before I'm not going to implement this, but also not going to stand in the way of landing it, if someone else does the work.

How long would it take to create a new directory, and type npm init -y followed by npm install standard before you type in your scratch pad code?

If it needs linting, it's probably worth keeping anyway :-)

It's below my bar for automation: https://xkcd.com/1205/