@sketch-hq/sketch-core-assistant v6.5.0
sketch-assistant-core-rules
This Assistant contains the official Sketch rule set.
It's a "rules only" Assistant, meaning it contains only rule implementations and no configuration. Adding this Assistant to Sketch won't do anything because rules need to be activated in configuration before they will report anything.
Make use of this Assistant by extending from it in your own Assistants and adding configuration for the rules listed below.
Available rules
This Assistant exports the following rules. Click the links to view their documentation, configuration options and implementation.
artboards-gridartboards-layoutartboards-max-ungrouped-layersborders-no-disableddebug-all-optionsdebug-i18ndebug-throws-errordebug-timeoutexported-layers-normal-blend-modefills-no-disabledgroups-max-layersgroups-no-emptygroups-no-redundantgroups-no-similarimages-no-outsizedimages-no-undersizedinner-shadows-no-disabledlayer-styles-no-dirtylayer-styles-prefer-sharedlayers-no-hiddenlayers-no-looselayers-subpixel-positioninglibrary-layer-styles-allowed-librarieslibrary-symbols-allowed-librarieslibrary-text-styles-allowed-librariesname-pattern-artboardsname-pattern-groupsname-pattern-imagesname-pattern-pagesname-pattern-shapesname-pattern-symbolsname-pattern-textresult-messages-includeshadows-no-disabledshared-styles-no-unusedsymbols-no-detachedsymbols-no-unusedtext-styles-no-dirtytext-styles-prefer-shared
Development
This section of the readme deals with development only. If you're just here to install Assistants in Sketch you can safely ignore this section.
Ensure you've followed the Getting Started section in the root README. Having done so the following scripts should work in this folder.
| Script | Description |
|---|---|
| yarn build | Builds the Assistant to the dist folder |
| yarn i18n:extract | Extracts strings from the JS source to PO files |
| yarn test | Runs the Jest tests |
Working on rules
Use a TDD approach, and the existing rules as a guide.
Rule functions can run in Node against plain Sketch file JSON, so the Mac Sketch app isn't required while actively developing rule logic.
When creating a new rule in this repository:
- Copy and paste one of the existing rule folders in
src/as a starting point. - Add the new rule to the Assistant definition in
src/index.ts. - With Sketch, create some example
.sketchfiles to use as test fixtures. At a minimum these should demonstrate two scenarios - one where you'd expect your rule to report violations, and one where it shouldn't report any - While developing your rule and its tests use Jest in watch mode:
yarn test --watch. - If you've added new strings then follow the internationalization workflow too.
- Add changeset for your rule, open a Pull Request and once merged release it
Internationalization
This Assistant is internationalized since it's an official Sketch Assistant. We need any user facing strings to display in the correct language. Translating your own Assistants is completely optional however.
Internationalization is handled by LinguiJS, and follows their guides for handling plain JavaScript projects.
The following locales are currently supported in the Sketch Mac app and this project:
en(American English)zh-Hans(Chinese Simplified)
When ready to perform a round of translation, for example when there are new untranslated strings in the repository, perform the following workflow:
- Run
yarn i18n:extractwhich will update the.pofiles insrc/locale/with the new strings used throughout the source code. - PR and merge these changes to
main. - Translation thereafter happens via CrowdIn automation.
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago