Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sketch-hq/sketch-assistant-core-rules

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sketch-hq/sketch-assistant-core-rules

> 💁‍♀️ This is 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. > > U

  • 3.1.0-next.3
  • next
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
3
Weekly downloads
 
Created
Source

sketch-assistant-core-rules

💁‍♀️ This is 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.

Use this Assistant by extending from it in your own Assistant, and adding configuration and/or additional rule implementations. To find out how to do this and more head to the Assistant Developer Documentation.

⚠️ This package is in pre-release mode using the next tag.

Available rules

This Assistant exports the following rules. Click the links to view their documentation, configuration options and implementation.

Development

The following section of the readme only relates to developing the Assistant, not using it in your own projects.

Requirements

  • Node
  • Yarn

Scripts

Interact with the tooling in this repository via the following scripts.

ScriptDescription
yarn buildBuilds the Assistant to the dist folder
yarn format-checkChecks the formatting with prettier
yarn i18n:extractExtracts strings from the JS source to PO files
yarn testRuns the Jest tests
yarn type-checkTypecheck the TypeScript

Workflows

Conventional commits

Try and use the conventional commits convention when writing commit messages.

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:

  1. Copy and paste one of the existing rule folders in src/ as a starting point.
  2. Add the new rule to the Assistant definition in src/index.ts.
  3. With Sketch, create some example .sketch files 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
  4. While developing your rule and its tests use Jest in watch mode: yarn test --watch.
  5. If you've added new strings then follow the internationalization workflow too.
  6. Add changeset for your rule, open a Pull Request and once merged release it
Releases

This repository uses Atlassian Changesets to automate the npm release process. Read the docs for more information, but the top-level summary is:

  • A GitHub Action maintains a permanently open PR that when merged will publish the package to npm with the latest changes and an automatically determined semver.
  • If the work you do in a PR should affect the next release, then you need to commit a "changeset" to the repository together with the rest of your code changes - do this by running yarn changeset. You'll be asked to provide a change type (major, minor or patch) and a message.
Internationalization

This Assistant requires internationalization since it's an official Sketch Assistant.

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:

  1. Run yarn i18n:extract which will update the .po files in src/locale/ with the new strings used throughout the source code.
  2. PR and merge these changes to master.
  3. Translation thereafter happens via CrowdIn automation.

Keywords

FAQs

Package last updated on 30 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc