This repo has moved to https://github.com/sketch-hq/sketch-assistants/
sketch-hq / sketch-assistant-core-rules Goto Github PK
View Code? Open in Web Editor NEWSketch Assistant containing the official core rules
License: MIT License
Sketch Assistant containing the official core rules
License: MIT License
This repo has moved to https://github.com/sketch-hq/sketch-assistants/
We've been discussing various scenarios for assistants that don't strictly check a document for validity but rather offer a list of suggestions or a checklist. This could be something particularly useful for team onboarding and general workflow conventions.
More sophisticate variants of this could be the display of usage instructions when certain design system components are being used within a design but this is out of scope of this rule.
messages
Set a list of messages with custom strings, e.g.
severity
For discussion, should each item have its own severity or do we just go with the rule-wide severity? Is this part of the messages
option?
Not sure what would make a good rule name, report
, report-always
, report-custom-message
, report-message-custom
, @jedrichards?
The same image can be used in multiple places, e.g. to fill an entire background and within a small button. While it may be way bigger than necessary for the button, as long as the image is below the ratio of the background size this represents no problem.
See reference document provided with https://github.com/sketch-hq/Sketch/issues/27973
See feeback from https://www.notion.so/sketchapp/Feedback-highlights-186f5de5a97b4b82bddaf4deaf3da339
Seeing violations for Unexpected subpixel positioning of 0.99999999999775 – a number Sketch can not display. He's not sure how this originally happened, as it's an old file (he thinks he combined some uneven shapes and then moved them around), but either way, this is either a Sketch problem or an Assistant problem. If Sketch says the circle sits on X=1, seeing a violation in Assitantant about the layer being off the pixel grid feels strange.
Also seeing a few violations for Unexpected subpixel positioning but everything seems good looking at the coordinates. Moving the layer up and down with the mouse to the exact same coordinates seems to fix the issue.
This seems like a Sketch problem, but need to decide if this is something we can handle in the rule, or whether it's not the rule's concern ...
This would be a rule that detected groups with similar contents, so a suggestion could be made to abstract them into a symbol. Possible rule name groups-detect-similar
? Or groups-prefer-symbols
?
Group similarity would be based on creating a consistent "fingerprint" for each group, initially comprised of the follow metrics:
We can revisit the way we generate the fingerprint based on feedback.
One approach could be to create a hash from the dataset defined above, then we would only need to compare hashes when looping over groups.
Rule configuration could include a maxIdentical
value, for example the rule could tolerate 2 similar groups before raising any violations.
"No dirty" rules would check for layer styles that have diverged from their associated shared style.
Two new rules could implement this behaviour:
text-styles-no-dirty
layer-styles-no-dirty
Inspiration for these rules comes from this community plugin https://github.com/KevinGutowski/FindDirtyStyles
I haven't thought through the approach fully yet but it's likely to involve:
sketch-lint-ruleset-core
needs to become a "rules only" assistant, perhaps called something like sketch-assistant-core-rules
.
Hi!
I am trying this wonderful package but I can't get to import rules from this repo to the template, I don't really know (I was looking the documentation but I couldn't find anything about that)
When I run yarn test --watch
with some of the rules imported this message appear.
FAIL src/rules/artboards-grid/__tests__/index.ts
● Test suite failed to run
src/rules/artboards-grid/__tests__/index.ts:1:26 - error TS2307: Cannot find module '../../../test-helpers'.
1 import { testRule } from '../../../test-helpers'
Probably I am doing something wrong xD
Thanks!
[email protected]:sketch-hq/sketch-assistants.git
git checkout feature/add-core-rules
yarn
yarn build
For the three assistants tidy
, reuse-suggestions
and naming-conventions
ensure that they can still be packaged and added to Sketch locally, and they generate the expected violations.
E.g.
cd assistants/tidy
yarn package-tarball
# Then "Add from Disk" in Sketch Experimental
Implement a rule that works similarly to images-no-outsized
, but instead of checking for over sized images, check for undersized images like to produce poor results in exported graphics.
I can into the scenario using the all.sketch
from https://github.com/sketch-hq/Sketch/issues/27973
- Group A (with a style)
- Group B (with a style)
- Other item (with a style)
Incorporate changes from the copy review
https://www.notion.so/sketchapp/Assistant-Core-Rules-Copy-755c48df95bb44c5ab2caaf2e9e3d2fa
Implement a rule that controls how many non-group layers are allowable as immediate children of an artboard.
Move the style comparison methods into the rule utils object. These methods can keep the existing hash-based approach. These methods must cover our existing style comparison cases.
The style comparison is being hand-rolled and repeated in a couple of rules:
It differs only slightly between them (e.g. text comparisons take into consideration the textStyle
attribute).
This poses an opportunity to refactor these parts of the code and perhaps even speed them up.
Umbrella issue for implementing initial ruleset. It may be sensible to firm up the rule architecture a bit before diving into these (e.g. sketch-hq/sketch-lint#1 and sketch-hq/sketch-document#9)
Adding documentation as markdown in the repo leaves the door open for using the content in a static website some point in the future.
Adding a README.md alongside the rule file could be a nice approach, like this https://github.com/stylelint/stylelint/tree/master/lib/rules/at-rule-blacklist
Move Sketch file fixtures near the tests they are used in, delete "Does not generate false negatives" tests (not useful), add more fixtures testing more cases
Layers marked as exportable, that also have blend modes applied should raise violations.
Rotation commonly leads to sub-pixel positioning which can be considered intentional at that point.
Disallow the usage of any document-local symbols, shared styles or shared text styles, preferring instead for these to come from libraries.
Define a rule option libraries
which is an array of whitelisted libraries to act as sources. If the libraries
array is empty then any library can be used as source. Investigate whether to use library names or ids in this option array.
Implement as three separate rules:
symbols-prefer-library
layer-styles-prefer-library
text-styles-prefer-library
From https://www.notion.so/sketchapp/Feedback-31-March-3-April-e8faf52704804db7b33fa3252eba2aae
I have a combined shape that has a shared style applied. However, for all shapes inside this combined shape, I'm getting a violation
Expected no identical layer styles in the document, but found 12 matching this layer's style. Consider a shared style instead
– this must be a mistake, right? Assistant should not consider the shapes inside a combined shape as individual "layers".
Still having the same issue as reported before, about combined shapes. It's the same issue as Janik but related to
Unexpected disabled border on layer style
So it sounds like we have multiple rules that shouldn't be raising violations about styles inside combined shapes.
In the same document given for QA of https://github.com/sketch-hq/Sketch/issues/27973, both artboards were flagged, despite one fully conforming to the layout settings. Also, both artboards were flagged twice for some reason. See demo video https://sketch.slack.com/archives/CRJLL8E80/p1578903499021700?thread_ts=1578863401.017800&cid=CRJLL8E80
Review error messages and rule violation messages.
Using borders-no-disabled
as a guide Implement the following rules:
fills-no-disabled
inner-shadows-no-disabled
shadows-no-disabled
Check to see whether layers to be exported as bitmaps shouldn't raise violations.
On the groups-max-layers rule:
skipClasses
to ignore
skipClasses
array includes invalid/unsupported class valuesCurrently the documentation says:
Layers outside of artboards don't show up on Cloud, therefore any layer (including group layers) outside of artboards should raise a violation.
Could a simple approach be to loop over layers that are immediate children of page objects, and check that they are all artboards?
layer-names-patterns-allowed
layer-names-patterns-disallowed
layer-name-pattern-pages
layer-name-pattern-artboards
layer-name-pattern-symbol-instances
layer-name-pattern-symbol-masters
layer-name-pattern-groups
layer-name-pattern-text
layer-name-pattern-shape
layer-name-pattern-bitmap
allowed
and disallowed
pattern lists could be moved to become rule options, rather than needing two rules for each layer typeA declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.