Socket
Socket
Sign inDemoInstall

@types/prettier

Package Overview
Dependencies
0
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.4 to 2.1.5

64

prettier/index.d.ts

@@ -8,5 +8,15 @@ // Type definitions for prettier 2.1

// Christopher Quadflieg <https://github.com/Shinigami92>
// Kevin Deisz <https://github.com/kddeisz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// This utility is here to handle the case where you have an explicit union
// between string literals and the generic string type. It would normally
// resolve out to just the string type, but this generic LiteralUnion maintains
// the intellisense of the original union.
//
// It comes from this issue: microsoft/TypeScript#29729:
// https://github.com/microsoft/TypeScript/issues/29729#issuecomment-700527227
export type LiteralUnion<T extends U, U = string> = T | (Pick<U, never> & { _?: never });
export type AST = any;

@@ -17,3 +27,3 @@ export type Doc = doc.builders.Doc;

export interface FastPath<T = any> {
stack: any[];
stack: T[];
getName(): null | PropertyKey;

@@ -98,3 +108,3 @@ getValue(): T;

*/
parser: BuiltInParserName | CustomParser;
parser: LiteralUnion<BuiltInParserName> | CustomParser;
/**

@@ -160,12 +170,12 @@ * Specify the input filepath. This will be used to do parser inference.

export interface ParserOptions extends RequiredOptions {
locStart: (node: any) => number;
locEnd: (node: any) => number;
export interface ParserOptions<T = any> extends RequiredOptions {
locStart: (node: T) => number;
locEnd: (node: T) => number;
originalText: string;
}
export interface Plugin {
export interface Plugin<T = any> {
languages?: SupportLanguage[];
parsers?: { [parserName: string]: Parser };
printers?: { [astFormat: string]: Printer };
parsers?: { [parserName: string]: Parser<T> };
printers?: { [astFormat: string]: Printer<T> };
options?: SupportOptions;

@@ -175,18 +185,18 @@ defaultOptions?: Partial<RequiredOptions>;

export interface Parser {
parse: (text: string, parsers: { [parserName: string]: Parser }, options: ParserOptions) => AST;
export interface Parser<T = any> {
parse: (text: string, parsers: { [parserName: string]: Parser }, options: ParserOptions<T>) => T;
astFormat: string;
hasPragma?: (text: string) => boolean;
locStart: (node: any) => number;
locEnd: (node: any) => number;
preprocess?: (text: string, options: ParserOptions) => string;
locStart: (node: T) => number;
locEnd: (node: T) => number;
preprocess?: (text: string, options: ParserOptions<T>) => string;
}
export interface Printer {
print(path: FastPath, options: ParserOptions, print: (path: FastPath) => Doc): Doc;
export interface Printer<T = any> {
print(path: FastPath<T>, options: ParserOptions<T>, print: (path: FastPath<T>) => Doc): Doc;
embed?: (
path: FastPath,
print: (path: FastPath) => Doc,
path: FastPath<T>,
print: (path: FastPath<T>) => Doc,
textToDoc: (text: string, options: Options) => Doc,
options: ParserOptions,
options: ParserOptions<T>,
) => Doc | null;

@@ -200,13 +210,13 @@ insertPragma?: (text: string) => string;

massageAstNode?: (node: any, newNode: any, parent: any) => any;
hasPrettierIgnore?: (path: FastPath) => boolean;
canAttachComment?: (node: any) => boolean;
willPrintOwnComments?: (path: FastPath) => boolean;
printComments?: (path: FastPath, print: (path: FastPath) => Doc, options: ParserOptions, needsSemi: boolean) => Doc;
hasPrettierIgnore?: (path: FastPath<T>) => boolean;
canAttachComment?: (node: T) => boolean;
willPrintOwnComments?: (path: FastPath<T>) => boolean;
printComments?: (path: FastPath<T>, print: (path: FastPath<T>) => Doc, options: ParserOptions<T>, needsSemi: boolean) => Doc;
handleComments?: {
ownLine?: (commentNode: any, text: string, options: ParserOptions, ast: any, isLastComment: boolean) => boolean;
ownLine?: (commentNode: any, text: string, options: ParserOptions<T>, ast: T, isLastComment: boolean) => boolean;
endOfLine?: (
commentNode: any,
text: string,
options: ParserOptions,
ast: any,
options: ParserOptions<T>,
ast: T,
isLastComment: boolean,

@@ -217,4 +227,4 @@ ) => boolean;

text: string,
options: ParserOptions,
ast: any,
options: ParserOptions<T>,
ast: T,
isLastComment: boolean,

@@ -221,0 +231,0 @@ ) => boolean;

{
"name": "@types/prettier",
"version": "2.1.4",
"version": "2.1.5",
"description": "TypeScript definitions for prettier",

@@ -31,2 +31,7 @@ "license": "MIT",

"githubUsername": "Shinigami92"
},
{
"name": "Kevin Deisz",
"url": "https://github.com/kddeisz",
"githubUsername": "kddeisz"
}

@@ -43,4 +48,4 @@ ],

"dependencies": {},
"typesPublisherContentHash": "7180ce912db0b0460173cc329c2a3e135bccf644e22ccbc4acd8c6c83742b778",
"typesPublisherContentHash": "d76ac305801e18b2c028d2a4c5ac2c2347a2529ab76dc3b5d68ab935053ca639",
"typeScriptVersion": "3.2"
}

@@ -11,3 +11,3 @@ # Installation

### Additional Details
* Last updated: Fri, 16 Oct 2020 16:03:42 GMT
* Last updated: Fri, 16 Oct 2020 17:36:09 GMT
* Dependencies: none

@@ -17,2 +17,2 @@ * Global values: `prettier`

# Credits
These definitions were written by [Ika](https://github.com/ikatyang), [Ifiok Jr.](https://github.com/ifiokjr), [Florian Keller](https://github.com/ffflorian), [Sosuke Suzuki](https://github.com/sosukesuzuki), and [Christopher Quadflieg](https://github.com/Shinigami92).
These definitions were written by [Ika](https://github.com/ikatyang), [Ifiok Jr.](https://github.com/ifiokjr), [Florian Keller](https://github.com/ffflorian), [Sosuke Suzuki](https://github.com/sosukesuzuki), [Christopher Quadflieg](https://github.com/Shinigami92), and [Kevin Deisz](https://github.com/kddeisz).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc