Skip to content

Commit

Permalink
Bump Prettier dependency to 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thorn0 committed Mar 21, 2020
1 parent 5b3028e commit 9dad95b
Show file tree
Hide file tree
Showing 229 changed files with 2,092 additions and 2,078 deletions.
4 changes: 2 additions & 2 deletions commands.md
Expand Up @@ -35,10 +35,10 @@ However, if any of the items inside the array have a hard break, the array will
```js
[
1,
function() {
function () {
return 2;
},
3
3,
];
```

Expand Down
8 changes: 4 additions & 4 deletions docs/api.md
Expand Up @@ -44,7 +44,7 @@ If `options.useCache` is `false`, all caching will be bypassed.

```js
const text = fs.readFileSync(filePath, "utf8");
prettier.resolveConfig(filePath).then(options => {
prettier.resolveConfig(filePath).then((options) => {
const formatted = prettier.format(text, options);
});
```
Expand All @@ -70,8 +70,8 @@ The promise will be rejected if there was an error parsing the configuration fil
The search starts at `process.cwd()`, or at `filePath` if provided. Please see the [cosmiconfig docs](https://github.com/davidtheclark/cosmiconfig#explorersearch) for details on how the resolving works.

```js
prettier.resolveConfigFile().then(filePath => {
prettier.resolveConfig(filePath).then(options => {
prettier.resolveConfigFile().then((filePath) => {
prettier.resolveConfig(filePath).then((options) => {
const formatted = prettier.format(text, options);
});
});
Expand Down Expand Up @@ -146,7 +146,7 @@ prettier.format("lodash ( )", {
const ast = babel(text);
ast.program.body[0].expression.callee.name = "_";
return ast;
}
},
});
// -> "_();\n"
```
Expand Down
6 changes: 3 additions & 3 deletions docs/browser.md
Expand Up @@ -21,7 +21,7 @@ See [Usage](#usage) below for examples.
<script>
prettier.format("query { }", {
parser: "graphql",
plugins: prettierPlugins
plugins: prettierPlugins,
});
</script>
```
Expand All @@ -34,7 +34,7 @@ import parserGraphql from "prettier/parser-graphql";

prettier.format("query { }", {
parser: "graphql",
plugins: [parserGraphql]
plugins: [parserGraphql],
});
```

Expand All @@ -43,7 +43,7 @@ prettier.format("query { }", {
```js
define([
"https://unpkg.com/prettier@2.0.0/standalone.js",
"https://unpkg.com/prettier@2.0.0/parser-graphql.js"
"https://unpkg.com/prettier@2.0.0/parser-graphql.js",
], (prettier, ...plugins) => {
prettier.format("query { }", { parser: "graphql", plugins });
});
Expand Down
4 changes: 2 additions & 2 deletions docs/configuration.md
Expand Up @@ -35,7 +35,7 @@ module.exports = {
trailingComma: "es5",
tabWidth: 4,
semi: false,
singleQuote: true
singleQuote: true,
};
```

Expand Down Expand Up @@ -129,7 +129,7 @@ An example configuration repository is available [here](https://github.com/azz/p
> ```js
> module.exports = {
> ...require("@company/prettier-config"),
> semi: false
> semi: false,
> };
> ```
Expand Down
16 changes: 8 additions & 8 deletions docs/plugins.md
Expand Up @@ -27,7 +27,7 @@ When plugins cannot be found automatically, you can load them with:
prettier.format("code", {
parser: "foo",
pluginSearchDirs: ["./dir-with-plugins"],
plugins: ["./foo-plugin"]
plugins: ["./foo-plugin"],
});
```

Expand Down Expand Up @@ -79,8 +79,8 @@ export const languages = [
name: "InterpretedDanceScript",
// Parsers that can parse this language.
// This can be built-in parsers, or parsers you have contributed via this plugin.
parsers: ["dance-parse"]
}
parsers: ["dance-parse"],
},
];
```

Expand All @@ -99,8 +99,8 @@ export const parsers = {
hasPragma,
locStart,
locEnd,
preprocess
}
preprocess,
},
};
```

Expand Down Expand Up @@ -139,8 +139,8 @@ export const printers = {
"dance-ast": {
print,
embed,
insertPragma
}
insertPragma,
},
};
```

Expand Down Expand Up @@ -264,7 +264,7 @@ const prettier = require("prettier");
const code = "(add 1 2)";
prettier.format(code, {
parser: "lisp",
plugins: ["."]
plugins: ["."],
});
```

Expand Down
8 changes: 4 additions & 4 deletions docs/rationale.md
Expand Up @@ -36,7 +36,7 @@ By default, Prettier’s printing algorithm prints expressions on a single line
```js
const user = {
name: "John Doe",
age: 30
age: 30,
};
```

Expand Down Expand Up @@ -68,7 +68,7 @@ const user = {
```js
const user = {
name: "John Doe",
age: 30
age: 30,
};
```

Expand All @@ -84,7 +84,7 @@ Just like with objects, decorators are used for a lot of different things. Somet
```js
@Component({
selector: "hero-button",
template: `<button>{{label}}</button>`
template: `<button>{{ label }}</button>`,
})
class HeroButtonComponent {
// These decorators were written inline and fit on the line so they stay
Expand Down Expand Up @@ -198,7 +198,7 @@ Prettier can break long `import` statements across several lines:
```js
import {
CollectionDashboard,
DashboardPlaceholder
DashboardPlaceholder,
} from "../components/collections/collection-dashboard/main";
```

Expand Down
10 changes: 5 additions & 5 deletions jest.config.js
Expand Up @@ -8,7 +8,7 @@ module.exports = {
setupFiles: ["<rootDir>/tests_config/run_spec.js"],
snapshotSerializers: [
"jest-snapshot-serializer-raw",
"jest-snapshot-serializer-ansi"
"jest-snapshot-serializer-ansi",
],
testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$",
testPathIgnorePatterns: ["tests/new_react", "tests/more_react"],
Expand All @@ -17,7 +17,7 @@ module.exports = {
coveragePathIgnorePatterns: [
"<rootDir>/standalone.js",
"<rootDir>/src/doc/doc-debug.js",
"<rootDir>/src/main/massage-ast.js"
"<rootDir>/src/main/massage-ast.js",
],
coverageReporters: ["text", "html", "cobertura"],
moduleNameMapper: {
Expand All @@ -28,13 +28,13 @@ module.exports = {
"graceful-fs": "<rootDir>/tests_config/fs.js",

"prettier/local": "<rootDir>/tests_config/require_prettier.js",
"prettier/standalone": "<rootDir>/tests_config/require_standalone.js"
"prettier/standalone": "<rootDir>/tests_config/require_standalone.js",
},
testEnvironment: "node",
transform: {},
watchPlugins: [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname"
"jest-watch-typeahead/testname",
],
reporters: ["default"].concat(ENABLE_TEST_RESULTS ? "jest-junit" : [])
reporters: ["default"].concat(ENABLE_TEST_RESULTS ? "jest-junit" : []),
};
4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "2.0.0",
"version": "2.1.0-dev",
"description": "Prettier is an opinionated code formatter",
"bin": "./bin/prettier.js",
"repository": "prettier/prettier",
Expand Down Expand Up @@ -97,7 +97,7 @@
"jest-snapshot-serializer-ansi": "1.0.0",
"jest-snapshot-serializer-raw": "1.1.0",
"jest-watch-typeahead": "0.4.2",
"prettier": "1.19.1",
"prettier": "2.0.0",
"rimraf": "3.0.2",
"rollup": "2.1.0",
"rollup-plugin-babel": "4.4.0",
Expand Down
6 changes: 3 additions & 3 deletions scripts/build/babel-plugins/transform-custom-require.js
Expand Up @@ -12,7 +12,7 @@
// require.cache
//

module.exports = function(babel) {
module.exports = function (babel) {
const t = babel.types;

return {
Expand Down Expand Up @@ -40,8 +40,8 @@ module.exports = function(babel) {
)
);
}
}
}
},
},
};

function isEvalRequire(node) {
Expand Down
12 changes: 6 additions & 6 deletions scripts/build/build.js
Expand Up @@ -13,7 +13,7 @@ const Cache = require("./cache");

// Errors in promises should be fatal.
const loggedErrors = new Set();
process.on("unhandledRejection", err => {
process.on("unhandledRejection", (err) => {
// No need to print it twice.
if (!loggedErrors.has(err)) {
console.error(err);
Expand All @@ -39,11 +39,11 @@ async function createBundle(bundleConfig, cache) {
process.stdout.write(fitTerminal(output));

return bundler(bundleConfig, cache)
.catch(error => {
.catch((error) => {
console.log(FAIL + "\n");
handleError(error);
})
.then(result => {
.then((result) => {
if (result.cached) {
console.log(CACHED);
} else {
Expand All @@ -66,7 +66,7 @@ async function cacheFiles() {
for (const bundleConfig of bundleConfigs) {
await execa("cp", [
path.join("dist", bundleConfig.output),
path.join(".cache", "files")
path.join(".cache", "files"),
]);
}
} catch (err) {
Expand All @@ -81,7 +81,7 @@ async function preparePackage() {
delete pkg.devDependencies;
pkg.scripts = {
prepublishOnly:
"node -e \"assert.equal(require('.').version, require('..').version)\""
"node -e \"assert.equal(require('.').version, require('..').version)\"",
};
pkg.files = ["*.js"];
await util.writeJson("dist/package.json", pkg);
Expand Down Expand Up @@ -114,6 +114,6 @@ async function run(params) {

run(
minimist(process.argv.slice(2), {
boolean: ["purge-cache"]
boolean: ["purge-cache"],
})
);

0 comments on commit 9dad95b

Please sign in to comment.