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

API #2

Closed
MoOx opened this issue Feb 6, 2015 · 15 comments
Closed

API #2

MoOx opened this issue Feb 6, 2015 · 15 comments

Comments

@MoOx
Copy link
Contributor

MoOx commented Feb 6, 2015

I just opened an issue on postcss that will helps a lot us. In fact that would make us just ready to drop rules as plugin & use this new message api.

postcss/postcss#177

Please give your opinion on this guys :)

@jeddy3
Copy link
Member

jeddy3 commented Feb 6, 2015

So am I right in thinking that, with the addition of result.messages to postcss, stylelint will be a collection of linter postcss plugins, just like cssnext is a collection of transpiler postcss plugins (with added caniuse support)?

And, just like cssnext, you'll be able to pass in a big options parameter. In stylelint's case, configuration options for the rules e.g:

var output = stylelint(input, {
  rules: {
    indentation: {
      default: 1,
      char: "\t",
    },
    eof-newline: true
  } 
})

And, with the addition of result.messages to postcss, stylelint will be able to capture all the messages from the separate linter plugins and display them in a nice way?

If so, that all sounds fantastic to me! :)

@MoOx
Copy link
Contributor Author

MoOx commented Feb 6, 2015

You are right 😉

@jeddy3
Copy link
Member

jeddy3 commented Feb 6, 2015

Awesome :)

@davidtheclark
Copy link
Contributor

Sounds great to me. Good thinking.

@davidtheclark
Copy link
Contributor

I was thinking about writing some linter modules sometime soonish, and just wanted to ensure that they would be compatible with stylelint once stylelint gets going. So I have one question for @MoOx about the intentions of stylelint: If I write linting modules that register their complaints via the PostCSS 4.1+ warnings API, will that be enough for stylelint to understand and interpret them? Is the plan to build stylelint right on top of that API?

@MoOx
Copy link
Contributor Author

MoOx commented Apr 22, 2015

FYI this messages API in postcss exists because I gave the idea for stylelint. So yes I would definitly use it :)
I don't plan to make hundreds of postcss-* plugins for this linter and would prefer to get the rules in a single repo.
I really like ESLint so I think I will try to mimic the way you can use it. So we should definitly support "stylelint plugin" (-> postcss plugin).

For a quick start I plan to work on stylelint as a postcss plugin. I will try to work on this really soon.

@magsout
Copy link
Member

magsout commented Apr 22, 2015

👍

@lorenz068
Copy link

Is it currently fonctionnal? If i read your source code i don't read anything about CSS. Just JS right?

@MoOx
Copy link
Contributor Author

MoOx commented Apr 24, 2015

Nothing has been made yet.

@davidtheclark
Copy link
Contributor

Until there is some other structure in place, what would you think of the following temporary setup:

  • Write and test rules individually, as though they were individual plugins although they live here in the same repo; basically, they are functions that accept the AST and result objects and register warnings on the result.
  • The plugin itself accepts a single options object containing settings for all rules.
  • Rules register problems as warnings. These could then be printed in the console by the runner or with something like postcss-log-warnings.

?? Would that work as a temporary setup?

I might have some time to write some rules soon -- e.g. at laundromat tonight :) -- so I wanted to see if there was an acceptable way to get something usable going. I can implement this if you agree with it.

@MoOx
Copy link
Contributor Author

MoOx commented May 5, 2015

That would totally works for me.
Sorry to started something and to not do anything... I am really busy with cssnext these days...
So I added you as a collaborator ;)

@davidtheclark
Copy link
Contributor

Ok. I understand that it's OSS and you do not have unlimited time, so definitely wasn't trying to pressure you :) Just wanted a starting point, and this would work. Cool! Hope I can write a few soon.

@MoOx MoOx removed the enhancement label May 6, 2015
@jeddy3
Copy link
Member

jeddy3 commented May 8, 2015

Would that work as a temporary setup?

Sounds good to me!

@MoOx
Copy link
Contributor Author

MoOx commented May 8, 2015

I think we can close this one for now. Don't you think ?

@davidtheclark
Copy link
Contributor

Yes.

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

No branches or pull requests

5 participants