-
-
Notifications
You must be signed in to change notification settings - Fork 10
Add command for running without having XO installed locally or a package.json #21
Comments
It's done this way so it doesn't activate on projects using something other than XO, like ESLint or JSHint, as that would conflict. I do see your use-case though. I'm open to suggestions on how we could solve this. Maybe have a command |
A simple, single command would make sense. Another viable option would be a 'Lint on Save' (like your esformatter package). A possible third option would be to expose a full settings panel with:
|
How about a default XO config that is used when none is defined in the
I suppose that setting a package.json in your home dir with an XO config the file.Wout. |
Too much. I want to keep options to a minimum.
👍 Sounds good to me. @jamestalmage You good with this? |
XO core already has that, are we discussing something atom specific?
Agreed, but it should check to see if it's in |
@jamestalmage but then you need to have some packages installed again, On Sun, Apr 3, 2016, 3:07 AM James Talmage notifications@github.com wrote:
Wout. |
If you are using the "only run when XO is in package.json" , I am suggesting having a local copy installed should also cause it to use XO |
It's about being able to just put in a default XO config (same as the one in package.json) in the Atom settings.
👍 |
Ahh - I see. Yeah that's cool. How does this plugin invoke XO, (via CLI or API?) - what do we need to do in XO core to make this happen. |
API. No changes in XO strictly required, but it would be nice to extract the logic of whether a project has XO from this plugin into XO core, so both the Atom and Sublime plugin could use it. Sidenote: It seems this plugin already incorrectly only uses the bundled XO version instead of the local one when available. So we'll need to change it to do the same as the XO CLI. |
The issue of automatically switching for the local copy is a bit more problematic when using via API vs CLI. The CLI switch works well because the primary consumers are humans, and humans are good at adapting on the fly. Where the CLI is used by build scripts, those are almost always packaged locally with the module anyways, and use the local CLI if they are Doing automatic API switching is a bit more problematic. For example, if we add a method to the core API that extracts "the logic of whether a project has XO" from this module, then that method is only available in new versions of XO. If we then rely on that method from core, then this plugin breaks for old installations of XO. I am not against the change. Just putting the possible complications out there. |
@jamestalmage I didn't mean we do automatic switch in the XO API. That's indeed bad. I meant we should do the same as the CLI in this plugin, not the API. Maybe expose a convenience API function in XO for achieving it. |
Hmm. I guess I don't understand. You are discussing automatically loading up the locally installed XO version right? That means the API this plugin uses will change. |
Oh, ok, I got it now. My mistake. Yeah, that would be a problem, but I think we can just enforce semver here and only support loading the same major version as this plugin bundles. So if this plugin bundles XO 1.0.0, it will only load |
Just an idea: what about creating an argv based interface. Instead of passing an options object, you pass an argv array, and get back an eslint report. var xo = requireLocally('xo/argv-interface');
if (xo) {
var report = xo(source, pkg, [
'--esnext',
'--global=foo'
]);
} else {
xo = requireWithinPlugin('xo');
x.lintFile(...); // We can use the API directly if we can't find local
} It could share code with Just a thought. |
Or, possibly better. Let's just expose a new API method that we will support long term. You can't pass it any configuration options: var xo = requireLocally('xo');
var report = xo.lintForIDEPlugin(filePath, fileSource);
I think we could commit to keeping that particular part of the API stable long term. If we can't find the local plugin, then we are using the one packaged with the IDE plugin, and we can use the full API (because we know which version we have at that point). |
👍 Good idea. Let's go with that. |
Sooo, tried reading this thread. What should I do if I have a mixed project (RoR, no proper I have tried running the Background: |
@Pysis868 There's no support for that yet, hence why this issue is still open. It's not something I personally need, so it's waiting for someone to do a pull request adding it. In the meantime, you could use the |
ok, thanks. Sorry, read #27's status and that tripped me up a bit about this issue's status. |
Actually, forgot to ask, I just added a sample
and no syntax errors (anymore!). It still doesn't seem to be working this way either. Any tips? Is this possible to help my situation? |
Sorry about the posts, just want to show what stages are occurring here. I just opened another JS file in Atom, and the XO linter panel opened with it! (Using the 'fake' So without creating a MCVE, I suspect the issue is that the file is excluded from source control, causing the plugin to not lint the file, and have opened issue #38 accordingly. |
Hi ! for my point of view preview @jamestalmage 's proposal is a good idea and hope you have focused on it. XO behavior that consist to just lint projects in which it have been explicitly defined to do the job is a really cool thing. So keeping in mine that behavior, a minimum step to enable XO to linting a project without have too include it as dev dependency can be to set a package.json like with just a XO's config mention. // package.json
{
xo: {}
} This minimum requirement event for a (simple)"one file project" isn't too much comparing to use a command to enable it (which can't be very usable in case of moving/renaming 's project, or without an .xorc file or somthing like that. which do not respond to philosophy behind XO). |
@tnga We already support |
I think the behaviour of I'd propose deprecating enabled=true{
"xo": {
"enabled": true
}
}
enabled=false{
"xo": {
"enabled": false
}
}
enabled=inherit{
"xo": {
"enabled": "inherit"
}
}
I am not sure on merging the |
No, With your proposal, every project would have to have |
@issuehunt has funded $40.00 to this issue.
|
Closing as Atom is abandoned. |
sometimes I use XO to follow tutorials and write only a few lines of javascript, and I see an extra process to use npm and install modules
IssueHunt Summary
Sponsors (Total: $40.00)
Become a sponsor now!
Or submit a pull request to get the deposits!
Tips
The text was updated successfully, but these errors were encountered: