Skip to content

Commit 2e1567d

Browse files
committed
Add prettier and CI
Quick addition to add prettier and a CI doing: 1. style checking through prettier 1. type checking through typescript 1. linting through eslint This is to prevent issues and to facilitate development.
1 parent f841c9e commit 2e1567d

File tree

12 files changed

+119
-69
lines changed

12 files changed

+119
-69
lines changed

.github/workflows/checks.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: README Tests
2+
3+
on:
4+
push:
5+
branches: [stable, dev, legacy-v3]
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
9+
jobs:
10+
format_check:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [20.x]
16+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v2
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
cache: "npm"
25+
26+
- run: npm ci
27+
- run: npm run fmt
28+
29+
typechecking_and_linting:
30+
runs-on: ubuntu-latest
31+
32+
strategy:
33+
matrix:
34+
node-version: [20.x]
35+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
36+
37+
steps:
38+
- uses: actions/checkout@v2
39+
- name: Use Node.js ${{ matrix.node-version }}
40+
uses: actions/setup-node@v2
41+
with:
42+
node-version: ${{ matrix.node-version }}
43+
cache: "npm"
44+
- run: npm ci
45+
- run: npm run check:types && npm run lint

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2+
"printWidth": 80,
23
"proseWrap": "always"
34
}

CHANGELOG.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,82 +2,82 @@
22

33
## Other
44

5-
- Stop transforming various tokens (like `(c)` for the copyright logo or `...` for the ellipsis)
5+
- Stop transforming various tokens (like `(c)` for the copyright logo or `...`
6+
for the ellipsis)
67

78
# v0.4.0 (2024-01-29)
89

910
## Breaking Changes
1011

11-
- Total overhaul of CLI tool options and of the JavaScript API
12-
- Update anchor syntax rule to make it more compatibe to GitHub's and GitLab's
13-
own generator
14-
- In local configurations, remove otherVersionsLink in profit of version.link
12+
- Total overhaul of CLI tool options and of the JavaScript API
13+
- Update anchor syntax rule to make it more compatibe to GitHub's and GitLab's
14+
own generator
15+
- In local configurations, remove otherVersionsLink in profit of version.link
1516

1617
## Features
1718

18-
- Check validity of anchor links and display verbose warning when not
19-
available
20-
- Add `defaultOpen` property to page groups in local configurations
21-
- Add `clean` JS and CLI option
22-
- Authorize http(s) url in media resources
19+
- Check validity of anchor links and display verbose warning when not available
20+
- Add `defaultOpen` property to page groups in local configurations
21+
- Add `clean` JS and CLI option
22+
- Authorize http(s) url in media resources
2323

2424
## Bug fixes
2525

26-
- Pages: Avoid hiding header when content is not scrollable
27-
- Fix false positives in table of contents generation
28-
- Make search also work for text without the right header hierarchy
26+
- Pages: Avoid hiding header when content is not scrollable
27+
- Fix false positives in table of contents generation
28+
- Make search also work for text without the right header hierarchy
2929

3030
## Other
3131

32-
- Forbid copy of local media resources not inside the root directory for
33-
security
34-
- Pages: content is now centered and has a higher minimal width
35-
- Pages: don't underline the version number if there's no link
36-
- Add documentation pages for README
37-
- Stop generating XHTML as output
32+
- Forbid copy of local media resources not inside the root directory for
33+
security
34+
- Pages: content is now centered and has a higher minimal width
35+
- Pages: don't underline the version number if there's no link
36+
- Add documentation pages for README
37+
- Stop generating XHTML as output
3838

3939
# v0.3.0 (2023-11-22)
4040

4141
## Other
4242

43-
- Rename project to README, and move it under a canalplus scope on npm to
44-
facilitate inside contributions
43+
- Rename project to README, and move it under a canalplus scope on npm to
44+
facilitate inside contributions
4545

4646
# v0.2.3 (2023-04-21)
4747

4848
## Bug fixes
4949

50-
- Fix multiple quick smooth navigation between inner links
50+
- Fix multiple quick smooth navigation between inner links
5151

5252
# v0.2.2 (2023-04-20)
5353

5454
## Bug fixes
5555

56-
- Fix documentation page's script soft navigation
56+
- Fix documentation page's script soft navigation
5757

5858
# v0.2.1 (2023-04-19)
5959

6060
## Bug fixes
6161

62-
- Fix header links when navigating in sub directories
62+
- Fix header links when navigating in sub directories
6363

6464
# v0.2.0 (2023-04-15)
6565

6666
## Features
6767

68-
- Rewrote in TypeScript with now type declarations
69-
- NodeJS API (as an import and no more as a script)
68+
- Rewrote in TypeScript with now type declarations
69+
- NodeJS API (as an import and no more as a script)
7070

7171
## Bug fixes
7272

73-
- Remove mention of "RxPlayer" in page titles
74-
- Various minor CSS fixes
73+
- Remove mention of "RxPlayer" in page titles
74+
- Various minor CSS fixes
7575

7676
# v0.1.1 (2023-04-07)
7777

7878
## Bug fixes
7979

80-
- Fix placement of search icon
80+
- Fix placement of search icon
8181

8282
# v0.1.0 (2023-04-06)
8383

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ at the
3838
and compare it to its
3939
[original markdown files](https://github.com/canalplus/rx-player/tree/master/doc/Getting_Started).
4040

41-
You can also look at [README's own documentation](https://peaberberian.github.io/README/doc/Getting_Started/Home.html)
41+
You can also look at
42+
[README's own documentation](https://peaberberian.github.io/README/doc/Getting_Started/Home.html)
4243
and compare it to its
4344
[original markdown files](https://github.com/canalplus/README/tree/main/doc/Getting_Started).
4445

@@ -68,7 +69,8 @@ readme.doc --version
6869

6970
## How to use it
7071

71-
See our [complete documentation](https://peaberberian.github.io/README/doc/Getting_Started/Home.html)
72+
See our
73+
[complete documentation](https://peaberberian.github.io/README/doc/Getting_Started/Home.html)
7274
(which is itself generated with README :)!)
7375

7476
## Why a new documentation generator

package-lock.json

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
"main": "build/index.js",
1010
"scripts": {
1111
"build": "npm run generateVersionFile && tsc",
12+
"check:types": "tsc --noEmit --project .",
1213
"clean": "rimraf doc-build",
1314
"doc": "node build/index.js --clean --input doc --output doc-build -p `npm run --silent getVersion`",
15+
"fmt": "prettier --write .",
1416
"generateVersionFile": "echo \"export default \\\"$(npm --silent run getVersion)\\\";\" > src/version.ts",
1517
"getVersion": "node -e \"console.log(require('./package.json').version)\"",
1618
"lint": "eslint src/**",
@@ -37,7 +39,7 @@
3739
"eslint-config-prettier": "^9.1.0",
3840
"eslint-plugin-import": "^2.29.1",
3941
"eslint-plugin-jsdoc": "^48.0.4",
40-
"prettier": "^3.2.4",
42+
"prettier": "^3.4.2",
4143
"typescript": "^5.3.3"
4244
},
4345
"types": "./build/index.d.ts"

src/anchor_checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export default class AnchorChecker {
7474
public addAnchorReference(
7575
inputFileWithLink: string,
7676
inputFileLinkDestination: string,
77-
anchor: string
77+
anchor: string,
7878
): void {
7979
this._anchorsList.push({
8080
inputFileWithLink,
@@ -94,7 +94,7 @@ export default class AnchorChecker {
9494
for (const elt of this._anchorsList) {
9595
const validity = this.checkValidAnchor(
9696
elt.inputFileLinkDestination,
97-
elt.anchor
97+
elt.anchor,
9898
);
9999
if (validity !== AnchorValidity.Found) {
100100
badResults.push({ ...elt, validity });

0 commit comments

Comments
 (0)