mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Rename hast-format to hast (#41542)
This commit is contained in:
committed by
Eli Barzilay
parent
f134237da4
commit
cbb4cc1d21
@@ -1,95 +0,0 @@
|
||||
import { Data, Point, Position } from "unist";
|
||||
import {
|
||||
Parent,
|
||||
Properties,
|
||||
Literal,
|
||||
Root,
|
||||
Element,
|
||||
DocType,
|
||||
Comment,
|
||||
Text
|
||||
} from "hast-format";
|
||||
|
||||
const data: Data = {
|
||||
string: "string",
|
||||
number: 1,
|
||||
object: {
|
||||
key: "value"
|
||||
},
|
||||
array: [],
|
||||
boolean: true,
|
||||
null: null
|
||||
};
|
||||
|
||||
const point: Point = {
|
||||
line: 1,
|
||||
column: 1,
|
||||
offset: 0
|
||||
};
|
||||
|
||||
const position: Position = {
|
||||
start: point,
|
||||
end: point,
|
||||
indent: [1]
|
||||
};
|
||||
|
||||
const literal: Literal = {
|
||||
type: "text",
|
||||
data,
|
||||
point,
|
||||
value: "value"
|
||||
};
|
||||
|
||||
const comment: Comment = {
|
||||
type: "comment",
|
||||
data,
|
||||
point,
|
||||
value: "value"
|
||||
};
|
||||
|
||||
const text: Text = {
|
||||
type: "text",
|
||||
data,
|
||||
point,
|
||||
value: "value"
|
||||
};
|
||||
|
||||
const docType: DocType = {
|
||||
type: "doctype",
|
||||
name: "name",
|
||||
public: "public",
|
||||
system: "system"
|
||||
};
|
||||
|
||||
const element: Element = getElement();
|
||||
|
||||
const parent: Parent = {
|
||||
type: "parent",
|
||||
data,
|
||||
position,
|
||||
children: [getElement(), docType, comment, text]
|
||||
};
|
||||
|
||||
const root: Root = {
|
||||
type: "root",
|
||||
data,
|
||||
position,
|
||||
children: [getElement(), docType, comment, text]
|
||||
};
|
||||
|
||||
const properties: Properties = {
|
||||
propertyName1: "propertyValue1",
|
||||
propertyName2: ["propertyValue2", "propertyValue3"],
|
||||
propertyName3: true,
|
||||
propertyName4: 47
|
||||
};
|
||||
|
||||
function getElement(): Element {
|
||||
return {
|
||||
type: "element",
|
||||
tagName: "tagName",
|
||||
properties,
|
||||
content: root,
|
||||
children: [element, comment, text]
|
||||
};
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,86 @@
|
||||
import { Data, Point, Position } from 'unist';
|
||||
import { Parent, Properties, Literal, Root, Element, DocType, Comment, Text } from 'hast';
|
||||
|
||||
const data: Data = {
|
||||
string: 'string',
|
||||
number: 1,
|
||||
object: {
|
||||
key: 'value',
|
||||
},
|
||||
array: [],
|
||||
boolean: true,
|
||||
null: null,
|
||||
};
|
||||
|
||||
const point: Point = {
|
||||
line: 1,
|
||||
column: 1,
|
||||
offset: 0,
|
||||
};
|
||||
|
||||
const position: Position = {
|
||||
start: point,
|
||||
end: point,
|
||||
indent: [1],
|
||||
};
|
||||
|
||||
const literal: Literal = {
|
||||
type: 'text',
|
||||
data,
|
||||
point,
|
||||
value: 'value',
|
||||
};
|
||||
|
||||
const comment: Comment = {
|
||||
type: 'comment',
|
||||
data,
|
||||
point,
|
||||
value: 'value',
|
||||
};
|
||||
|
||||
const text: Text = {
|
||||
type: 'text',
|
||||
data,
|
||||
point,
|
||||
value: 'value',
|
||||
};
|
||||
|
||||
const docType: DocType = {
|
||||
type: 'doctype',
|
||||
name: 'name',
|
||||
public: 'public',
|
||||
system: 'system',
|
||||
};
|
||||
|
||||
const element: Element = getElement();
|
||||
|
||||
const parent: Parent = {
|
||||
type: 'parent',
|
||||
data,
|
||||
position,
|
||||
children: [getElement(), docType, comment, text],
|
||||
};
|
||||
|
||||
const root: Root = {
|
||||
type: 'root',
|
||||
data,
|
||||
position,
|
||||
children: [getElement(), docType, comment, text],
|
||||
};
|
||||
|
||||
const properties: Properties = {
|
||||
propertyName1: 'propertyValue1',
|
||||
propertyName2: ['propertyValue2', 'propertyValue3'],
|
||||
propertyName3: true,
|
||||
propertyName4: 47,
|
||||
};
|
||||
|
||||
function getElement(): Element {
|
||||
return {
|
||||
type: 'element',
|
||||
tagName: 'tagName',
|
||||
properties,
|
||||
content: root,
|
||||
children: [element, comment, text],
|
||||
};
|
||||
}
|
||||
+7
-10
@@ -1,14 +1,11 @@
|
||||
// Type definitions for non-npm package Hast 2.3
|
||||
// Project: https://github.com/syntax-tree/hast
|
||||
// Definitions by: lukeggchapman <https://github.com/lukeggchapman>
|
||||
// Junyoung Choi <https://github.com/rokt33r>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.0
|
||||
|
||||
import {
|
||||
Parent as UnistParent,
|
||||
Literal as UnistLiteral,
|
||||
Node as UnistNode
|
||||
} from "unist";
|
||||
import { Parent as UnistParent, Literal as UnistLiteral, Node as UnistNode } from 'unist';
|
||||
|
||||
export { UnistNode as Node };
|
||||
|
||||
@@ -38,7 +35,7 @@ export interface Root extends Parent {
|
||||
/**
|
||||
* Represents this variant of a Node.
|
||||
*/
|
||||
type: "root";
|
||||
type: 'root';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +45,7 @@ export interface Element extends Parent {
|
||||
/**
|
||||
* Represents this variant of a Node.
|
||||
*/
|
||||
type: "element";
|
||||
type: 'element';
|
||||
|
||||
/**
|
||||
* Represents the element’s local name.
|
||||
@@ -85,7 +82,7 @@ export interface DocType extends UnistNode {
|
||||
/**
|
||||
* Represents this variant of a Node.
|
||||
*/
|
||||
type: "doctype";
|
||||
type: 'doctype';
|
||||
|
||||
name: string;
|
||||
|
||||
@@ -107,7 +104,7 @@ export interface Comment extends Literal {
|
||||
/**
|
||||
* Represents this variant of a Literal.
|
||||
*/
|
||||
type: "comment";
|
||||
type: 'comment';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,5 +114,5 @@ export interface Text extends Literal {
|
||||
/**
|
||||
* Represents this variant of a Literal.
|
||||
*/
|
||||
type: "text";
|
||||
type: 'text';
|
||||
}
|
||||
@@ -12,5 +12,5 @@
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "hast-format-tests.ts"]
|
||||
"files": ["index.d.ts", "hast-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"npm-naming": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user