Socket
Socket
Sign inDemoInstall

dprint

Package Overview
Dependencies
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dprint - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

241

lib/dprint.d.ts

@@ -46,3 +46,3 @@ /**

*/
newLineKind?: "auto" | "crlf" | "lf" | "system";
newlineKind?: "auto" | "crlf" | "lf" | "system";
/**

@@ -73,8 +73,43 @@ * If braces should be used or not.

nextControlFlowPosition?: "maintain" | "sameLine" | "nextLine";
/**
* If trailing commas should be used.
* @default "never"
* @value "never" - Trailing commas should not be used.
* @value "always" - Trailing commas should always be used.
* @value "onlyMultiLine" - Trailing commas should only be used in multi-line scenarios.
*/
trailingCommas?: "never" | "always" | "onlyMultiLine";
/**
* How to space the members of an enum.
* @default "newline"
* @value "newline" - Forces a new line between members.
* @value "blankline" - Forces a blank line between members.
* @value "maintain" - Maintains whether a newline or blankline is used.
*/
"enumDeclaration.memberSpacing"?: "newline" | "blankline" | "maintain";
"breakStatement.semiColon"?: boolean;
"callSignature.semiColon"?: boolean;
"classMethod.semiColon"?: boolean;
"classProperty.semiColon"?: boolean;
"constructSignature.semiColon"?: boolean;
"continueStatement.semiColon"?: boolean;
"debuggerStatement.semiColon"?: boolean;
"directive.semiColon"?: boolean;
"doWhileStatement.semiColon"?: boolean;
"exportAssignment.semiColon"?: boolean;
"expressionStatement.semiColon"?: boolean;
"functionDeclaration.semiColon"?: boolean;
"ifStatement.semiColon"?: boolean;
"importDeclaration.semiColon"?: boolean;
"importEqualsDeclaration.semiColon"?: boolean;
"indexSignature.semiColon"?: boolean;
"mappedType.semiColon"?: boolean;
"methodSignature.semiColon"?: boolean;
"moduleDeclaration.semiColon"?: boolean;
"namespaceExportDeclaration.semiColon"?: boolean;
"propertySignature.semiColon"?: boolean;
"returnStatement.semiColon"?: boolean;
"throwStatement.semiColon"?: boolean;
"typeAlias.semiColon"?: boolean;
"variableStatement.semiColon"?: boolean;
/**

@@ -87,2 +122,26 @@ * If braces should be used or not.

*/
"forInStatement.useBraces"?: "maintain" | "always" | "preferNone";
/**
* If braces should be used or not.
* @default "maintain"
* @value "maintain" - Uses braces if they're used. Doesn't use braces if they're not used.
* @value "always" - Forces the use of braces. Will add them if they aren't used.
* @value "preferNone" - Forces no braces when when the header is one line and body is one line. Otherwise forces braces.
*/
"forOfStatement.useBraces"?: "maintain" | "always" | "preferNone";
/**
* If braces should be used or not.
* @default "maintain"
* @value "maintain" - Uses braces if they're used. Doesn't use braces if they're not used.
* @value "always" - Forces the use of braces. Will add them if they aren't used.
* @value "preferNone" - Forces no braces when when the header is one line and body is one line. Otherwise forces braces.
*/
"forStatement.useBraces"?: "maintain" | "always" | "preferNone";
/**
* If braces should be used or not.
* @default "maintain"
* @value "maintain" - Uses braces if they're used. Doesn't use braces if they're not used.
* @value "always" - Forces the use of braces. Will add them if they aren't used.
* @value "preferNone" - Forces no braces when when the header is one line and body is one line. Otherwise forces braces.
*/
"ifStatement.useBraces"?: "maintain" | "always" | "preferNone";

@@ -105,2 +164,11 @@ /**

*/
"arrowFunctionExpression.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";
/**
* Where to place the brace.
* @default "nextLineIfHanging"
* @value "maintain" - Maintains the brace being on the next line or the same line.
* @value "sameLine" - Forces the brace to be on the same line.
* @value "nextLine" - Forces the brace to be on the next line.
* @value "nextLineIfHanging" - Forces the brace to be on the next line if the same line is hanging, but otherwise uses the next.
*/
"classDeclaration.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";

@@ -115,2 +183,20 @@ /**

*/
"classExpression.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";
/**
* Where to place the brace.
* @default "nextLineIfHanging"
* @value "maintain" - Maintains the brace being on the next line or the same line.
* @value "sameLine" - Forces the brace to be on the same line.
* @value "nextLine" - Forces the brace to be on the next line.
* @value "nextLineIfHanging" - Forces the brace to be on the next line if the same line is hanging, but otherwise uses the next.
*/
"classMethod.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";
/**
* Where to place the brace.
* @default "nextLineIfHanging"
* @value "maintain" - Maintains the brace being on the next line or the same line.
* @value "sameLine" - Forces the brace to be on the same line.
* @value "nextLine" - Forces the brace to be on the next line.
* @value "nextLineIfHanging" - Forces the brace to be on the next line if the same line is hanging, but otherwise uses the next.
*/
"doWhileStatement.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";

@@ -125,2 +211,38 @@ /**

*/
"enumDeclaration.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";
/**
* Where to place the brace.
* @default "nextLineIfHanging"
* @value "maintain" - Maintains the brace being on the next line or the same line.
* @value "sameLine" - Forces the brace to be on the same line.
* @value "nextLine" - Forces the brace to be on the next line.
* @value "nextLineIfHanging" - Forces the brace to be on the next line if the same line is hanging, but otherwise uses the next.
*/
"forInStatement.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";
/**
* Where to place the brace.
* @default "nextLineIfHanging"
* @value "maintain" - Maintains the brace being on the next line or the same line.
* @value "sameLine" - Forces the brace to be on the same line.
* @value "nextLine" - Forces the brace to be on the next line.
* @value "nextLineIfHanging" - Forces the brace to be on the next line if the same line is hanging, but otherwise uses the next.
*/
"forOfStatement.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";
/**
* Where to place the brace.
* @default "nextLineIfHanging"
* @value "maintain" - Maintains the brace being on the next line or the same line.
* @value "sameLine" - Forces the brace to be on the same line.
* @value "nextLine" - Forces the brace to be on the next line.
* @value "nextLineIfHanging" - Forces the brace to be on the next line if the same line is hanging, but otherwise uses the next.
*/
"forStatement.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";
/**
* Where to place the brace.
* @default "nextLineIfHanging"
* @value "maintain" - Maintains the brace being on the next line or the same line.
* @value "sameLine" - Forces the brace to be on the same line.
* @value "nextLine" - Forces the brace to be on the next line.
* @value "nextLineIfHanging" - Forces the brace to be on the next line if the same line is hanging, but otherwise uses the next.
*/
"functionDeclaration.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";

@@ -135,2 +257,11 @@ /**

*/
"functionExpression.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";
/**
* Where to place the brace.
* @default "nextLineIfHanging"
* @value "maintain" - Maintains the brace being on the next line or the same line.
* @value "sameLine" - Forces the brace to be on the same line.
* @value "nextLine" - Forces the brace to be on the next line.
* @value "nextLineIfHanging" - Forces the brace to be on the next line if the same line is hanging, but otherwise uses the next.
*/
"ifStatement.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";

@@ -145,2 +276,29 @@ /**

*/
"interfaceDeclaration.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";
/**
* Where to place the brace.
* @default "nextLineIfHanging"
* @value "maintain" - Maintains the brace being on the next line or the same line.
* @value "sameLine" - Forces the brace to be on the same line.
* @value "nextLine" - Forces the brace to be on the next line.
* @value "nextLineIfHanging" - Forces the brace to be on the next line if the same line is hanging, but otherwise uses the next.
*/
"moduleDeclaration.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";
/**
* Where to place the brace.
* @default "nextLineIfHanging"
* @value "maintain" - Maintains the brace being on the next line or the same line.
* @value "sameLine" - Forces the brace to be on the same line.
* @value "nextLine" - Forces the brace to be on the next line.
* @value "nextLineIfHanging" - Forces the brace to be on the next line if the same line is hanging, but otherwise uses the next.
*/
"switchStatement.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";
/**
* Where to place the brace.
* @default "nextLineIfHanging"
* @value "maintain" - Maintains the brace being on the next line or the same line.
* @value "sameLine" - Forces the brace to be on the same line.
* @value "nextLine" - Forces the brace to be on the next line.
* @value "nextLineIfHanging" - Forces the brace to be on the next line if the same line is hanging, but otherwise uses the next.
*/
"tryStatement.bracePosition"?: "maintain" | "sameLine" | "nextLine" | "nextLineIfHanging";

@@ -172,2 +330,42 @@ /**

"tryStatement.nextControlFlowPosition"?: "maintain" | "sameLine" | "nextLine";
/**
* If trailing commas should be used.
* @default "never"
* @value "never" - Trailing commas should not be used.
* @value "always" - Trailing commas should always be used.
* @value "onlyMultiLine" - Trailing commas should only be used in multi-line scenarios.
*/
"arrayExpression.trailingCommas"?: "never" | "always" | "onlyMultiLine";
/**
* If trailing commas should be used.
* @default "never"
* @value "never" - Trailing commas should not be used.
* @value "always" - Trailing commas should always be used.
* @value "onlyMultiLine" - Trailing commas should only be used in multi-line scenarios.
*/
"arrayPattern.trailingCommas"?: "never" | "always" | "onlyMultiLine";
/**
* If trailing commas should be used.
* @default "never"
* @value "never" - Trailing commas should not be used.
* @value "always" - Trailing commas should always be used.
* @value "onlyMultiLine" - Trailing commas should only be used in multi-line scenarios.
*/
"enumDeclaration.trailingCommas"?: "never" | "always" | "onlyMultiLine";
/**
* If trailing commas should be used.
* @default "never"
* @value "never" - Trailing commas should not be used.
* @value "always" - Trailing commas should always be used.
* @value "onlyMultiLine" - Trailing commas should only be used in multi-line scenarios.
*/
"objectExpression.trailingCommas"?: "never" | "always" | "onlyMultiLine";
/**
* If trailing commas should be used.
* @default "never"
* @value "never" - Trailing commas should not be used.
* @value "always" - Trailing commas should always be used.
* @value "onlyMultiLine" - Trailing commas should only be used in multi-line scenarios.
*/
"tupleType.trailingCommas"?: "never" | "always" | "onlyMultiLine";
}

@@ -205,15 +403,49 @@

singleQuotes: boolean;
newLineKind: "auto" | "\r\n" | "\n";
newlineKind: "auto" | "\r\n" | "\n";
"enumDeclaration.memberSpacing": NonNullable<Configuration["enumDeclaration.memberSpacing"]>;
"breakStatement.semiColon": boolean;
"callSignature.semiColon": boolean;
"classMethod.semiColon": boolean;
"classProperty.semiColon": boolean;
"constructSignature.semiColon": boolean;
"continueStatement.semiColon": boolean;
"debuggerStatement.semiColon": boolean;
"directive.semiColon": boolean;
"doWhileStatement.semiColon": boolean;
"exportAssignment.semiColon": boolean;
"expressionStatement.semiColon": boolean;
"functionDeclaration.semiColon": boolean;
"ifStatement.semiColon": boolean;
"importDeclaration.semiColon": boolean;
"importEqualsDeclaration.semiColon": boolean;
"indexSignature.semiColon": boolean;
"mappedType.semiColon": boolean;
"methodSignature.semiColon": boolean;
"moduleDeclaration.semiColon": boolean;
"namespaceExportDeclaration.semiColon": boolean;
"propertySignature.semiColon": boolean;
"returnStatement.semiColon": boolean;
"throwStatement.semiColon": boolean;
"typeAlias.semiColon": boolean;
"variableStatement.semiColon": boolean;
"forInStatement.useBraces": NonNullable<Configuration["useBraces"]>;
"forOfStatement.useBraces": NonNullable<Configuration["useBraces"]>;
"forStatement.useBraces": NonNullable<Configuration["useBraces"]>;
"ifStatement.useBraces": NonNullable<Configuration["useBraces"]>;
"whileStatement.useBraces": NonNullable<Configuration["useBraces"]>;
"arrowFunctionExpression.bracePosition": NonNullable<Configuration["bracePosition"]>;
"classDeclaration.bracePosition": NonNullable<Configuration["bracePosition"]>;
"classExpression.bracePosition": NonNullable<Configuration["bracePosition"]>;
"classMethod.bracePosition": NonNullable<Configuration["bracePosition"]>;
"doWhileStatement.bracePosition": NonNullable<Configuration["bracePosition"]>;
"enumDeclaration.bracePosition": NonNullable<Configuration["bracePosition"]>;
"forInStatement.bracePosition": NonNullable<Configuration["bracePosition"]>;
"forOfStatement.bracePosition": NonNullable<Configuration["bracePosition"]>;
"forStatement.bracePosition": NonNullable<Configuration["bracePosition"]>;
"functionDeclaration.bracePosition": NonNullable<Configuration["bracePosition"]>;
"functionExpression.bracePosition": NonNullable<Configuration["bracePosition"]>;
"ifStatement.bracePosition": NonNullable<Configuration["bracePosition"]>;
"interfaceDeclaration.bracePosition": NonNullable<Configuration["bracePosition"]>;
"moduleDeclaration.bracePosition": NonNullable<Configuration["bracePosition"]>;
"switchStatement.bracePosition": NonNullable<Configuration["bracePosition"]>;
"tryStatement.bracePosition": NonNullable<Configuration["bracePosition"]>;

@@ -223,2 +455,7 @@ "whileStatement.bracePosition": NonNullable<Configuration["bracePosition"]>;

"tryStatement.nextControlFlowPosition": NonNullable<Configuration["nextControlFlowPosition"]>;
"arrayExpression.trailingCommas": NonNullable<Configuration["trailingCommas"]>;
"arrayPattern.trailingCommas": NonNullable<Configuration["trailingCommas"]>;
"enumDeclaration.trailingCommas": NonNullable<Configuration["trailingCommas"]>;
"objectExpression.trailingCommas": NonNullable<Configuration["trailingCommas"]>;
"tupleType.trailingCommas": NonNullable<Configuration["trailingCommas"]>;
}

@@ -225,0 +462,0 @@

24

package.json
{
"name": "dprint",
"version": "0.0.2",
"version": "0.1.0",
"description": "TypeScript code formatter for my personal projects.",

@@ -35,4 +35,4 @@ "main": "dist/index.js",

"dependencies": {
"@babel/core": "^7.4.5",
"@babel/parser": "^7.4.5",
"@babel/core": "^7.5.5",
"@babel/parser": "^7.5.5",
"@babel/preset-typescript": "^7.3.3",

@@ -51,16 +51,16 @@ "globby": "^10.0.1",

"@types/mocha": "^5.2.7",
"@types/node": "^12.0.8",
"@types/ts-nameof": "^2.0.0",
"@types/node": "^12.6.8",
"@types/ts-nameof": "^3.2.0",
"chai": "^4.2.0",
"cross-env": "^5.2.0",
"mocha": "^6.1.4",
"mocha": "^6.2.0",
"rimraf": "^2.6.3",
"rollup": "^1.16.6",
"rollup-plugin-typescript2": "^0.21.2",
"ts-morph": "^3.0.0",
"ts-nameof": "^3.1.0",
"ts-node": "^8.2.0",
"rollup": "^1.17.0",
"rollup-plugin-typescript2": "^0.22.0",
"ts-morph": "^3.1.3",
"ts-nameof": "^3.2.0",
"ts-node": "^8.3.0",
"ttypescript": "^1.5.7",
"typescript": "^3.5.2"
"typescript": "^3.5.3"
}
}

@@ -7,3 +7,3 @@ # dprint

* [Implemented nodes](implemented-nodes.md) (59/223)
* [Implemented nodes](implemented-nodes.md) (140/155 -- only JSX nodes left)
* [Configuration schema](schema/dprint.schema.json) (more to come...)

@@ -15,5 +15,4 @@ * [API declarations](lib/dprint.d.ts)

1. Reasonable configuration.
2. Work well above an 80 character line width.
3. Satisfy my formatting needs.
4. TypeScript and probably JSON support.
2. Satisfy my formatting needs.
3. TypeScript and probably JSON support.

@@ -20,0 +19,0 @@ ## Licence

@@ -36,2 +36,12 @@ {

"default": "nextLine"
},
"trailingCommas": {
"type": "string",
"description": "If trailing commas should be used.",
"oneOf": [
{ "const": "never", "description": "Trailing commas should not be used." },
{ "const": "always", "description": "Trailing commas should always be used." },
{ "const": "onlyMultiLine", "description": "Trailing commas should only be used in multi-line scenarios." }
],
"default": "never"
}

@@ -65,3 +75,3 @@ },

},
"newLineKind": {
"newlineKind": {
"type": "string",

@@ -86,3 +96,38 @@ "description": "The kind of newline to use.",

},
"trailingCommas": {
"$ref": "#/definitions/trailingCommas"
},
"enumDeclaration.memberSpacing": {
"type": "string",
"description": "How to space the members of an enum.",
"oneOf": [
{ "const": "newline", "description": "Forces a new line between members." },
{ "const": "blankline", "description": "Forces a blank line between members." },
{ "const": "maintain", "description": "Maintains whether a newline or blankline is used." }
],
"default": "newline"
},
"breakStatement.semiColon": {
"type": "boolean"
},
"callSignature.semiColon": {
"type": "boolean"
},
"classMethod.semiColon": {
"type": "boolean"
},
"classProperty.semiColon": {
"type": "boolean"
},
"constructSignature.semiColon": {
"type": "boolean"
},
"continueStatement.semiColon": {
"type": "boolean"
},
"debuggerStatement.semiColon": {
"type": "boolean"
},
"directive.semiColon": {

@@ -94,5 +139,11 @@ "type": "boolean"

},
"exportAssignment.semiColon": {
"type": "boolean"
},
"expressionStatement.semiColon": {
"type": "boolean"
},
"functionDeclaration.semiColon": {
"type": "boolean"
},
"ifStatement.semiColon": {

@@ -104,6 +155,45 @@ "type": "boolean"

},
"importEqualsDeclaration.semiColon": {
"type": "boolean"
},
"indexSignature.semiColon": {
"type": "boolean"
},
"mappedType.semiColon": {
"type": "boolean"
},
"methodSignature.semiColon": {
"type": "boolean"
},
"moduleDeclaration.semiColon": {
"type": "boolean"
},
"namespaceExportDeclaration.semiColon": {
"type": "boolean"
},
"propertySignature.semiColon": {
"type": "boolean"
},
"returnStatement.semiColon": {
"type": "boolean"
},
"throwStatement.semiColon": {
"type": "boolean"
},
"typeAlias.semiColon": {
"type": "boolean"
},
"variableStatement.semiColon": {
"type": "boolean"
},
"forInStatement.useBraces": {
"$ref": "#/definitions/useBraces"
},
"forOfStatement.useBraces": {
"$ref": "#/definitions/useBraces"
},
"forStatement.useBraces": {
"$ref": "#/definitions/useBraces"
},
"ifStatement.useBraces": {

@@ -116,14 +206,47 @@ "$ref": "#/definitions/useBraces"

"arrowFunctionExpression.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"classDeclaration.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"classExpression.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"classMethod.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"doWhileStatement.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"enumDeclaration.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"forInStatement.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"forOfStatement.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"forStatement.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"functionDeclaration.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"functionExpression.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"ifStatement.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"interfaceDeclaration.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"moduleDeclaration.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"switchStatement.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"tryStatement.bracePosition": {

@@ -141,4 +264,20 @@ "$ref": "#/definitions/bracePosition"

"$ref": "#/definitions/nextControlFlowPosition"
},
"arrayExpression.trailingCommas": {
"$ref": "#/definitions/trailingCommas"
},
"arrayPattern.trailingCommas": {
"$ref": "#/definitions/trailingCommas"
},
"enumDeclaration.trailingCommas": {
"$ref": "#/definitions/trailingCommas"
},
"objectExpression.trailingCommas": {
"$ref": "#/definitions/trailingCommas"
},
"tupleType.trailingCommas": {
"$ref": "#/definitions/trailingCommas"
}
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc