Skip to content

Commit

Permalink
enable markdownlint for mdx (#6446)
Browse files Browse the repository at this point in the history
* enable markdownlint for mdx

* clean up .markdownlintignore
  • Loading branch information
chenxsan authored Oct 12, 2022
1 parent 98f254c commit 86a9696
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 15 deletions.
6 changes: 5 additions & 1 deletion .markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
"MD002": false,
"MD004": { "style": "dash" },
"MD007": { "indent": 2 },
"MD013": { "line_length": 600 },
"MD013": { "line_length": 600, "code_blocks": false },
"MD024": {
"siblings_only": true
},
"MD026": false,
"MD029": { "style": "ordered" },
"MD033": false,
"MD034": false,
"MD036": false,
"MD041": false,
"MD053": false,
"no-hard-tabs": false,
"whitespace": false
}
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"lint": "run-s lint:*",
"lint:js": "npm run lint-js .",
"lint-js": "eslint --cache --cache-location .cache/.eslintcache",
"lint:markdown": "npm run lint-markdown *.md",
"lint-markdown": "markdownlint --config ./.markdownlint.json --ignore '.vale/**/*.md' --ignore '.github/**/*.md'",
"lint:markdown": "npm run lint-markdown '**/*.{md,mdx}'",
"lint-markdown": "markdownlint --config ./.markdownlint.json",
"lint:prose": "vale --config='.vale.ini' src/content",
"lint:links": "hyperlink -c 8 --root dist -r dist/index.html --canonicalroot https://webpack.js.org/ --internal --skip /plugins/extract-text-webpack-plugin/ --skip /printable --skip https:// --skip http:// --skip sw.js > internal-links.tap; cat internal-links.tap | tap-spot",
"sitemap": "cd dist && sitemap-static --ignore-file=../sitemap-ignore.json --pretty --prefix=https://webpack.js.org/ > sitemap.xml",
Expand All @@ -62,7 +62,7 @@
"*.{js,jsx,md,mdx}": [
"npm run lint-js"
],
"*.md": [
"*.{md,mdx}": [
"npm run lint-markdown"
],
"*.{js,jsx,css,scss,md,mdx,json}": [
Expand Down
7 changes: 5 additions & 2 deletions src/content/api/loaders.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ module.exports = function (source) {
The module will get bundled like this:
```
```text
/***/ "./src/loader.js!./src/lib.js":
/*!************************************!*\
!*** ./src/loader.js!./src/lib.js ***!
Expand Down Expand Up @@ -722,7 +722,10 @@ module.exports = function (source) {
if (STYLES_REGEXP.test(source)) {
source = source.replace(STYLES_REGEXP, '');
return `import ${JSON.stringify(
this.utils.contextify(this.context || this.rootContext, `${this.resource}.css!=!${getStylesLoader}!${this.remainingRequest}`)
this.utils.contextify(
this.context || this.rootContext,
`${this.resource}.css!=!${getStylesLoader}!${this.remainingRequest}`
)
)};${source}`;
}
return source;
Expand Down
2 changes: 2 additions & 0 deletions src/content/api/module-variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Returns the same value as `require.context` but only for `javascript/auto` and `
- Available: 5.70.0+
- Example:
```js
const contextRequire = import.meta.webpackContext('.', {
recursive: false,
Expand Down Expand Up @@ -285,6 +286,7 @@ Change base URI at runtime.
- Type: `string`
- Available: 5.21.0+
- Example:
```js
__webpack_base_uri__ = 'https://example.com';
```
Expand Down
4 changes: 4 additions & 0 deletions src/content/configuration/experiments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ When enabled, webpack can build remote resources that begin with the `http(s):`
A shortcut for [`experiments.buildHttp.allowedUris`](#experimentsbuildhttpalloweduris).

- `HttpUriOptions`

```ts
{
allowedUris: (string|RegExp|(uri: string) => boolean)[],
Expand Down Expand Up @@ -134,6 +135,7 @@ Define the location for caching remote resources.
- `string`
- `false`
- Example

```javascript
// webpack.config.js
module.exports = {
Expand Down Expand Up @@ -259,6 +261,7 @@ Compile entrypoints and dynamic `import`s only when they are in use. It can be u

- Available: 5.17.0+
- Example 1:

```js
module.exports = {
//
Expand All @@ -267,6 +270,7 @@ Compile entrypoints and dynamic `import`s only when they are in use. It can be u
},
};
```

- Example 2:

```js
Expand Down
16 changes: 13 additions & 3 deletions src/content/configuration/module.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ Enable [magic comments](/api/module-methods/#magic-comments) support for CommonJ
- Type: `boolean`
- Available: 5.17.0+
- Example:

```js
module.exports = {
module: {
Expand All @@ -172,6 +173,7 @@ Specifies global mode for dynamic import.
- Type: `'eager' | 'weak' | 'lazy' | 'lazy-once'`
- Available: 5.73.0+
- Example:

```js
module.exports = {
module: {
Expand All @@ -191,6 +193,7 @@ Specifies global prefetch for dynamic import.
- Type: ` number | boolean`
- Available: 5.73.0+
- Example:

```js
module.exports = {
module: {
Expand All @@ -210,6 +213,7 @@ Specifies global preload for dynamic import.
- Type: ` number | boolean`
- Available: 5.73.0+
- Example:

```js
module.exports = {
module: {
Expand All @@ -229,6 +233,7 @@ Specifies the behavior of invalid export names in `\"import ... from ...\"` and
- Type: `'error' | 'warn' | 'auto' | false`
- Available: 5.62.0+
- Example:

```js
module.exports = {
module: {
Expand All @@ -248,6 +253,7 @@ Specifies the behavior of invalid export names in `\"import ... from ...\"`.
- Type: `'error' | 'warn' | 'auto' | false`
- Available: 5.62.0+
- Example:

```js
module.exports = {
module: {
Expand All @@ -267,6 +273,7 @@ Enable or disable evaluating `import.meta`.
- Type: `boolean = true`
- Available: 5.68.0+
- Example:

```js
module.exports = {
module: {
Expand All @@ -286,6 +293,7 @@ Enable/disable evaluating [`import.meta.webpackContext`](/api/module-variables/#
- Type: `boolean`
- Available: 5.70.0+
- Example:

```js
module.exports = {
module: {
Expand All @@ -305,6 +313,7 @@ Specifies the behavior of invalid export names in `\"export ... from ...\"`. Thi
- Type: `'error' | 'warn' | 'auto' | false`
- Available: 5.62.0+
- Example:

```js
module.exports = {
module: {
Expand All @@ -323,6 +332,7 @@ Enable parsing of `new URL()` syntax.

- Type: `boolean = true` | `'relative'`
- Example:

```js
module.exports = {
module: {
Expand All @@ -337,12 +347,12 @@ Enable parsing of `new URL()` syntax.

The `'relative'` value for `module.parser.javascript.url` is available since webpack <Badge text='5.23.0' />. When used, webpack would generate relative URLs for `new URL()` syntax, i.e., there's no base URL included in the result URL:

```
```html
<!-- with 'relative' -->
<img src='c43188443804f1b1f534.svg' />
<img src="c43188443804f1b1f534.svg" />

<!-- without 'relative' -->
<img src='file:///path/to/project/dist/c43188443804f1b1f534.svg' />
<img src="file:///path/to/project/dist/c43188443804f1b1f534.svg" />
```

1. This is useful for SSR (Server side rendering) when base URL is not known by server (and it saves a few bytes). To be identical it must also be used for the client build.
Expand Down
1 change: 1 addition & 0 deletions src/content/configuration/output.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,7 @@ module.exports = {
Specify a name for the library.

- Type:

```ts
string | string[] | {amd?: string, commonjs?: string, root?: string | string[]}
```
Expand Down
1 change: 1 addition & 0 deletions src/content/configuration/resolve.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ Configure resolve options by the type of module request.
- Type: `[type: string]: ResolveOptions`
- Example:
```js
module.exports = {
// ...
Expand Down
2 changes: 2 additions & 0 deletions src/content/configuration/watch.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ Follow symbolic links while looking for a file. This is usually not needed as we

- Type: `boolean`
- Example:

```js
module.exports = {
//...
Expand All @@ -165,6 +166,7 @@ Stop watching when stdin stream has ended.

- Type: `boolean`
- Example:

```js
module.exports = {
//...
Expand Down
7 changes: 1 addition & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,7 @@
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63"
integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==

"@babel/helper-validator-identifier@^7.18.6":
version "7.18.6"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz#9c97e30d31b2b8c72a1d08984f2ca9b574d7a076"
integrity sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==

"@babel/helper-validator-identifier@^7.19.1":
"@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1":
version "7.19.1"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2"
integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==
Expand Down

1 comment on commit 86a9696

@vercel
Copy link

@vercel vercel bot commented on 86a9696 Oct 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.