Skip to content
This repository was archived by the owner on Oct 1, 2019. It is now read-only.

Commit f365ae9

Browse files
committed
Remote copy of utils from the main prettier repo, use the exported shared utils instead
1 parent d5605f4 commit f365ae9

3 files changed

Lines changed: 5 additions & 52 deletions

File tree

src/_util-from-prettier.js

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/index.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use strict";
22

3-
const utilShared = require("prettier").util;
4-
const util = require("./_util-from-prettier");
3+
const util = require("prettier").util;
54
const parse = require("./parser");
65
const print = require("./printer");
76

@@ -43,9 +42,7 @@ function locStart(node) {
4342
return node.start;
4443
}
4544
if (node.source) {
46-
return (
47-
utilShared.lineColumnToIndex(node.source.start, node.source.input.css) - 1
48-
);
45+
return util.lineColumnToIndex(node.source.start, node.source.input.css) - 1;
4946
}
5047
if (node.loc) {
5148
return node.loc.start;
@@ -55,7 +52,7 @@ function locStart(node) {
5552
function locEnd(node) {
5653
// This function is copied from the code that used to live in the main prettier repo.
5754

58-
const endNode = node.nodes && utilShared.getLast(node.nodes);
55+
const endNode = node.nodes && util.getLast(node.nodes);
5956
if (endNode && node.source && !node.source.end) {
6057
node = endNode;
6158
}
@@ -66,7 +63,7 @@ function locEnd(node) {
6663
} else if (typeof node.end === "number") {
6764
loc = node.end;
6865
} else if (node.source) {
69-
loc = utilShared.lineColumnToIndex(node.source.end, node.source.input.css);
66+
loc = util.lineColumnToIndex(node.source.end, node.source.input.css);
7067
}
7168

7269
if (node.__location) {
@@ -136,7 +133,6 @@ function clean(ast, newObj) {
136133
const printers = {
137134
python: {
138135
print,
139-
hasPrettierIgnore: util.hasIgnoreComment,
140136
printComment,
141137
canAttachComment,
142138
massageAstNode: clean

src/printer/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22

3-
const util = require("../_util-from-prettier");
3+
const util = require("prettier").util;
44
const tokens = require("./tokens");
55

66
const docBuilders = require("prettier").doc.builders;

0 commit comments

Comments
 (0)