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

@sketch-hq/sketch-assistant-utils

Package Overview
Dependencies
Maintainers
3
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sketch-hq/sketch-assistant-utils - npm Package Compare versions

Comparing version 5.0.0-next.2 to 5.0.0-next.3

7

CHANGELOG.md
# @sketch-hq/sketch-assistant-utils
## 5.0.0-next.3
### Patch Changes
- 78760f5: Support `ruleTitle` values in rule config
- ac80655: Make package public
## 5.0.0-next.2

@@ -4,0 +11,0 @@

6

dist/cjs/assistant-config/index.d.ts

@@ -29,3 +29,7 @@ import Ajv from 'ajv';

declare const getRuleSeverity: (config: AssistantConfig, ruleName: string) => ViolationSeverity;
export { getRuleConfig, getRuleOption, isRuleConfigured, isRuleActive, getRuleSeverity, isRuleConfigValid, };
/**
* Return the custom title for a rule if its been defined at configuration-time.
*/
declare const getRuleTitle: (config: AssistantConfig, ruleName: string) => string | null;
export { getRuleConfig, getRuleOption, isRuleConfigured, isRuleActive, getRuleSeverity, isRuleConfigValid, getRuleTitle, };
//# sourceMappingURL=index.d.ts.map

@@ -48,3 +48,3 @@ "use strict";

const isRuleActive = (config, ruleName) => {
const active = getRuleOption(config, ruleName, 'active');
const active = getRuleOption(config, ruleName, sketch_assistant_types_1.ReservedRuleOptionNames.active);
return typeof active === 'boolean' ? active : false;

@@ -57,3 +57,3 @@ };

const getRuleSeverity = (config, ruleName) => {
const severity = getRuleOption(config, ruleName, 'severity');
const severity = getRuleOption(config, ruleName, sketch_assistant_types_1.ReservedRuleOptionNames.severity);
switch (severity) {

@@ -69,2 +69,10 @@ case sketch_assistant_types_1.ViolationSeverity.info:

exports.getRuleSeverity = getRuleSeverity;
/**
* Return the custom title for a rule if its been defined at configuration-time.
*/
const getRuleTitle = (config, ruleName) => {
const ruleTitle = getRuleOption(config, ruleName, sketch_assistant_types_1.ReservedRuleOptionNames.ruleTitle);
return typeof ruleTitle === 'string' ? ruleTitle : null;
};
exports.getRuleTitle = getRuleTitle;
//# sourceMappingURL=index.js.map

17

dist/cjs/run-assistant/index.js

@@ -52,10 +52,15 @@ "use strict";

const ruleConfig = assistant_config_1.getRuleConfig(assistant.config, rule.name);
const configTitle = assistant_config_1.getRuleTitle(assistant.config, rule.name);
const title = configTitle
? configTitle
: ruleConfig && 'active' in ruleConfig && typeof rule.title === 'function'
? rule.title(ruleConfig)
: rule.title;
const description = ruleConfig && 'active' in ruleConfig && typeof rule.description === 'function'
? rule.description(ruleConfig)
: rule.description;
return Object.assign(Object.assign({}, acc), { [rule.name]: {
name: rule.name,
title: typeof rule.title === 'function' && ruleConfig && 'active' in ruleConfig
? rule.title(ruleConfig)
: rule.title,
description: typeof rule.description === 'function' && ruleConfig && 'active' in ruleConfig
? rule.description(ruleConfig)
: rule.description,
title,
description,
debug: rule.debug,

@@ -62,0 +67,0 @@ platform: rule.platform,

@@ -29,3 +29,7 @@ import Ajv from 'ajv';

declare const getRuleSeverity: (config: AssistantConfig, ruleName: string) => ViolationSeverity;
export { getRuleConfig, getRuleOption, isRuleConfigured, isRuleActive, getRuleSeverity, isRuleConfigValid, };
/**
* Return the custom title for a rule if its been defined at configuration-time.
*/
declare const getRuleTitle: (config: AssistantConfig, ruleName: string) => string | null;
export { getRuleConfig, getRuleOption, isRuleConfigured, isRuleActive, getRuleSeverity, isRuleConfigValid, getRuleTitle, };
//# sourceMappingURL=index.d.ts.map
import Ajv from 'ajv';
import { ViolationSeverity, } from '@sketch-hq/sketch-assistant-types';
import { ViolationSeverity, ReservedRuleOptionNames, } from '@sketch-hq/sketch-assistant-types';
import { helpers, buildRuleOptionSchema } from '../rule-option-schemas';

@@ -39,3 +39,3 @@ /**

const isRuleActive = (config, ruleName) => {
const active = getRuleOption(config, ruleName, 'active');
const active = getRuleOption(config, ruleName, ReservedRuleOptionNames.active);
return typeof active === 'boolean' ? active : false;

@@ -47,3 +47,3 @@ };

const getRuleSeverity = (config, ruleName) => {
const severity = getRuleOption(config, ruleName, 'severity');
const severity = getRuleOption(config, ruleName, ReservedRuleOptionNames.severity);
switch (severity) {

@@ -58,3 +58,10 @@ case ViolationSeverity.info:

};
export { getRuleConfig, getRuleOption, isRuleConfigured, isRuleActive, getRuleSeverity, isRuleConfigValid, };
/**
* Return the custom title for a rule if its been defined at configuration-time.
*/
const getRuleTitle = (config, ruleName) => {
const ruleTitle = getRuleOption(config, ruleName, ReservedRuleOptionNames.ruleTitle);
return typeof ruleTitle === 'string' ? ruleTitle : null;
};
export { getRuleConfig, getRuleOption, isRuleConfigured, isRuleActive, getRuleSeverity, isRuleConfigValid, getRuleTitle, };
//# sourceMappingURL=index.js.map

@@ -12,3 +12,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import { createRuleUtilsCreator } from '../rule-utils';
import { isRuleActive, getRuleConfig } from '../assistant-config';
import { isRuleActive, getRuleConfig, getRuleTitle } from '../assistant-config';
class RuleInvocationError extends Error {

@@ -47,10 +47,15 @@ constructor(cause, assistantName, ruleName) {

const ruleConfig = getRuleConfig(assistant.config, rule.name);
const configTitle = getRuleTitle(assistant.config, rule.name);
const title = configTitle
? configTitle
: ruleConfig && 'active' in ruleConfig && typeof rule.title === 'function'
? rule.title(ruleConfig)
: rule.title;
const description = ruleConfig && 'active' in ruleConfig && typeof rule.description === 'function'
? rule.description(ruleConfig)
: rule.description;
return Object.assign(Object.assign({}, acc), { [rule.name]: {
name: rule.name,
title: typeof rule.title === 'function' && ruleConfig && 'active' in ruleConfig
? rule.title(ruleConfig)
: rule.title,
description: typeof rule.description === 'function' && ruleConfig && 'active' in ruleConfig
? rule.description(ruleConfig)
: rule.description,
title,
description,
debug: rule.debug,

@@ -57,0 +62,0 @@ platform: rule.platform,

{
"name": "@sketch-hq/sketch-assistant-utils",
"version": "5.0.0-next.2",
"version": "5.0.0-next.3",
"module": "dist/esm/index",

@@ -30,3 +30,3 @@ "main": "dist/cjs/index",

"@json-schema-spec/json-pointer": "0.1.2",
"@sketch-hq/sketch-assistant-types": "3.0.0-next.2",
"@sketch-hq/sketch-assistant-types": "3.0.0-next.3",
"ajv": "6.12.0",

@@ -33,0 +33,0 @@ "humps": "2.0.1",

@@ -6,5 +6,3 @@ # sketch-assistant-utils

> 🙋‍♀️ These utility functions are mainly of use when creating Sketch Assistant Runners, i.e. tools
> that invoke Assistants against Sketch files and present the results to a user. The types exported
> from this module are generally useful to any TypeScript project related to Assistants, including
> the development of individual Assistant packages themselves.
> that invoke Assistants against Sketch files and present the results to a user.

@@ -14,9 +12,7 @@ ## Usage

```sh
yarn add @sketch-hq/sketch-assistant-utils
yarn add @sketch-hq/sketch-assistant-utils@next
```
## Documentation
> ⚠️ The repo is in pre-release mode using the `next` tag.
Coming soon.
## Development

@@ -23,0 +19,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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