Skip to content

Commit a7d409f

Browse files
authored
Using prettier instead of prettier/standalone and let webpack decide which to use (#540)
* Using Prettier's 'doc' build instead of going through standalone or prettier * prettier/standalone is not required as long as the webpack or the bundler used supports the browser field * using prettier instead of prettier/doc
1 parent a2e441f commit a7d409f

45 files changed

Lines changed: 51 additions & 45 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

jest.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const FULL_TEST = Boolean(process.env.FULL_TEST);
2+
const TEST_STANDALONE = Boolean(process.env.TEST_STANDALONE);
23

34
module.exports = {
45
collectCoverage: FULL_TEST,
@@ -19,6 +20,11 @@ module.exports = {
1920
statements: 100
2021
}
2122
},
23+
moduleNameMapper: {
24+
'^prettier$': TEST_STANDALONE
25+
? '<rootDir>/node_modules/prettier/standalone'
26+
: '<rootDir>/node_modules/prettier'
27+
},
2228
setupFiles: ['<rootDir>/tests/config/setup.js'],
2329
snapshotSerializers: [
2430
'jest-snapshot-serializer-raw',

src/binary-operator-printers/arithmetic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const {
22
doc: {
33
builders: { group, line, indent }
44
}
5-
} = require('prettier/standalone');
5+
} = require('prettier');
66
const comparison = require('./comparison');
77

88
const groupIfNecessaryBuilder = (path) => (doc) => {

src/binary-operator-printers/assignment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const {
22
doc: {
33
builders: { group, line, indent }
44
}
5-
} = require('prettier/standalone');
5+
} = require('prettier');
66

77
module.exports = {
88
match: (op) =>

src/binary-operator-printers/comparison.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const {
22
doc: {
33
builders: { group, line, indent }
44
}
5-
} = require('prettier/standalone');
5+
} = require('prettier');
66

77
const indentIfNecessaryBuilder = (path) => (doc) => {
88
let node = path.getNode();

src/binary-operator-printers/exponentiation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const {
22
doc: {
33
builders: { group, ifBreak, indent, softline }
44
}
5-
} = require('prettier/standalone');
5+
} = require('prettier');
66

77
module.exports = {
88
match: (op) => op === '**',

src/binary-operator-printers/logical.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const {
22
doc: {
33
builders: { group, line, indent }
44
}
5-
} = require('prettier/standalone');
5+
} = require('prettier');
66

77
const groupIfNecessaryBuilder = (path) => (doc) =>
88
path.getParentNode().type === 'BinaryOperation' ? doc : group(doc);

src/nodes/AssemblyAssignment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const {
22
doc: {
33
builders: { join }
44
}
5-
} = require('prettier/standalone');
5+
} = require('prettier');
66

77
const AssemblyAssignment = {
88
print: ({ path, print }) =>

src/nodes/AssemblyBlock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const {
22
doc: {
33
builders: { hardline }
44
}
5-
} = require('prettier/standalone');
5+
} = require('prettier');
66

77
const printSeparatedItem = require('./print-separated-item');
88
const printComments = require('./print-comments');

src/nodes/AssemblyFor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const {
22
doc: {
33
builders: { join }
44
}
5-
} = require('prettier/standalone');
5+
} = require('prettier');
66

77
const AssemblyFor = {
88
print: ({ path, print }) =>

src/nodes/AssemblyFunctionDefinition.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const {
22
doc: {
33
builders: { group, line }
44
}
5-
} = require('prettier/standalone');
5+
} = require('prettier');
66

77
const printSeparatedItem = require('./print-separated-item');
88
const printSeparatedList = require('./print-separated-list');

0 commit comments

Comments
 (0)