Skip to content

Commit 0220528

Browse files
authored
dependency, lint upgrades (#502)
* upgrade dev dependencies * minor updates to chai * bulk lint fixes * remove two 'easy' lint rules * remove another lint rule * remove unused rule * remove another lint config * oops, keep this
1 parent d3472b4 commit 0220528

32 files changed

+465
-353
lines changed

eslint.config.mjs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ export default [
2525
"jsdoc/require-returns-type": "off",
2626

2727
"@typescript-eslint/no-require-imports": "warn", // TODO(bkendall): remove allow to error.
28-
"@typescript-eslint/no-unused-expressions": "warn", // TODO(bkendall): remove allow to error.
29-
"@typescript-eslint/no-unused-vars": "warn", // TODO(bkendall): remove allow to error.
30-
"@typescript-eslint/prefer-includes": "warn", // TODO(bkendall): remove allow to error.
31-
"@typescript-eslint/prefer-optional-chain": "warn", // TODO(bkendall): remove allow to error.
32-
"@typescript-eslint/prefer-promise-reject-errors": "warn", // TODO(bkendall): remove allow to error.
33-
"@typescript-eslint/prefer-nullish-coalescing": "warn", // TODO(bkendall): remove allow to error.
3428

3529
"no-unused-vars": "off", // Turned off in favor of @typescript-eslint/no-unused-vars.
3630
"require-atomic-updates": "off", // This rule is so noisy and isn't useful: https://github.com/eslint/eslint/issues/11899

package-lock.json

Lines changed: 375 additions & 250 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@
8888
"eslint": "^9.35.0",
8989
"eslint-config-google": "^0.14.0",
9090
"eslint-config-prettier": "^10.1.8",
91-
"eslint-plugin-jsdoc": "^55.0.0",
91+
"eslint-plugin-jsdoc": "^60.6.0",
9292
"eslint-plugin-prettier": "^5.5.4",
9393
"globals": "^16.3.0",
9494
"mocha": "^11.7.2",
9595
"nyc": "^17.0.0",
9696
"prettier": "^3.1.1",
97-
"rimraf": "^5.0.1",
97+
"rimraf": "^6.0.1",
9898
"sinon": "^17.0.1",
9999
"sinon-chai": "^3.7.0",
100100
"source-map-support": "^0.5.21",

src/activator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Activator.prototype.build = function () {
5959

6060
return function (req, res, next) {
6161
promiseback(self.awaitConfig, 2)(req, res).then((config) => {
62-
req.superstatic = config || {};
62+
req.superstatic = config ?? {};
6363

6464
const stack = self.stack.slice(0).reverse();
6565
const _run = function () {

src/bin/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2222
*/
2323

24-
const updateNotifier = require("update-notifier-cjs"); // eslint-disable-line @typescript-eslint/no-var-requires
24+
const updateNotifier = require("update-notifier-cjs");
2525

2626
import cli from "../cli";
27-
const pkg = require("../../package.json"); // eslint-disable-line @typescript-eslint/no-var-requires
27+
const pkg = require("../../package.json");
2828

2929
const updateCheckInterval = 1000 * 60 * 60 * 24 * 7; // 1 week
3030

src/cli/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { Command } from "commander";
2323
import * as fs from "node:fs";
2424
import * as path from "node:path";
2525

26-
const pkg = require("../../package.json"); // eslint-disable-line @typescript-eslint/no-var-requires
26+
const pkg = require("../../package.json");
2727
import server = require("../server");
2828

2929
const PORT = "3474";
@@ -34,7 +34,7 @@ const ENV_FILENAME = ".env.json";
3434
let env: Record<string, string> | undefined = undefined;
3535
try {
3636
env = JSON.parse(fs.readFileSync(path.resolve(ENV_FILENAME), "utf8"));
37-
} catch (e) {
37+
} catch {
3838
// do nothing
3939
}
4040

@@ -65,7 +65,6 @@ cli
6565
});
6666
app.listen(() => resolve());
6767
console.log(
68-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
6968
`Superstatic started.\nVisit http://${options.hostname}:${options.port} to view your app.`,
7069
);
7170
});

src/loaders/config-file.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ module.exports = function (filename) {
3232
return filename;
3333
}
3434

35-
filename = filename || CONFIG_FILE;
35+
filename = filename ?? CONFIG_FILE;
3636

3737
let configObject = {};
3838
let config = {};
3939

4040
// From custom config data passed in
4141
try {
4242
configObject = JSON.parse(filename);
43-
} catch (e) {
43+
} catch {
4444
if (_.isPlainObject(filename)) {
4545
configObject = filename;
4646
filename = CONFIG_FILE;
@@ -63,8 +63,8 @@ module.exports = function (filename) {
6363
if (_.isString(filename) && _.endsWith(filename, "json")) {
6464
try {
6565
config = JSON.parse(fs.readFileSync(path.resolve(filename)));
66-
config = config.hosting ? config.hosting : config;
67-
} catch (e) {
66+
config = config.hosting ?? config;
67+
} catch {
6868
// do nothing
6969
}
7070
}

src/middleware/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ interface SuperstaticResponse {
4242
* Returns middleware for `/__/env.json|js`.
4343
* @param spec superstatic options.
4444
* @param spec.env environment variables.
45-
* @return middleware.
45+
* @returns middleware.
4646
*/
4747
export function env(spec: { env: Record<string, string> }) {
4848
return (

src/middleware/files.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const url = require("url");
2727
/**
2828
* We cannot redirect to "", redirect to "/" instead.
2929
* @param {string} path path
30-
* @return {string} noramlized path
30+
* @returns {string} noramlized path
3131
*/
3232
function normalizeRedirectPath(path) {
3333
return path || "/";
@@ -192,7 +192,7 @@ module.exports = function () {
192192
* @param {*} req the Request.
193193
* @param {*} res the Response.
194194
* @param {string} p the path to search for.
195-
* @return {Promise<*>} a non-null value if a file is found.
195+
* @returns {Promise<*>} a non-null value if a file is found.
196196
*/
197197
function providerResult(req, res, p) {
198198
const promises = [];

src/middleware/headers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ const onHeaders = require("on-headers");
2626
const patterns = require("../utils/patterns");
2727

2828
const normalizedConfigHeaders = function (spec, config) {
29-
const out = config || [];
29+
const out = config ?? [];
3030
if (_.isArray(config)) {
3131
const _isAllowed = function (headerToSet) {
3232
return _.includes(spec.allowedHeaders, headerToSet.key.toLowerCase());
3333
};
3434

3535
for (const c of config) {
3636
c.source = slasher(c.source);
37-
c.headers = c.headers || [];
37+
c.headers = c.headers ?? [];
3838
if (spec.allowedHeaders) {
3939
c.headers = c.headers.filter(_isAllowed);
4040
}

0 commit comments

Comments
 (0)