diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index d0a0ae3..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "extends": ["airbnb-base", "prettier"], - "plugins": ["prettier"], - "rules": { - "prettier/prettier": "error", - "func-names": "off", - "vars-on-top": "off", - "consistent-return": "off" - }, - "overrides": [ - { - "files": ["index.html"], - "plugins": [ - "html" - ] - }, - { - "files": ["server.js", "generators/*.js", "tools/**/*.js"], - "plugins": ["node"], - "extends": ["plugin:node/recommended"] - }, - { - "files": ["test/*.js"], - "env": { - "mocha": true - }, - "rules": { - "node/no-unpublished-require": "off" - }, - "plugins": ["node"], - "extends": "plugin:node/recommended" - } - ] -} diff --git a/eslint.config.cjs b/eslint.config.cjs new file mode 100644 index 0000000..c949193 --- /dev/null +++ b/eslint.config.cjs @@ -0,0 +1,36 @@ +[ + { + "extends": ["airbnb-base", "prettier"], + "plugins": ["prettier"], + "rules": { + "prettier/prettier": "error", + "func-names": "off", + "vars-on-top": "off", + "consistent-return": "off" + }, + "overrides": [ + { + "files": ["index.html"], + "plugins": [ + "html" + ] + }, + { + "files": ["server.js", "generators/*.js", "tools/**/*.js"], + "plugins": ["node"], + "extends": ["plugin:node/recommended"] + }, + { + "files": ["test/*.js"], + "env": { + "mocha": true + }, + "rules": { + "node/no-unpublished-require": "off" + }, + "plugins": ["node"], + "extends": "plugin:node/recommended" + } + ] + } +] diff --git a/generators/respec.js b/generators/respec.js index 8c1333a..da86be1 100644 --- a/generators/respec.js +++ b/generators/respec.js @@ -7,10 +7,9 @@ class SpecGeneratorError extends Error { } } -// eslint-disable-next-line import/prefer-default-export export async function generate(url) { try { - // eslint-disable-next-line no-console + console.log("Generating", url); const { html, errors, warnings } = await toHTML(url, { timeout: 30000, diff --git a/server.js b/server.js index 58599e0..ce1689c 100644 --- a/server.js +++ b/server.js @@ -12,7 +12,6 @@ import request from "request"; import { mkdirp } from "mkdirp"; import fetch from "node-fetch"; -// eslint-disable-next-line import/extensions import { generate } from "./generators/respec.js"; const genMap = { @@ -67,7 +66,7 @@ async function extractTar(tarFile) { extract.on("finish", () => { if (!hasIndex) { - // eslint-disable-next-line prefer-promise-reject-errors + reject("No index.html file"); } else { resolve(uploadPath); @@ -103,7 +102,7 @@ app.get( .status(500) .json({ error: "Both 'type' and 'url' are required." }); } - // eslint-disable-next-line no-prototype-builtins + if (!genMap.hasOwnProperty(req.query.type)) { return res .status(500) diff --git a/test/test.js b/test/test.js index c116907..74daaef 100644 --- a/test/test.js +++ b/test/test.js @@ -1,6 +1,5 @@ import ASSERT from "assert"; import REQUEST from "request"; -// eslint-disable-next-line import/named, import/extensions import app, { server } from "../server.js"; const PORT = 3000;