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

Document/add programmatic use? #60

Closed
bcomnes opened this issue Mar 10, 2015 · 14 comments
Closed

Document/add programmatic use? #60

bcomnes opened this issue Mar 10, 2015 · 14 comments
Assignees

Comments

@bcomnes
Copy link
Member

bcomnes commented Mar 10, 2015

I'm trying to write some tests for standard-format and want to run standard against some strings inside the test. So far the CLI seems to be the only thing documented. It would be nice to have some documentation on how/what I can do once I require('standard'). I'll try to contribute some after I get my head wrapped around what is available and opening this issue in the meantime.

@bcomnes
Copy link
Member Author

bcomnes commented Mar 10, 2015

For example, it would be great to have some kind of interface that lets me pass in a file or string to standard, and get back an array of error objects or something. Right now there is a runner that uses spawn: https://github.com/maxogden/standard-format/blob/master/test/standard-runner.js

@bcomnes bcomnes changed the title Document programmatic use? Document/add programmatic use? Mar 10, 2015
@feross
Copy link
Member

feross commented Mar 11, 2015

There is some documentation here: https://github.com/feross/standard/blob/master/index.js#L37-L47

Right now require('standard') doesn't let you test strings. Only stdin, or a list of file paths. I'd accept a PR that makes it support testing strings, though you'd need to get this working with eslint and jscs.

Also, index.js currently prints to stdout instead of returning an array of errors. We should change this to do the printing in cmd.js.

PRs welcome!

@bcomnes
Copy link
Member Author

bcomnes commented Mar 11, 2015

I'll see what I can do sometime soon.

@feross
Copy link
Member

feross commented Mar 12, 2015

If you get this done in the next day or two, we can include this in the v3.0.0 release.

@bcomnes
Copy link
Member Author

bcomnes commented Mar 12, 2015

I'm going to try and look at it in the morning tomorrow. Don't wait around for me though ;)

Bret Comnes
http://bret.io
Sent from my mobile

On Mar 11, 2015, at 8:41 PM, Feross Aboukhadijeh notifications@github.com wrote:

If you get this done in the next day or two, we can include this in the v3.0.0 release.


Reply to this email directly or view it on GitHub.

@bcomnes
Copy link
Member Author

bcomnes commented Mar 12, 2015

I have checking of strings working in jscs here: https://github.com/bcomnes/standard/blob/dev/lib/checkString.js Ill try for eslint tomorrow.

@bcomnes
Copy link
Member Author

bcomnes commented Mar 15, 2015

Arg... getting distracted over here. I think im going to finish up https://github.com/bcomnes/sublime-standard-format before I can get to this issue so please dont wait for me.

feross added a commit that referenced this issue Mar 19, 2015
Improves performance of standard by 2-4x by:

- remove the need for `npm run which-eslint`
- remove the `child_process.exec` calls and use the node api of eslint
directly
- Remove `jscs` linter

Fixes #43 - speed issues
Fixes #45 - eliminate jscs

Lays the groundwork for #60 - programmatic use
@feross feross self-assigned this Mar 19, 2015
feross added a commit that referenced this issue Mar 19, 2015
@feross
Copy link
Member

feross commented Mar 19, 2015

This is done! But it's currently on the speed branch. We'll merge into master soon, but feel free to give it a try now and confirm that it works for your purposes 👍

standard now exports two functions: lintText and lintFiles. They are documented inline in the source.

@bcomnes
Copy link
Member Author

bcomnes commented Mar 19, 2015

Thanks maaan! Sorry I couldn't pull through on this. Will help with writing standard-format tests.

@bcomnes bcomnes closed this as completed Mar 19, 2015
@feross
Copy link
Member

feross commented Mar 19, 2015

No problem 👍

@feross
Copy link
Member

feross commented Mar 19, 2015

Let's leave this open until speed is merged into master.

@feross feross reopened this Mar 19, 2015
@bcomnes
Copy link
Member Author

bcomnes commented Mar 19, 2015

Oh derp. Good point

@feross feross mentioned this issue Mar 23, 2015
feross added a commit that referenced this issue Mar 23, 2015
Improves performance of standard by 2-4x by:

- remove the need for `npm run which-eslint`
- remove the `child_process.exec` calls and use the node api of eslint
directly
- Remove `jscs` linter

Fixes #43 - speed issues
Fixes #45 - eliminate jscs

Lays the groundwork for #60 - programmatic use
feross added a commit that referenced this issue Mar 23, 2015
@feross
Copy link
Member

feross commented Mar 26, 2015

This is released as 3.3.0.

feross added a commit that referenced this issue Mar 26, 2015
Improves performance of standard by 2-4x by:

- remove the need for `npm run which-eslint`
- remove the `child_process.exec` calls and use the node api of eslint
directly
- Remove `jscs` linter

Fixes #43 - speed issues
Fixes #45 - eliminate jscs

Lays the groundwork for #60 - programmatic use
@feross feross closed this as completed in eb255c2 Mar 26, 2015
feross added a commit that referenced this issue Mar 26, 2015
Depending on the latest eslint via git will let us release the next
version of `standard` asap and fix #43, #45, and #60. Once eslint
releases the next version, we can switch back to the npm dep.
@bcomnes
Copy link
Member Author

bcomnes commented Mar 26, 2015

Boo ya!

@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants