Skip to content

Commit

Permalink
[v3] [Proposal] Bring prettier to the v3
Browse files Browse the repository at this point in the history
One of the bigger pain points of backporting fixes and improvements to
the v3 is due to the fact that we rely on prettier for the v4 but not on
the v3, leading to huge conflicts in the end mostly related to different
formatting.

This PR proposes that we bring prettier and a similar eslint config to
the v3 just to ease comparisons between both major versions.

Note that some eslint rules enabled on the v4 are here not enabled,
mostly `eqeqeq` and `no-nested-ternaries`(both because that's a lot of
work).

For that second rule, the fact that we also run prettier may lead to code
harder to read than before.
  • Loading branch information
peaBerberian committed Sep 23, 2024
1 parent 83d6dbf commit 40a5093
Show file tree
Hide file tree
Showing 1,020 changed files with 45,574 additions and 44,514 deletions.
377 changes: 132 additions & 245 deletions .eslintrc.js

Large diffs are not rendered by default.

97 changes: 69 additions & 28 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,90 @@ on:
types: [opened, synchronize, reopened]

jobs:
check:
format_check:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- run: npm install
- run: rustup target add wasm32-unknown-unknown
- run: npm run fmt:prettier:check
- run: npm run fmt:rust:check

typechecking_and_linting:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm install
- run: npm run check

unit_tests:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm run check
- run: npm run test:unit
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm install
- run: npm run test:unit

integration_linux:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# needed for integration & memory tests codecs support
- run: sudo add-apt-repository multiverse && sudo apt update && sudo apt install -y ubuntu-restricted-extras
- run: npm install
# Firefox seems to have issue with integration tests on GitHub actions only
# TODO to check
- run: node tests/integration/run.js --bchromehl
- run: npm run test:memory
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
# needed for integration & memory tests codecs support
- run:
sudo add-apt-repository multiverse && sudo apt update && sudo apt install -y
ubuntu-restricted-extras
- run: npm install
# Firefox seems to have issue with integration tests on GitHub actions only
# TODO to check
- run: node tests/integration/run.js --bchromehl
- run: npm run test:memory

# Windows seems to be a lot less stable for some reason.
# TODO debug?
Expand All @@ -62,7 +103,7 @@ jobs:

# strategy:
# matrix:
# node-version: [16.x]
# node-version: [20.x]
# # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

# steps:
Expand All @@ -86,7 +127,7 @@ jobs:

# strategy:
# matrix:
# node-version: [16.x]
# node-version: [20.x]
# # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

# steps:
Expand Down
36 changes: 19 additions & 17 deletions .github/workflows/perfs.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
name: Performance tests
on:
pull_request:
types: [ labeled ]
types: [labeled]

jobs:
perf-tests:
if: ${{ github.event.label.name == 'Performance checks' }}
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# needed for integration & memory tests codecs support
- run: sudo add-apt-repository multiverse && sudo apt update && sudo apt install -y ubuntu-restricted-extras
- run: npm install
- run: export DISPLAY=:99
- run: sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
- run: node tests/performance/run.js
perf-tests:
if: ${{ github.event.label.name == 'Performance checks' }}
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
# needed for integration & memory tests codecs support
- run:
sudo add-apt-repository multiverse && sudo apt update && sudo apt install -y
ubuntu-restricted-extras
- run: npm install
- run: export DISPLAY=:99
- run: sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
- run: node tests/performance/run.js
4 changes: 2 additions & 2 deletions .github/workflows/sonarcloud_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"printWidth": 90,
"proseWrap": "always"
}
Loading

0 comments on commit 40a5093

Please sign in to comment.