Skip to content

Commit 66e79c2

Browse files
rferenszgroza
andauthored
Modernize used node and a few other packages, add eslint and enforce sorting includes
* Add eslint and sort includes This is code health CL, it foster code health by adding linter that can verify keeping consistent style and avoiding some kind of error. It also adds prettier plugin that sorts includes when as usual run with `npm run lint` and fixes some audit issues. The code also updates developer dependency packages versions and the node version. * Updating package-lock.json * Undo removing line * Make package-lock.json smaller * Update Luke's name Co-authored-by: Zgroza (Luke) Klimek <zgroza@google.com> * Update node and prettier version * Fixing Editor's Copy and prettier workflow check * Prettier workflow problems * Try with older prettier-actions * Add plugin to prettier on command level * Customized worflow to workaround prettier-actions external plugins bug * Sorry, i cannot test workflow locally... * Sorry, I cannot test workflow locally... p.2 * Another workflow try... * I'll squash it later... * Typo * Use npx * Use glob path * Maybe separate test will help * Maybe separate test will help p.2 * Where it starts? * Simple path typo * Use working directory of prettier actions * Manual workflow * Manual workflow nit * Manual workflow nit2 * No cache - simple better --------- Co-authored-by: Zgroza (Luke) Klimek <zgroza@google.com>
1 parent 94029ee commit 66e79c2

23 files changed

Lines changed: 1888 additions & 356 deletions

.github/workflows/build.yml

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
node-version: [16, 18, 20]
17+
node-version: [20, 22, 24]
1818
steps:
1919
- uses: actions/checkout@v2
2020
- uses: actions/setup-node@v3
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: ubuntu-latest
2929
strategy:
3030
matrix:
31-
node-version: [16, 18, 20]
31+
node-version: [20, 22, 24]
3232
steps:
3333
- uses: actions/checkout@v2
3434
- uses: actions/setup-node@v3
@@ -38,13 +38,38 @@ jobs:
3838
- run: npm --prefix ./js/sign run build
3939
- run: npm --prefix ./js/sign test
4040

41-
prettier:
41+
prettier-wbn:
4242
runs-on: ubuntu-latest
43+
defaults:
44+
run:
45+
working-directory: js/bundle
4346
steps:
44-
- uses: actions/checkout@v2
45-
- uses: creyD/prettier_action@v4.3
47+
- uses: actions/checkout@v4
48+
- name: Setup Node.js
49+
uses: actions/setup-node@v4
50+
with:
51+
node-version: 22
52+
- name: Install Prettier
53+
run: |
54+
npm install prettier@3.5 --no-save
55+
- name: Run Prettier Check
56+
run: |
57+
npx prettier --check . --ignore-unknown
58+
59+
prettier-wbn-sign:
60+
runs-on: ubuntu-latest
61+
defaults:
62+
run:
63+
working-directory: js/sign
64+
steps:
65+
- uses: actions/checkout@v4
66+
- name: Setup Node.js
67+
uses: actions/setup-node@v4
4668
with:
47-
prettier_options: --write **/*.{js,ts}
48-
only_changed: True
49-
dry: True
50-
prettier_version: 2.7.1
69+
node-version: 22
70+
- name: Install Prettier and Plugins
71+
run: |
72+
npm install prettier@3.5 @ianvs/prettier-plugin-sort-imports --no-save
73+
- name: Run Prettier Check
74+
run: |
75+
npx prettier --check . --ignore-unknown --plugin=@ianvs/prettier-plugin-sort-imports

.github/workflows/ghpages.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
echo "::set-output name=path::$HOME/.cache/xml2rfc"
3434
date -u "+::set-output name=date::%FT%T"
3535
- name: "Cache References"
36-
uses: actions/cache@v2
36+
uses: actions/cache@v4
3737
with:
3838
path: ${{ steps.cache-setup.outputs.path }}
3939
key: refcache-${{ steps.cache-setup.outputs.date }}
@@ -59,11 +59,11 @@ jobs:
5959
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6060

6161
- name: "Save HTML"
62-
uses: actions/upload-artifact@v2
62+
uses: actions/upload-artifact@v4
6363
with:
6464
path: "*.html"
6565

6666
- name: "Save Text"
67-
uses: actions/upload-artifact@v2
67+
uses: actions/upload-artifact@v4
6868
with:
6969
path: "*.txt"

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
echo "::set-output name=path::$HOME/.cache/xml2rfc"
2525
date -u "+::set-output name=date::%FT%T"
2626
- name: "Cache References"
27-
uses: actions/cache@v2
27+
uses: actions/cache@v4
2828
with:
2929
path: ${{ steps.cache-setup.outputs.path }}
3030
key: refcache-${{ steps.date.outputs.date }}

js/bundle/package-lock.json

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

js/bundle/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,18 @@
4646
"@types/node": "^12.7.11",
4747
"esbuild": "^0.25.0",
4848
"jasmine": "^4.2.1",
49-
"prettier": "2.8.0",
49+
"prettier": "3.5.3",
5050
"typescript": "^4.7.3"
5151
},
5252
"engines": {
53-
"node": ">= 12.0.0"
53+
"node": ">= 20.0.0"
5454
},
5555
"prettier": {
5656
"tabWidth": 2,
5757
"semi": true,
5858
"singleQuote": true,
5959
"printWidth": 80,
60-
"proseWrap": "always"
60+
"proseWrap": "always",
61+
"trailingComma": "es5"
6162
}
6263
}

js/bundle/src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export const B1 = 'b1';
22
export const B2 = 'b2';
33
export const DEFAULT_VERSION = B2;
44
export const APPROVED_VERSIONS = [B1, B2] as const;
5-
export type FormatVersion = typeof APPROVED_VERSIONS[number];
5+
export type FormatVersion = (typeof APPROVED_VERSIONS)[number];
66

77
export function isApprovedVersion(param: any): param is FormatVersion {
88
return APPROVED_VERSIONS.includes(param);

js/sign/.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ lib
22
*.wbn
33
*.swbn
44
testdata
5+
README.md

js/sign/eslint.config.mjs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// @ts-check
2+
3+
import eslint from '@eslint/js';
4+
import { defineConfig } from 'eslint/config';
5+
import globals from 'globals';
6+
import tseslint from 'typescript-eslint';
7+
8+
export default defineConfig(
9+
{
10+
ignores: ['lib/**', 'node_modules/**'],
11+
},
12+
eslint.configs.recommended,
13+
...tseslint.configs.recommended,
14+
{
15+
files: ['**/*.ts', '**/*.js'],
16+
languageOptions: {
17+
globals: {
18+
...globals.node,
19+
},
20+
},
21+
},
22+
// Test specific rules/globals
23+
{
24+
files: ['**/tests/**/*.js', '**/*_test.js'],
25+
languageOptions: {
26+
globals: {
27+
...globals.jasmine,
28+
},
29+
},
30+
}
31+
);

0 commit comments

Comments
 (0)