New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

markuplint

Package Overview
Dependencies
Maintainers
1
Versions
294
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markuplint - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

6

bin/index.js

@@ -38,4 +38,4 @@ #!/usr/bin/env node

for (const filePath of cli.input) {
const reports = await verifyFile(filePath, cli.flags.ruleset);
await standardReporter(filePath, reports);
const { html, reports } = await verifyFile(filePath, cli.flags.ruleset);
await standardReporter(filePath, reports, html);
}

@@ -59,3 +59,3 @@ console.log(`🎉 markuplint CLI done.`);

const reports = await verify(html, ruleset, rules);
await standardReporter('STDIN_DATA', reports);
await standardReporter('STDIN_DATA', reports, html);
});

@@ -62,0 +62,0 @@ }

import Rule, { VerifiedResult } from './rule';
import { Ruleset } from './ruleset';
export declare function verify(html: string, ruleset: Ruleset, rules: Rule[]): Promise<VerifiedResult[]>;
export declare function verifyFile(filePath: string, ruleset?: Ruleset, rules?: Rule[]): Promise<VerifiedResult[]>;
export declare function verifyFile(filePath: string, ruleset?: Ruleset, rules?: Rule[]): Promise<{
html: string;
reports: VerifiedResult[];
}>;

@@ -32,5 +32,9 @@ "use strict";

const html = yield readFile(filePath, 'utf-8');
return markuplint.verify(html, ruleset, rules);
const reports = markuplint.verify(html, ruleset, rules);
return {
html,
reports,
};
});
}
exports.verifyFile = verifyFile;
import { VerifiedResult } from '../rule';
export declare function standardReporter(targetPath: string, results: VerifiedResult[]): Promise<void>;
export declare function standardReporter(targetPath: string, results: VerifiedResult[], rawSource: string): Promise<void>;
export declare function simpleReporter(targetPath: string, results: VerifiedResult[], rawSource: string): Promise<void>;
"use strict";
// tslint:disable:no-magic-numbers
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -11,15 +12,51 @@ return new (P || (P = Promise))(function (resolve, reject) {

Object.defineProperty(exports, "__esModule", { value: true });
function standardReporter(targetPath, results) {
const c = require("cli-color");
function standardReporter(targetPath, results, rawSource) {
return __awaiter(this, void 0, void 0, function* () {
const out = [];
const loggerError = c.red;
const loggerWarning = c.xterm(208);
if (results.length) {
console.log(`❌ : ${targetPath} [markuplint]`);
const lines = rawSource.split(/\r?\n/g);
for (const result of results) {
console.warn(`\t${targetPath}:${result.line}:${result.col} ${result.message} [markuplint]`);
const prev = lines[result.line - 2] || '';
const line = lines[result.line - 1] || '';
const next = lines[result.line - 0] || '';
const before = line.substring(0, result.col);
const after = line.substring(result.col + result.raw.length);
const logger = result.level === 'error' ? loggerError : loggerWarning;
out.push(`${logger(`markuplint ${result.level}: ${result.message} [${targetPath}:${result.line}:${result.col}]`)}
${c.cyan(result.line - 1).padStart(5)}: ${space(prev)}
${c.cyan(result.line).padStart(5)}: ${space(before)}${c.bgRed(result.raw)}${space(after)}
${c.cyan(result.line + 1).padStart(5)}: ${space(next)}
`);
}
}
else {
console.log(`✅ : ${targetPath} [markuplint]`);
out.push(`${c.green('markuplint passed')} [${targetPath}]`);
}
process.stdout.write(`${out.join('\n')}\n`);
});
}
exports.standardReporter = standardReporter;
function simpleReporter(targetPath, results, rawSource) {
return __awaiter(this, void 0, void 0, function* () {
const out = [];
if (results.length) {
out.push(`❌ : ${targetPath} [markuplint]`);
for (const result of results) {
out.push(`\t${targetPath}:${result.line}:${result.col} ${result.message} [markuplint]`);
}
}
else {
out.push(`✅ : ${targetPath} [markuplint]`);
}
process.stdout.write(`${out.join('\n')}\n`);
});
}
exports.simpleReporter = simpleReporter;
function space(str) {
return str.replace(/\s+/g, ($0) => {
return c.xterm(8)($0);
}).replace(/ /g, ($0) => `•`).replace(/\t/g, ($0) => `→ `);
}
{
"name": "markuplint",
"version": "0.3.0",
"version": "0.4.0",
"description": "HTML linter for legacy/modern HTML, Web Components, SVG, MathML, AMP HTML and more.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"bin": {

@@ -23,2 +24,3 @@ "markuplint": "bin/index.js"

"dependencies": {
"cli-color": "^1.2.0",
"meow": "^4.0.0",

@@ -28,2 +30,3 @@ "parse5": "^3.0.3"

"devDependencies": {
"@types/cli-color": "^0.3.29",
"@types/meow": "^3.6.2",

@@ -30,0 +33,0 @@ "ava": "^0.24.0",

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