@sketch-hq/sketch-tidy-assistant
Version:
- [Maximum ungrouped layers in an artboard](https://github.com/sketch-hq/sketch-assistants/tree/main/assistants/core/src/rules/artboards-max-ungrouped-layers): `5` - [Borders should not be disabled](https://github.com/sketch-hq/sketch-assistants/tree/ma
86 lines (85 loc) • 4.96 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = require("path");
const sketch_assistant_utils_1 = require("@sketch-hq/sketch-assistant-utils");
const __1 = __importDefault(require(".."));
const testCoreRule = (fixture, ruleName) => __awaiter(void 0, void 0, void 0, function* () {
return yield sketch_assistant_utils_1.testRuleInAssistant(path_1.resolve(__dirname, fixture), __1.default, `@sketch-hq/sketch-core-assistant/${ruleName}`);
});
test('borders-no-disabled', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./disabled-border.sketch', 'borders-no-disabled');
expect(violations).toHaveLength(1);
expect(ruleErrors).toHaveLength(0);
}));
test('fills-no-disabled', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./disabled-fill.sketch', 'fills-no-disabled');
expect(violations).toHaveLength(1);
expect(ruleErrors).toHaveLength(0);
}));
test('shadows-no-disabled', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./disabled-shadow.sketch', 'shadows-no-disabled');
expect(violations).toHaveLength(1);
expect(ruleErrors).toHaveLength(0);
}));
test('inner-shadows-no-disabled', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./disabled-inner-shadow.sketch', 'inner-shadows-no-disabled');
expect(violations).toHaveLength(1);
expect(ruleErrors).toHaveLength(0);
}));
test('groups-no-empty', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./empty-group.sketch', 'groups-no-empty');
expect(violations).toHaveLength(1);
expect(ruleErrors).toHaveLength(0);
}));
test('layer-styles-no-dirty', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./dirty-style.sketch', 'layer-styles-no-dirty');
expect(violations).toHaveLength(1);
expect(ruleErrors).toHaveLength(0);
}));
test('text-styles-no-dirty', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./dirty-text-style.sketch', 'text-styles-no-dirty');
expect(violations).toHaveLength(1);
expect(ruleErrors).toHaveLength(0);
}));
test('groups-no-redundant', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./redundant-group.sketch', 'groups-no-redundant');
expect(violations).toHaveLength(1);
expect(ruleErrors).toHaveLength(0);
}));
test('layers-no-hidden', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./hidden-layer.sketch', 'layers-no-hidden');
expect(violations).toHaveLength(1);
expect(ruleErrors).toHaveLength(0);
}));
test('layers-subpixel-positioning', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./subpixel-positioning.sketch', 'layers-subpixel-positioning');
expect(violations).toHaveLength(1);
expect(ruleErrors).toHaveLength(0);
}));
test('artboards-max-ungrouped-layers', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./ungrouped-layers.sketch', 'artboards-max-ungrouped-layers');
expect(violations).toHaveLength(1);
expect(ruleErrors).toHaveLength(0);
}));
test('layers-no-loose', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./loose-layers.sketch', 'layers-no-loose');
expect(violations).toHaveLength(1);
expect(ruleErrors).toHaveLength(0);
}));
test('shared-styles-no-unused', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./unused-shared-style.sketch', 'shared-styles-no-unused');
expect(violations).toHaveLength(1);
expect(ruleErrors).toHaveLength(0);
}));