You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to the object_literal rule, I'd like to have configurability for the inverse discouraged_object_literal rule, to enforce literals for some objects, and enforce the opposite for others.
Currently, only enforcing literals can be configured, but you cannot selectively discourage the others.
The main motivation comes from Xcode 10's terrible image literal support (you can basically only use them by dragging from the media library, and it's very hard to see or edit the raw image names in Xcode, nor do you see a preview).
Our goal is to enforce literals for all objects (currently that means colors), except for images, where we want to enforce non-literal syntax.
The relevant part of our config file would look like this:
opt_in_rules:
- discouraged_object_literal
- object_literal
# this part doesn't work yet
discouraged_object_literal:
color_literal: false
# this already works
object_literal:
image_literal: false
I would assume the existing ObjectLiteralConfiguration can be used for both rules.
Unless I'm missing something and this option shouldn't be implemented after all, I would volunteer to look into the code myself.
The text was updated successfully, but these errors were encountered:
New Issue Checklist
New rule request
Similar to the
object_literal
rule, I'd like to have configurability for the inversediscouraged_object_literal
rule, to enforce literals for some objects, and enforce the opposite for others.Currently, only enforcing literals can be configured, but you cannot selectively discourage the others.
The main motivation comes from Xcode 10's terrible image literal support (you can basically only use them by dragging from the media library, and it's very hard to see or edit the raw image names in Xcode, nor do you see a preview).
Our goal is to enforce literals for all objects (currently that means colors), except for images, where we want to enforce non-literal syntax.
The relevant part of our config file would look like this:
I would assume the existing
ObjectLiteralConfiguration
can be used for both rules.Unless I'm missing something and this option shouldn't be implemented after all, I would volunteer to look into the code myself.
The text was updated successfully, but these errors were encountered: