@markuplint/ml-core
Advanced tools
Comparing version 3.3.1 to 3.4.0
@@ -1,5 +0,1 @@ | ||
import type { MLRule } from '../../ml-rule'; | ||
import type Ruleset from '../../ruleset'; | ||
import type { Walker } from '../helper/walkers'; | ||
import type { MLToken } from '../token/token'; | ||
import type { MLAttr } from './attr'; | ||
@@ -12,2 +8,6 @@ import type { MLComment } from './comment'; | ||
import type { DocumentNodeType } from './types'; | ||
import type { MLRule } from '../../ml-rule'; | ||
import type Ruleset from '../../ruleset'; | ||
import type { Walker } from '../helper/walkers'; | ||
import type { MLToken } from '../token/token'; | ||
import type { EndTagType, MLASTDocument } from '@markuplint/ml-ast'; | ||
@@ -14,0 +14,0 @@ import type { Pretender, RuleConfigValue } from '@markuplint/ml-config'; |
@@ -109,4 +109,4 @@ "use strict"; | ||
_pick(token, _offset = 0) { | ||
var _a, _b, _c, _d, _e, _f; | ||
token = token.trim().split(/\s+/g)[0]; | ||
var _a, _b, _c, _d, _e, _f, _g; | ||
token = (_a = token.trim().split(/\s+/g)[0]) !== null && _a !== void 0 ? _a : ''; | ||
if (!token) { | ||
@@ -127,5 +127,5 @@ return null; | ||
raw: token, | ||
startOffset: ((_b = (_a = ownerAttr.valueNode) === null || _a === void 0 ? void 0 : _a.startOffset) !== null && _b !== void 0 ? _b : 0) + startOffset, | ||
startLine: ((_d = (_c = ownerAttr.valueNode) === null || _c === void 0 ? void 0 : _c.startLine) !== null && _d !== void 0 ? _d : 0) + (startLine - 1), | ||
startCol: ((_f = (_e = ownerAttr.valueNode) === null || _e === void 0 ? void 0 : _e.startCol) !== null && _f !== void 0 ? _f : 0) + (startCol - 1), | ||
startOffset: ((_c = (_b = ownerAttr.valueNode) === null || _b === void 0 ? void 0 : _b.startOffset) !== null && _c !== void 0 ? _c : 0) + startOffset, | ||
startLine: ((_e = (_d = ownerAttr.valueNode) === null || _d === void 0 ? void 0 : _d.startLine) !== null && _e !== void 0 ? _e : 0) + (startLine - 1), | ||
startCol: ((_g = (_f = ownerAttr.valueNode) === null || _f === void 0 ? void 0 : _f.startCol) !== null && _g !== void 0 ? _g : 0) + (startCol - 1), | ||
rule: ownerAttr.rule, | ||
@@ -132,0 +132,0 @@ _searchedIndex: startOffset, |
@@ -1660,3 +1660,3 @@ import type { MLDocument } from './document'; | ||
*/ | ||
getElementsByTagName(qualifiedName: string): ReturnType<typeof Element['prototype']['getElementsByTagName']>; | ||
getElementsByTagName(qualifiedName: string): ReturnType<(typeof Element)['prototype']['getElementsByTagName']>; | ||
/** | ||
@@ -1663,0 +1663,0 @@ * **IT THROWS AN ERROR WHEN CALLING THIS.** |
@@ -20,3 +20,4 @@ "use strict"; | ||
item(index) { | ||
return this[index]; | ||
var _a; | ||
return (_a = this[index]) !== null && _a !== void 0 ? _a : null; | ||
} | ||
@@ -23,0 +24,0 @@ /** |
@@ -9,3 +9,17 @@ "use strict"; | ||
item(index) { | ||
return this[index]; | ||
const node = this[index]; | ||
if (!node) { | ||
/** | ||
* ⚠ TYPE CONTRADICTION | ||
* | ||
* It throws an error because it should return null but the `item` method of `NodeListOf` doesn't return null in the type definition of TypeScript. | ||
* | ||
* @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-844377136 | ||
* | ||
* > item | ||
* > Returns the index-th item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null. | ||
*/ | ||
throw new ReferenceError('Invalid index'); | ||
} | ||
return node; | ||
} | ||
@@ -20,3 +34,4 @@ } | ||
item(index) { | ||
return this[index]; | ||
var _a; | ||
return (_a = this[index]) !== null && _a !== void 0 ? _a : null; | ||
} | ||
@@ -23,0 +38,0 @@ namedItem(name) { |
@@ -1,2 +0,1 @@ | ||
import type { RuleInfo } from '../..'; | ||
import type { MLBlock } from './block'; | ||
@@ -8,2 +7,3 @@ import type { MLChildNode } from './child-node'; | ||
import type { MarkuplintPreprocessorBlockType, NodeType, NodeTypeOf } from './types'; | ||
import type { RuleInfo } from '../..'; | ||
import type { MLASTAbstractNode } from '@markuplint/ml-ast'; | ||
@@ -147,3 +147,3 @@ import type { AnyRule, RuleConfigValue } from '@markuplint/ml-config'; | ||
*/ | ||
get firstChild(): MLChildNode<T, O>; | ||
get firstChild(): MLChildNode<T, O> | null; | ||
/** | ||
@@ -164,3 +164,3 @@ * **IT THROWS AN ERROR WHEN CALLING THIS.** | ||
*/ | ||
get lastChild(): MLChildNode<T, O>; | ||
get lastChild(): MLChildNode<T, O> | null; | ||
/** | ||
@@ -167,0 +167,0 @@ * @implements `@markuplint/ml-core` API: `MLNode` |
@@ -190,3 +190,4 @@ "use strict"; | ||
get firstChild() { | ||
return this.childNodes[0] || null; | ||
var _a; | ||
return (_a = this.childNodes[0]) !== null && _a !== void 0 ? _a : null; | ||
} | ||
@@ -211,3 +212,4 @@ /** | ||
get lastChild() { | ||
return this.childNodes[this.childNodes.length - 1] || null; | ||
var _a; | ||
return (_a = this.childNodes[this.childNodes.length - 1]) !== null && _a !== void 0 ? _a : null; | ||
} | ||
@@ -214,0 +216,0 @@ /** |
@@ -32,3 +32,3 @@ import type { MLElement } from './element'; | ||
*/ | ||
get firstElementChild(): MLElement<T, O>; | ||
get firstElementChild(): MLElement<T, O> | null; | ||
/** | ||
@@ -38,3 +38,3 @@ * @implements DOM API: `Element`, `Document`, `DocumentFragment` | ||
*/ | ||
get lastElementChild(): MLElement<T, O>; | ||
get lastElementChild(): MLElement<T, O> | null; | ||
/** | ||
@@ -41,0 +41,0 @@ * **IT THROWS AN ERROR WHEN CALLING THIS.** |
@@ -27,2 +27,5 @@ "use strict"; | ||
const rule = rules[ruleName]; | ||
if (!rule) { | ||
return; | ||
} | ||
node.rules[ruleName] = rule.rule; | ||
@@ -29,0 +32,0 @@ ruleMapperNodeRuleLog('[from: %s(%s)] %s: %o', rule.from, rule.specificity, ruleName, rule.rule); |
@@ -1,2 +0,1 @@ | ||
import type { MLToken } from '../token/token'; | ||
import type { MLAttr } from './attr'; | ||
@@ -11,2 +10,3 @@ import type { MLBlock } from './block'; | ||
import type { MLText } from './text'; | ||
import type { MLToken } from '../token/token'; | ||
import type { | ||
@@ -13,0 +13,0 @@ MLASTAbstractNode, |
@@ -0,3 +1,3 @@ | ||
import type { CheckerReport } from './types'; | ||
import type { MLDocument } from '../ml-dom/node/document'; | ||
import type { CheckerReport } from './types'; | ||
import type { LocaleSet, Translator } from '@markuplint/i18n'; | ||
@@ -4,0 +4,0 @@ import type { Report, RuleConfigValue } from '@markuplint/ml-config'; |
@@ -0,4 +1,4 @@ | ||
import type { RuleSeed } from './types'; | ||
import type { Ruleset } from '..'; | ||
import type { MLDocument } from '../ml-dom/node/document'; | ||
import type { RuleSeed } from './types'; | ||
import type { LocaleSet } from '@markuplint/i18n'; | ||
@@ -5,0 +5,0 @@ import type { GlobalRuleInfo, RuleConfig, RuleConfigValue, RuleInfo, Severity, Violation } from '@markuplint/ml-config'; |
@@ -0,3 +1,3 @@ | ||
import type { MLRuleContext } from './ml-rule-context'; | ||
import type { Attr, Element } from '../ml-dom'; | ||
import type { MLRuleContext } from './ml-rule-context'; | ||
import type { Translator } from '@markuplint/i18n'; | ||
@@ -4,0 +4,0 @@ import type { Report, RuleConfigValue, Severity } from '@markuplint/ml-config'; |
@@ -30,3 +30,3 @@ "use strict"; | ||
const el = document.nodeList[0]; | ||
if (el.is(el.ELEMENT_NODE)) { | ||
if (el && el.is(el.ELEMENT_NODE)) { | ||
return el; | ||
@@ -33,0 +33,0 @@ } |
{ | ||
"name": "@markuplint/ml-core", | ||
"version": "3.3.1", | ||
"version": "3.4.0", | ||
"description": "The core module of markuplint", | ||
@@ -27,10 +27,10 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
"@markuplint/config-presets": "3.3.0", | ||
"@markuplint/html-parser": "3.3.1", | ||
"@markuplint/html-spec": "3.3.1", | ||
"@markuplint/i18n": "3.3.0", | ||
"@markuplint/html-parser": "3.4.0", | ||
"@markuplint/html-spec": "3.4.0", | ||
"@markuplint/i18n": "3.4.0", | ||
"@markuplint/ml-ast": "3.0.0", | ||
"@markuplint/ml-config": "3.3.0", | ||
"@markuplint/ml-spec": "3.3.0", | ||
"@markuplint/parser-utils": "3.3.0", | ||
"@markuplint/selector": "3.3.0", | ||
"@markuplint/ml-config": "3.4.0", | ||
"@markuplint/ml-spec": "3.4.0", | ||
"@markuplint/parser-utils": "3.4.0", | ||
"@markuplint/selector": "3.4.0", | ||
"debug": "^4.3.4", | ||
@@ -43,3 +43,3 @@ "tslib": "^2.4.1" | ||
}, | ||
"gitHead": "f19e7de726cf01d53342bc5513c30da75d28da63" | ||
"gitHead": "a83e0f5f214a9bbcc0286b9e269074ddca6189e7" | ||
} |
Sorry, the diff of this file is too big to display
391236
12750
+ Added@markuplint/html-parser@3.4.0(transitive)
+ Added@markuplint/html-spec@3.4.0(transitive)
+ Added@markuplint/i18n@3.4.0(transitive)
+ Added@markuplint/ml-config@3.4.0(transitive)
+ Added@markuplint/ml-spec@3.4.0(transitive)
+ Added@markuplint/parser-utils@3.4.0(transitive)
+ Added@markuplint/selector@3.4.0(transitive)
+ Added@markuplint/types@3.3.0(transitive)
- Removed@markuplint/html-parser@3.3.1(transitive)
- Removed@markuplint/html-spec@3.3.1(transitive)
- Removed@markuplint/i18n@3.3.0(transitive)
- Removed@markuplint/ml-config@3.3.0(transitive)
- Removed@markuplint/ml-spec@3.3.0(transitive)
- Removed@markuplint/parser-utils@3.3.0(transitive)
- Removed@markuplint/selector@3.3.0(transitive)
- Removed@markuplint/types@3.2.0(transitive)
Updated@markuplint/html-spec@3.4.0
Updated@markuplint/i18n@3.4.0
Updated@markuplint/ml-config@3.4.0
Updated@markuplint/ml-spec@3.4.0
Updated@markuplint/selector@3.4.0