@linthtml/core
Advanced tools
Comparing version 0.10.0-beta.6 to 0.10.0-beta.7
{ | ||
"name": "@linthtml/core", | ||
"version": "0.10.0-beta.6", | ||
"version": "0.10.0-beta.7", | ||
"description": "LintHTML core package", | ||
@@ -55,4 +55,4 @@ "author": "BenjaminJ <kamikillerto@gmail.com>", | ||
"dependencies": { | ||
"@linthtml/dom-utils": "^0.10.0-beta.6", | ||
"@linthtml/html-parser": "^0.10.0-beta.6", | ||
"@linthtml/dom-utils": "^0.10.0-beta.7", | ||
"@linthtml/html-parser": "^0.10.0-beta.7", | ||
"bulk-require": "1.0.1", | ||
@@ -62,3 +62,3 @@ "cosmiconfig": "^8.0.0", | ||
"globby": "^13.0.0", | ||
"ignore": "^5.2.4", | ||
"ignore": "^5.3.1", | ||
"lodash.pull": "4.1.0", | ||
@@ -76,5 +76,5 @@ "resolve-from": "^5.0.0" | ||
}, | ||
"gitHead": "1500ccd38457cbf97dee37a5d5cbc245be9dc620", | ||
"gitHead": "7d84c2b72609c835e825ce2678adcbf6c623c40d", | ||
"module": "./src/index.js", | ||
"main": "./src/index.js" | ||
} |
@@ -1,2 +0,2 @@ | ||
import { ActiveRuleDefinition, LegacyLinterConfig, LegacyRuleDefinition, LinterConfig, RuleConfig, RuleDefinition } from "./read-config.js"; | ||
import type { ActiveRuleDefinition, LegacyLinterConfig, LegacyRuleDefinition, LinterConfig, RuleConfig, RuleDefinition } from "./read-config.js"; | ||
export declare class NonExistingRule extends Error { | ||
@@ -3,0 +3,0 @@ rule_name: string; |
@@ -52,2 +52,3 @@ export class NonExistingRule extends Error { | ||
} | ||
// isArray return "arr is any[]" | ||
const ruleConfig = config[1]; | ||
@@ -57,3 +58,4 @@ return ruleConfig; | ||
function generate_rules_from_options(rule) { | ||
return rule.options.reduce((rules, option) => { | ||
var _a; | ||
return ((_a = rule.options) !== null && _a !== void 0 ? _a : []).reduce((rules, option) => { | ||
if (option.name) { | ||
@@ -60,0 +62,0 @@ rules[option.name] = { |
@@ -5,3 +5,3 @@ import { config_from_path, find_local_config, LegacyLinterConfig, LinterConfig } from "./read-config.js"; | ||
import * as messages from "./messages.js"; | ||
import Issue from "./issue.js"; | ||
import type Issue from "./issue.js"; | ||
export interface FileLinter { | ||
@@ -8,0 +8,0 @@ file_path: string; |
@@ -52,2 +52,3 @@ import { config_from_path, find_local_config } from "./read-config.js"; | ||
} | ||
// Eslint not correctly getting types for ignorer here | ||
const ignorer = ignore().add(ignore_pattern); | ||
@@ -71,2 +72,3 @@ return ignorer.filter(file_paths); | ||
} | ||
// Eslint not correctly getting types for ignorer here | ||
const ignorer = ignore().add(ignore_pattern); | ||
@@ -73,0 +75,0 @@ return ignorer.ignores(file_path); |
@@ -1,4 +0,4 @@ | ||
import { Node } from "@linthtml/dom-utils/dom_elements"; | ||
import Config from "./config.js"; | ||
import { reportFunction } from "./read-config.js"; | ||
import type { Node } from "@linthtml/dom-utils/dom_elements"; | ||
import type Config from "./config.js"; | ||
import type { reportFunction } from "./read-config.js"; | ||
export interface InlineInstructionConfig { | ||
@@ -5,0 +5,0 @@ config?: unknown; |
@@ -74,3 +74,5 @@ import { is_comment_node } from "@linthtml/dom-utils"; | ||
try { | ||
rule_configuration = rule.configTransform ? rule.configTransform(rule_configuration) : rule_configuration; | ||
rule_configuration = rule.configTransform | ||
? rule.configTransform(rule_configuration) | ||
: rule_configuration; | ||
if (rule.validateConfig) { | ||
@@ -77,0 +79,0 @@ rule.validateConfig(rule_configuration); |
@@ -1,2 +0,2 @@ | ||
import { Range } from "@linthtml/dom-utils/dom_elements"; | ||
import type { Range } from "@linthtml/dom-utils/dom_elements"; | ||
export default class Issue { | ||
@@ -3,0 +3,0 @@ code: string; |
@@ -1,2 +0,2 @@ | ||
import { LegacyRuleDefinition, LegacyRuleOption } from "../read-config.js"; | ||
import type { LegacyRuleDefinition, LegacyRuleOption } from "../read-config.js"; | ||
/** | ||
@@ -3,0 +3,0 @@ * The config object stores all possible rules and options and manages |
@@ -36,2 +36,3 @@ import { is_boolean } from "../validate_option.js"; | ||
addRule(rule) { | ||
var _a; | ||
if (["free-options", "dom"].indexOf(rule.name) === -1) { | ||
@@ -46,3 +47,3 @@ rule.on = "dom"; | ||
this.rulesMap[rule.name] = rule; | ||
if (oldRule === null || oldRule === void 0 ? void 0 : oldRule.subscribers.length) { | ||
if ((_a = oldRule === null || oldRule === void 0 ? void 0 : oldRule.subscribers) === null || _a === void 0 ? void 0 : _a.length) { | ||
this.deactivateRule(oldRule); | ||
@@ -163,5 +164,6 @@ this.activateRule(rule); | ||
setOptionObj(option, value) { | ||
var _a; | ||
const active = value !== false && value !== undefined; | ||
if (active !== option.active) { | ||
this.onAllSubs(option, option.rules, (active ? this.addSubscriber : this.removeSubscriber).bind(this)); | ||
this.onAllSubs(option, (_a = option.rules) !== null && _a !== void 0 ? _a : [], active ? this.addSubscriber.bind(this) : this.removeSubscriber.bind(this)); | ||
option.active = active; | ||
@@ -183,6 +185,7 @@ } | ||
addSubscriber(rule, sub) { | ||
if (!rule.subscribers.length) { | ||
var _a, _b; | ||
if (!((_a = rule.subscribers) === null || _a === void 0 ? void 0 : _a.length)) { | ||
this.activateRule(rule); | ||
} | ||
rule.subscribers.push(sub); | ||
(_b = rule.subscribers) === null || _b === void 0 ? void 0 : _b.push(sub); | ||
} | ||
@@ -195,4 +198,5 @@ deactivateRule(rule) { | ||
removeSubscriber(rule, sub) { | ||
var _a; | ||
// I've try replacing pull with array.filter but it's not working | ||
if (!pull(rule.subscribers, sub).length) { | ||
if (!pull((_a = rule.subscribers) !== null && _a !== void 0 ? _a : [], sub).length) { | ||
this.deactivateRule(rule); | ||
@@ -199,0 +203,0 @@ } |
import Issue from "../issue.js"; | ||
import Config from "./config.js"; | ||
import { Comment, Range } from "@linthtml/dom-utils/dom_elements"; | ||
import type Config from "./config.js"; | ||
import type { Comment, Range } from "@linthtml/dom-utils/dom_elements"; | ||
export interface InlineConfigIndex { | ||
@@ -65,5 +65,5 @@ [key: string]: unknown; | ||
name: string; | ||
value: any; | ||
value: string | boolean | Record<string, unknown> | unknown[]; | ||
}; | ||
} | ||
//# sourceMappingURL=inline_config.d.ts.map |
@@ -71,3 +71,3 @@ import { parse_HTML_attributes } from "@linthtml/dom-utils"; | ||
.filter((x) => !!x) | ||
.forEach(this.applyConfig, this); | ||
.forEach(this.applyConfig.bind(this), this); | ||
index = newIndex; | ||
@@ -104,3 +104,3 @@ } | ||
const r = this.parsePair(pair.name, pair.value, node.loc); | ||
// @ts-ignore | ||
// @ts-expect-error Weird legacy | ||
(r.code ? issues : settings).push(r); | ||
@@ -149,3 +149,3 @@ }); | ||
if (!name || !value || !name.length || !value.length) { | ||
// @ts-ignore | ||
// @ts-expect-error Error can accept extra args | ||
throw new Error("Cannot parse inline configuration.", { pos }); | ||
@@ -152,0 +152,0 @@ } |
import Config from "./config.js"; | ||
import InlineConfig from "./inline_config.js"; | ||
import { LegacyLinterConfig, LegacyRuleDefinition } from "../read-config.js"; | ||
import { Document } from "@linthtml/dom-utils/dom_elements"; | ||
import Issue from "../issue.js"; | ||
import type { LegacyLinterConfig, LegacyRuleDefinition } from "../read-config.js"; | ||
import type { Document } from "@linthtml/dom-utils/dom_elements"; | ||
import type Issue from "../issue.js"; | ||
export default class Linter { | ||
@@ -7,0 +7,0 @@ rules: Config; |
@@ -6,3 +6,2 @@ import parse from "@linthtml/html-parser"; | ||
import { is_comment_node } from "@linthtml/dom-utils"; | ||
import { flatten } from "../utils/array.js"; | ||
/** | ||
@@ -72,3 +71,3 @@ * Apply the raw-ignore-regex option. | ||
}); | ||
return flatten(rules); | ||
return rules.flat(); | ||
} | ||
@@ -75,0 +74,0 @@ setupInlineConfigs(dom) { |
import Config from "./config.js"; | ||
import Issue from "./issue.js"; | ||
import { LinterConfig } from "./read-config.js"; | ||
import type { LinterConfig } from "./read-config.js"; | ||
export default class Linter { | ||
@@ -5,0 +5,0 @@ private get_parse_fn; |
@@ -7,3 +7,2 @@ import Config from "./config.js"; | ||
import { get_module_path } from "./read-config.js"; | ||
import { flatten } from "./utils/array.js"; | ||
/** | ||
@@ -46,10 +45,11 @@ * Apply the raw-ignore-regex option. | ||
const parser_module = get_module_path(process.cwd(), config.parser); | ||
return import(parser_module).then((parser) => { var _a; return (_a = parser.default) !== null && _a !== void 0 ? _a : parser; }); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
return import(parser_module).then((parser) => { var _a; return ((_a = parser.default) !== null && _a !== void 0 ? _a : parser); }); | ||
} | ||
catch (error) { | ||
// @ts-expect-error system error with meta object | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access | ||
throw new CustomError("CORE-04", { module_name: error.meta.module_name }); | ||
} | ||
} | ||
// TODO: Switch to import | ||
// Eslint Typescript recommend using import statement but import return a promise. | ||
@@ -111,3 +111,3 @@ /* eslint-disable-next-line @typescript-eslint/no-var-requires */ | ||
}); | ||
return [...issues, ...flatten(rules_issues)]; | ||
return [...issues, ...rules_issues.flat()]; | ||
} | ||
@@ -114,0 +114,0 @@ // TODO: Remove after v1 |
@@ -1,2 +0,2 @@ | ||
import type { Range } from "@linthtml/dom-utils/dom_elements"; | ||
import type { CharValue, Range } from "@linthtml/dom-utils/dom_elements"; | ||
import type Issue from "./issue.js"; | ||
@@ -6,4 +6,171 @@ export declare const CORE_ERRORS: { | ||
}; | ||
export declare const errors: { | ||
[code: string]: (meta: Record<string, unknown>, position: Range) => string; | ||
export declare const ISSUE_ERRORS: { | ||
readonly E000: () => string; | ||
readonly E001: (data: { | ||
attribute: string; | ||
}) => string; | ||
readonly E002: (data: { | ||
format: string; | ||
attribute: string; | ||
}) => string; | ||
readonly E003: (data: { | ||
attribute: string; | ||
}) => string; | ||
readonly E004: (data: { | ||
attribute: string; | ||
}) => string; | ||
readonly E005: (data: { | ||
attribute: string; | ||
format: string; | ||
}) => string; | ||
readonly E006: (data: { | ||
attribute: string; | ||
}) => string; | ||
readonly E007: () => string; | ||
readonly E008: () => string; | ||
readonly E009: (data: { | ||
format: string; | ||
}) => string; | ||
readonly E010: (data: { | ||
attribute: string; | ||
word: string; | ||
}) => string; | ||
readonly E011: (data: { | ||
value: string; | ||
format: string; | ||
attribute: string; | ||
}) => string; | ||
readonly E012: (data: { | ||
id: string; | ||
line: number; | ||
column: number; | ||
}) => string; | ||
readonly E013: () => string; | ||
readonly E014: () => string; | ||
readonly E015: (data: { | ||
format: string; | ||
}) => string; | ||
readonly E016: (data: { | ||
tag: string; | ||
}) => string; | ||
readonly E017: (data: { | ||
name: string; | ||
}) => string; | ||
readonly E018: (data: { | ||
expect: "always" | "never"; | ||
}) => string; | ||
readonly E019: () => string; | ||
readonly E020: () => string; | ||
readonly E021: (data: { | ||
id: string; | ||
}) => string; | ||
readonly E022: (data: { | ||
id: string; | ||
}) => string; | ||
readonly E023: (data: { | ||
part: string; | ||
desc: string; | ||
chars: string; | ||
}) => string; | ||
readonly E024: (data: { | ||
tagName: string; | ||
expected_indentation: number; | ||
expected_type: "spaces" | "tabs" | "mixed"; | ||
current_indentation: number; | ||
current_type: "spaces" | "tabs" | "mixed"; | ||
}, { start }: Range) => string; | ||
readonly E025: () => string; | ||
readonly E026: (data: { | ||
tabindex: number; | ||
}) => string; | ||
readonly E027: () => string; | ||
readonly E028: (data: { | ||
num: number; | ||
}) => string; | ||
readonly E029: (data: { | ||
title: string; | ||
max_length: number; | ||
}) => string; | ||
readonly E030: (data: { | ||
open: CharValue; | ||
}) => string; | ||
readonly E031: () => string; | ||
readonly E032: () => string; | ||
readonly E033: (data: { | ||
idValue: string; | ||
}) => string; | ||
readonly E034: () => string; | ||
readonly E035: () => string; | ||
readonly E036: (data: { | ||
isClose: boolean; | ||
tagName: string; | ||
expected_indentation: number; | ||
current_indentation: number; | ||
}, { start }: Range) => string; | ||
readonly E037: (data: { | ||
limit: string; | ||
}) => string; | ||
readonly E038: (data: { | ||
lang: string; | ||
}) => string; | ||
readonly E039: (data: { | ||
lang: string; | ||
}) => string; | ||
readonly E040: (data: { | ||
length: number; | ||
maxlength: number; | ||
}) => string; | ||
readonly E041: (data: { | ||
classes: string; | ||
}) => string; | ||
readonly E042: () => string; | ||
readonly E043: (data: { | ||
attribute: string; | ||
previous: string; | ||
}) => string; | ||
readonly E044: () => string; | ||
readonly E045: () => string; | ||
readonly E046: () => string; | ||
readonly E047: () => string; | ||
readonly E049: () => string; | ||
readonly E051: (data: { | ||
name: string; | ||
}) => string; | ||
readonly E052: (data: { | ||
preset: string; | ||
}) => string; | ||
readonly E055: () => string; | ||
readonly E056: (data: { | ||
expectedMin: number; | ||
expectedMax: number; | ||
value: string; | ||
}) => string; | ||
readonly E057: (data: { | ||
attribute: string; | ||
tag: string; | ||
}) => string; | ||
readonly E058: () => string; | ||
readonly E059: (data: { | ||
content: string; | ||
}) => string; | ||
readonly E060: () => string; | ||
readonly E061: () => string; | ||
readonly E062: () => string; | ||
readonly E063: () => string; | ||
readonly E064: (data: { | ||
is_before: boolean; | ||
}) => string; | ||
readonly INLINE_01: (data: { | ||
instruction: string; | ||
}) => string; | ||
readonly INLINE_02: (data: { | ||
rule_name: string; | ||
}) => string; | ||
readonly INLINE_03: (data: { | ||
rule_configuration: string; | ||
}) => string; | ||
readonly INLINE_04: (data: { | ||
rule_name: string; | ||
error: string; | ||
}) => string; | ||
}; | ||
@@ -10,0 +177,0 @@ export declare function renderIssue(issue: Issue): string; |
@@ -12,17 +12,17 @@ import chalkTemplate from "chalk-template"; | ||
"09": () => chalkTemplate `{red Error:} Plugins should expose rules under the property "rules" and as an array.`, | ||
"10": (meta) => chalkTemplate `{red Error:} Plugin ${meta === null || meta === void 0 ? void 0 : meta.plugin_name} is using cjs require() to import esm code, use cjs import() or migrate plugin to esm instead` | ||
"10": (meta) => chalkTemplate `{red Error:} Cannot resolve plugin ${meta === null || meta === void 0 ? void 0 : meta.module_name}. NodeJS reported the following error.\n${meta === null || meta === void 0 ? void 0 : meta.message}` | ||
}; | ||
// TODO: add the possibility to use chalk ? | ||
export const errors = { | ||
export const ISSUE_ERRORS = { | ||
E000: ( /* data */) => "not a valid error code", | ||
E001: (data) => `The attribute "${data.attribute}" attribute is cannot be used as it's banned`, | ||
E002: ({ format, attribute }) => `The attribute "${attribute}" must be written using the format "${format}"`, | ||
E002: (data) => `The attribute "${data.attribute}" must be written using the format "${data.format}"`, | ||
E003: (data) => `The attribute ${data.attribute} is duplicated`, | ||
E004: ({ attribute }) => `The value of the attribute "${attribute}" contains unsafe characters`, | ||
E004: (data) => `The value of the attribute "${data.attribute}" contains unsafe characters`, | ||
E005: (data) => `The attribute "${data.attribute}" is not ${data.format}`, | ||
E006: ({ attribute }) => `The attribute "${attribute}" requires a value`, | ||
E006: (data) => `The attribute "${data.attribute}" requires a value`, | ||
E007: ( /* data */) => "The first element of the document should be <!DOCTYPE>", | ||
E008: ( /* data */) => "The doctype must conform to the HTML5 standard", | ||
E009: (data) => `Invalid href for link, only ${data.format} links are allowed`, | ||
E010: ({ attribute, word }) => `The value of attribute "${attribute}" contains the word "${word}" which is not allowed`, | ||
E010: (data) => `The value of attribute "${data.attribute}" contains the word "${data.word}" which is not allowed`, | ||
E011: (data) => `The value "${data.value}" of attribute "${data.attribute}" does not respect the format: ${data.format}`, | ||
@@ -48,4 +48,4 @@ E012: (data) => `The id "${data.id}" is already used at L${data.line}:c${data.column}`, | ||
E028: (data) => `The <head> tag can only contain one title: ${data.num} given`, | ||
E029: (data) => `Title "${data.title}" exceeds maximum length of ${data.maxlength}`, | ||
E030: ({ open }) => `Tag close does not match opened tag at C${open.loc.start.line}:L${open.loc.start.column}`, | ||
E029: (data) => `Title "${data.title}" exceeds maximum length of ${data.max_length}`, | ||
E030: (data) => `Tag close does not match opened tag at C${data.open.loc.start.line}:L${data.open.loc.start.column}`, | ||
E031: ( /* data */) => "Table must have captions (<caption>) for accessibility", | ||
@@ -72,4 +72,4 @@ E032: ( /* data */) => "Tag <figure> must contains a <figcaption> tag for accessibility", | ||
E049: ( /* data */) => "The tag attributes are malformed", | ||
E051: ({ name }) => `unrecognized rule name or preset \`${name}\` in linthtml-configure instruction`, | ||
E052: ({ preset }) => `unrecognized preset name \`${preset}\` in linthtml-configure instruction `, | ||
E051: (data) => `unrecognized rule name or preset \`${data.name}\` in linthtml-configure instruction`, | ||
E052: (data) => `unrecognized preset name \`${data.preset}\` in linthtml-configure instruction `, | ||
E055: ( /* data */) => "Line contains trailing whitespace", | ||
@@ -79,3 +79,3 @@ E056: (data) => `Expected from ${data.expectedMin} to ${data.expectedMax} levels of indentation. ${data.value} levels instead`, | ||
E058: ( /* data */) => 'Links should with `target="blank"` should define `rel="noopener"`', | ||
E059: ({ content }) => `Link text should have at least 4 chars, current text "${content}" has a length of ${content.length}`, | ||
E059: (data) => `Link text should have at least 4 chars, current text "${data.content}" has a length of ${data.content.length}`, | ||
E060: ( /* data */) => 'Input elements with type "button", "submit" and "reset" must have a value or title attribute.', | ||
@@ -86,6 +86,6 @@ E061: ( /* data */) => "Each button element must have a text content.", | ||
E064: (data) => `Unexpected space ${data.is_before ? "before" : "after"} text.`, | ||
INLINE_01: ({ instruction }) => `unrecognized linthtml instruction: \`linthtml-${instruction}\``, | ||
INLINE_02: ({ rule_name }) => `unrecognized rule name \`${rule_name}\` in inline configuration`, | ||
INLINE_03: ({ rule_configuration }) => `malformed linthtml-configure instruction: \`${rule_configuration}\` is not valid JSON global`, | ||
INLINE_04: ({ rule_name, error }) => `linthtml-configure instruction for rule \`${rule_name}\` is not valid. ${error}` | ||
INLINE_01: (data) => `unrecognized linthtml instruction: \`linthtml-${data.instruction}\``, | ||
INLINE_02: (data) => `unrecognized rule name \`${data.rule_name}\` in inline configuration`, | ||
INLINE_03: (data) => `malformed linthtml-configure instruction: \`${data.rule_configuration}\` is not valid JSON global`, | ||
INLINE_04: (data) => `linthtml-configure instruction for rule \`${data.rule_name}\` is not valid. ${data.error}` | ||
}; | ||
@@ -98,8 +98,10 @@ // Error code INLINE-xx | ||
var _a; | ||
const format = errors[issue.code]; | ||
const format = ISSUE_ERRORS[issue.code]; | ||
// @ts-expect-error Type of data and format too complex | ||
return format ? format(issue.data, issue.position) : (_a = issue.message) !== null && _a !== void 0 ? _a : ""; | ||
} | ||
export function get_issue_message(issue) { | ||
const generate_issue_message = errors[issue.code]; | ||
const generate_issue_message = ISSUE_ERRORS[issue.code]; | ||
// @ts-expect-error Type of data and format too complex | ||
return generate_issue_message(issue.data, issue.position); | ||
} |
@@ -1,4 +0,4 @@ | ||
import { LegacyLinterConfig } from "../read-config.js"; | ||
import type { LegacyLinterConfig } from "../read-config.js"; | ||
declare const _default: LegacyLinterConfig; | ||
export default _default; | ||
//# sourceMappingURL=accessibility.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { LegacyLinterConfig } from "../read-config.js"; | ||
import type { LegacyLinterConfig } from "../read-config.js"; | ||
declare const _default: LegacyLinterConfig; | ||
export default _default; | ||
//# sourceMappingURL=default.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { LegacyLinterConfig } from "../read-config.js"; | ||
import type { LegacyLinterConfig } from "../read-config.js"; | ||
export declare const presets: { | ||
@@ -3,0 +3,0 @@ none: LegacyLinterConfig; |
@@ -1,4 +0,4 @@ | ||
import { LegacyLinterConfig } from "../read-config.js"; | ||
import type { LegacyLinterConfig } from "../read-config.js"; | ||
declare const _default: LegacyLinterConfig; | ||
export default _default; | ||
//# sourceMappingURL=validate.d.ts.map |
@@ -1,7 +0,9 @@ | ||
import Issue from "./issue.js"; | ||
import { Node, Range } from "@linthtml/dom-utils/dom_elements"; | ||
import type Issue from "./issue.js"; | ||
import type { Node, Range } from "@linthtml/dom-utils/dom_elements"; | ||
export type reportFunction = (data: { | ||
code: string; | ||
position: Range; | ||
meta?: Record<string, unknown>; | ||
meta?: { | ||
data: unknown; | ||
}; | ||
message?: string; | ||
@@ -27,3 +29,3 @@ }) => void; | ||
export type RuleActivation = boolean | RuleSeverity | "off"; | ||
export type RuleConfig = RuleActivation | [RuleActivation] | [RuleActivation, unknown]; | ||
export type RuleConfig = RuleActivation | readonly [RuleActivation] | readonly [RuleActivation, unknown]; | ||
export type LinterConfig = { | ||
@@ -53,8 +55,8 @@ extends?: string | string[]; | ||
active?: boolean; | ||
rules: string[]; | ||
rules?: string[]; | ||
}; | ||
export type LegacyRuleDefinition = RuleDefinition & { | ||
options: LegacyRuleOption[]; | ||
on: string; | ||
subscribers: LegacyRuleDefinition[]; | ||
options?: LegacyRuleOption[]; | ||
on?: string; | ||
subscribers?: LegacyRuleDefinition[]; | ||
}; | ||
@@ -68,3 +70,3 @@ export interface LegacyLinterConfig { | ||
"line-max-len-ignore-regex"?: string | RegExp | false; | ||
[rule_name: string]: boolean | unknown; | ||
[rule_name: string]: unknown; | ||
} | ||
@@ -77,5 +79,5 @@ export interface ExtractConfigResult { | ||
declare function get_module_path(basedir: string, module_name: string): string | never; | ||
declare function config_from_path(file_path: string): Promise<ExtractConfigResult | never>; | ||
declare function config_from_path(file_path: string): Promise<ExtractConfigResult> | never; | ||
declare function find_local_config(file_path: string): Promise<ExtractConfigResult | null> | never; | ||
export { config_from_path, find_local_config, get_module_path }; | ||
//# sourceMappingURL=read-config.d.ts.map |
@@ -7,3 +7,2 @@ import path from "path"; | ||
import CustomError from "./utils/custom-errors.js"; | ||
import { createRequire } from "module"; | ||
import { fileURLToPath } from "url"; | ||
@@ -99,3 +98,3 @@ const IS_TEST = process.env.NODE_ENV === "test"; | ||
}).load(extendPath); | ||
return cosmiconfig_result ? cosmiconfig_result.config : null; | ||
return cosmiconfig_result ? cosmiconfig_result.config : {}; // is {} possible? | ||
} | ||
@@ -127,17 +126,17 @@ /** | ||
function load_plugin(plugin_name) { | ||
try { | ||
// TODO: Switch to import | ||
// Eslint Typescript recommend using import statement but import return a promise. | ||
const require = createRequire(import.meta.url); | ||
const plugin_import = require(plugin_name); | ||
// const plugin_import = await import(plugin_name); | ||
// Handle either ES6 or CommonJS modules | ||
return plugin_import.default || plugin_import; | ||
} | ||
catch (error) { | ||
if (error.code === "ERR_REQUIRE_ESM") { | ||
throw new CustomError("CORE-10", { module_name: plugin_name }); | ||
return import(plugin_name) | ||
.then((plugin_import) => { | ||
var _a; | ||
return (_a = plugin_import.default) !== null && _a !== void 0 ? _a : plugin_import; | ||
}) | ||
.catch((error) => { | ||
if (error.code === "ERR_REQUIRE_ESM" || | ||
error.message.match("module is not defined in ES module scope")) { | ||
throw new CustomError("CORE-10", { | ||
module_name: plugin_name, | ||
message: error.message | ||
}); | ||
} | ||
throw new CustomError("CORE-05", { module_name: plugin_name }); | ||
} | ||
}); | ||
} | ||
@@ -149,3 +148,3 @@ /** | ||
*/ | ||
function add_plugins_rules(cosmiconfig_result) { | ||
async function add_plugins_rules(cosmiconfig_result) { | ||
if (cosmiconfig_result.config.plugins) { | ||
@@ -155,4 +154,5 @@ const normalized_plugins = Array.isArray(cosmiconfig_result.config.plugins) // throw an error if not string or array | ||
: [cosmiconfig_result.config.plugins]; | ||
const plugins_rules = normalized_plugins.reduce((plugin_rules, plugin_name) => { | ||
const { rules } = load_plugin(plugin_name); | ||
const plugins = await Promise.all(normalized_plugins.map((plugin_name) => load_plugin(plugin_name).then((pkg) => ({ plugin_name, pkg })))); | ||
const plugins_rules = plugins.reduce((plugin_rules, { plugin_name, pkg }) => { | ||
const { rules } = pkg; | ||
if (rules && !Array.isArray(rules)) { | ||
@@ -159,0 +159,0 @@ throw new CustomError("CORE-09", { plugin_name }); |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -25,3 +25,3 @@ import match_format from "../../utils/check_format.js"; | ||
data: { | ||
format, | ||
format: format.toString(), | ||
attribute: name.chars | ||
@@ -28,0 +28,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -15,3 +15,3 @@ import { is_tag_node } from "@linthtml/dom-utils"; | ||
data: { | ||
limit | ||
limit: limit.toString() | ||
} | ||
@@ -18,0 +18,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -10,4 +10,3 @@ import { types } from "node:util"; | ||
options = options.map((option) => { | ||
const type = typeof option; | ||
if (type === "string") { | ||
if (typeof option === "string") { | ||
return option.toLowerCase(); | ||
@@ -18,3 +17,3 @@ } | ||
} | ||
throw new Error(typeError(`${type}[]`)); | ||
throw new Error(typeError(`${typeof option}[]`)); | ||
}); | ||
@@ -21,0 +20,0 @@ return options; |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -33,3 +33,3 @@ import match_format from "../../utils/check_format.js"; | ||
attribute: "class", | ||
format, | ||
format: format.toString(), | ||
value: _class | ||
@@ -36,0 +36,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -17,8 +17,9 @@ import { is_tag_node, is_text_node, is_directive_node, is_comment_node } from "@linthtml/dom-utils"; | ||
// CHECK if parent if first child instead | ||
// USE util function to check node type | ||
// @ts-ignore | ||
// @ts-expect-error USE parents and sibling instead | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
if (this.passedFirst || is_comment_node(node) || is_whitespace(node)) { | ||
return; | ||
} | ||
// @ts-ignore | ||
// @ts-expect-error USE parents and sibling instead | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
this.passedFirst = true; | ||
@@ -43,3 +44,3 @@ if (is_directive_node(node) && node.name.toUpperCase() === "!DOCTYPE") { | ||
end() { | ||
// @ts-ignore | ||
// @ts-expect-error USE parents and sibling instead | ||
this.passedFirst = false; | ||
@@ -46,0 +47,0 @@ return []; |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
import Issue from "../issue.js"; | ||
import { Document } from "@linthtml/dom-utils/dom_elements"; | ||
import InlineConfig, { InlineConfigIndex } from "../legacy/inline_config.js"; | ||
import type { Document } from "@linthtml/dom-utils/dom_elements"; | ||
import type { InlineConfigIndex } from "../legacy/inline_config.js"; | ||
import type InlineConfig from "../legacy/inline_config.js"; | ||
declare function lint(dom: Document, opts: InlineConfigIndex, inlineConfigs: InlineConfig): Issue[]; | ||
@@ -5,0 +6,0 @@ declare const _default: { |
import Issue from "../issue.js"; | ||
import { flatten } from "../utils/array.js"; | ||
function apply_rules(rules, element, global_config) { | ||
@@ -12,5 +11,7 @@ const issues = []; | ||
if (Array.isArray(data)) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument | ||
issues.push(...data); | ||
} | ||
else { | ||
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */ | ||
const meta = { | ||
@@ -21,2 +22,4 @@ ...data.meta, | ||
}; | ||
/* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */ | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access | ||
issues.push(new Issue(rule.name, data.position, meta)); | ||
@@ -43,3 +46,4 @@ } | ||
function lint(dom, opts, inlineConfigs) { | ||
// @ts-ignore | ||
// @ts-expect-error Legacy, rules should not have a context object normally | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access | ||
const subs = this.subscribers; | ||
@@ -63,3 +67,3 @@ /* | ||
const issues = dom.children.length ? dom.children.map(getIssues) : []; | ||
return flatten(issues); | ||
return issues.flat(); | ||
} | ||
@@ -66,0 +70,0 @@ export default { |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,5 +7,3 @@ import { is_tag_node } from "@linthtml/dom-utils"; | ||
let has_body = false; | ||
node.children | ||
.filter((child) => child.type === "tag") | ||
.forEach((child) => { | ||
node.children.filter(is_tag_node).forEach((child) => { | ||
// E044: Illegal element | ||
@@ -12,0 +10,0 @@ // E045: Duplicated tag |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -11,3 +11,4 @@ import { is_tag_node, attribute_value, has_non_empty_attribute } from "@linthtml/dom-utils"; | ||
// node has a duplicate id | ||
// @ts-ignore | ||
// @ts-expect-error To remove once moved to visitor pattern | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
const saved_id = this.idMap.get(id.chars); | ||
@@ -29,3 +30,4 @@ if (saved_id) { | ||
// and pass the node | ||
// @ts-ignore | ||
// @ts-expect-error To remove once moved to visitor pattern | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
this.idMap.set(id.chars, id); | ||
@@ -36,3 +38,4 @@ } | ||
// wipe previous table | ||
// @ts-ignore | ||
// @ts-expect-error To remove once moved to visitor pattern | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
this.idMap = new Map(); | ||
@@ -45,4 +48,3 @@ return []; | ||
end, | ||
// @ts-ignore | ||
idMap: new Map() // TODO: Convert rules to class to fix this issue? | ||
idMap: new Map() | ||
}; |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -30,3 +30,3 @@ import match_format from "../../utils/check_format.js"; | ||
attribute: "id", | ||
format, | ||
format: format.toString(), | ||
value: id | ||
@@ -33,0 +33,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { LegacyRuleDefinition } from "../read-config.js"; | ||
import type { LegacyRuleDefinition } from "../read-config.js"; | ||
declare const _default: LegacyRuleDefinition[]; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -12,2 +12,3 @@ // Export an array of all rules. | ||
const rulesExport = await Promise.all(rules_path.map((path) => import(path))); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access | ||
export default Object.values(rulesExport).map((rule) => { var _a, _b; return (_b = (_a = rule === null || rule === void 0 ? void 0 : rule.index) === null || _a === void 0 ? void 0 : _a.default) !== null && _b !== void 0 ? _b : rule.default; }); |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -16,3 +16,4 @@ import Issue from "../../issue.js"; | ||
if (for_attribute) { | ||
// @ts-ignore | ||
// @ts-expect-error To remove once moved to visitor pattern | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
this.labels[for_attribute.chars] = node; | ||
@@ -41,8 +42,8 @@ } | ||
// check if the input has a label as a parent. | ||
// TODO: check if | ||
// @ts-ignore | ||
for (let e = node; (e = e.parent);) { | ||
if (e.name === "label") { | ||
let parent = node.parent; // TODO: Fix typing for parent node | ||
while (parent) { | ||
if (parent.name === "label") { | ||
return; | ||
} | ||
parent = parent.parent; | ||
} | ||
@@ -53,3 +54,4 @@ // check if the input has a named label, by storing the values to | ||
if (id) { | ||
// @ts-ignore | ||
// @ts-expect-error To remove once moved to visitor pattern | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
this.inputsInfo.push({ | ||
@@ -75,2 +77,3 @@ id: id.chars, | ||
const issues = []; | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
const { inputsInfo, labels } = this; | ||
@@ -89,5 +92,7 @@ inputsInfo.forEach(({ id, loc }) => { | ||
// wipe previous table | ||
// @ts-ignore | ||
// @ts-expect-error To remove once moved to visitor pattern | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
this.labels = {}; | ||
// @ts-ignore | ||
// @ts-expect-error To remove once moved to visitor pattern | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
this.inputsInfo = []; | ||
@@ -94,0 +99,0 @@ return issues; |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -47,9 +47,12 @@ import { is_labelable, is_tag_node, has_attribute, attribute_value } from "@linthtml/dom-utils"; | ||
} | ||
// @ts-ignore | ||
// @ts-expect-error To remove once moved to visitor pattern | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
if (!this.idmap) { | ||
// @ts-ignore | ||
// @ts-expect-error To remove once moved to visitor pattern | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
this.idmap = buil_id_map(node); | ||
} | ||
const id = attribute_value(node, "for").chars; | ||
// @ts-ignore | ||
// @ts-expect-error To remove once moved to visitor pattern | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
const fornodement = this.idmap.get(id); | ||
@@ -81,3 +84,4 @@ if (!fornodement) { | ||
function end() { | ||
// @ts-ignore | ||
// @ts-expect-error To remove once moved to visitor pattern | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
this.idmap = null; | ||
@@ -90,4 +94,3 @@ return []; | ||
end, | ||
// @ts-ignore | ||
idmap: null // needed? | ||
}; |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -18,3 +18,3 @@ import { is_tag_node, is_text_node } from "@linthtml/dom-utils"; | ||
title: text, | ||
max_lengthgth: max_length | ||
max_length | ||
} | ||
@@ -21,0 +21,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import { RuleDefinition } from "../../read-config.js"; | ||
import type { RuleDefinition } from "../../read-config.js"; | ||
declare const _default: RuleDefinition; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
export declare function is_boolean(rule_name: string): (option: unknown) => boolean | never; | ||
export declare function create_string_or_regexp_validator(rule_name: string, allow_empty_string?: boolean): (option: unknown) => string | RegExp | never; | ||
export declare function create_list_value_validator(rule_name: string, values: string[], allow_reg?: true): (option: unknown) => option is (string | RegExp) | never; | ||
export declare function create_list_value_validator(rule_name: string, values: string[], allow_reg: false): (option: unknown) => option is string | never; | ||
export declare function create_list_value_validator(rule_name: string, values: string[], allow_reg?: true): never | ((option: unknown) => option is string | RegExp | never); | ||
export declare function create_list_value_validator(rule_name: string, values: string[], allow_reg: false): never | ((option: unknown) => option is string | never); | ||
export declare function create_number_validator(rule_name: string, allow_neg?: boolean): (option: unknown) => number | never; | ||
//# sourceMappingURL=validate_option.d.ts.map |
{ | ||
"name": "@linthtml/core", | ||
"version": "0.10.0-beta.6", | ||
"version": "0.10.0-beta.7", | ||
"description": "LintHTML core package", | ||
@@ -55,4 +55,4 @@ "author": "BenjaminJ <kamikillerto@gmail.com>", | ||
"dependencies": { | ||
"@linthtml/dom-utils": "^0.10.0-beta.6", | ||
"@linthtml/html-parser": "^0.10.0-beta.6", | ||
"@linthtml/dom-utils": "^0.10.0-beta.7", | ||
"@linthtml/html-parser": "^0.10.0-beta.7", | ||
"bulk-require": "1.0.1", | ||
@@ -62,3 +62,3 @@ "cosmiconfig": "^8.0.0", | ||
"globby": "^13.0.0", | ||
"ignore": "^5.2.4", | ||
"ignore": "^5.3.1", | ||
"lodash.pull": "4.1.0", | ||
@@ -76,3 +76,3 @@ "resolve-from": "^5.0.0" | ||
}, | ||
"gitHead": "1500ccd38457cbf97dee37a5d5cbc245be9dc620" | ||
"gitHead": "7d84c2b72609c835e825ce2678adcbf6c623c40d" | ||
} |
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
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
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
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
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
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
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
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
203632
4702
3
242
Updatedignore@^5.3.1