Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dprint

Package Overview
Dependencies
Maintainers
1
Versions
119
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.1.0 to 0.2.0

LICENSE

52

lib/dprint.d.ts

@@ -14,2 +14,9 @@ /**

/**
* Specify the type of project this is. You may specify any of the allowed values here according to your conscience.
* @value "openSource" - Dprint is formatting an open source project.
* @value "commercialSponsored" - Dprint is formatting a closed source commercial project and your company sponsored dprint.
* @value "commercialDidNotSponsor" - Dprint is formatting a closed source commercial project and you want to forever enshrine your name in source control for having specified this.
*/
projectType?: "openSource" | "commercialSponsored" | "commercialDidNotSponsor";
/**
* The width of a line the printer will try to stay under. Note that the printer may exceed this width in certain cases.

@@ -23,3 +30,3 @@ * @default 120

*/
indentSize?: number;
indentWidth?: number;
/**

@@ -83,2 +90,32 @@ * Whether to use tabs (true) or spaces (false).

/**
* The width of a line the printer will try to stay under. Note that the printer may exceed this width in certain cases.
* @default 120
*/
"typescript.lineWidth"?: number;
/**
* The width of a line the printer will try to stay under. Note that the printer may exceed this width in certain cases.
* @default 120
*/
"json.lineWidth"?: number;
/**
* The number of spaces for an indent. This option is ignored when using tabs.
* @default 4
*/
"typescript.indentWidth"?: number;
/**
* The number of spaces for an indent. This option is ignored when using tabs.
* @default 4
*/
"json.indentWidth"?: number;
/**
* Whether to use tabs (true) or spaces (false).
* @default false
*/
"typescript.useTabs"?: boolean;
/**
* Whether to use tabs (true) or spaces (false).
* @default false
*/
"json.useTabs"?: boolean;
/**
* How to space the members of an enum.

@@ -370,3 +407,3 @@ * @default "newline"

/** The property name the problem occurred on. */
propertyName: string;
propertyName: keyof Configuration;
/** The diagnostic's message. */

@@ -394,7 +431,10 @@ message: string;

export interface ResolvedConfiguration {
lineWidth: number;
indentSize: number;
useTabs: boolean;
singleQuotes: boolean;
newlineKind: "auto" | "\r\n" | "\n";
"typescript.lineWidth": NonNullable<Configuration["lineWidth"]>;
"json.lineWidth": NonNullable<Configuration["lineWidth"]>;
"typescript.indentWidth": NonNullable<Configuration["indentWidth"]>;
"json.indentWidth": NonNullable<Configuration["indentWidth"]>;
"typescript.useTabs": NonNullable<Configuration["useTabs"]>;
"json.useTabs": NonNullable<Configuration["useTabs"]>;
"enumDeclaration.memberSpacing": NonNullable<Configuration["enumDeclaration.memberSpacing"]>;

@@ -471,2 +511,3 @@ "breakStatement.semiColon": boolean;

error(text: string): void;
basename(fileOrDirPath: string): string;
resolvePath(fileOrDirPath: string): string;

@@ -484,2 +525,3 @@ readFile(filePath: string): Promise<string>;

resolvePath(path: string): string;
basename(filePath: string): string;
readFile(filePath: string): Promise<string>;

@@ -486,0 +528,0 @@ writeFile(filePath: string, text: string): Promise<void>;

7

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

@@ -16,3 +16,3 @@ "main": "dist/index.js",

"generate-config-from-schema": "ts-node --compiler ttypescript --project scripts/tsconfig.json --transpile-only scripts/generateConfigFromSchema",
"format": "ts-node --compiler ttypescript --transpile-only src/cli-bin.ts \"src/**/*.ts\" \"scripts/**/*.ts\"",
"format": "ts-node --compiler ttypescript --transpile-only src/cli-bin.ts \"**/*{.ts|.json}\"",
"type-check": "tsc --project tsconfig.json --noEmit",

@@ -30,3 +30,3 @@ "test": "cross-env TS_NODE_COMPILER=\"ttypescript\" TS_NODE_TRANSPILE_ONLY=\"true\" mocha --opts mocha.opts",

"author": "David Sherret",
"license": "No License",
"license": "MIT",
"bugs": {

@@ -41,2 +41,3 @@ "url": "https://github.com/dsherret/dprint/issues"

"globby": "^10.0.1",
"jsonc-parser": "^2.1.0",
"minimist": "^1.2.0"

@@ -43,0 +44,0 @@ },

@@ -15,8 +15,2 @@ # dprint

2. Satisfy my formatting needs.
3. TypeScript and probably JSON support.
## Licence
No licence for the time being. That means you are not legally allowed to use this, make any changes/derivitives, or provide contributions.
Copyright (c) 2019 David Sherret.
3. TypeScript and JSON support.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "dprint configuration",
"type": "object",
"definitions": {
"useBraces": {
"type": "string",
"description": "If braces should be used or not.",
"oneOf": [
{ "const": "maintain", "description": "Uses braces if they're used. Doesn't use braces if they're not used." },
{ "const": "always", "description": "Forces the use of braces. Will add them if they aren't used." },
{ "const": "preferNone", "description": "Forces no braces when when the header is one line and body is one line. Otherwise forces braces." }
],
"default": "maintain"
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "dprint configuration",
"type": "object",
"definitions": {
"indentWidth": {
"type": "number",
"description": "The number of spaces for an indent. This option is ignored when using tabs.",
"default": 4
},
"lineWidth": {
"type": "number",
"description": "The width of a line the printer will try to stay under. Note that the printer may exceed this width in certain cases.",
"default": 120
},
"useTabs": {
"type": "boolean",
"description": "Whether to use tabs (true) or spaces (false).",
"default": false
},
"bracePosition": {
"type": "string",
"description": "Where to place the brace.",
"oneOf": [
{ "const": "maintain", "description": "Maintains the brace being on the next line or the same line." },
{ "const": "sameLine", "description": "Forces the brace to be on the same line." },
{ "const": "nextLine", "description": "Forces the brace to be on the next line." },
{ "const": "nextLineIfHanging", "description": "Forces the brace to be on the next line if the same line is hanging, but otherwise uses the next." }
],
"default": "nextLineIfHanging"
},
"nextControlFlowPosition": {
"type": "string",
"description": "Where to place the next control flow within a control flow statement.",
"oneOf": [
{ "const": "maintain", "description": "Maintains the next control flow being on the next line or the same line." },
{ "const": "sameLine", "description": "Forces the next control flow to be on the same line." },
{ "const": "nextLine", "description": "Forces the next control flow to be on the next line." }
],
"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"
},
"useBraces": {
"type": "string",
"description": "If braces should be used or not.",
"oneOf": [
{ "const": "maintain", "description": "Uses braces if they're used. Doesn't use braces if they're not used." },
{ "const": "always", "description": "Forces the use of braces. Will add them if they aren't used." },
{ "const": "preferNone", "description": "Forces no braces when when the header is one line and body is one line. Otherwise forces braces." }
],
"default": "maintain"
}
},
"required": ["projectType"],
"properties": {
"projectType": {
"type": "string",
"description": "Specify the type of project this is. You may specify any of the possible values here according to your conscience.",
"oneOf": [
{
"const": "openSource",
"description": "Dprint is formatting an open source project."
},
"bracePosition": {
"type": "string",
"description": "Where to place the brace.",
"oneOf": [
{ "const": "maintain", "description": "Maintains the brace being on the next line or the same line." },
{ "const": "sameLine", "description": "Forces the brace to be on the same line." },
{ "const": "nextLine", "description": "Forces the brace to be on the next line." },
{ "const": "nextLineIfHanging", "description": "Forces the brace to be on the next line if the same line is hanging, but otherwise uses the next." }
],
"default": "nextLineIfHanging"
{
"const": "commercialSponsored",
"description": "Dprint is formatting a closed source commercial project and your company sponsored dprint."
},
"nextControlFlowPosition": {
"type": "string",
"description": "Where to place the next control flow within a control flow statement.",
"oneOf": [
{ "const": "maintain", "description": "Maintains the next control flow being on the next line or the same line." },
{ "const": "sameLine", "description": "Forces the next control flow to be on the same line." },
{ "const": "nextLine", "description": "Forces the next control flow to be on the next line." }
],
"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"
{
"const": "commercialDidNotSponsor",
"description": "Dprint is formatting a closed source commercial project and you want to forever enshrine your name in source control for having specified this."
}
]
},
"properties": {
"lineWidth": {
"type": "number",
"description": "The width of a line the printer will try to stay under. Note that the printer may exceed this width in certain cases.",
"default": 120
},
"indentSize": {
"type": "number",
"description": "The number of spaces for an indent. This option is ignored when using tabs.",
"default": 4
},
"useTabs": {
"type": "boolean",
"description": "Whether to use tabs (true) or spaces (false).",
"default": false
},
"semiColons": {
"type": "boolean",
"description": "Whether statements should use semi-colons.",
"default": true
},
"singleQuotes": {
"type": "boolean",
"description": "Whether to use single quotes (true) or double quotes (false).",
"default": false
},
"newlineKind": {
"type": "string",
"description": "The kind of newline to use.",
"oneOf": [
{ "const": "auto", "description": "For each file, uses the newline kind found at the end of the last line." },
{ "const": "crlf", "description": "Uses carriage return, line feed." },
{ "const": "lf", "description": "Uses line feed." },
{ "const": "system", "description": "Uses the system standard (ex. crlf on Windows)." }
],
"default": "auto"
},
"useBraces": {
"$ref": "#/definitions/useBraces"
},
"bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"nextControlFlowPosition": {
"$ref": "#/definitions/nextControlFlowPosition"
},
"trailingCommas": {
"$ref": "#/definitions/trailingCommas"
},
"lineWidth": {
"$ref": "#/definitions/lineWidth"
},
"indentWidth": {
"$ref": "#/definitions/indentWidth"
},
"useTabs": {
"$ref": "#/definitions/useTabs"
},
"semiColons": {
"type": "boolean",
"description": "Whether statements should use semi-colons.",
"default": true
},
"singleQuotes": {
"type": "boolean",
"description": "Whether to use single quotes (true) or double quotes (false).",
"default": false
},
"newlineKind": {
"type": "string",
"description": "The kind of newline to use.",
"oneOf": [
{ "const": "auto", "description": "For each file, uses the newline kind found at the end of the last line." },
{ "const": "crlf", "description": "Uses carriage return, line feed." },
{ "const": "lf", "description": "Uses line feed." },
{ "const": "system", "description": "Uses the system standard (ex. crlf on Windows)." }
],
"default": "auto"
},
"useBraces": {
"$ref": "#/definitions/useBraces"
},
"bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"nextControlFlowPosition": {
"$ref": "#/definitions/nextControlFlowPosition"
},
"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"
},
"typescript.lineWidth": {
"$ref": "#/definitions/lineWidth"
},
"json.lineWidth": {
"$ref": "#/definitions/lineWidth"
},
"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": {
"type": "boolean"
},
"doWhileStatement.semiColon": {
"type": "boolean"
},
"exportAssignment.semiColon": {
"type": "boolean"
},
"expressionStatement.semiColon": {
"type": "boolean"
},
"functionDeclaration.semiColon": {
"type": "boolean"
},
"ifStatement.semiColon": {
"type": "boolean"
},
"importDeclaration.semiColon": {
"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"
},
"typescript.indentWidth": {
"$ref": "#/definitions/indentWidth"
},
"json.indentWidth": {
"$ref": "#/definitions/indentWidth"
},
"forInStatement.useBraces": {
"$ref": "#/definitions/useBraces"
},
"forOfStatement.useBraces": {
"$ref": "#/definitions/useBraces"
},
"forStatement.useBraces": {
"$ref": "#/definitions/useBraces"
},
"ifStatement.useBraces": {
"$ref": "#/definitions/useBraces"
},
"whileStatement.useBraces": {
"$ref": "#/definitions/useBraces"
},
"typescript.useTabs": {
"$ref": "#/definitions/useTabs"
},
"json.useTabs": {
"$ref": "#/definitions/useTabs"
},
"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": {
"$ref": "#/definitions/bracePosition"
},
"whileStatement.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"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"
},
"ifStatement.nextControlFlowPosition": {
"$ref": "#/definitions/nextControlFlowPosition"
},
"tryStatement.nextControlFlowPosition": {
"$ref": "#/definitions/nextControlFlowPosition"
},
"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": {
"type": "boolean"
},
"doWhileStatement.semiColon": {
"type": "boolean"
},
"exportAssignment.semiColon": {
"type": "boolean"
},
"expressionStatement.semiColon": {
"type": "boolean"
},
"functionDeclaration.semiColon": {
"type": "boolean"
},
"ifStatement.semiColon": {
"type": "boolean"
},
"importDeclaration.semiColon": {
"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"
},
"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"
}
"forInStatement.useBraces": {
"$ref": "#/definitions/useBraces"
},
"forOfStatement.useBraces": {
"$ref": "#/definitions/useBraces"
},
"forStatement.useBraces": {
"$ref": "#/definitions/useBraces"
},
"ifStatement.useBraces": {
"$ref": "#/definitions/useBraces"
},
"whileStatement.useBraces": {
"$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": {
"$ref": "#/definitions/bracePosition"
},
"whileStatement.bracePosition": {
"$ref": "#/definitions/bracePosition"
},
"ifStatement.nextControlFlowPosition": {
"$ref": "#/definitions/nextControlFlowPosition"
},
"tryStatement.nextControlFlowPosition": {
"$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