Skip to content

Commit

Permalink
Clarify naming of lint-md scripts js and docs
Browse files Browse the repository at this point in the history
- Updates lint-md scripts to lint-md-js for linting source included in the document and lint-md-docs for
linting the markup of the document itself.

- Update scripts changelog
- Update readme with commands
  • Loading branch information
mkaz committed Jan 27, 2020
1 parent fdc0820 commit c71e4ca
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
"lint-css": "wp-scripts lint-style '**/*.scss'",
"lint-css:fix": "npm run lint-css -- --fix",
"lint-types": "tsc",
"lint-md": "wp-scripts lint-md",
"lint-md:js": "wp-scripts lint-md-js",
"lint-md:docs": "wp-scripts lint-md-docs",
"package-plugin": "./bin/build-plugin-zip.sh",
"pot-to-php": "./bin/pot-to-php.js",
Expand Down
3 changes: 2 additions & 1 deletion packages/scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
### New Features

- Add SVGR support to compile SVG files to React components using the `@svgr/webpack` plugin ([#18243](https://github.com/WordPress/gutenberg/pull/18243)).
- Add `lint-md` script to lint JavaScript source code in markdown files, uses the `eslint-plugin-markdown` plugin ([#19518](https://github.com/WordPress/gutenberg/pull/19518)).
- Add `lint-md-js` script to lint JavaScript source code in markdown files, uses the `eslint-plugin-markdown` plugin ([#19518](https://github.com/WordPress/gutenberg/pull/19518)).
- Add `packages-update` script to update WordPress packages to the latest version automatically ([#19448](https://github.com/WordPress/gutenberg/pull/19448)).
- Add `lint-md-docs` script to lint the markup of markdown files, uses the `markdownlint` module ([#19855](https://github.com/WordPress/gutenberg/pull/19855)).

## 6.1.1 (2020-01-01)

Expand Down
35 changes: 30 additions & 5 deletions packages/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ _Example:_
"check-licenses": "wp-scripts check-licenses",
"lint:css": "wp-scripts lint-style",
"lint:js": "wp-scripts lint-js",
"lint:md": "wp-scripts lint-md",
"lint-md:docs": "wp-scripts lint-md-docs",
"lint-md:js": "wp-scripts lint-md-js",
"lint:pkg-json": "wp-scripts lint-pkg-json",
"packages-update": "wp-scripts packages-update",
"start": "wp-scripts start",
Expand Down Expand Up @@ -225,23 +226,47 @@ By default, files located in `build` and `node_modules` folders are ignored.

It uses [npm-package-json-lint](https://www.npmjs.com/package/npm-package-json-lint) with the set of recommended rules defined in [@wordpress/npm-package-json-lint-config](https://www.npmjs.com/package/@wordpress/npm-package-json-lint-config) npm package. You can override default rules with your own as described in [npm-package-json-lint wiki](https://github.com/tclindner/npm-package-json-lint/wiki). Learn more in the [Advanced Usage](#advanced-usage) section.

### `lint-md`
### `lint-md:docs`

Helps enforce standards for JS source code in your markdown files.
Uses markdownlint to lint the markup of markdown files to enforce standards.

_Example:_

```json
{
"scripts": {
"lint:md": "wp-scripts lint-md"
"lint-md:docs": "wp-scripts lint-md-docs"
}
}
```

This is how you execute the script with presented setup:

* `npm run lint:md` - lints markdown files in the entire project’s directories.
* `npm run lint-md:docs` - lints markdown files in the entire project’s directories.

By default, files located in `build` and `node_modules` folders are ignored.

#### Advanced information

It uses [markdownlint](https://github.com/DavidAnson/markdownlint) with the [.markdownlint.json](https://github.com/WordPress/gutenberg/blob/master/packages/scripts/config/.markdownlint.json) configuration. This configuration tunes the linting rules to match WordPress standard, you can override with your own config, see [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli/) for command-line parameters.

### `lint-md:js`

Uses eslint to lint the source included in markdown files to enforce standards for JS code.

_Example:_

```json
{
"scripts": {
"lint-md:js": "wp-scripts lint-md-js"
}
}
```

This is how you execute the script with presented setup:

* `npm run lint-md:js` - lints markdown files in the entire project’s directories.

By default, files located in `build` and `node_modules` folders are ignored.

Expand Down
File renamed without changes.

0 comments on commit c71e4ca

Please sign in to comment.