mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 08:17:05 +00:00
Discard local type definitions in vfile
This commit is contained in:
Vendored
+3
-41
@@ -8,6 +8,7 @@
|
||||
/// <reference types='node' />
|
||||
|
||||
import * as Unist from 'unist';
|
||||
import * as vfileMessage from 'vfile-message';
|
||||
|
||||
declare namespace vfile {
|
||||
type VFileContents = string | Buffer;
|
||||
@@ -29,45 +30,6 @@ declare namespace vfile {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* File-related message describing something at certain position.
|
||||
*/
|
||||
interface VFileMessage {
|
||||
/**
|
||||
* File-path, when the message was triggered.
|
||||
*/
|
||||
file: string;
|
||||
/**
|
||||
* Category of message.
|
||||
*/
|
||||
ruleId: string | null;
|
||||
/**
|
||||
* Reason for message.
|
||||
*/
|
||||
reason: string;
|
||||
/**
|
||||
* Starting line of error.
|
||||
*/
|
||||
line: number | null;
|
||||
/**
|
||||
* Starting column of error.
|
||||
*/
|
||||
column: number | null;
|
||||
/**
|
||||
* Full range information, when available.
|
||||
* Has start and end properties, both set to an object with line and column, set to number?.
|
||||
*/
|
||||
location: Unist.Position;
|
||||
/**
|
||||
* Namespace of warning.
|
||||
*/
|
||||
source: string | null;
|
||||
/**
|
||||
* If true, marks associated file as no longer processable.
|
||||
*/
|
||||
fatal?: boolean | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Associates a message with the file for `reason` at `position`.
|
||||
* When an error is passed in as `reason`, copies the stack.
|
||||
@@ -76,7 +38,7 @@ declare namespace vfile {
|
||||
* @param position Place at which the message occurred in `vfile`.
|
||||
* @param ruleId Category of message.
|
||||
*/
|
||||
type Message = (reason: string, position?: Unist.Point | Unist.Position | NodeWithPosition, ruleId?: string) => VFileMessage;
|
||||
type Message = (reason: string, position?: Unist.Point | Unist.Position | NodeWithPosition, ruleId?: string) => vfileMessage.VFileMessage;
|
||||
/**
|
||||
* Associates a fatal message with the file, then immediately throws it.
|
||||
* Note: fatal errors mean a file is no longer processable.
|
||||
@@ -121,7 +83,7 @@ declare namespace vfile {
|
||||
/**
|
||||
* List of messages associated with the file.
|
||||
*/
|
||||
messages: VFileMessage[];
|
||||
messages: vfileMessage.VFileMessage[];
|
||||
/**
|
||||
* Raw value.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import vfile = require('vfile');
|
||||
import * as Unist from 'unist';
|
||||
import vfileMessage = require('vfile-message');
|
||||
|
||||
// Instantiation
|
||||
const file: vfile.VFile = vfile();
|
||||
@@ -15,24 +16,7 @@ file.dirname = '~';
|
||||
file.extname = '.md';
|
||||
file.basename = 'test.text';
|
||||
file.history = ['~/test.txt']; // => ['~/example.txt', '~/example.md', '~/index.text']
|
||||
file.messages = [{
|
||||
file: '~/test.txt',
|
||||
ruleId: '',
|
||||
reason: '',
|
||||
line: 1,
|
||||
column: 1,
|
||||
location: {
|
||||
start: {
|
||||
line: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: {
|
||||
line: 1,
|
||||
column: 1,
|
||||
}
|
||||
},
|
||||
source: ''
|
||||
}];
|
||||
file.messages = [vfileMessage('random error')];
|
||||
|
||||
const startPoint: Unist.Point = {
|
||||
line: 1,
|
||||
@@ -46,7 +30,7 @@ const position: Unist.Position = {
|
||||
},
|
||||
};
|
||||
|
||||
file.message('test', startPoint);
|
||||
const message: vfileMessage.VFileMessage = file.message('test', startPoint, 'test origin');
|
||||
file.message('test', position);
|
||||
file.message('test', {
|
||||
type: 'ramdom node',
|
||||
|
||||
Reference in New Issue
Block a user