diff --git a/.eslintrc.js b/.eslintrc.js index 2e4a39916b2a0..5782de167e193 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -49,7 +49,15 @@ module.exports = { // eslint-disable-next-line inclusive-language/use-inclusive-words // * https://github.com/highlightjs/highlight.js/blob/master/SUPPORTED_LANGUAGES.md) // * https://www.npmjs.com/package/eslint-plugin-md#modifying-eslint-setup-for-js-code-inside-md-files - files: [ '*.md.js', '*.md.javascript', '*.md.cjs', '*.md.ejs', '*.md.jsx' ], + files: [ + '*.md.js', + '*.md.javascript', + '*.md.cjs', + '*.md.ejs', + '*.md.jsx', + '*.md.tsx', + '*.md.ts', + ], rules: { // These are ok for examples 'import/no-extraneous-dependencies': 'off', @@ -64,6 +72,9 @@ module.exports = { 'react/react-in-jsx-scope': 'off', 'wpcalypso/import-docblock': 'off', 'wpcalypso/jsx-classname-namespace': 'off', + '@typescript-eslint/no-unused-vars': 'off', + 'jsdoc/require-param': 'off', + 'jsdoc/check-param-names': 'off', }, }, { diff --git a/client/blocks/time-mismatch-warning/README.md b/client/blocks/time-mismatch-warning/README.md index 0f77cb59fc2e0..cdeb71268e082 100644 --- a/client/blocks/time-mismatch-warning/README.md +++ b/client/blocks/time-mismatch-warning/README.md @@ -20,6 +20,7 @@ const Test = () => ( ## Props There are two props: + - `siteId`: Site ID to check. - `settingsUrl`: Site settings URL. If unset defaults to current page. - `status`: This is optional, and allows overriding the notice status. See the `Notice` component for allowed values. diff --git a/client/components/forms/README.md b/client/components/forms/README.md index 927955cca3eea..4af37fe366985 100644 --- a/client/components/forms/README.md +++ b/client/components/forms/README.md @@ -65,34 +65,34 @@ The `FormInputValidation` component is used to display a validation notice to th ```jsx const options = [ - { - label: 'Group 1', - options: [ - { - label: 'Option 1', - value: 1, - }, - { - label: 'Option 2', - value: 2, - }, - ], - }, - { - label: 'Group 2', - options: [ - { - label: 'Option 3', - value: 3, - }, - { - label: 'Option 4', - value: 4, - }, - ], - }, - ], - initialSelected = 3; + { + label: 'Group 1', + options: [ + { + label: 'Option 1', + value: 1, + }, + { + label: 'Option 2', + value: 2, + }, + ], + }, + { + label: 'Group 2', + options: [ + { + label: 'Option 3', + value: 3, + }, + { + label: 'Option 4', + value: 4, + }, + ], + }, +]; +const initialSelected = 3; ; ``` diff --git a/client/components/infinite-list/README.md b/client/components/infinite-list/README.md index 87c287a0251bb..fe3a90d6645ec 100644 --- a/client/components/infinite-list/README.md +++ b/client/components/infinite-list/README.md @@ -51,8 +51,8 @@ class Listing extends React.Component { } renderLoadingPlaceholders() { - const count = this.props.list.get().length ? 2 : this.props.list.perPage, - placeholders = []; + const count = this.props.list.get().length ? 2 : this.props.list.perPage; + const placeholders = []; times( count, function ( i ) { placeholders.push( ); } ); diff --git a/client/reader/list-manage/README.md b/client/reader/list-manage/README.md index 90986f5aadfcb..37d7a6e03c8bd 100644 --- a/client/reader/list-manage/README.md +++ b/client/reader/list-manage/README.md @@ -1,3 +1,3 @@ # Reader List Management -Allows creation, editing, export and deletion of Reader lists. \ No newline at end of file +Allows creation, editing, export and deletion of Reader lists. diff --git a/client/reader/list-stream/README.md b/client/reader/list-stream/README.md index 483af3a9bf9bf..e4cf3388da1e8 100644 --- a/client/reader/list-stream/README.md +++ b/client/reader/list-stream/README.md @@ -1,3 +1,3 @@ # Reader List Stream -A stream of posts from a Reader list. \ No newline at end of file +A stream of posts from a Reader list. diff --git a/client/test-helpers/use-sinon/README.md b/client/test-helpers/use-sinon/README.md index 3dafc3eececfb..1ca84f6d6c82b 100644 --- a/client/test-helpers/use-sinon/README.md +++ b/client/test-helpers/use-sinon/README.md @@ -30,8 +30,8 @@ import { useFakeTimers } from 'calypso/test-helpers/use-sinon'; describe( 'my time dependent test', function () { let clock; - const aLongTimeAgo = Date.parse( '1976-09-15T010:00:00Z' ).valueOf(), - yearInMillis = 1000 * 60 * 60 * 24 * 365; + const aLongTimeAgo = Date.parse( '1976-09-15T010:00:00Z' ).valueOf(); + const yearInMillis = 1000 * 60 * 60 * 24 * 365; useFakeTimers( aLongTimeAgo, ( newClock ) => { clock = newClock; diff --git a/config/README.md b/config/README.md index 0891debfce881..549ace9f06149 100644 --- a/config/README.md +++ b/config/README.md @@ -7,7 +7,7 @@ If it is necessary to access a `config` value on the client-side, add the proper Server-side and client-side code can retrieve a config value by invoking the `config()` exported function with the desired key name: ```js -import config from 'config'; +import config from 'calypso/config'; console.log( config( 'redirect_uri' ) ); ``` diff --git a/desktop/README.md b/desktop/README.md index 4659bce390d40..f05882ee451b7 100644 --- a/desktop/README.md +++ b/desktop/README.md @@ -4,18 +4,18 @@ WordPress.com for Desktop is an [Electron](https://github.com/atom/electron) wra ![WordPress.com for Desktop](https://en-blog.files.wordpress.com/2015/12/01-writing-with-dock.png?w=1150) -# Getting Started & Running Locally +## Getting Started & Running Locally -The steps marked _Production*_ can be omitted but should be taken when building the production version of the app. +The steps marked _Production\*_ can be omitted but should be taken when building the production version of the app. 1. Clone the Calypso repository locally 1. Install all root level dependencies with `yarn` or `yarn install --frozen-lockfile` 1. Export the environment variables: - - `CHROMEDRIVER_SKIP_DOWNLOAD` (set to `true`) - - `DETECT_CHROMEDRIVER_VERSION` (set to `false`) - - _Production*_: `CONFIG_ENV` (set to `release`) - - _Production*_: `CALYPSO_SECRETS_ENCRYPTION_KEY` (it's a secret!) -1. _Production*_: `yarn run build-desktop:secrets` + - `CHROMEDRIVER_SKIP_DOWNLOAD` (set to `true`) + - `DETECT_CHROMEDRIVER_VERSION` (set to `false`) + - _Production\*_: `CONFIG_ENV` (set to `release`) + - _Production\*_: `CALYPSO_SECRETS_ENCRYPTION_KEY` (it's a secret!) +1. _Production\*_: `yarn run build-desktop:secrets` 1. Build the app with `yarn run build-desktop` 1. Find the built apps in the `desktop/release` @@ -26,33 +26,33 @@ export DEBUG='*' ./desktop/release/mac/WordPress.com.app/Contents/MacOS/WordPress.com ``` -# Development +## Development Refer to the [development guide](docs/development.md) for help with how the app works and how to change stuff. -# Running The End-To-End Test Suite +## Running The End-To-End Test Suite 1. Set the environment variables `E2EUSERNAME` and `E2EPASSWORD`. 2. Use `npm run e2e` or `make e2e` to invoke the test suite. To manually start each platform's _pre-packaged_ executable used for end-to-end testing: -- Mac: Double-click `WordPress.com.app` (extract with [`ditto`](##Extracting-Published-ZIP-Archive-in-MacOS-10.15-(Catalina))) +- Mac: Double-click `WordPress.com.app` (extract with [`ditto`](<##Extracting-Published-ZIP-Archive-in-MacOS-10.15-(Catalina)>)) - Windows: Double-click WordPress.com.exe in `win-unpacked` directory - Linux: `npx electron /path/to/linux-unpacked/resources/app` -# MacOS Notarization +## MacOS Notarization Notes on MacOS notarization can be found [here](docs/notarization.md). -# Building & Packaging a Release +## Building & Packaging a Release While running the app locally in a development environment is great, you will eventually need to [build a release version](docs/release.md) you can share. -# Troubleshooting +## Troubleshooting If you have any problems running the app please see the [most common issues](docs/troubleshooting.md). -# License +## License WordPress.com for Desktop is licensed under [GNU General Public License v2 (or later)](LICENSE.md). diff --git a/desktop/docs/development.md b/desktop/docs/development.md index afcaa0bc36b42..8aa7174319012 100644 --- a/desktop/docs/development.md +++ b/desktop/docs/development.md @@ -15,28 +15,28 @@ We use Electron's [IPC](https://github.com/atom/electron/blob/master/docs/api/ip ### How does it work? -It's a fairly complicated process so buckle up. Note that *(main)* and *(renderer)* will be added to show where the code actually runs. +It's a fairly complicated process so buckle up. Note that _(main)_ and _(renderer)_ will be added to show where the code actually runs. For clarity, all file and folder locations are relative to the root of the Calypso monorepo. -- *(main)* The `main` entry in `desktop/package.json` refers to `build/desktop.js`, which is the entrypoint of the compiled webpack bundle of the Calypso server running in Electron's main process. +- _(main)_ The `main` entry in `desktop/package.json` refers to `build/desktop.js`, which is the entrypoint of the compiled webpack bundle of the Calypso server running in Electron's main process. - The Calypso server is an Express.js HTTP server that serves files to Electron's Renderer process. - `client/desktop/server/index.js` is where the Calypso server is started by the Electron process. Calypso's `boot` code is contained in the file `client/server/boot/index.js`. -- *(main)* `client/desktop/index.js` sets up the environment in `client/desktop/env.js` - this includes Node paths for Calypso -- *(main)* Various [app handlers](../../client/desktop/app-handlers/README.md) are loaded from `client/desktop/app-handlers` - these are bits of code that run before the main window opens -- *(main)* A Calypso server is started directly from Electron's Node process in `client/desktop/server.js`. The server is customized to serve files from the following directories: +- _(main)_ `client/desktop/index.js` sets up the environment in `client/desktop/env.js` - this includes Node paths for Calypso +- _(main)_ Various [app handlers](../../client/desktop/app-handlers/README.md) are loaded from `client/desktop/app-handlers` - these are bits of code that run before the main window opens +- _(main)_ A Calypso server is started directly from Electron's Node process in `client/desktop/server.js`. The server is customized to serve files from the following directories: - `/calypso` - mapped to `/public` - `/desktop` - mapped to `/public_desktop` -- *(main)* An Electron `BrowserWindow` is opened and loads the 'index' page from the Calypso server -- *(main)* Once the window has opened the [window handlers](../../client/desktop/window-handlers/README.md) load to provide interaction between Calypso and Electron -- *(renderer)* Calypso's index page is served by a React renderer in `client/document/desktop.jsx`. In addition: +- _(main)_ An Electron `BrowserWindow` is opened and loads the 'index' page from the Calypso server +- _(main)_ Once the window has opened the [window handlers](../../client/desktop/window-handlers/README.md) load to provide interaction between Calypso and Electron +- _(renderer)_ Calypso's index page is served by a React renderer in `client/document/desktop.jsx`. In addition: - `desktop/public_desktop/wordpress-desktop.css` - any CSS specific to the desktop app (mapped to `desktop` directory mentioned above) - `desktop/public_desktop/desktop-app.js` - desktop-specific JS and also the Calypso boot code (mapped to `desktop` directory mentioned above) - The Calypso client bundle for the Desktop app is built to `desktop/public`. - The built Calypso bundle has multiple webpack entrypoints (like `entry-main.[hash].min.js`). - The various Calypso filenames are written to `desktop/build/assets-evergreen.js` at buildtime. The Express.js server loads this `assets-evergreen.js` file to find out which `