stylelint-itcss
Version:
A stylelint plugin to help with itcss architecture
73 lines • 2.9 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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("../index");
const ava_1 = require("ava");
const stylelint = require("stylelint");
function ruleConfig(config = [true]) {
return {
plugins: ["./dist/src"],
rules: {
[index_1.ruleName]: config,
}
};
}
ava_1.default.serial(`${index_1.ruleName} - inline code - OK`, (t) => __awaiter(void 0, void 0, void 0, function* () {
const options = {
code: `
body {
color: blue;
margin: auto;
}
`,
config: ruleConfig()
};
const output = yield stylelint.lint(options);
t.falsy(output.errored);
}));
ava_1.default.serial(`${index_1.ruleName} - inline code - KO`, (t) => __awaiter(void 0, void 0, void 0, function* () {
const options = {
code: `
body {
--color: blue;
margin: auto;
}
`,
config: ruleConfig(),
};
const output = yield stylelint.lint(options);
t.true(output.errored);
}));
ava_1.default.serial(`${index_1.ruleName} - layers options - ok`, (t) => __awaiter(void 0, void 0, void 0, function* () {
const options = {
files: ["**/no-variable-declaration/__tests__/fixtures/_layer.style.css"],
config: ruleConfig([true, { ignoreLayers: ["layer"] }]),
};
const output = yield stylelint.lint(options);
t.false(output.errored);
}));
ava_1.default.serial(`${index_1.ruleName} - layers options - ko`, (t) => __awaiter(void 0, void 0, void 0, function* () {
const options = {
files: ["**/no-variable-declaration/__tests__/fixtures/style.css"],
config: ruleConfig([true, { ignoreLayers: ["layer"] }]),
};
const output = yield stylelint.lint(options);
t.true(output.errored);
}));
ava_1.default.serial(`${index_1.ruleName} - ignoreVariables options - ok`, (t) => __awaiter(void 0, void 0, void 0, function* () {
const options = {
files: ["**/no-variable-declaration/__tests__/fixtures/style.css"],
config: ruleConfig([true, { ignoreVariables: ["--var"] }]),
};
const output = yield stylelint.lint(options);
t.false(output.errored);
}));
//# sourceMappingURL=index.js.map