Skip to content

Commit 051edfa

Browse files
committed
Adopt eslint
1 parent 12cf2fe commit 051edfa

File tree

7 files changed

+1167
-8
lines changed

7 files changed

+1167
-8
lines changed

.github/workflows/main.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,29 @@ jobs:
2323

2424
steps:
2525
- uses: actions/checkout@v2
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: '22.11.0'
2629

2730
- name: Lint Dockerfiles
2831
run: |
2932
wget -O hadolint https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64
3033
mv hadolint /usr/local/bin/hadolint
3134
chmod +x /usr/local/bin/hadolint
32-
ls -la
33-
hadolint --config .hadolint.yaml ./Dockerfiles/*
35+
hadolint --config .hadolint.yaml Dockerfiles/*
36+
37+
- name: Lint Dockerfiles
38+
run: |
39+
wget -O hadolint https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64
40+
mv hadolint /usr/local/bin/hadolint
41+
chmod +x /usr/local/bin/hadolint
42+
hadolint --config .hadolint.yaml Dockerfiles/*
43+
44+
- name: Lint JS
45+
run: |
46+
cd src/
47+
npm i
48+
npx eslint .
3449
3550
build:
3651
if: "!contains(github.event.head_commit.message, 'skip ci')"

src/db.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pgPromise from "pg-promise"
22
import { wipeDB } from "./utils.js"
3+
import { process } from "node:process"
34

45
const pgp = pgPromise({})
56

src/eslint.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import globals from "globals";
2+
import pluginJs from "@eslint/js";
3+
4+
5+
/** @type {import('eslint').Linter.Config[]} */
6+
export default [
7+
{languageOptions: { globals: globals.browser }},
8+
pluginJs.configs.recommended,
9+
{
10+
rules: {
11+
"no-prototype-builtins": "off"
12+
}
13+
}
14+
];

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ app.get("/recommendations", async (req, res) => {
9191
const tagsVal = sanitizeString(checkForBannedWords(req.query, "tags"))
9292
const limit = parseInt(sanitizeString(checkForBannedWords(req.query, "limit")))
9393

94-
if (limit === NaN || tagsVal === "") {
94+
if (isNaN(limit) || tagsVal === "") {
9595
res.status(400).json({
9696
"message": "Invalid request body",
9797
})
@@ -120,7 +120,7 @@ app.get("/recommendations", async (req, res) => {
120120
deploymentURLs.push(deployment[0].url)
121121
}
122122
}
123-
} catch {}
123+
} catch {} // eslint-disable-line no-empty
124124
}
125125
})
126126

0 commit comments

Comments
 (0)