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

Add formatter option to add custom formatters using the CLI #593

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add formatter option to add custom formatters using the CLI #593

wants to merge 1 commit into from

Conversation

SimenB
Copy link

@SimenB SimenB commented Apr 28, 2015

I haven't written any tests in case you are not interested in this.

The use case is to provide formatters over npm, instead of maintaining them within CSSLint core.

Usage:
image

I'm currently trying to throw together a custom reporter (based on jshint-stylish), which is the one used in the SS. If I could publish it to npm, it's release-cycle is not dependent on this.

The format of the formatter-options is just a path (relative to where csslint is called) than can be required, and resolves into a formatter.

EDIT: I published the formatter on npm. https://www.npmjs.com/package/csslint-stylish

npm i csslint-stylish, and then the command in the Screenshot should work to use the formatter from npm. npm link would make the node call cleaner, but meh

@SimenB SimenB changed the title Try to require unknown formatters if running Node Add formatter option to CLI, to add formatter using the CLI Apr 29, 2015
var path = require("path");
var fullPath = path.resolve(process.cwd(), options.formatter);

var customFormatter = require(fullPath);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line could throw exception. Catch it and return exitcode = 1?

@SimenB SimenB changed the title Add formatter option to CLI, to add formatter using the CLI Add formatter option to add custom formatters using the CLI Apr 29, 2015
@ideadapt
Copy link

I like this feature. Would be nice to have this merged :)

@SimenB
Copy link
Author

SimenB commented Mar 1, 2016

@frvge @XhmikosR Thoughts on this?

@XhmikosR
Copy link
Member

XhmikosR commented Apr 8, 2016

I guess it's OK having such a feature, but we need more people to help with the development.

@SimenB
Copy link
Author

SimenB commented Jul 28, 2016

@XhmikosR what do you mean, "more people"? This thing is really just exposing part of the programmatic API through the CLI. It's missing tests, I know, could probably write them if you want (unsure how you test the CLI itself)

@mbejda
Copy link

mbejda commented Sep 21, 2016

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants