Skip to content

Commit

Permalink
style: lint javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Nov 26, 2024
1 parent 0a1566a commit 8bd5b44
Show file tree
Hide file tree
Showing 330 changed files with 640 additions and 230 deletions.
2 changes: 1 addition & 1 deletion helpers/database/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MongoMemoryServer } from "mongodb-memory-server";
import { getMongodbClient } from "@indiekit/indiekit/lib/mongodb.js";
import { MongoMemoryServer } from "mongodb-memory-server";

export const testDatabase = async () => {
const mongoServer = await MongoMemoryServer.create();
Expand Down
2 changes: 1 addition & 1 deletion helpers/mock-agent/endpoint-auth.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MockAgent } from "undici";
import { getFixture } from "@indiekit-test/fixtures";
import { MockAgent } from "undici";

/**
* @returns {import("undici").MockAgent} Undici MockAgent
Expand Down
2 changes: 1 addition & 1 deletion helpers/mock-agent/endpoint-image.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MockAgent } from "undici";
import { getFixture } from "@indiekit-test/fixtures";
import { MockAgent } from "undici";

/**
* @returns {import("undici").MockAgent} Undici MockAgent
Expand Down
2 changes: 1 addition & 1 deletion helpers/mock-agent/endpoint-micropub.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MockAgent } from "undici";
import { getFixture } from "@indiekit-test/fixtures";
import { testToken } from "@indiekit-test/token";
import { MockAgent } from "undici";

/**
* @returns {import("undici").MockAgent} Undici MockAgent
Expand Down
2 changes: 1 addition & 1 deletion helpers/mock-agent/syndicator-mastodon.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MockAgent } from "undici";
import { getFixture } from "@indiekit-test/fixtures";
import { MockAgent } from "undici";

/**
* @returns {import("undici").MockAgent} Undici MockAgent
Expand Down
2 changes: 1 addition & 1 deletion helpers/publication/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import TestStore from "@indiekit-test/store";
import JekyllPreset from "@indiekit/preset-jekyll";
import TestStore from "@indiekit-test/store";

export const publication = {
categories: `https://website.example/categories.json`,
Expand Down
5 changes: 3 additions & 2 deletions helpers/server/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { mock } from "node:test";

import "dotenv/config.js";
import getPort from "get-port";
import { Indiekit } from "@indiekit/indiekit";
import { testConfig } from "@indiekit-test/config";
import { testDatabase } from "@indiekit-test/database";
import { Indiekit } from "@indiekit/indiekit";
import getPort from "get-port";

const { mongoUri } = await testDatabase();
const defaultOptions = { mongodbUrl: mongoUri };
Expand Down
3 changes: 2 additions & 1 deletion helpers/session/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import process from "node:process";
import mockSession from "mock-session";

import { testToken } from "@indiekit-test/token";
import mockSession from "mock-session";

export const testCookie = (options) => {
return mockSession("test", process.env.SECRET, {
Expand Down
1 change: 1 addition & 0 deletions packages/create-indiekit/bin/create.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env node
import process from "node:process";

import { init } from "../index.js";
import { checkNodeVersion } from "../lib/utils.js";

Expand Down
5 changes: 4 additions & 1 deletion packages/create-indiekit/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/usr/bin/env node
import { createRequire } from "node:module";

import create from "base-create";
import chalk from "chalk";
import prompts from "prompts";
import { setupPrompts } from "./lib/setup-prompts.js";

import { getFiles } from "./lib/files.js";
import { getPackageValues } from "./lib/package.js";
import { setupPrompts } from "./lib/setup-prompts.js";

// eslint-ignore import/order
const require = createRequire(import.meta.url);
const { name, version, bugs } = require("./package.json");
Expand Down
1 change: 1 addition & 0 deletions packages/create-indiekit/lib/docker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import YAML from "yaml";

import { getPlugin } from "./utils.js";

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/create-indiekit/lib/files.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env node
import { readFile } from "node:fs/promises";
import process from "node:process";
import path from "node:path";
import process from "node:process";

import { getDockerComposeFileContent, getDockerEnvironment } from "./docker.js";

/**
Expand Down
1 change: 1 addition & 0 deletions packages/create-indiekit/lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env node
import process from "node:process";

import chalk from "chalk";
import prompts from "prompts";

Expand Down
1 change: 1 addition & 0 deletions packages/create-indiekit/test/unit/docker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { strict as assert } from "node:assert";
import { describe, it } from "node:test";

import {
getDockerComposeFileContent,
getDockerEnvironment,
Expand Down
1 change: 1 addition & 0 deletions packages/create-indiekit/test/unit/files.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { strict as assert } from "node:assert";
import { describe, it, mock } from "node:test";

import { getFileContents, getFiles } from "../../lib/files.js";

describe("create-indiekit/lib/files", () => {
Expand Down
1 change: 1 addition & 0 deletions packages/create-indiekit/test/unit/package.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { strict as assert } from "node:assert";
import { describe, it, mock } from "node:test";

import { getPackageValues } from "../../lib/package.js";

describe("create-indiekit/lib/package", () => {
Expand Down
1 change: 1 addition & 0 deletions packages/create-indiekit/test/unit/setup-prompts.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { strict as assert } from "node:assert";
import { describe, it } from "node:test";

import { setupPrompts } from "../../lib/setup-prompts.js";

describe("create-indiekit/lib/setup-prompts", () => {
Expand Down
1 change: 1 addition & 0 deletions packages/create-indiekit/test/unit/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { strict as assert } from "node:assert";
import { describe, it, mock } from "node:test";

import {
addPluginConfig,
checkNodeVersion,
Expand Down
1 change: 1 addition & 0 deletions packages/endpoint-auth/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import express from "express";

import { authorizationController } from "./lib/controllers/authorization.js";
import { consentController } from "./lib/controllers/consent.js";
import { documentationController } from "./lib/controllers/documentation.js";
Expand Down
1 change: 1 addition & 0 deletions packages/endpoint-auth/lib/controllers/authorization.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IndiekitError } from "@indiekit/error";
import { getCanonicalUrl } from "@indiekit/util";

import { getClientInformation } from "../client.js";
import { createRequestUri } from "../pushed-authorization-request.js";
import { validateRedirect } from "../redirect.js";
Expand Down
2 changes: 2 additions & 0 deletions packages/endpoint-auth/lib/controllers/consent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import process from "node:process";

import { IndiekitError } from "@indiekit/error";
import { validationResult } from "express-validator";

import { getRequestUriData } from "../pushed-authorization-request.js";
import { getScopeItems } from "../scope.js";
import { signToken } from "../token.js";
Expand Down
1 change: 1 addition & 0 deletions packages/endpoint-auth/lib/controllers/password.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { validationResult } from "express-validator";

import { createPasswordHash } from "../password.js";

export const passwordController = {
Expand Down
1 change: 1 addition & 0 deletions packages/endpoint-auth/lib/middleware/code.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IndiekitError } from "@indiekit/error";
import { getCanonicalUrl } from "@indiekit/util";

import { verifyCode } from "../pkce.js";
import { validateRedirect } from "../redirect.js";
import { verifyToken } from "../token.js";
Expand Down
1 change: 1 addition & 0 deletions packages/endpoint-auth/lib/middleware/secret.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import process from "node:process";

import { IndiekitError } from "@indiekit/error";

/**
Expand Down
1 change: 1 addition & 0 deletions packages/endpoint-auth/lib/middleware/validation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { check } from "express-validator";

import { verifyPassword } from "../password.js";

export const consentValidator = [
Expand Down
1 change: 1 addition & 0 deletions packages/endpoint-auth/lib/password.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import process from "node:process";

import bcrypt from "bcrypt";

/**
Expand Down
1 change: 1 addition & 0 deletions packages/endpoint-auth/lib/token.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import process from "node:process";

import jwt from "jsonwebtoken";

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { strict as assert } from "node:assert";
import { after, describe, it } from "node:test";
import supertest from "supertest";
import { JSDOM } from "jsdom";

import { testServer } from "@indiekit-test/server";
import { JSDOM } from "jsdom";
import supertest from "supertest";

const server = await testServer();
const request = supertest.agent(server);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { strict as assert } from "node:assert";
import { after, describe, it } from "node:test";
import supertest from "supertest";

import { mockAgent } from "@indiekit-test/mock-agent";
import { testServer } from "@indiekit-test/server";
import supertest from "supertest";

await mockAgent("endpoint-auth");
const server = await testServer();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { strict as assert } from "node:assert";
import { after, describe, it } from "node:test";
import supertest from "supertest";

import { mockAgent } from "@indiekit-test/mock-agent";
import { testServer } from "@indiekit-test/server";
import supertest from "supertest";

await mockAgent("endpoint-auth");
const server = await testServer();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { strict as assert } from "node:assert";
import { after, describe, it } from "node:test";
import supertest from "supertest";

import { mockAgent } from "@indiekit-test/mock-agent";
import { testServer } from "@indiekit-test/server";
import supertest from "supertest";

await mockAgent("endpoint-auth");
const server = await testServer();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { strict as assert } from "node:assert";
import { after, describe, it } from "node:test";
import supertest from "supertest";

import { mockAgent } from "@indiekit-test/mock-agent";
import { testServer } from "@indiekit-test/server";
import supertest from "supertest";

await mockAgent("endpoint-auth");
const server = await testServer();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { strict as assert } from "node:assert";
import { after, before, describe, it } from "node:test";
import supertest from "supertest";

import { mockAgent } from "@indiekit-test/mock-agent";
import { testServer } from "@indiekit-test/server";
import supertest from "supertest";

import { signToken } from "../../lib/token.js";

await mockAgent("endpoint-auth");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { strict as assert } from "node:assert";
import { after, before, describe, it } from "node:test";
import supertest from "supertest";

import { mockAgent } from "@indiekit-test/mock-agent";
import { testServer } from "@indiekit-test/server";
import supertest from "supertest";

import { signToken } from "../../lib/token.js";

await mockAgent("endpoint-auth");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { strict as assert } from "node:assert";
import { after, before, describe, it } from "node:test";
import supertest from "supertest";

import { mockAgent } from "@indiekit-test/mock-agent";
import { testServer } from "@indiekit-test/server";
import supertest from "supertest";

import { createPasswordHash } from "../../lib/password.js";

await mockAgent("endpoint-auth");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { strict as assert } from "node:assert";
import { after, before, describe, it } from "node:test";
import supertest from "supertest";

import { mockAgent } from "@indiekit-test/mock-agent";
import { testServer } from "@indiekit-test/server";
import supertest from "supertest";

import { createPasswordHash } from "../../lib/password.js";

await mockAgent("endpoint-auth");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { strict as assert } from "node:assert";
import { after, describe, it } from "node:test";
import supertest from "supertest";

import { testServer } from "@indiekit-test/server";
import { testToken } from "@indiekit-test/token";
import supertest from "supertest";

const server = await testServer();
const request = supertest.agent(server);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { strict as assert } from "node:assert";
import { after, describe, it } from "node:test";
import supertest from "supertest";

import { testServer } from "@indiekit-test/server";
import { testToken } from "@indiekit-test/token";
import supertest from "supertest";

const server = await testServer();
const request = supertest.agent(server);
Expand Down
3 changes: 2 additions & 1 deletion packages/endpoint-auth/test/integration/200-metadata.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { strict as assert } from "node:assert";
import { after, describe, it } from "node:test";
import supertest from "supertest";

import { testServer } from "@indiekit-test/server";
import supertest from "supertest";

const server = await testServer();
const request = supertest.agent(server);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { strict as assert } from "node:assert";
import { after, describe, it } from "node:test";
import supertest from "supertest";
import { JSDOM } from "jsdom";

import { testServer } from "@indiekit-test/server";
import { JSDOM } from "jsdom";
import supertest from "supertest";

const server = await testServer();
const request = supertest.agent(server);
Expand Down
5 changes: 3 additions & 2 deletions packages/endpoint-auth/test/integration/200-new-password.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { strict as assert } from "node:assert";
import { after, describe, it } from "node:test";
import supertest from "supertest";
import { JSDOM } from "jsdom";

import { testServer } from "@indiekit-test/server";
import { JSDOM } from "jsdom";
import supertest from "supertest";

const server = await testServer();
const request = supertest.agent(server);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { strict as assert } from "node:assert";
import { after, before, describe, it } from "node:test";
import supertest from "supertest";

import { mockAgent } from "@indiekit-test/mock-agent";
import { testServer } from "@indiekit-test/server";
import supertest from "supertest";

import { signToken } from "../../lib/token.js";

await mockAgent("endpoint-auth");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { strict as assert } from "node:assert";
import { after, before, describe, it } from "node:test";
import supertest from "supertest";

import { mockAgent } from "@indiekit-test/mock-agent";
import { testServer } from "@indiekit-test/server";
import supertest from "supertest";

import { signToken } from "../../lib/token.js";

await mockAgent("endpoint-auth");
Expand Down
3 changes: 2 additions & 1 deletion packages/endpoint-auth/test/integration/200-token-verify.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { strict as assert } from "node:assert";
import { after, describe, it } from "node:test";
import supertest from "supertest";

import { testServer } from "@indiekit-test/server";
import { testToken } from "@indiekit-test/token";
import supertest from "supertest";

const server = await testServer();
const request = supertest.agent(server);
Expand Down
Loading

0 comments on commit 8bd5b44

Please sign in to comment.