-
Notifications
You must be signed in to change notification settings - Fork 8
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
Set severity level of rules in preset, as remark(-lint) has no option to pass the level through a preset plugin #36
Comments
Do errors stop builds? If warnings don't, it may actually foster adoption of the standard by not enforcing it when people want to slightly modify their READMEs to match their particular use-case. |
remark is not just a linter, it can also process and format. Hence, if formatting succeeds, we don’t exit with an error, even if there are warnings. As this is a preset, and the remark CLI has a |
Thanks for clarifying, @wooorm! Leaving as is. |
I understand that |
I looked into several presets, and there is like no rule in what should be used. Some don't set a level, other do like https://github.com/raduserbanescu/remark-preset-lint-styleguide/blob/master/src/index.js. So it would be interesting to know what the standard approach should be? The ability to set the severity level was specifically added because |
@wooorm is the expert on this one. |
I suggest that errors which crash, be errors (e.g., misconfiguration or so), and that errors that are stylistic (e.g., linting, this project), be warnings. And that The preset you linked to sets an error everywhere: that could’ve just as well been
There is no hard rule indeed, but my strong suggestion, and what most folks are doing, is to use the defaults: warnings. I agree with what Richard said at the start:
Finally, presets are a combination of plugins. This one is 7 lines. If you want to differentiate here, or combine with other things, you can make your own! Here’s mine! |
Though the thing is that linting is not only stylistic, it's also about avoiding errors, confusion etc.... So linting itself, you have rules that point out potential errors, or "errors" in the sense that it will confuse devs and in turn write errors. Other rules are purely stylistic, which are there to just bring consistency, which Imho are not really needed, but some want them. So the use-case is that when you have both "stylistic" linting rules AND "error-avoiding" linting rules, then you want the linting process to fail on these last kind, so you can take action and fix them.
I understand this, though I did observe multiple times that warnings get discarded, and are never solved, which means that in this case the standard will not be adopted, even though it was intended to. However, my intent is not to force my opinions on this preset and change it towards what I want. I just want to help improve for use-cases I have and see are needed. Programming is about trade-offs, and whatever get decided eventually, I'm fine with it.
Though the point of presets is that you can just add them to your dependencies, and add them to your config, and it just works. Imho, presets must work together to enable to just use them, and use all the ones you need for your project. Less presets out there in the wild makes the OS projects that uses them more consistent, which makes it easier for the devs working on them, and other that are reading through code of these projects. So I see that there is another view on linting and errors vs warnings. I would like to discuss more about this to find out why you have these views, as I probably will be missing views/parts of why. Apart from the discussion I'm fine with whatever get decided. I already have an idea for a helper that can set the severity level for any preset to the one needed/wanted, so that it can be applied based on the fact that it's "stylistic" vs "error-avoiding". |
I don't have a lot of views on this. I don't use this module, at the moment, and I don't really use any similar modules that have errors or warnings. My main concern is that managing expectations for people who use this sort of tool, and for that I tend to defer to @wooorm. |
unified does two things: a) check and b) build your site/docs/whatever. An error means that it all stops: it failed. The site can’t or shouldn’t be deployed. In my opinion it makes the most sense that builds succeed if they can, even if there are stylistic problems or inconsistencies. You’re of course free to choose and configure how you want, but that’s why all the checks for unified that I maintain are warnings. And all the incorrectly configured things and such, are errors.
Nice! Sounds useful! |
By default, if no severity is set, it seems that remark-lint sees the messages as warnings. Imho, it makes more sense that rules that must be obeyed to correctly follow the spec are listed as "error", no? If one would like to set them as warning, then they can overwrite it. Off course, this change would be a breaking change, so @RichardLitt , how would you like this improvement be handled in relation to versioning?
The text was updated successfully, but these errors were encountered: