Phillip9587 / nx-stylelint

Nx plugin to use Stylelint in your Nx workspace.
MIT License
84 stars 15 forks source link

Add configuration to all current and future projects in workspace #425

Open SimonKunz opened 1 year ago

SimonKunz commented 1 year ago

Hi,

I just installed your plugin on our nx-workspace with > 120 Angular apps and libs. Is there a way to run "nx-stylelint:configuration" for every project in the corresponding angular.json file?

Also I'd be cool to automatically add the configuration to every new project that gets added to the workspace (not sure if that's possible).

Thank you for the great work!

Phillip9587 commented 1 year ago

Hi Simon,

There is currently no way to do this. I think it should be possible to implement a --all flag which adds a stylelint target to each project which does not contain a stylelint target.

It is not possible to automatically add stylelint targets to every new project that gets added to the workspace because there it is out of the scope of this project to extends other generators. But you can implement your own Local Plugin Generator which combines the App/Lib Generator you are using with the nx-stylelint:configuration Generator: https://nx.dev/recipes/generators/local-generators and https://nx.dev/recipes/generators/composing-generators

SimonKunz commented 1 year ago

Hi Philip,

alright, maybe I'll have a look at the --all flag and give you a Pull Request.

I think for adding the stylelint targets to new projects I'll write a custom generator for our project as you suggested.

Thank you!

jase88 commented 11 months ago

Hey @SimonKunz, how did you manage to make it work for new projects? Thinking about a executor (for CI) that checks if a project contains a css or scss file, it needs to have a stylelint target

Phillip9587 commented 11 months ago

Nx introduced the concept of plugins that can automatically add targets to projects if the project matches some criterias.

I'm working on a new version of nx-stylelint that adds the stylelint target when a .stylelintrc file is present at the project root.

I think it should be possible to make the plugin configurable to add a stylelint target with a default config to projects containing css or scss files.

SimonKunz commented 11 months ago

@jase88 We solved it by implementing some custom NX-Generators. We needed them anyway for some other project specific tasks, so it was not a big deal for us.

But I really like the idea of a Nx plugin for nx-stylelint.

jase88 commented 9 months ago

Would this be solved with https://github.com/Phillip9587/nx-stylelint/issues/635 ?