Skip to content

Commit 28438df

Browse files
lumirlumirCopilot
andauthored
chore: introduce prettier (#92)
* chore: introduce `prettier` * wip: fmt * wip * wip * Update lib/release-ops.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update lib/shell-ops.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent a1983b5 commit 28438df

13 files changed

Lines changed: 1222 additions & 1149 deletions
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
name: add-to-triage
2-
3-
on:
4-
issues:
5-
types:
6-
- opened
7-
- reopened
8-
- transferred
9-
10-
pull_request_target:
11-
types:
12-
- opened
13-
- reopened
14-
15-
jobs:
16-
add-to-triage:
17-
uses: eslint/workflows/.github/workflows/add-to-triage.yml@main
18-
secrets:
19-
project_bot_token: ${{ secrets.PROJECT_BOT_TOKEN }}
1+
name: add-to-triage
2+
3+
on:
4+
issues:
5+
types:
6+
- opened
7+
- reopened
8+
- transferred
9+
10+
pull_request_target:
11+
types:
12+
- opened
13+
- reopened
14+
15+
jobs:
16+
add-to-triage:
17+
uses: eslint/workflows/.github/workflows/add-to-triage.yml@main
18+
secrets:
19+
project_bot_token: ${{ secrets.PROJECT_BOT_TOKEN }}

.github/workflows/ci.yml

Lines changed: 50 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,53 @@
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
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-
test:
24-
name: Test
25-
strategy:
26-
matrix:
27-
os: [ubuntu-latest]
28-
node: [25.x, 24.x, 22.x, 20.x, 18.x]
29-
runs-on: ${{ matrix.os }}
30-
steps:
31-
- uses: actions/checkout@v6
32-
- uses: actions/setup-node@v6
33-
with:
34-
node-version: ${{ matrix.node }}
35-
- name: Install dependencies
36-
run: npm install
37-
- name: Run tests
38-
run: npm test
10+
lint:
11+
name: Lint
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
37+
38+
test:
39+
name: Test
40+
strategy:
41+
matrix:
42+
os: [ubuntu-latest]
43+
node: [25.x, 24.x, 22.x, 20.x, 18.x]
44+
runs-on: ${{ matrix.os }}
45+
steps:
46+
- uses: actions/checkout@v6
47+
- uses: actions/setup-node@v6
48+
with:
49+
node-version: ${{ matrix.node }}
50+
- name: Install dependencies
51+
run: npm install
52+
- name: Run tests
53+
run: npm test
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
name: update-readme
2-
3-
on:
4-
schedule:
5-
- cron: "0 8 * * *" # Runs every day at 08:00 AM UTC
6-
7-
workflow_dispatch:
8-
9-
jobs:
10-
update-readme:
11-
uses: eslint/workflows/.github/workflows/update-readme.yml@main
12-
secrets:
13-
workflow_push_bot_token: ${{ secrets.WORKFLOW_PUSH_BOT_TOKEN }}
1+
name: update-readme
2+
3+
on:
4+
schedule:
5+
- cron: "0 8 * * *" # Runs every day at 08:00 AM UTC
6+
7+
workflow_dispatch:
8+
9+
jobs:
10+
update-readme:
11+
uses: eslint/workflows/.github/workflows/update-readme.yml@main
12+
secrets:
13+
workflow_push_bot_token: ${{ secrets.WORKFLOW_PUSH_BOT_TOKEN }}

.prettierignore

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

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ $ npm install eslint-release --save-dev
2222

2323
To start, you'll need to define two environment variables:
2424

25-
* `NPM_TOKEN` - a token to use for `npm publish`. The token must be from a user that has permission to publish the package.
26-
* `ESLINT_GITHUB_TOKEN` - a token for a GitHub user that has `repo` permission (used for posting release notes).
25+
- `NPM_TOKEN` - a token to use for `npm publish`. The token must be from a user that has permission to publish the package.
26+
- `ESLINT_GITHUB_TOKEN` - a token for a GitHub user that has `repo` permission (used for posting release notes).
2727

2828
The ESLint release tool is designed to be used on the command line and is divided into two phases: package generation and package publishing.
2929

@@ -77,8 +77,8 @@ When you do a prerelease, the same steps are taken except that package is publis
7777

7878
This package exports two functions:
7979

80-
* `generateRelease(prereleaseId, packageTag)` - This corresponds to the CLI command `eslint-generate-release` when `prereleaseId` is `undefined`, and the CLI command `eslint-generate-prerelease prereleaseId` when `prereleaseId` is a string value.
81-
* `publishRelease()` - This corresponds to the CLI command `eslint-publish-release`.
80+
- `generateRelease(prereleaseId, packageTag)` - This corresponds to the CLI command `eslint-generate-release` when `prereleaseId` is `undefined`, and the CLI command `eslint-generate-prerelease prereleaseId` when `prereleaseId` is a string value.
81+
- `publishRelease()` - This corresponds to the CLI command `eslint-publish-release`.
8282

8383
`packageTag` is used as the `--tag` value in the `npm publish` command. It's also used to determine whether a regular release will be marked as Latest on GitHub: it will be marked as Latest only if `packageTag` is `"latest"`. This parameter is optional and defaults to `"latest"` when `prereleaseId` is `undefined`, `"next"` otherwise.
8484

bin/eslint-generate-prerelease.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ const ReleaseOps = require("../lib/release-ops");
2424
* $ eslint-generate-prerelease beta
2525
*/
2626
const args = process.argv.slice(2),
27-
prereleaseId = (args.length ? args[0] : null);
27+
prereleaseId = args.length ? args[0] : null;
2828

2929
// there must be a prerelease ID
3030
if (!prereleaseId) {
31-
console.log("Missing prerelease identifier (alpha, beta, rc, etc.).");
32-
process.exit(1);
31+
console.log("Missing prerelease identifier (alpha, beta, rc, etc.).");
32+
process.exit(1);
3333
}
3434

3535
ReleaseOps.generateRelease(prereleaseId);

eslint.config.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
"use strict";
2-
3-
const { defineConfig } = require("eslint/config");
4-
const eslintConfigESLint = require("eslint-config-eslint/cjs");
5-
const globals = require("globals");
6-
7-
module.exports = defineConfig([
8-
eslintConfigESLint,
9-
{
10-
files: ["lib/**/*.js", "bin/**/*.js"],
11-
rules: {
12-
"no-console": "off",
13-
"require-unicode-regexp": "off",
14-
"regexp/optimal-quantifier-concatenation": "off",
15-
"n/no-process-exit": "off",
16-
},
17-
},
18-
{
19-
files: ["tests/**/*.test.js"],
20-
languageOptions: {
21-
globals: {
22-
...globals.mocha
23-
}
24-
}
25-
}
26-
]);
1+
"use strict";
2+
3+
const { defineConfig } = require("eslint/config");
4+
const eslintConfigESLint = require("eslint-config-eslint/cjs");
5+
const globals = require("globals");
6+
7+
module.exports = defineConfig([
8+
eslintConfigESLint,
9+
{
10+
files: ["lib/**/*.js", "bin/**/*.js"],
11+
rules: {
12+
"no-console": "off",
13+
"require-unicode-regexp": "off",
14+
"regexp/optimal-quantifier-concatenation": "off",
15+
"n/no-process-exit": "off",
16+
},
17+
},
18+
{
19+
files: ["tests/**/*.test.js"],
20+
languageOptions: {
21+
globals: {
22+
...globals.mocha,
23+
},
24+
},
25+
},
26+
]);

0 commit comments

Comments
 (0)