-
Notifications
You must be signed in to change notification settings - Fork 469
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 support for custom linters #161
Comments
Since version 0.12.0 there are a lot of changes - hard to say what's the reason. In General I would think it's always better to contribute to the project and introduce new (configurable) linters instead of keeping them private. So you also don't have to take care on every change, that your private code is still running. What kind of linters to you have? |
Our usage is fairly basic right now, but we plan to expand on it. We in particular have a linter that prevents pointer event attributes being used in CSS. Maybe other people would like that? Or we could turn it into a linter that disallows event types that a user passes in via config? |
Can you give an example, so that I understand what you are trying to achieve? |
this is the one linter we currently have: module SCSSLint
class Linter::NoPointerEvents < Linter
include LinterRegistry
def visit_prop(node)
add_lint(node) if node.name.first.to_s == 'pointer-events'
end
def description
'IE doesnt support pointer-events.'
end
end
end pretty simple, right? 'm not sure anyone else cares about keeping pointer-events out of their scss, but we were thinking it might be nice to let users keep arbitrary attributes of their choice out of their codebase. ie somewhere in the config file for a linter, list disallowed attributes. but you could also imagine all kinds of custom rules that don't make sense for everyone - like my PM hates orange, and wants to make sure no one adds any orange to the website. I think first hand functionality to add custom linters would be really useful. |
I think it would be a great linter where I can specify a list of properties, that are banned. It would be diabled by default, and can be enabled if needed. The configuration could look like this:
@sds what do you think? |
geniou - I love that. |
@marcogallotta: One of the big milestones that is holding I don't think this would be too much work to implement, but it requires some changes to the If you're interested in having this added to |
@geniou: I'd accept a pull request for a |
+1 custom repository-specific linters would be useful |
+1 I need to test some guidelines I use in my work, for example, we use variables of the colors palette instead of filling with large amount of hexadecimals on the project. Would be great if a could write a custom test for this. |
👍 |
👍 |
+1 for ForbiddenProperty |
Experimental support for custom linters was implemented in #459. Please check out the |
Hey there
I am trying to add custom linters. The code we use to add our linters is included below. It was working in scss-lint version 0.12.0, but not on the latest version. We are enabling it by passing the args "-i ", and the linters are in admin/lint/scss_lint_rules/ and follow the same structure as pre-packaged ones. It just never gets loaded into @options.
Any suggestions on how to get this working? We have also tried enabling it through a config file, but that doesn't seem to do anything.
and - any chance you'd add the functionality to pass custom linters in? I'm sure lots of other groups have custom lint rules that don't make sense to add to this package, but would be of great use to them.
thanks!!
The text was updated successfully, but these errors were encountered: