Skip to content

Commit 26ea4f8

Browse files
bmishljharb
authored andcommitted
[Docs] Add markdownlint
1 parent c704253 commit 26ea4f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+274
-210
lines changed

Diff for: .markdownlint.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"line-length": false,
3+
"ul-indent": {
4+
"start_indent": 1,
5+
"start_indented": true
6+
},
7+
"ul-style": {
8+
"style": "dash"
9+
}
10+
}

Diff for: .markdownlintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CHANGELOG.md
2+
node_modules

Diff for: CONTRIBUTING.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@ Thanks for your interest in helping out! Here are a **few** _weird_ tricks to ~~
66

77
When opening an [issue](#issues):
88

9-
- [ ] search open/closed issues
10-
- [ ] discuss bug/enhancement in new or old issue
9+
- [ ] search open/closed issues
10+
- [ ] discuss bug/enhancement in new or old issue
1111

1212
[PR](#prs) time:
1313

14-
- [ ] write tests
15-
- [ ] implement feature/fix bug
16-
- [ ] update docs
17-
- [ ] make a note in change log
14+
- [ ] write tests
15+
- [ ] implement feature/fix bug
16+
- [ ] update docs
17+
- [ ] make a note in change log
1818

1919
Remember, you don't need to do it all yourself; any of these are helpful! 😎
2020

2121
## How to get started
2222

2323
If you are new to `eslint`, below are a few resources that will help you to familiarize yourself with the project.
2424

25-
- Watch [this presentation](https://www.youtube.com/watch?v=2W9tUnALrLg) to learn the fundamental concept of Abstract Syntax Trees (AST) and the way `eslint` works under the hood.
26-
- Familiarize yourself with the [AST explorer](https://astexplorer.net/) tool. Look into rules in `docs/rules`, create patterns in the rules, then analyze its AST.
27-
- Explore the blog posts on how to create a custom rule. [One blog post](https://blog.yonatan.dev/writing-a-custom-eslint-rule-to-spot-undeclared-props/). [Second blog post](https://betterprogramming.pub/creating-custom-eslint-rules-cdc579694608).
28-
- Read the official `eslint` [developer guide](https://eslint.org/docs/latest/developer-guide/architecture/).
25+
- Watch [this presentation](https://www.youtube.com/watch?v=2W9tUnALrLg) to learn the fundamental concept of Abstract Syntax Trees (AST) and the way `eslint` works under the hood.
26+
- Familiarize yourself with the [AST explorer](https://astexplorer.net/) tool. Look into rules in `docs/rules`, create patterns in the rules, then analyze its AST.
27+
- Explore the blog posts on how to create a custom rule. [One blog post](https://blog.yonatan.dev/writing-a-custom-eslint-rule-to-spot-undeclared-props/). [Second blog post](https://betterprogramming.pub/creating-custom-eslint-rules-cdc579694608).
28+
- Read the official `eslint` [developer guide](https://eslint.org/docs/latest/developer-guide/architecture/).
2929

3030
## Issues
3131

Diff for: README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ rules:
131131
# etc...
132132
```
133133

134-
# TypeScript
134+
## TypeScript
135135

136136
You may use the following snippet or assemble your own config using the granular settings described below it.
137137

@@ -154,7 +154,7 @@ settings:
154154
[`@typescript-eslint/parser`]: https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser
155155
[`eslint-import-resolver-typescript`]: https://github.com/import-js/eslint-import-resolver-typescript
156156

157-
# Resolvers
157+
## Resolvers
158158

159159
With the advent of module bundlers and the current state of modules and module
160160
syntax specs, it's not always obvious where `import x from 'module'` should look
@@ -175,7 +175,7 @@ resolvers are just npm packages, so [third party packages are supported](https:/
175175

176176
You can reference resolvers in several ways (in order of precedence):
177177

178-
- as a conventional `eslint-import-resolver` name, like `eslint-import-resolver-foo`:
178+
- as a conventional `eslint-import-resolver` name, like `eslint-import-resolver-foo`:
179179

180180
```yaml
181181
# .eslintrc.yml
@@ -195,7 +195,7 @@ module.exports = {
195195
}
196196
```
197197

198-
- with a full npm module name, like `my-awesome-npm-module`:
198+
- with a full npm module name, like `my-awesome-npm-module`:
199199

200200
```yaml
201201
# .eslintrc.yml
@@ -214,7 +214,7 @@ module.exports = {
214214
}
215215
```
216216

217-
- with a filesystem path to resolver, defined in this example as a `computed property` name:
217+
- with a filesystem path to resolver, defined in this example as a `computed property` name:
218218

219219
```js
220220
// .eslintrc.js
@@ -336,11 +336,11 @@ If you are using `yarn` PnP as your package manager, add the `.yarn` folder and
336336

337337
Each item in this array is either a folder's name, its subpath, or its absolute prefix path:
338338

339-
- `jspm_modules` will match any file or folder named `jspm_modules` or which has a direct or non-direct parent named `jspm_modules`, e.g. `/home/me/project/jspm_modules` or `/home/me/project/jspm_modules/some-pkg/index.js`.
339+
- `jspm_modules` will match any file or folder named `jspm_modules` or which has a direct or non-direct parent named `jspm_modules`, e.g. `/home/me/project/jspm_modules` or `/home/me/project/jspm_modules/some-pkg/index.js`.
340340

341-
- `packages/core` will match any path that contains these two segments, for example `/home/me/project/packages/core/src/utils.js`.
341+
- `packages/core` will match any path that contains these two segments, for example `/home/me/project/packages/core/src/utils.js`.
342342

343-
- `/home/me/project/packages` will only match files and directories inside this directory, and the directory itself.
343+
- `/home/me/project/packages` will only match files and directories inside this directory, and the directory itself.
344344

345345
Please note that incomplete names are not allowed here so `components` won't match `bower_components` and `packages/ui` won't match `packages/ui-utils` (but will match `packages/ui/utils`).
346346

Diff for: docs/rules/consistent-type-specifier-style.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ This rule includes a fixer that will automatically convert your specifiers to th
3737

3838
The rule accepts a single string option which may be one of:
3939

40-
- `'prefer-inline'` - enforces that named type-only specifiers are only ever written with an inline marker; and never as part of a top-level, type-only import.
41-
- `'prefer-top-level'` - enforces that named type-only specifiers only ever written as part of a top-level, type-only import; and never with an inline marker.
40+
- `'prefer-inline'` - enforces that named type-only specifiers are only ever written with an inline marker; and never as part of a top-level, type-only import.
41+
- `'prefer-top-level'` - enforces that named type-only specifiers only ever written as part of a top-level, type-only import; and never with an inline marker.
4242

4343
By default the rule will use the `prefer-inline` option.
4444

Diff for: docs/rules/default.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ A module path that is [ignored] or not [unambiguously an ES module] will not be
1919
[ignored]: ../README.md#importignore
2020
[unambiguously an ES module]: https://github.com/bmeck/UnambiguousJavaScriptGrammar
2121

22-
2322
## Rule Details
2423

2524
Given:
@@ -54,7 +53,6 @@ import bar from './bar' // no default export found in ./bar
5453
import baz from './baz' // no default export found in ./baz
5554
```
5655

57-
5856
## When Not To Use It
5957

6058
If you are using CommonJS and/or modifying the exported namespace of any module at
@@ -65,10 +63,9 @@ either, so such a situation will be reported in the importing module.
6563

6664
## Further Reading
6765

68-
- Lee Byron's [ES7] export proposal
69-
- [`import/ignore`] setting
70-
- [`jsnext:main`] (Rollup)
71-
66+
- Lee Byron's [ES7] export proposal
67+
- [`import/ignore`] setting
68+
- [`jsnext:main`] (Rollup)
7269

7370
[ES7]: https://github.com/leebyron/ecmascript-more-export-from
7471
[`import/ignore`]: ../../README.md#importignore

Diff for: docs/rules/dynamic-import-chunkname.md

+5
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ This rule reports any dynamic imports without a webpackChunkName specified in a
77
This rule enforces naming of webpack chunks in dynamic imports. When you don't explicitly name chunks, webpack will autogenerate chunk names that are not consistent across builds, which prevents long-term browser caching.
88

99
## Rule Details
10+
1011
This rule runs against `import()` by default, but can be configured to also run against an alternative dynamic-import function, e.g. 'dynamicImport.'
1112
You can also configure the regex format you'd like to accept for the webpackChunkName - for example, if we don't want the number 6 to show up in our chunk names:
13+
1214
```javascript
1315
{
1416
"dynamic-import-chunkname": [2, {
@@ -19,6 +21,7 @@ You can also configure the regex format you'd like to accept for the webpackChun
1921
```
2022

2123
### invalid
24+
2225
The following patterns are invalid:
2326

2427
```javascript
@@ -53,7 +56,9 @@ import(
5356
'someModule',
5457
);
5558
```
59+
5660
### valid
61+
5762
The following patterns are valid:
5863

5964
```javascript

Diff for: docs/rules/export.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default makeClass // Multiple default exports.
1717
```
1818

1919
or
20+
2021
```js
2122
export const foo = function () { /*...*/ } // Multiple exports of name 'foo'.
2223

@@ -31,6 +32,6 @@ intent to rename, etc.
3132

3233
## Further Reading
3334

34-
- Lee Byron's [ES7] export proposal
35+
- Lee Byron's [ES7] export proposal
3536

3637
[ES7]: https://github.com/leebyron/ecmascript-more-export-from

Diff for: docs/rules/exports-last.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
This rule enforces that all exports are declared at the bottom of the file. This rule will report any export declarations that comes before any non-export statements.
66

7-
87
## This will be reported
98

109
```JS
@@ -45,7 +44,7 @@ export const str = 'foo'
4544

4645
If you don't mind exports being sprinkled throughout a file, you may not want to enable this rule.
4746

48-
#### ES6 exports only
47+
### ES6 exports only
4948

5049
The exports-last rule is currently only working on ES6 exports. You may not want to enable this rule if you're using CommonJS exports.
5150

Diff for: docs/rules/extensions.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ In order to provide a consistent use of file extensions across your code base, t
1010

1111
This rule either takes one string option, one object option, or a string and an object option. If it is the string `"never"` (the default value), then the rule forbids the use for any extension. If it is the string `"always"`, then the rule enforces the use of extensions for all import statements. If it is the string `"ignorePackages"`, then the rule enforces the use of extensions for all import statements except package imports.
1212

13-
```
13+
```json
1414
"import/extensions": [<severity>, "never" | "always" | "ignorePackages"]
1515
```
1616

1717
By providing an object you can configure each extension separately.
1818

19-
```
19+
```json
2020
"import/extensions": [<severity>, {
2121
<extension>: "never" | "always" | "ignorePackages"
2222
}]
@@ -26,7 +26,7 @@ By providing an object you can configure each extension separately.
2626

2727
By providing both a string and an object, the string will set the default setting for all extensions, and the object can be used to set granular overrides for specific extensions.
2828

29-
```
29+
```json
3030
"import/extensions": [
3131
<severity>,
3232
"never" | "always" | "ignorePackages",
@@ -40,7 +40,7 @@ For example, `["error", "never", { "svg": "always" }]` would require that all ex
4040

4141
`ignorePackages` can be set as a separate boolean option like this:
4242

43-
```
43+
```json
4444
"import/extensions": [
4545
<severity>,
4646
"never" | "always" | "ignorePackages",
@@ -62,7 +62,7 @@ When disallowing the use of certain extensions this rule makes an exception and
6262

6363
For example, given the following folder structure:
6464

65-
```
65+
```pt
6666
├── foo
6767
│   ├── bar.js
6868
│   ├── bar.json

Diff for: docs/rules/first.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Given that, see [#255] for the reasoning.
5757
### With Fixer
5858

5959
This rule contains a fixer to reorder in-body import to top, the following criteria applied:
60+
6061
1. Never re-order relative to each other, even if `absolute-first` is set.
6162
2. If an import creates an identifier, and that identifier is referenced at module level *before* the import itself, that won't be re-ordered.
6263

@@ -67,8 +68,8 @@ enable this rule.
6768

6869
## Further Reading
6970

70-
- [`import/order`]: a major step up from `absolute-first`
71-
- Issue [#255]
71+
- [`import/order`]: a major step up from `absolute-first`
72+
- Issue [#255]
7273

7374
[`import/order`]: ./order.md
7475
[#255]: https://github.com/import-js/eslint-plugin-import/issues/255

Diff for: docs/rules/group-exports.md

-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ export {first}
7171
export type {firstType}
7272
```
7373

74-
7574
### Invalid
7675

7776
```js

Diff for: docs/rules/max-dependencies.md

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Ignores `type` imports. Type imports are a feature released in TypeScript 3.8, y
4747

4848
Given `{"max": 2, "ignoreTypeImports": true}`:
4949

50+
<!-- markdownlint-disable-next-line MD024 -- duplicate header -->
5051
### Fail
5152

5253
```ts
@@ -55,6 +56,7 @@ import b from './b';
5556
import c from './c';
5657
```
5758

59+
<!-- markdownlint-disable-next-line MD024 -- duplicate header -->
5860
### Pass
5961

6062
```ts

Diff for: docs/rules/named.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ A module path that is [ignored] or not [unambiguously an ES module] will not be
1818
[unambiguously an ES module]: https://github.com/bmeck/UnambiguousJavaScriptGrammar
1919
[Flow]: https://flow.org/
2020

21-
2221
## Rule Details
2322

2423
Given:
@@ -94,10 +93,9 @@ runtime, you will likely see false positives with this rule.
9493

9594
## Further Reading
9695

97-
- [`import/ignore`] setting
98-
- [`jsnext:main`] deprecation
99-
- [`pkg.module`] (Rollup)
100-
96+
- [`import/ignore`] setting
97+
- [`jsnext:main`] deprecation
98+
- [`pkg.module`] (Rollup)
10199

102100
[`jsnext:main`]: https://github.com/jsforum/jsforum/issues/5
103101
[`pkg.module`]: https://github.com/rollup/rollup/wiki/pkg.module

Diff for: docs/rules/namespace.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ redefinition of the namespace in an intermediate scope. Adherence to the ESLint
3030
For [ES7], reports if an exported namespace would be empty (no names exported from the referenced module.)
3131

3232
Given:
33+
3334
```js
3435
// @module ./named-exports
3536
export const a = 1
@@ -44,7 +45,9 @@ export class ExportedClass { }
4445
// ES7
4546
export * as deep from './deep'
4647
```
48+
4749
and:
50+
4851
```js
4952
// @module ./deep
5053
export const e = "MC2"
@@ -94,9 +97,9 @@ still can't be statically analyzed any further.
9497

9598
## Further Reading
9699

97-
- Lee Byron's [ES7] export proposal
98-
- [`import/ignore`] setting
99-
- [`jsnext:main`](Rollup)
100+
- Lee Byron's [ES7] export proposal
101+
- [`import/ignore`] setting
102+
- [`jsnext:main`](Rollup)
100103

101104
[ES7]: https://github.com/leebyron/ecmascript-more-export-from
102105
[`import/ignore`]: ../../README.md#importignore

Diff for: docs/rules/newline-after-import.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ Enforces having one or more empty lines after the last top-level import statemen
99
## Rule Details
1010

1111
This rule supports the following options:
12-
- `count` which sets the number of newlines that are enforced after the last top-level import statement or require call. This option defaults to `1`.
1312

14-
- `considerComments` which enforces the rule on comments after the last import-statement as well when set to true. This option defaults to `false`.
13+
- `count` which sets the number of newlines that are enforced after the last top-level import statement or require call. This option defaults to `1`.
14+
15+
- `considerComments` which enforces the rule on comments after the last import-statement as well when set to true. This option defaults to `false`.
1516

1617
Valid:
1718

@@ -103,6 +104,7 @@ const FOO = 'BAR'
103104
```
104105

105106
## Example options usage
107+
106108
```json
107109
{
108110
"rules": {
@@ -111,7 +113,6 @@ const FOO = 'BAR'
111113
}
112114
```
113115

114-
115116
## When Not To Use It
116117

117118
If you like to visually group module imports with its usage, you don't want to use this rule.

Diff for: docs/rules/no-absolute-path.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ By default, only ES6 imports and CommonJS `require` calls will have this rule en
3838

3939
You may provide an options object providing true/false for any of
4040

41-
- `esmodule`: defaults to `true`
42-
- `commonjs`: defaults to `true`
43-
- `amd`: defaults to `false`
41+
- `esmodule`: defaults to `true`
42+
- `commonjs`: defaults to `true`
43+
- `amd`: defaults to `false`
4444

4545
If `{ amd: true }` is provided, dependency paths for AMD-style `define` and `require`
4646
calls will be resolved:

0 commit comments

Comments
 (0)