From 7b387c189ed5dda76498a0b853f6fdfef8af67b5 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 7 Nov 2017 14:29:12 +0100 Subject: [PATCH] Use prettier@1.8.1 --- .github/ISSUE_TEMPLATE.md | 2 +- CONTRIBUTING.md | 8 ++- docs/CLI.md | 2 +- docs/Configuration.md | 35 ++++++------- docs/ExpectAPI.md | 2 +- docs/GettingStarted.md | 16 +++--- docs/Troubleshooting.md | 22 ++++---- docs/TutorialReact.md | 2 +- docs/Webpack.md | 50 +++++++++---------- package.json | 2 +- packages/babel-plugin-jest-hoist/README.md | 2 +- packages/babel-preset-jest/README.md | 2 +- packages/eslint-plugin-jest/README.md | 24 ++++----- packages/pretty-format/README.md | 4 +- ...e-watch-mode-test-platform-improvements.md | 12 ++--- yarn.lock | 6 +-- 16 files changed, 96 insertions(+), 95 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 5c7310325ef3..98bbca702d84 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -11,7 +11,7 @@ Before creating an issue please check the following: * run Jest once with `--no-cache` to see if that fixes the problem you are experiencing. --> -**Do you want to request a _feature_ or report a *bug*?** +**Do you want to request a _feature_ or report a _bug_?** **What is the current behavior?** diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5fa2d737b2c5..a2210a51d30d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,11 +56,15 @@ _Before_ submitting a pull request, please make sure the following is doneā€¦ [Yarn](https://yarnpkg.com/en/docs/install#windows-tab) on Windows you may need to download either node.js or Chocolatey
- yarn install + ```sh + yarn install + ``` To check your version of Yarn and ensure it's installed you can type: - yarn --version + ```sh + yarn --version + ``` 4. If you've added code that should be tested, add tests. You can use watch mode that continuously transforms changed files to make your life easier. diff --git a/docs/CLI.md b/docs/CLI.md index d5f611648de7..f2d0b6a03054 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -259,7 +259,7 @@ Note that `column` is 0-indexed while `line` is not. ```json { "column": 4, - "line": 5, + "line": 5 } ``` diff --git a/docs/Configuration.md b/docs/Configuration.md index 681d3122c9c8..1c7a2e08a134 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -13,8 +13,8 @@ settings: { "name": "my-project", "jest": { - "verbose": true, - }, + "verbose": true + } } ``` @@ -34,7 +34,7 @@ When using the --config option, the JSON file must not contain a "jest" key: ```json { "bail": true, - "verbose": true, + "verbose": true } ``` @@ -118,8 +118,8 @@ Example: "collectCoverageFrom": [ "**/*.{js,jsx}", "!**/node_modules/**", - "!**/vendor/**", - ], + "!**/vendor/**" + ] } ``` @@ -278,8 +278,7 @@ module's location. Setting this option will _override_ the default, if you wish to still search `node_modules` for packages include it along with any other options: `["node_modules", "bower_components"]` -### `moduleNameMapper` [object] +### `moduleNameMapper` [object] Default: `null` @@ -301,9 +300,9 @@ Example: { "moduleNameMapper": { "^image![a-zA-Z0-9$_-]+$": "GlobalImageStub", - "^[./a-zA-Z0-9$_-]+\\.png$": "/RelativeImageStub.js", - "module_name_(.*)": "/substituted_module_$1.js", - }, + "^[./a-zA-Z0-9$_-]+.png$": "/RelativeImageStub.js", + "module_name_(.*)": "/substituted_module_$1.js" + } } ``` @@ -359,7 +358,7 @@ time. ```json { - "projects": ["", "/examples/*"], + "projects": ["", "/examples/*"] } ``` @@ -375,8 +374,7 @@ Automatically clear mock calls and instances between every test. Equivalent to calling `jest.clearAllMocks()` between each test. This does not remove any mock implementation that may have been provided. -### `reporters` [array] +### `reporters` [array] Default: `undefined` @@ -393,7 +391,7 @@ This will override default reporters: ```json { - "reporters": ["/my-custom-reporter.js"], + "reporters": ["/my-custom-reporter.js"] } ``` @@ -402,7 +400,7 @@ provides: ```json { - "reporters": ["default", "/my-custom-reporter.js"], + "reporters": ["default", "/my-custom-reporter.js"] } ``` @@ -413,8 +411,8 @@ as a second argument: { "reporters": [ "default", - ["/my-custom-reporter.js", {"banana": "yes", "pineapple": "no"}], - ], + ["/my-custom-reporter.js", {"banana": "yes", "pineapple": "no"}] + ] } ``` @@ -835,8 +833,7 @@ Setting this value to `fake` allows the use of fake timers for functions such as `setTimeout`. Fake timers are useful when a piece of code sets a long timeout that we don't want to wait for in a test. -### `transform` [object] +### `transform` [object] Default: `undefined` diff --git a/docs/ExpectAPI.md b/docs/ExpectAPI.md index 9bffccfed02f..6572590e8f41 100644 --- a/docs/ExpectAPI.md +++ b/docs/ExpectAPI.md @@ -572,7 +572,7 @@ cases. Use `.toBeDefined` to check that a variable is not undefined. For example, if you just want to check that a function `fetchNewFlavorIdea()` returns -*something*, you can write: +_something_, you can write: ```js test('there is a new flavor idea', () => { diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md index 8f2020d9ec3f..429b94502d37 100644 --- a/docs/GettingStarted.md +++ b/docs/GettingStarted.md @@ -40,8 +40,8 @@ Add the following section to your `package.json`: ```json { "scripts": { - "test": "jest", - }, + "test": "jest" + } } ``` @@ -95,7 +95,7 @@ in your project's root folder. For example, if you are using ES6 and ```json { - "presets": ["es2015", "react"], + "presets": ["es2015", "react"] } ``` @@ -115,9 +115,9 @@ You are now set up to use all ES6 features and React specific syntax. "presets": [["es2015", {"modules": false}], "react"], "env": { "test": { - "presets": [["es2015"], "react"], - }, - }, + "presets": [["es2015"], "react"] + } + } } ``` @@ -130,8 +130,8 @@ You are now set up to use all ES6 features and React specific syntax. { // package.json "jest": { - "transform": {}, - }, + "transform": {} + } } ``` diff --git a/docs/Troubleshooting.md b/docs/Troubleshooting.md index 1b8d6c7997ca..ece8af185e28 100644 --- a/docs/Troubleshooting.md +++ b/docs/Troubleshooting.md @@ -65,9 +65,9 @@ Then attach VS Code's debugger using the following `launch.json` config: "type": "node", "request": "attach", "name": "Attach", - "port": 9229, - }, - ], + "port": 9229 + } + ] } ``` @@ -85,12 +85,12 @@ following configuration: "runtimeArgs": [ "--inspect-brk", "${workspaceRoot}/node_modules/.bin/jest", - "--runInBand", + "--runInBand" ], "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen", - }, - ], + "internalConsoleOptions": "neverOpen" + } + ] } ``` @@ -112,9 +112,9 @@ can debug your Jest tests with the following configuration: "cwd": "${workspaceRoot}", "protocol": "inspector", "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen", - }, - ], + "internalConsoleOptions": "neverOpen" + } + ] } ``` @@ -199,7 +199,7 @@ npm test -- --runInBand ``` Another alternative to expediting test execution time on Continuous Integration -Servers such as Travis-CI is to set the max worker pool to ~*4*. Specifically on +Servers such as Travis-CI is to set the max worker pool to ~_4_. Specifically on Travis-CI, this can reduce test execution time in half. Note: The Travis CI _free_ plan available for open source projects only includes 2 CPU cores. diff --git a/docs/TutorialReact.md b/docs/TutorialReact.md index 25a9dd1c466a..11143af43044 100644 --- a/docs/TutorialReact.md +++ b/docs/TutorialReact.md @@ -55,7 +55,7 @@ jest configuration entries: ```json { // .babelrc - "presets": ["es2015", "react"], + "presets": ["es2015", "react"] } ``` diff --git a/docs/Webpack.md b/docs/Webpack.md index 312a7341c1ff..e97b5e039e35 100644 --- a/docs/Webpack.md +++ b/docs/Webpack.md @@ -61,9 +61,9 @@ mock a proxy for your className lookups. "moduleNameMapper": { "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/__mocks__/fileMock.js", - "\\.(css|less)$": "/__mocks__/styleMock.js", - }, - }, + "\\.(css|less)$": "/__mocks__/styleMock.js" + } + } } ``` @@ -101,9 +101,9 @@ Testing](SnapshotTesting.md). "moduleNameMapper": { "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/__mocks__/fileMock.js", - "\\.(css|less)$": "identity-obj-proxy", - }, - }, + "\\.(css|less)$": "identity-obj-proxy" + } + } } ``` @@ -133,13 +133,13 @@ module.exports = { // package.json (for custom transformers and CSS Modules) "jest": { "moduleNameMapper": { - "\\.(css|less)$": "identity-obj-proxy", + "\\.(css|less)$": "identity-obj-proxy" }, "transform": { "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": - "/fileTransformer.js", - }, - }, + "/fileTransformer.js" + } + } } ``` @@ -174,9 +174,9 @@ direct analogs in Jest's `moduleDirectories` and `moduleFileExtensions` options. "moduleNameMapper": { "\\.(css|less)$": "/__mocks__/styleMock.js", - "\\.(gif|ttf|eot|svg)$": "/__mocks__/fileMock.js", - }, - }, + "\\.(gif|ttf|eot|svg)$": "/__mocks__/fileMock.js" + } + } } ``` @@ -196,9 +196,9 @@ env variable, which you can set, or make use of the `modulePaths` option. "moduleDirectories": ["node_modules", "bower_components", "shared"], "moduleNameMapper": { "\\.(css|less)$": "/__mocks__/styleMock.js", - "\\.(gif|ttf|eot|svg)$": "/__mocks__/fileMock.js", - }, - }, + "\\.(gif|ttf|eot|svg)$": "/__mocks__/fileMock.js" + } + } } ``` @@ -218,9 +218,9 @@ make use of the `moduleNameMapper` option again. "^config$": "/configs/app-config.js", "\\.(css|less)$": "/__mocks__/styleMock.js", - "\\.(gif|ttf|eot|svg)$": "/__mocks__/fileMock.js", - }, - }, + "\\.(gif|ttf|eot|svg)$": "/__mocks__/fileMock.js" + } + } } ``` @@ -247,9 +247,9 @@ ES modules to CommonJS modules only in the `test` environment. "env": { "test": { - "plugins": ["transform-es2015-modules-commonjs"], - }, - }, + "plugins": ["transform-es2015-modules-commonjs"] + } + } } ``` @@ -268,9 +268,9 @@ need to enable the `dynamic-import-node` plugin. "env": { "test": { - "plugins": ["dynamic-import-node"], - }, - }, + "plugins": ["dynamic-import-node"] + } + } } ``` diff --git a/package.json b/package.json index 2a8879f09ae0..3320f434c91e 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "mkdirp": "^0.5.1", "mocha": "^4.0.1", "mock-fs": "^4.4.1", - "prettier": "^1.8.0", + "prettier": "^1.8.1", "progress": "^2.0.0", "react": "^15.4.2", "react-addons-test-utils": "15.4.2", diff --git a/packages/babel-plugin-jest-hoist/README.md b/packages/babel-plugin-jest-hoist/README.md index 59d704117310..5adf69f92e66 100644 --- a/packages/babel-plugin-jest-hoist/README.md +++ b/packages/babel-plugin-jest-hoist/README.md @@ -19,7 +19,7 @@ $ npm install babel-plugin-jest-hoist ```json { - "plugins": ["jest-hoist"], + "plugins": ["jest-hoist"] } ``` diff --git a/packages/babel-preset-jest/README.md b/packages/babel-preset-jest/README.md index bc2f353ddd1d..c30136010902 100644 --- a/packages/babel-preset-jest/README.md +++ b/packages/babel-preset-jest/README.md @@ -18,7 +18,7 @@ $ npm install --save-dev babel-preset-jest ```json { - "presets": ["jest"], + "presets": ["jest"] } ``` diff --git a/packages/eslint-plugin-jest/README.md b/packages/eslint-plugin-jest/README.md index 927fcfafe7f6..0100efc30e99 100644 --- a/packages/eslint-plugin-jest/README.md +++ b/packages/eslint-plugin-jest/README.md @@ -18,7 +18,7 @@ can omit the `eslint-plugin-` prefix: ```json { - "plugins": ["jest"], + "plugins": ["jest"] } ``` @@ -30,8 +30,8 @@ Then configure the rules you want to use under the rules section. "jest/no-disabled-tests": "warn", "jest/no-focused-tests": "error", "jest/no-identical-title": "error", - "jest/valid-expect": "error", - }, + "jest/valid-expect": "error" + } } ``` @@ -40,19 +40,19 @@ You can also whitelist the environment variables provided by Jest by doing: ```json { "env": { - "jest/globals": true, - }, + "jest/globals": true + } } ``` ## Supported Rules -* [no-disabled-tests](/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) - - disallow disabled tests. -* [no-focused-tests](/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) - - disallow focused tests. -* [no-identical-title](/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) - - disallow identical titles. +* [no-disabled-tests](/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) - + disallow disabled tests. +* [no-focused-tests](/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) - + disallow focused tests. +* [no-identical-title](/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) - + disallow identical titles. * [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) - ensure expect is called correctly. @@ -68,7 +68,7 @@ config file: ```json { - "extends": ["plugin:jest/recommended"], + "extends": ["plugin:jest/recommended"] } ``` diff --git a/packages/pretty-format/README.md b/packages/pretty-format/README.md index 52e65f46cccb..56e5fcd755db 100755 --- a/packages/pretty-format/README.md +++ b/packages/pretty-format/README.md @@ -177,8 +177,8 @@ example, in a `package.json` file: ```json { "jest": { - "snapshotSerializers": ["my-serializer-module"], - }, + "snapshotSerializers": ["my-serializer-module"] + } } ``` diff --git a/website/blog/2017-02-21-jest-19-immersive-watch-mode-test-platform-improvements.md b/website/blog/2017-02-21-jest-19-immersive-watch-mode-test-platform-improvements.md index 6f02e681e272..72ddd08ac134 100644 --- a/website/blog/2017-02-21-jest-19-immersive-watch-mode-test-platform-improvements.md +++ b/website/blog/2017-02-21-jest-19-immersive-watch-mode-test-platform-improvements.md @@ -116,13 +116,13 @@ inside browsers](https://github.com/facebook/jest/pull/2795). Thanks to [Jonathan Kim](https://twitter.com/jonnykim) Jest finally has its own official ESLint plugin. It exposes three rules: -* [no-disabled-tests](https://github.com/facebook/jest/blob/master/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) - - this rule prevents you from accidentally committing disabled tests. -* [no-focused-tests](https://github.com/facebook/jest/blob/master/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) - - this rule prevents you from committing focused tests which would disable all +* [no-disabled-tests](https://github.com/facebook/jest/blob/master/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) - + this rule prevents you from accidentally committing disabled tests. +* [no-focused-tests](https://github.com/facebook/jest/blob/master/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) - + this rule prevents you from committing focused tests which would disable all other tests in the same suite. -* [no-identical-title](https://github.com/facebook/jest/blob/master/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) - - disallows identical titles in test names. +* [no-identical-title](https://github.com/facebook/jest/blob/master/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) - + disallows identical titles in test names. You can install it using `npm install eslint-plugin-jest` or `yarn add --dev eslint eslint-plugin-jest` and it can be enabled by adding `{"plugins": diff --git a/yarn.lock b/yarn.lock index f029af596a36..4c122a0957ea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4764,9 +4764,9 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -prettier@^1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.8.0.tgz#d9dc68277cf1ded816c8e8863ab47889c29ce9a6" +prettier@^1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.8.1.tgz#91064d778c08c85ac1cbe6b23195c34310d039f9" private@^0.1.6, private@^0.1.7: version "0.1.7"