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
297
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

to
4.0.0-dev.12

2

lib/api/ml-engine.js

@@ -84,3 +84,3 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {

const sourceCode = await __classPrivateFieldGet(this, _MLEngine_file, "f").getCode();
const fixedCode = core.document.toString();
const fixedCode = core.document.toString(true);
if (violations instanceof Error) {

@@ -87,0 +87,0 @@ this.emit('lint-error', __classPrivateFieldGet(this, _MLEngine_file, "f").path, sourceCode, violations);

import type { ReadonlyDeep } from 'type-fest';
export declare const help = "\nUsage\n\t$ markuplint <HTML file paths (glob format)>\n\t$ <stdout> | markuplint\n\nOptions\n\t--config, -c FILE_PATH A configuration file path.\n\t--fix, Fix HTML.\n\t--format, -f FORMAT Output format. Support \"JSON\", \"Simple\", \"GitHub\" and \"Standard\". Default: \"Standard\".\n\t--no-search-config No search a configure file automatically.\n\t--ignore-ext Evaluate files that are received even though the type of extension.\n\t--no-import-preset-rules No import preset rules.\n\t--locale Locale of the message of violation. Default is an OS setting.\n\t--no-color, Output no color.\n\t--problem-only, -p Output only problems, without passeds.\n\t--allow-warnings Return status code 0 even if there are warnings.\n\t--allow-empty-input Return status code 1 even if there are no input files.\n\t--verbose Output with detailed information.\n\t--include-node-modules Include files in node_modules directory. Default: false.\n\n\t--init Initialize settings interactively.\n\t--create-rule Add the scaffold of a custom rule.\n\t--search Search lines of codes that include the target element by selectors.\n\n\t--help, -h Show help.\n\t--version, -v Show version.\n\nExamples\n\t$ markuplint verifyee.html --config path/to/.markuplintrc\n\t$ cat verifyee.html | markuplint\n";
export declare const help = "\nUsage\n\t$ markuplint <HTML file paths (glob format)>\n\t$ <stdout> | markuplint\n\nOptions\n\t--config, -c FILE_PATH A configuration file path.\n\t--fix, Fix HTML.\n\t--format, -f FORMAT Output format. Support \"JSON\", \"Simple\", \"GitHub\" and \"Standard\". Default: \"Standard\".\n\t--no-search-config No search a configure file automatically.\n\t--ignore-ext Evaluate files that are received even though the type of extension.\n\t--no-import-preset-rules No import preset rules.\n\t--locale Locale of the message of violation. Default is an OS setting.\n\t--no-color, Output no color.\n\t--problem-only, -p Output only problems, without passeds.\n\t--allow-warnings Return status code 0 even if there are warnings.\n\t--allow-empty-input Return status code 1 even if there are no input files.\n\t--verbose Output with detailed information.\n\t--include-node-modules Include files in node_modules directory. Default: false.\n\n\t--init Initialize settings interactively.\n\t--search Search lines of codes that include the target element by selectors.\n\n\t--help, -h Show help.\n\t--version, -v Show version.\n\nExamples\n\t$ markuplint verifyee.html --config path/to/.markuplintrc\n\t$ cat verifyee.html | markuplint\n";
export declare const cli: import("meow").Result<{

@@ -4,0 +4,0 @@ config: {

@@ -23,3 +23,2 @@ import meow from 'meow';

--init Initialize settings interactively.
--create-rule Add the scaffold of a custom rule.
--search Search lines of codes that include the target element by selectors.

@@ -26,0 +25,0 @@

@@ -53,15 +53,12 @@ import { promises as fs } from 'node:fs';

await fs.writeFile(result.filePath, result.fixedCode, { encoding: 'utf8' });
process.stdout.write(`markuplint: Fix "${result.filePath}"\n`);
}
else {
if (format === 'json') {
jsonOutput.push(...result.violations.map(v => ({
...v,
filePath: result.filePath,
})));
continue;
}
log('Output reports');
output(result, options);
if (format === 'json') {
jsonOutput.push(...result.violations.map(v => ({
...v,
filePath: result.filePath,
})));
continue;
}
log('Output reports');
output(result, options);
}

@@ -68,0 +65,0 @@ if (format === 'json') {

@@ -5,2 +5,3 @@ const extRExp = {

svelte: '\\.svelte$',
sveltekit: '\\.html$',
astro: '\\.astro$',

@@ -20,2 +21,3 @@ pug: '\\.pug$',

svelte: 'Svelte',
sveltekit: 'SvelteKit',
astro: 'Astro',

@@ -39,3 +41,11 @@ pug: 'Pug',

}
parser[ext] = `@markuplint/${lang}-parser`;
switch (lang) {
case 'sveltekit': {
parser[ext] = '@markuplint/svelte-parser/kit';
break;
}
default: {
parser[ext] = `@markuplint/${lang}-parser`;
}
}
if (lang === 'vue') {

@@ -42,0 +52,0 @@ config = {

@@ -1,3 +0,3 @@

export declare function getDefaultRules(version: string): Promise<{
export declare function getDefaultRules(): {
[x: string]: import("./types.js").Rule;
}>;
};

@@ -1,52 +0,16 @@

import matter from 'gray-matter';
import fetch from 'node-fetch';
const RULES_SCHEMA_URL = 'https://raw.githubusercontent.com/markuplint/markuplint/[VERSION]/packages/@markuplint/rules/schema.json';
const RULES_README_URL = 'https://raw.githubusercontent.com/markuplint/markuplint/[VERSION]/packages/@markuplint/rules/src/[NAME]/README.md';
export async function getDefaultRules(version) {
const json = await safeFetch(RULES_SCHEMA_URL, version);
import builtinRules from '@markuplint/rules';
export function getDefaultRules() {
const rules = {};
await Promise.all(Object.entries(json.definitions.rules.properties).map(async ([name, rule]) => {
const json = await safeFetch(rule.$ref.replace('/main/', '/[VERSION]/'), version);
let severity = (Array.isArray(json.oneOf) ? json.oneOf : []).find((val) => val.properties)?.properties
?.severity?.default;
let category = json._category;
if (severity == null || category == null) {
const data = await getCatAndSeverityFromLegacy(version, name);
severity = data.severity;
category = data.category;
for (const [ruleName, rule] of Object.entries(builtinRules)) {
const defaultSeverity = rule.defaultSeverity;
const defaultValue = defaultSeverity === 'warning' ? false : rule.defaultValue ?? true;
const category = rule.meta?.category;
if (category) {
rules[ruleName] = {
defaultValue,
category,
};
}
const defaultValue = severity === 'warning' ? false : json.definitions.value.default ?? true;
rules[name] = {
defaultValue,
category,
};
}));
}
return rules;
}
async function safeFetch(baseUrl, version, type = 'json') {
const url = baseUrl.replace('[VERSION]', `v${version}`);
const res = await fetch(url);
if (!res.ok) {
return safeFetch(baseUrl, '3.0.0', type);
}
if (type === 'json') {
return (await res.json());
}
const md = await res.text();
const { data } = matter(md);
return data;
}
/**
* Fallback fetching until 3.0.x
*
* @param version
* @param name
* @returns
*/
async function getCatAndSeverityFromLegacy(version, name) {
const data = await safeFetch(RULES_README_URL.replace('[NAME]', name), version, 'md');
return {
category: data.category,
severity: data.severity,
};
}
import fs from 'node:fs/promises';
import module from 'node:module';
import path from 'node:path';

@@ -8,3 +7,2 @@ import { installModule, multiSelect, confirm, confirmSequence, header } from '@markuplint/cli-utils';

import { selectModules } from './select-modules.js';
const require = module.createRequire(import.meta.url);
const ruleCategories = {

@@ -56,4 +54,3 @@ validation: {

if (ruleSettingMode !== 'recommended') {
const rulesVersion = require('../../../package.json').version;
defaultRules = await getDefaultRules(rulesVersion);
defaultRules = getDefaultRules();
}

@@ -60,0 +57,0 @@ const config = createConfig(selectedLangs, ruleSettingMode, defaultRules);

@@ -1,2 +0,3 @@

export type Langs = 'jsx' | 'vue' | 'svelte' | 'astro' | 'pug' | 'php' | 'smarty' | 'erb' | 'ejs' | 'mustache' | 'nunjucks' | 'liquid';
import type { RuleConfigValue } from '@markuplint/ml-config';
export type Langs = 'jsx' | 'vue' | 'svelte' | 'sveltekit' | 'astro' | 'pug' | 'php' | 'smarty' | 'erb' | 'ejs' | 'mustache' | 'nunjucks' | 'liquid';
export type Category = 'validation' | 'a11y' | 'naming-convention' | 'style' | 'maintainability';

@@ -7,3 +8,3 @@ export type RuleSettingMode = readonly Category[] | 'recommended' | 'none';

readonly category: Category;
readonly defaultValue: boolean | string | number;
readonly defaultValue: RuleConfigValue;
};
{
"name": "markuplint",
"version": "4.0.0-dev.10+b28398ab",
"version": "4.0.0-dev.12+2275fbeb0",
"description": "An HTML linter for all markup developers",

@@ -28,13 +28,13 @@ "author": "Yusuke Hirao",

"dependencies": {
"@markuplint/cli-utils": "4.0.0-dev.3823+b28398ab",
"@markuplint/file-resolver": "4.0.0-dev.10+b28398ab",
"@markuplint/html-parser": "4.0.0-dev.10+b28398ab",
"@markuplint/html-spec": "4.0.0-dev.10+b28398ab",
"@markuplint/i18n": "4.0.0-dev.10+b28398ab",
"@markuplint/ml-ast": "4.0.0-dev.10+b28398ab",
"@markuplint/ml-config": "4.0.0-dev.10+b28398ab",
"@markuplint/ml-core": "4.0.0-dev.10+b28398ab",
"@markuplint/ml-spec": "4.0.0-dev.10+b28398ab",
"@markuplint/rules": "4.0.0-dev.10+b28398ab",
"@markuplint/shared": "4.0.0-dev.10+b28398ab",
"@markuplint/cli-utils": "4.0.0-dev.12+2275fbeb0",
"@markuplint/file-resolver": "4.0.0-dev.12+2275fbeb0",
"@markuplint/html-parser": "4.0.0-dev.12+2275fbeb0",
"@markuplint/html-spec": "4.0.0-dev.12+2275fbeb0",
"@markuplint/i18n": "4.0.0-dev.12+2275fbeb0",
"@markuplint/ml-ast": "4.0.0-dev.12+2275fbeb0",
"@markuplint/ml-config": "4.0.0-dev.12+2275fbeb0",
"@markuplint/ml-core": "4.0.0-dev.12+2275fbeb0",
"@markuplint/ml-spec": "4.0.0-dev.12+2275fbeb0",
"@markuplint/rules": "4.0.0-dev.12+2275fbeb0",
"@markuplint/shared": "4.0.0-dev.12+2275fbeb0",
"@types/debug": "^4.1.12",

@@ -44,11 +44,9 @@ "chokidar": "^3.5.3",

"get-stdin": "^9.0.0",
"gray-matter": "^4.0.3",
"meow": "^12.1.1",
"node-fetch": "^3.3.2",
"meow": "^13.1.0",
"os-locale": "^6.0.2",
"strict-event-emitter": "^0.5.1",
"strip-ansi": "^7.1.0",
"type-fest": "^4.8.3"
"type-fest": "^4.9.0"
},
"gitHead": "b28398ab9c8f0ad790f2915ad5da8f3a80e9b8d6"
"gitHead": "2275fbeb053605b636f080f4fafd7cd4fc57a9a3"
}

@@ -89,3 +89,2 @@ # ![markuplint](https://cdn.jsdelivr.net/gh/markuplint/markuplint@main/media/logo-v.svg)

--init Initialize settings interactively.
--create-rule Add the scaffold of a custom rule.

@@ -130,2 +129,4 @@ --help, -h Show help.

[<img width="36" src="https://avatars.githubusercontent.com/u/802921" alt="Hideyuki Saito" />](https://github.com/hideyukisaito)
[<img width="36" src="https://avatars.githubusercontent.com/u/3056064" alt="tamshow" />](https://github.com/tamshow)
[<img width="36" src="https://avatars.githubusercontent.com/u/91047157" alt="shamokit" />](https://github.com/shamokit)

@@ -132,0 +133,0 @@ ## Thanks

Sorry, the diff of this file is not supported yet