Skip to content

Commit 6c6cc54

Browse files
authored
Lint markdown format and links (#777)
1 parent 4047521 commit 6c6cc54

File tree

8 files changed

+326
-280
lines changed

8 files changed

+326
-280
lines changed

.github/workflows/markdown_linter.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: markdown_linter
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
schedule:
8+
- cron: "0 0 * * 0"
9+
10+
jobs:
11+
markdown-link-check:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@master
15+
- uses: gaurav-nelson/github-action-markdown-link-check@v1
16+
markdown_lint:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
node-version: [ 14.x ]
21+
steps:
22+
- uses: actions/checkout@master
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v1
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
- name: Install dependencies
28+
run: npm install --global markdownlint-cli2
29+
- name: Run lint check
30+
run: markdownlint-cli2-fix "**/*.md"

.markdownlint.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Rules for markdownlint-cli2 (https://github.com/DavidAnson/markdownlint-cli2)
2+
# Based on markdownlint library (https://github.com/DavidAnson/markdownlint)
3+
# (same linter as vscode-markdownlint).
4+
# See rules descriptions here:
5+
# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
6+
#
7+
first-line-heading: false
8+
line_length: # MD013 max line length
9+
tables: false # don't break tables
10+
code_blocks: false # don't break on code blocks
11+
line_length: 80
12+
html: # MD033 no html
13+
allowed_elements: [br]
14+
images: false # MD045: image alt text
15+
no-blanks-blockquote: false # MD028

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ deserialization.
55

66
## json_serializable [![Pub Package](https://img.shields.io/pub/v/json_serializable.svg)](https://pub.dev/packages/json_serializable)
77

8-
* Package: https://pub.dev/packages/json_serializable
9-
* [Source code](json_serializable)
8+
- Package: <https://pub.dev/packages/json_serializable>
9+
- [Source code](json_serializable)
1010

1111
The core package providing Generators for JSON-specific tasks.
1212

1313
Import it into your pubspec `dev_dependencies:` section.
1414

1515
## json_annotation [![Pub Package](https://img.shields.io/pub/v/json_annotation.svg)](https://pub.dev/packages/json_annotation)
1616

17-
* Package: https://pub.dev/packages/json_annotation
18-
* [Source code](json_annotation)
17+
- Package: <https://pub.dev/packages/json_annotation>
18+
- [Source code](json_annotation)
1919

2020
The annotation package which has no dependencies.
2121

2222
Import it into your pubspec `dependencies:` section.
2323

2424
## checked_yaml [![Pub Package](https://img.shields.io/pub/v/checked_yaml.svg)](https://pub.dev/packages/checked_yaml)
2525

26-
* Package: https://pub.dev/packages/checked_yaml
27-
* [Source code](checked_yaml)
26+
- Package: <https://pub.dev/packages/checked_yaml>
27+
- [Source code](checked_yaml)
2828

2929
Generate more helpful exceptions when decoding YAML documents using
3030
`package:json_serializable` and `package:yaml`.
@@ -33,7 +33,7 @@ Import it into your pubspec `dependencies:` section.
3333

3434
## example
3535

36-
* [Source code](example)
36+
- [Source code](example)
3737

3838
An example showing how to setup and use `json_serializable` and
3939
`json_annotation`.

checked_yaml/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ the target type.
77

88
[`package:json_serializable`] can generate classes that can parse the
99
[`YamlMap`] type provided by [`package:yaml`] when `anyMap: true` is specified
10-
for the class annotation.
10+
for the class annotation.
1111

1212
```dart
1313
@JsonSerializable(

example/README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*This example assumes you're using a recent version of the Dart or Flutter SDK.*
1+
_This example assumes you're using a recent version of the Dart or Flutter SDK._
22

33
To use [package:json_serializable][json_serializable] in your package, add these
44
dependencies to your `pubspec.yaml`.
@@ -15,10 +15,10 @@ dev_dependencies:
1515
Annotate your code with classes defined in
1616
[package:json_annotation][json_annotation].
1717
18-
* See [`lib/example.dart`][example] for an example of a file using these
18+
- See [`lib/example.dart`][example] for an example of a file using these
1919
annotations.
2020

21-
* See [`lib/example.g.dart`][example_g] for the generated file.
21+
- See [`lib/example.g.dart`][example_g] for the generated file.
2222

2323
Run `pub run build_runner build` to generate files into your source directory.
2424

@@ -32,7 +32,8 @@ Run `pub run build_runner build` to generate files into your source directory.
3232
[INFO] Build: Succeeded after 4687ms with 1 outputs
3333
```
3434

35-
*NOTE*: If you're using Flutter, replace `pub run` with `flutter packages pub run`.
35+
_NOTE_: If you're using Flutter, replace `pub run` with
36+
`flutter packages pub run`.
3637

3738
[example]: lib/example.dart
3839
[example_g]: lib/example.g.dart

json_annotation/CHANGELOG.md

+48-48
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
## 3.1.1
99

10-
- Avoid `null` values for `CheckedFromJsonException.message` by using
10+
- Avoid `null` values for `CheckedFromJsonException.message` by using
1111
`toString()` with unrecognized error types.
1212
- Added a helpful `UnrecognizedKeysException.toString()`.
1313
- Fixed doc comments for `JsonSerializable.genericArgumentFactories`.
1414

1515
## 3.1.0
1616

17-
- Added `JsonSerializable.genericArgumentFactories` field.
17+
- Added `JsonSerializable.genericArgumentFactories` field.
1818
- Require at least Dart `2.7.0`.
1919

2020
## 3.0.1
@@ -48,134 +48,134 @@
4848

4949
## 2.2.0
5050

51-
* Add an optional (named) `badKey` parameter and field to
51+
- Add an optional (named) `badKey` parameter and field to
5252
`CheckedFromJsonException`.
5353

5454
## 2.1.0
5555

56-
* Require at least Dart `2.1.1`.
56+
- Require at least Dart `2.1.1`.
5757

58-
* Added to `encodeEmptyCollection` to `JsonKey` and `JsonSerializable`.
58+
- Added to `encodeEmptyCollection` to `JsonKey` and `JsonSerializable`.
5959

60-
* `JsonSerializable.fromJson` now throws `CheckedFromJsonException` on errors.
61-
This is potentially a breaking change.
60+
- `JsonSerializable.fromJson` now throws `CheckedFromJsonException` on errors.
61+
This is potentially a breaking change.
6262

63-
* Added a more helpful `toString` to `CheckedFromJsonException`.
63+
- Added a more helpful `toString` to `CheckedFromJsonException`.
6464

6565
## 2.0.0
6666

67-
* **Potentially Breaking** `JsonSerializable` no longer sets default values for
67+
- **Potentially Breaking** `JsonSerializable` no longer sets default values for
6868
fields when constructor arguments are unset or `null`. This is not likely an
6969
issue for developers using this class as an annotation with a compatible
7070
version of `package:json_serializable`, but it may cause issues if class is
7171
used in other contexts.
7272

73-
* Support all `build.yaml` configuration options on classes by adding a number
73+
- Support all `build.yaml` configuration options on classes by adding a number
7474
of fields to `JsonSerializable`: `anyMap`, `checked`, `explicitToJson`,
7575
`generateToJsonFunction`, and `useWrappers`.
7676

7777
## 1.2.0
7878

79-
* Added `JsonConverter` class to support custom conversion of types.
79+
- Added `JsonConverter` class to support custom conversion of types.
8080

8181
## 1.1.0
8282

83-
* Added the `fieldRename` option to `JsonSerializable` and the associated
83+
- Added the `fieldRename` option to `JsonSerializable` and the associated
8484
`FieldRename` enum.
8585

8686
## 1.0.0
8787

88-
* Added `JsonValue` class for annotating `enum` fields with a custom
88+
- Added `JsonValue` class for annotating `enum` fields with a custom
8989
serialization value.
9090

91-
* Removed `$checkAllowedKeys`, `$enumDecode` and `$enumDecodeNullable` which are
91+
- Removed `$checkAllowedKeys`, `$enumDecode` and `$enumDecodeNullable` which are
9292
no longer needed by the latest release of `package:json_serializable`.
9393

9494
## 0.2.9+1
9595

96-
* Support the Dart 2.0 stable release.
96+
- Support the Dart 2.0 stable release.
9797

9898
## 0.2.9
9999

100-
* When `FormatException` is caught in "checked mode", use the `message`
101-
property when creating `CheckedFromJsonException`.
100+
- When `FormatException` is caught in "checked mode", use the `message` property
101+
when creating `CheckedFromJsonException`.
102102

103103
## 0.2.8
104104

105-
* Added `$checkKeys` helper function and deprecated `$checkAllowedKeys`.
105+
- Added `$checkKeys` helper function and deprecated `$checkAllowedKeys`.
106106
Upgrading to the latest `json_serializable` and re-running your build will
107107
eliminate any `@deprecated` hints you see.
108108

109-
* Added `BadKeyException` exception which is the abstract super class for
109+
- Added `BadKeyException` exception which is the abstract super class for
110110
`MissingRequiredKeysException`, `UnrecognizedKeysException`, and
111111
`DisallowedNullValueException`.
112112

113-
* Added `JsonKey.required` field and an associated
113+
- Added `JsonKey.required` field and an associated
114114
`MissingRequiredKeysException` that is thrown when `required` fields don't
115115
have corresponding keys in a source JSON map.
116116

117-
* Added `JsonKey.disallowNullValue` field and an associated
117+
- Added `JsonKey.disallowNullValue` field and an associated
118118
`DisallowedNullValueException` that is thrown when corresponding keys exist in
119119
a source JSON map, but their values are `null`.
120120

121-
* Updated documentation of `JsonSerializable.createToJson` to include details
122-
of the new `generate_to_json_function` configuration option.
121+
- Updated documentation of `JsonSerializable.createToJson` to include details of
122+
the new `generate_to_json_function` configuration option.
123123

124124
## 0.2.7+1
125125

126-
* Small improvement to `UnrecognizedKeysException.message` output and
126+
- Small improvement to `UnrecognizedKeysException.message` output and
127127
documentation comments.
128128

129129
## 0.2.7
130130

131-
* Added `JsonSerializable.disallowUnrecognizedKeys`.
132-
* Added a helper function to support this option. This function starts with a
131+
- Added `JsonSerializable.disallowUnrecognizedKeys`.
132+
- Added a helper function to support this option. This function starts with a
133133
`$` and should only be referenced by generated code. It is not meant for
134134
direct use.
135-
* Added `UnrecognizedKeysException` for reporting errors.
135+
- Added `UnrecognizedKeysException` for reporting errors.
136136

137137
## 0.2.6
138138

139-
* `CheckedFromJsonException`
140-
* Added a public constructor to support hand-written JSON decoding logic.
141-
* The `message` property is now `String` (instead of `Object`).
139+
- `CheckedFromJsonException`
142140

143-
* Added `JsonKey.defaultValue`.
141+
- Added a public constructor to support hand-written JSON decoding logic.
142+
- The `message` property is now `String` (instead of `Object`).
144143

145-
* Added helpers for deserialization of `enum` values.
146-
These functions starting with `$` are referenced by generated code.
147-
They are not meant for direct use.
144+
- Added `JsonKey.defaultValue`.
145+
146+
- Added helpers for deserialization of `enum` values. These functions starting
147+
with `$` are referenced by generated code. They are not meant for direct use.
148148

149149
## 0.2.5
150150

151-
* Added `CheckedFromJsonException` which is thrown by code generated when
152-
`checked` is enabled in `json_serializable`.
151+
- Added `CheckedFromJsonException` which is thrown by code generated when
152+
`checked` is enabled in `json_serializable`.
153153

154-
* Added functions to support the `checked` generation option.
155-
These functions starting with `$` are referenced by generated code.
156-
They are not meant for direct use.
154+
- Added functions to support the `checked` generation option. These functions
155+
starting with `$` are referenced by generated code. They are not meant for
156+
direct use.
157157

158158
## 0.2.4
159159

160-
* Added `fromJson` and `toJson` fields to `JsonKey` class.
160+
- Added `fromJson` and `toJson` fields to `JsonKey` class.
161161

162162
## 0.2.3
163163

164-
* Added `ignore` field to `JsonKey` class annotation
164+
- Added `ignore` field to `JsonKey` class annotation
165165

166166
## 0.2.2
167167

168-
* Added a helper class – `$JsonMapWrapper` – and helper functions – `$wrapMap`,
169-
`$wrapMapHandleNull`, `$wrapList`, and `$wrapListHandleNull` – to support
170-
the `useWrappers` option added to `JsonSerializableGenerator` in `v0.3.0` of
168+
- Added a helper class – `$JsonMapWrapper` – and helper functions – `$wrapMap`,
169+
`$wrapMapHandleNull`, `$wrapList`, and `$wrapListHandleNull` – to support the
170+
`useWrappers` option added to `JsonSerializableGenerator` in `v0.3.0` of
171171
`package:json_serializable`.
172172

173173
## 0.2.1
174174

175-
* `JsonSerializable` class annotation
176-
* Added `nullable` field.
177-
* Fixed doc comment.
175+
- `JsonSerializable` class annotation
176+
- Added `nullable` field.
177+
- Fixed doc comment.
178178

179179
## 0.2.0
180180

181-
* Moved annotation classes for `JsonSerializable` and `JsonLiteral`.
181+
- Moved annotation classes for `JsonSerializable` and `JsonLiteral`.

0 commit comments

Comments
 (0)