Skip to content

Commit

Permalink
Adopt eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanDamron committed Dec 7, 2024
1 parent 12cf2fe commit 051edfa
Show file tree
Hide file tree
Showing 7 changed files with 1,167 additions and 8 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,29 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v4
with:
node-version: '22.11.0'

- name: Lint Dockerfiles
run: |
wget -O hadolint https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64
mv hadolint /usr/local/bin/hadolint
chmod +x /usr/local/bin/hadolint
ls -la
hadolint --config .hadolint.yaml ./Dockerfiles/*
hadolint --config .hadolint.yaml Dockerfiles/*
- name: Lint Dockerfiles
run: |
wget -O hadolint https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64
mv hadolint /usr/local/bin/hadolint
chmod +x /usr/local/bin/hadolint
hadolint --config .hadolint.yaml Dockerfiles/*
- name: Lint JS
run: |
cd src/
npm i
npx eslint .
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
Expand Down
1 change: 1 addition & 0 deletions src/db.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pgPromise from "pg-promise"
import { wipeDB } from "./utils.js"
import { process } from "node:process"

const pgp = pgPromise({})

Expand Down
14 changes: 14 additions & 0 deletions src/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import globals from "globals";
import pluginJs from "@eslint/js";


/** @type {import('eslint').Linter.Config[]} */
export default [
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
{
rules: {
"no-prototype-builtins": "off"
}
}
];
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ app.get("/recommendations", async (req, res) => {
const tagsVal = sanitizeString(checkForBannedWords(req.query, "tags"))
const limit = parseInt(sanitizeString(checkForBannedWords(req.query, "limit")))

if (limit === NaN || tagsVal === "") {
if (isNaN(limit) || tagsVal === "") {
res.status(400).json({
"message": "Invalid request body",
})
Expand Down Expand Up @@ -120,7 +120,7 @@ app.get("/recommendations", async (req, res) => {
deploymentURLs.push(deployment[0].url)
}
}
} catch {}
} catch {} // eslint-disable-line no-empty
}
})

Expand Down
Loading

0 comments on commit 051edfa

Please # to comment.