Skip to content

Commit f9969d4

Browse files
authored
Merge pull request #694 from sir-gon/develop
Develop
2 parents 7a7cac2 + 2ae03db commit f9969d4

28 files changed

+11006
-334
lines changed

.github/workflows/eslint-code-scanning.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: Set up Node.js
4949
uses: actions/setup-node@v4
5050
with:
51-
node-version: 22.x
51+
node-version: 24.x
5252

5353
- name: Install ESLint
5454
run: |

.github/workflows/eslint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
strategy:
2828
matrix:
2929
os: ["ubuntu-24.04", "macos-14", "windows-2022"]
30-
node-version: [18.x, 20.x, 22.x]
30+
node-version: [20.x, 22.x, 24.x]
3131
# See supported Node.js release schedule
3232
# at https://nodejs.org/en/about/releases/
3333
permissions:
@@ -43,7 +43,7 @@ jobs:
4343
- name: Set up Node.js
4444
uses: actions/setup-node@v4
4545
with:
46-
node-version: 22.x
46+
node-version: ${{ matrix.node-version }}
4747

4848
- name: Install ESLint
4949
run: |

.github/workflows/markdown-lint.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,14 @@ jobs:
1616
name: Markdown Lint
1717
runs-on: ubuntu-24.04
1818

19-
strategy:
20-
matrix:
21-
node-version: [22.x]
22-
# See supported Node.js release schedule
23-
# at https://nodejs.org/en/about/releases/
24-
2519
steps:
2620
- name: Checkout repository
2721
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
2822

29-
- name: Set up Node.js ${{ matrix.node-version }}
23+
- name: Set up Node.js
3024
uses: actions/setup-node@v4
3125
with:
32-
node-version: ${{ matrix.node-version }}
26+
node-version: 24.x
3327

3428
- name: Install dependencies
3529
run: npm install -g markdownlint-cli

.github/workflows/node-coverage.js.yml renamed to .github/workflows/node-coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Set up Node.js
2424
uses: actions/setup-node@v4
2525
with:
26-
node-version: 22.x
26+
node-version: 24.x
2727

2828
- name: Install dependencies
2929
run: npm ci --verbose

.github/workflows/node.js.yml renamed to .github/workflows/node-test.js.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ on: # yamllint disable-line rule:truthy
1111
workflow_dispatch:
1212

1313
jobs:
14-
build:
14+
test:
1515
name: NodeJS Jest CI Test
1616
runs-on: ${{ matrix.os }}
1717
strategy:
1818
matrix:
1919
os: ["ubuntu-24.04", "macos-14", "windows-2022"]
20-
node-version: [18.x, 20.x, 22.x]
20+
node-version: [20.x, 22.x, 24.x]
2121
# See supported Node.js release schedule
2222
# at https://nodejs.org/en/about/releases/
2323

.github/workflows/prettier-json.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Prettier JSON Lint
3+
4+
on: # yamllint disable-line rule:truthy
5+
push:
6+
branches: ['main']
7+
pull_request:
8+
# The branches below must be a subset of the branches above
9+
branches: ['main']
10+
workflow_dispatch:
11+
12+
jobs:
13+
json-lint:
14+
name: 'Prettier JSON Lint'
15+
runs-on: ['ubuntu-24.04']
16+
steps:
17+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 24.x
23+
24+
- name: Install Prettier
25+
run: |
26+
npm install -g [email protected]
27+
28+
- name: Prettier LINT / Style JSON
29+
run: >
30+
prettier --check ./src/**/*.json
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
---
12
singleQuote: true
23
quoteProps: preserve
34
useTabs: false
45
printWidth: 80
56
tabWidth: 2
67
trailingComma: none
7-
parser: typescript

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ WORKDIR ${WORKDIR}
1717

1818
RUN apk add --update --no-cache make nodejs npm \
1919
&& apk add --update --no-cache yamllint \
20-
&& npm install -g --ignore-scripts markdownlint-cli
20+
&& npm install -g --ignore-scripts markdownlint-cli \
21+
&& npm install -g --ignore-scripts prettier
2122

2223
# [!TIP] Use a bind-mount to "/app" to override following "copys"
2324
# for lint and test against "current" sources in this stage
@@ -39,7 +40,7 @@ COPY ./package-lock.json ${WORKDIR}/package-lock.json
3940
COPY ./Makefile ${WORKDIR}/
4041

4142
# code linting conf
42-
COPY ./.prettierrc ${WORKDIR}/
43+
COPY ./.prettierrc.yaml ${WORKDIR}/
4344
COPY ./.prettierignore ${WORKDIR}/
4445
COPY ./eslint.config.js ${WORKDIR}/
4546
COPY ./.babelrc ${WORKDIR}/

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,31 @@ dependencies:
6363
test -x ./node_modules || npm install --verbose
6464
@echo "################################################################################"
6565

66+
lint/json:
67+
prettier --check ./src/**/*.json
68+
6669
lint/markdown:
6770
markdownlint '**/*.md' --ignore node_modules && echo '✔ Your code looks good.'
6871

6972
lint/yaml:
7073
yamllint --stric . && echo '✔ Your code looks good.'
7174

72-
lint: lint/markdown lint/yaml test/styling test/static
75+
lint: lint/markdown lint/yaml lint/json test/styling test/static
7376

7477
test/static: dependencies
7578
${NPM} run lint
7679

7780
test/styling: dependencies
7881
${NPM} run style:check
7982

80-
format: dependencies
83+
format/sources: dependencies
8184
${NPM} run style:format
8285

86+
format/json:
87+
prettier --write ./src/**/*.json
88+
89+
format: format/sources format/json
90+
8391
test: env dependencies
8492
${NPM} run jest:ci
8593

src/hackerrank/interview_preparation_kit/arrays/cruch_testcases_test.json

Lines changed: 10 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,30 @@
33
"title": "Sample Test Case 0",
44
"n": 5,
55
"queries": [
6-
[
7-
1,
8-
2,
9-
100
10-
],
11-
[
12-
2,
13-
5,
14-
100
15-
],
16-
[
17-
3,
18-
4,
19-
100
20-
]
6+
[1, 2, 100],
7+
[2, 5, 100],
8+
[3, 4, 100]
219
],
2210
"expected": 200
2311
},
2412
{
2513
"title": "Sample Test Case 1",
2614
"n": 10,
2715
"queries": [
28-
[
29-
1,
30-
5,
31-
3
32-
],
33-
[
34-
4,
35-
8,
36-
7
37-
],
38-
[
39-
6,
40-
9,
41-
1
42-
]
16+
[1, 5, 3],
17+
[4, 8, 7],
18+
[6, 9, 1]
4319
],
4420
"expected": 10
4521
},
4622
{
4723
"title": "Sample Test Case 3",
4824
"n": 10,
4925
"queries": [
50-
[
51-
2,
52-
6,
53-
8
54-
],
55-
[
56-
3,
57-
5,
58-
7
59-
],
60-
[
61-
1,
62-
8,
63-
1
64-
],
65-
[
66-
5,
67-
9,
68-
15
69-
]
26+
[2, 6, 8],
27+
[3, 5, 7],
28+
[1, 8, 1],
29+
[5, 9, 15]
7030
],
7131
"expected": 31
7232
}

0 commit comments

Comments
 (0)