Skip to content

Commit

Permalink
style: reformat with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
zackad committed Apr 13, 2024
1 parent 645e817 commit 34e4c4c
Show file tree
Hide file tree
Showing 51 changed files with 246 additions and 302 deletions.
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use strict";

import { print } from './printer.js';
import { parse } from './parser.js';
import * as symbols from './util/publicSymbols.js';
import * as publicFunctions from './util/publicFunctions.js';
import { print } from "./printer.js";
import { parse } from "./parser.js";
import * as symbols from "./util/publicSymbols.js";
import * as publicFunctions from "./util/publicFunctions.js";

const languages = [
{
Expand Down
14 changes: 7 additions & 7 deletions src/parser.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { CharStream, Lexer, TokenStream, Parser } from 'melody-parser';
import { extension as coreExtension } from 'melody-extension-core';
import { getAdditionalMelodyExtensions, getPluginPathsFromOptions } from './util/index.js';
import { CharStream, Lexer, TokenStream, Parser } from "melody-parser";
import { extension as coreExtension } from "melody-extension-core";
import {
getAdditionalMelodyExtensions,
getPluginPathsFromOptions
} from "./util/index.js";

const ORIGINAL_SOURCE = Symbol("ORIGINAL_SOURCE");

Expand Down Expand Up @@ -83,7 +86,4 @@ const parse = (text, parsers, options) => {
return ast;
};

export {
parse,
ORIGINAL_SOURCE
};
export { parse, ORIGINAL_SOURCE };
4 changes: 1 addition & 3 deletions src/print/AliasExpression.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ const p = (node, path, print) => {
return [path.call(print, "name"), " as ", path.call(print, "alias")];
};

export {
p as printAliasExpression
};
export { p as printAliasExpression };
8 changes: 3 additions & 5 deletions src/print/ArrayExpression.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import prettier from 'prettier';
import prettier from "prettier";
const { group, softline, line, indent, join } = prettier.doc.builders;
import { STRING_NEEDS_QUOTES } from '../util/index.js';
import { STRING_NEEDS_QUOTES } from "../util/index.js";

const p = (node, path, print) => {
node[STRING_NEEDS_QUOTES] = true;
Expand All @@ -10,6 +10,4 @@ const p = (node, path, print) => {
return group(["[", indent(indentedContent), softline, "]"]);
};

export {
p as printArrayExpression
};
export { p as printArrayExpression };
8 changes: 3 additions & 5 deletions src/print/Attribute.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EXPRESSION_NEEDED, STRING_NEEDS_QUOTES } from '../util/index.js';
import { Node } from 'melody-types';
import { EXPRESSION_NEEDED, STRING_NEEDS_QUOTES } from "../util/index.js";
import { Node } from "melody-types";

const mayCorrectWhitespace = attrName =>
["id", "class", "type"].indexOf(attrName) > -1;
Expand Down Expand Up @@ -47,6 +47,4 @@ const p = (node, path, print = print) => {
return docs;
};

export {
p as printAttribute
};
export { p as printAttribute };
8 changes: 3 additions & 5 deletions src/print/AutoescapeBlock.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import prettier from 'prettier';
import prettier from "prettier";
const { hardline } = prettier.doc.builders;
import { printChildBlock, quoteChar } from '../util/index.js';
import { printChildBlock, quoteChar } from "../util/index.js";

const createOpener = (node, options) => {
return [
Expand All @@ -27,6 +27,4 @@ const p = (node, path, print, options) => {
return parts;
};

export {
p as printAutoescapeBlock
};
export { p as printAutoescapeBlock };
14 changes: 6 additions & 8 deletions src/print/BinaryExpression.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import prettier from 'prettier';
import prettier from "prettier";
const { group, line, softline, indent } = prettier.doc.builders;
import { Node } from 'melody-types';
import { Node } from "melody-types";

import {
EXPRESSION_NEEDED,
Expand All @@ -10,10 +10,10 @@ import {
IS_ROOT_LOGICAL_EXPRESSION,
firstValueInAncestorChain,
findParentNode,
wrapExpressionIfNeeded,
} from '../util/index.js';
wrapExpressionIfNeeded
} from "../util/index.js";

import { extension as coreExtension } from 'melody-extension-core';
import { extension as coreExtension } from "melody-extension-core";
const ALREADY_INDENTED = Symbol("ALREADY_INDENTED");
const OPERATOR_PRECEDENCE = Symbol("OPERATOR_PRECEDENCE");
const NO_WHITESPACE_AROUND = [".."];
Expand Down Expand Up @@ -153,6 +153,4 @@ const p = (node, path, print, options) => {
return printBinaryExpression(node, path, print);
};

export {
p as printBinaryExpression
};
export { p as printBinaryExpression };
10 changes: 4 additions & 6 deletions src/print/BlockStatement.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import prettier from 'prettier';
import prettier from "prettier";
const { hardline, group } = prettier.doc.builders;
import { Node } from 'melody-types';
import { EXPRESSION_NEEDED, printChildBlock } from '../util/index.js';
import { Node } from "melody-types";
import { EXPRESSION_NEEDED, printChildBlock } from "../util/index.js";

const p = (node, path, print, options) => {
node[EXPRESSION_NEEDED] = false;
Expand Down Expand Up @@ -44,6 +44,4 @@ const p = (node, path, print, options) => {
}
};

export {
p as printBlockStatement
};
export { p as printBlockStatement };
14 changes: 8 additions & 6 deletions src/print/CallExpression.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import prettier from 'prettier';
import prettier from "prettier";
const { group, softline, line, indent, join } = prettier.doc.builders;
import { EXPRESSION_NEEDED, STRING_NEEDS_QUOTES, wrapExpressionIfNeeded } from '../util/index.js';
import { Node } from 'melody-types';
import {
EXPRESSION_NEEDED,
STRING_NEEDS_QUOTES,
wrapExpressionIfNeeded
} from "../util/index.js";
import { Node } from "melody-types";

const p = (node, path, print) => {
node[EXPRESSION_NEEDED] = false;
Expand Down Expand Up @@ -30,6 +34,4 @@ const p = (node, path, print) => {
return group(parts);
};

export {
p as printCallExpression
};
export { p as printCallExpression };
12 changes: 7 additions & 5 deletions src/print/ConditionalExpression.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import prettier from 'prettier';
import prettier from "prettier";
const { line, indent, group } = prettier.doc.builders;
import { EXPRESSION_NEEDED, STRING_NEEDS_QUOTES, wrapExpressionIfNeeded } from '../util/index.js';
import {
EXPRESSION_NEEDED,
STRING_NEEDS_QUOTES,
wrapExpressionIfNeeded
} from "../util/index.js";

const p = (node, path, print) => {
node[EXPRESSION_NEEDED] = false;
Expand All @@ -19,6 +23,4 @@ const p = (node, path, print) => {
return group(parts);
};

export {
p as printConditionalExpression
};
export { p as printConditionalExpression };
8 changes: 3 additions & 5 deletions src/print/Declaration.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import prettier from 'prettier';
import prettier from "prettier";
const { fill, join } = prettier.doc.builders;
import { STRING_NEEDS_QUOTES, OVERRIDE_QUOTE_CHAR } from '../util/index.js';
import { STRING_NEEDS_QUOTES, OVERRIDE_QUOTE_CHAR } from "../util/index.js";

const p = (node, path, print) => {
node[STRING_NEEDS_QUOTES] = true;
Expand All @@ -11,6 +11,4 @@ const p = (node, path, print) => {
return fill([start, " ", join(" ", printedParts), ">"]);
};

export {
p as printDeclaration
};
export { p as printDeclaration };
4 changes: 1 addition & 3 deletions src/print/DoStatement.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ const p = (node, path, print) => {
];
};

export {
p as printDoStatement
};
export { p as printDoStatement };
10 changes: 4 additions & 6 deletions src/print/Element.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import prettier from 'prettier';
import prettier from "prettier";
const { group, line, hardline, softline, indent, join } = prettier.doc.builders;

import {
removeSurroundingWhitespace,
isInlineElement,
printChildGroups,
EXPRESSION_NEEDED,
STRING_NEEDS_QUOTES,
} from '../util/index.js';
STRING_NEEDS_QUOTES
} from "../util/index.js";

const printOpeningTag = (node, path, print) => {
const opener = "<" + node.name;
Expand Down Expand Up @@ -60,6 +60,4 @@ const p = (node, path, print) => {
return openingGroup;
};

export {
p as printElement
};
export { p as printElement };
12 changes: 7 additions & 5 deletions src/print/EmbedStatement.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import prettier from 'prettier';
import prettier from "prettier";
const { indent, hardline, line, group } = prettier.doc.builders;
import { EXPRESSION_NEEDED, STRING_NEEDS_QUOTES, printChildBlock } from '../util/index.js';
import {
EXPRESSION_NEEDED,
STRING_NEEDS_QUOTES,
printChildBlock
} from "../util/index.js";

const printOpener = (node, path, print) => {
node[EXPRESSION_NEEDED] = false;
Expand Down Expand Up @@ -30,6 +34,4 @@ const p = (node, path, print) => {
return [printedOpener, children, closing];
};

export {
p as printEmbedStatement
};
export { p as printEmbedStatement };
14 changes: 8 additions & 6 deletions src/print/ExpressionStatement.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import prettier from 'prettier';
import prettier from "prettier";
const { group, indent, line } = prettier.doc.builders;
import { EXPRESSION_NEEDED, STRING_NEEDS_QUOTES, isContractableNodeType } from '../util/index.js';
import { Node } from 'melody-types';
import {
EXPRESSION_NEEDED,
STRING_NEEDS_QUOTES,
isContractableNodeType
} from "../util/index.js";
import { Node } from "melody-types";

const p = (node, path, print) => {
node[EXPRESSION_NEEDED] = false;
Expand All @@ -17,6 +21,4 @@ const p = (node, path, print) => {
return group([opener, value, padding, closing]);
};

export {
p as printExpressionStatement
};
export { p as printExpressionStatement };
6 changes: 2 additions & 4 deletions src/print/ExtendsStatement.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { STRING_NEEDS_QUOTES } from '../util/index.js';
import { STRING_NEEDS_QUOTES } from "../util/index.js";

const p = (node, path, print) => {
node[STRING_NEEDS_QUOTES] = true;
Expand All @@ -10,6 +10,4 @@ const p = (node, path, print) => {
];
};

export {
p as printExtendsStatement
};
export { p as printExtendsStatement };
8 changes: 3 additions & 5 deletions src/print/FilterBlockStatement.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import prettier from 'prettier';
import prettier from "prettier";
const { group, line, hardline } = prettier.doc.builders;
import { FILTER_BLOCK, printChildBlock } from '../util/index.js';
import { FILTER_BLOCK, printChildBlock } from "../util/index.js";

const printOpeningGroup = (node, path, print) => {
const parts = [node.trimLeft ? "{%- " : "{% "];
Expand All @@ -23,6 +23,4 @@ const p = (node, path, print) => {
return [openingGroup, body, closingStatement];
};

export {
p as printFilterBlockStatement
};
export { p as printFilterBlockStatement };
12 changes: 5 additions & 7 deletions src/print/FilterExpression.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import prettier from 'prettier';
import prettier from "prettier";
const { group, indent, line, softline, join } = prettier.doc.builders;
import { Node } from 'melody-types';
import { Node } from "melody-types";

import {
EXPRESSION_NEEDED,
Expand All @@ -11,8 +11,8 @@ import {
wrapInStringInterpolation,
someParentNode,
isMultipartExpression,
getDeepProperty,
} from '../util/index.js';
getDeepProperty
} from "../util/index.js";

const isInFilterBlock = path =>
someParentNode(path, node => node[FILTER_BLOCK] === true);
Expand Down Expand Up @@ -128,6 +128,4 @@ const p = (node, path, print, options) => {
return group(parts);
};

export {
p as printFilterExpression
};
export { p as printFilterExpression };
4 changes: 1 addition & 3 deletions src/print/FlushStatement.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ const p = (node, path, print) => {
return `{%${dashLeft} flush ${dashRight}%}`;
};

export {
p as printFlushStatement
};
export { p as printFlushStatement };
12 changes: 7 additions & 5 deletions src/print/ForStatement.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import prettier from 'prettier';
import prettier from "prettier";
const { group, indent, line, hardline } = prettier.doc.builders;
import { EXPRESSION_NEEDED, isWhitespaceNode, indentWithHardline } from '../util/index.js';
import {
EXPRESSION_NEEDED,
isWhitespaceNode,
indentWithHardline
} from "../util/index.js";

const printFor = (node, path, print) => {
const parts = [node.trimLeft ? "{%-" : "{%", " for "];
Expand Down Expand Up @@ -50,6 +54,4 @@ const p = (node, path, print) => {
return parts;
};

export {
p as printForStatement
};
export { p as printForStatement };
8 changes: 3 additions & 5 deletions src/print/FromStatement.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import prettier from 'prettier';
import prettier from "prettier";
const { group, join, line, indent } = prettier.doc.builders;
import { STRING_NEEDS_QUOTES } from '../util/index.js';
import { STRING_NEEDS_QUOTES } from "../util/index.js";

const printImportDeclaration = node => {
const parts = [node.key.name];
Expand Down Expand Up @@ -28,6 +28,4 @@ const p = (node, path, print) => {
]);
};

export {
p as printFromStatement
};
export { p as printFromStatement };
4 changes: 1 addition & 3 deletions src/print/GenericToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ const p = (node, path, print) => {
return node.tokenText;
};

export {
p as printGenericToken
};
export { p as printGenericToken };
Loading

0 comments on commit 34e4c4c

Please sign in to comment.