Skip to content

Commit ee8c804

Browse files
authored
chore: introduce prettier (#641)
* chore: introduce `prettier` * wip: add EOL * wip: add `"use strict"` * wip: update `actions/*` reusable workflow version
1 parent c0d3681 commit ee8c804

10 files changed

Lines changed: 320 additions & 239 deletions

.github/workflows/ci.yml

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
11
name: CI
22
on:
3-
push:
4-
branches:
5-
- main
6-
pull_request:
7-
branches:
8-
- main
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
99
jobs:
10-
lint:
11-
name: Lint Files
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v4
15-
- name: Setup Node.js
16-
uses: actions/setup-node@v4
17-
with:
18-
node-version: 'lts/*'
19-
- name: Install dependencies
20-
run: npm install
21-
- name: Lint Files
22-
run: npm run lint
10+
lint:
11+
name: Lint Files
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v6
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v6
17+
with:
18+
node-version: "lts/*"
19+
- name: Install dependencies
20+
run: npm install
21+
- name: Lint Files
22+
run: npm run lint
23+
24+
format:
25+
name: File Format
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v6
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v6
31+
with:
32+
node-version: "lts/*"
33+
- name: Install dependencies
34+
run: npm install
35+
- name: Prettier Check
36+
run: npm run fmt:check
Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,40 @@
11
name: Generate Contributor Pool Report
22
on:
3-
workflow_dispatch:
4-
schedule:
5-
- cron: '0 9 1 * *' # Runs on the 1st of every month at 9:00 AM UTC
6-
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "0 9 1 * *" # Runs on the 1st of every month at 9:00 AM UTC
6+
77
jobs:
8-
generate-contributor-pool:
9-
10-
permissions:
11-
contents: write
12-
pull-requests: write
13-
14-
env:
15-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16-
17-
runs-on: ubuntu-latest
18-
steps:
19-
- uses: actions/checkout@v4
20-
- name: Setup Node.js
21-
uses: actions/setup-node@v4
22-
with:
23-
node-version: 'lts/*'
8+
generate-contributor-pool:
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v6
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v6
21+
with:
22+
node-version: "lts/*"
23+
24+
- name: Install dependencies
25+
run: npm install
26+
27+
- name: Generate report
28+
run: npm run generate:contributor-pool
29+
30+
- name: Create Pull Request
31+
uses: peter-evans/create-pull-request@v7
32+
with:
33+
commit-message: "chore: Add contributor pool report"
34+
title: "chore: Add contributor pool report"
35+
branch: generate-contributor-pool-report
36+
branch-suffix: timestamp
37+
body: |
38+
Add contributor pool report for the month.
2439
25-
- name: Install dependencies
26-
run: npm install
27-
28-
- name: Generate report
29-
run: npm run generate:contributor-pool
30-
31-
- name: Create Pull Request
32-
uses: peter-evans/create-pull-request@v7
33-
with:
34-
commit-message: "chore: Add contributor pool report"
35-
title: "chore: Add contributor pool report"
36-
branch: generate-contributor-pool-report
37-
branch-suffix: timestamp
38-
body: |
39-
Add contributor pool report for the month.
40-
41-
This PR is autogenerated by the "Generate Contributor Pool" GitHub Action.
40+
This PR is autogenerated by the "Generate Contributor Pool" GitHub Action.
Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
name: Generate TSC Meeting Transcript
22
on:
3-
issues:
4-
types: [closed]
3+
issues:
4+
types: [closed]
55
jobs:
6-
generate-trancript:
7-
runs-on: ubuntu-latest
8-
permissions:
9-
contents: write
10-
pull-requests: write
11-
if: contains(github.event.issue.labels.*.name, 'tsc meeting')
12-
steps:
13-
- uses: actions/checkout@v4
14-
- name: Setup Node.js
15-
uses: actions/setup-node@v4
16-
with:
17-
node-version: 'lts/*'
18-
- name: Install dependencies
19-
run: npm install
20-
- name: Generate transcript
21-
run: npm run generate:transcript
22-
env:
23-
TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
24-
ID: ${{ secrets.DISCORD_CHANNEL_ID }}
25-
ISSUE_TITLE: ${{ github.event.issue.title }}
26-
- name: Configure Git identity
27-
run: |
28-
git config user.email "eslint[bot]@users.noreply.github.com"
29-
git config user.name "ESLint Bot"
30-
- name: Commit generated transcript (if changed)
31-
run: |
32-
if [ -z "$(git status --porcelain)" ]; then
33-
echo "No changed files. Skipping commit."
34-
else
35-
echo "Files changed."
36-
git add .
37-
git commit -m 'Add ${{ github.event.issue.title }} transcript'
38-
echo "TRANSCRIPT_GENERATED=true" >> $GITHUB_ENV
39-
fi
40-
- name: Create Pull Request
41-
if: env.TRANSCRIPT_GENERATED == 'true'
42-
uses: peter-evans/create-pull-request@v7
43-
with:
44-
commit-message: Add ${{ github.event.issue.title }} transcript
45-
title: Add ${{ github.event.issue.title }} transcript
46-
branch: generate-meeting-transcript
47-
branch-suffix: timestamp
48-
author: ESLint Bot <eslint[bot]@users.noreply.github.com>
49-
committer: ESLint Bot <eslint[bot]@users.noreply.github.com>
50-
body: |
51-
Add ${{ github.event.issue.title }} transcript.
52-
53-
This PR is autogenerated by the "Generate Transcript" GitHub Action.
6+
generate-trancript:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
if: contains(github.event.issue.labels.*.name, 'tsc meeting')
12+
steps:
13+
- uses: actions/checkout@v6
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v6
16+
with:
17+
node-version: "lts/*"
18+
- name: Install dependencies
19+
run: npm install
20+
- name: Generate transcript
21+
run: npm run generate:transcript
22+
env:
23+
TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
24+
ID: ${{ secrets.DISCORD_CHANNEL_ID }}
25+
ISSUE_TITLE: ${{ github.event.issue.title }}
26+
- name: Configure Git identity
27+
run: |
28+
git config user.email "eslint[bot]@users.noreply.github.com"
29+
git config user.name "ESLint Bot"
30+
- name: Commit generated transcript (if changed)
31+
run: |
32+
if [ -z "$(git status --porcelain)" ]; then
33+
echo "No changed files. Skipping commit."
34+
else
35+
echo "Files changed."
36+
git add .
37+
git commit -m 'Add ${{ github.event.issue.title }} transcript'
38+
echo "TRANSCRIPT_GENERATED=true" >> $GITHUB_ENV
39+
fi
40+
- name: Create Pull Request
41+
if: env.TRANSCRIPT_GENERATED == 'true'
42+
uses: peter-evans/create-pull-request@v7
43+
with:
44+
commit-message: Add ${{ github.event.issue.title }} transcript
45+
title: Add ${{ github.event.issue.title }} transcript
46+
branch: generate-meeting-transcript
47+
branch-suffix: timestamp
48+
author: ESLint Bot <eslint[bot]@users.noreply.github.com>
49+
committer: ESLint Bot <eslint[bot]@users.noreply.github.com>
50+
body: |
51+
Add ${{ github.event.issue.title }} transcript.
52+
53+
This PR is autogenerated by the "Generate Transcript" GitHub Action.

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/*.md

eslint.config.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ const { defineConfig } = require("eslint/config");
44
const eslintConfigESLint = require("eslint-config-eslint/cjs");
55

66
module.exports = defineConfig([
7-
eslintConfigESLint,
8-
{
9-
files: ["scripts/**/*.js"],
10-
rules: {
11-
"no-console": "off",
12-
}
13-
}
7+
eslintConfigESLint,
8+
{
9+
files: ["scripts/**/*.js"],
10+
rules: {
11+
"no-console": "off",
12+
},
13+
},
1414
]);

package-lock.json

Lines changed: 24 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"scripts": {
77
"lint": "eslint",
88
"lint:fix": "eslint --fix",
9+
"fmt": "prettier --write .",
10+
"fmt:check": "prettier --check .",
911
"generate:transcript": "node ./scripts/generate-transcript.js",
1012
"generate:contributor-pool": "node ./scripts/generate-contributor-pool.js"
1113
},
@@ -21,6 +23,7 @@
2123
},
2224
"devDependencies": {
2325
"eslint": "^9.39.1",
24-
"eslint-config-eslint": "^13.0.0"
26+
"eslint-config-eslint": "^13.0.0",
27+
"prettier": "^3.7.4"
2528
}
2629
}

prettier.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"use strict";
2+
3+
module.exports = {
4+
useTabs: true,
5+
tabWidth: 4,
6+
arrowParens: "avoid",
7+
8+
overrides: [
9+
{
10+
files: ["*.json"],
11+
options: {
12+
tabWidth: 2,
13+
useTabs: false,
14+
},
15+
},
16+
],
17+
};

0 commit comments

Comments
 (0)