Skip to content

Commit

Permalink
Merge pull request #802 from ninoseki/lint-on-ci
Browse files Browse the repository at this point in the history
ci: add lint job
  • Loading branch information
ninoseki authored Mar 29, 2024
2 parents f3c251d + 6686534 commit 130313e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 33 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,39 @@ on:
branches: [master]

jobs:
build:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

cache: npm
- name: Install npm dependencies
run: npm install

- name: Run tests
run: npm run test

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install npm dependencies
run: npm install
- name: Run lint
run: npx eslint --ext .js,.vue,.ts --ignore-path .gitignore src tests
36 changes: 18 additions & 18 deletions src/searcher/hostio.ts → src/searcher/host.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import type { SearchableType } from "~/schemas";
import type { Searcher } from "~/types";
import { buildURL } from "~/utils";

export class Hostio implements Searcher {
public baseURL: string;
public name: string;
public supportedTypes: SearchableType[] = ["domain"];

public constructor() {
this.baseURL = "https://host.io";
this.name = "Host.io";
}

public searchByDomain(query: string): string {
return buildURL(this.baseURL, `/${query}`);
}
}
import type { SearchableType } from "~/schemas";
import type { Searcher } from "~/types";
import { buildURL } from "~/utils";

export class Host implements Searcher {
public baseURL: string;
public name: string;
public supportedTypes: SearchableType[] = ["domain"];

public constructor() {
this.baseURL = "https://host.io";
this.name = "host.io";
}

public searchByDomain(query: string): string {
return buildURL(this.baseURL, `/${query}`);
}
}
6 changes: 3 additions & 3 deletions src/searcher/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
FortiGuard,
GoogleSafeBrowsing,
GreyNoise,
Hostio,
Host,
HurricaneElectric,
HybridAnalysis,
InQuest,
Expand Down Expand Up @@ -94,7 +94,7 @@ export { FOFA } from "./fofa";
export { FortiGuard } from "./fortiguard";
export { GoogleSafeBrowsing } from "./googlesafebrowsing";
export { GreyNoise } from "./greynoise";
export { Hostio } from "./hostio";
export { Host } from "./host";
export { HurricaneElectric } from "./hurricaneelectric";
export { HybridAnalysis } from "./hybridanalysis";
export { InQuest } from "./inquest";
Expand Down Expand Up @@ -165,7 +165,7 @@ export const Searchers: Searcher[] = [
new FortiGuard(),
new GoogleSafeBrowsing(),
new GreyNoise(),
new Hostio(),
new Host(),
new HurricaneElectric(),
new HybridAnalysis(),
new InQuest(),
Expand Down
10 changes: 4 additions & 6 deletions tests/searcher/hostio.spec.ts → tests/searcher/host.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Hostio } from "~/searcher";
import { Host } from "~/searcher";

describe("Hostio", function () {
const subject = new Hostio();
describe("Host", function () {
const subject = new Host();

it("should support domain", function () {
expect(subject.supportedTypes).toEqual(["domain"]);
Expand All @@ -10,9 +10,7 @@ describe("Hostio", function () {
describe("#searchByDomain", function () {
const domain = "github.com";
it("should return a URL", function () {
expect(subject.searchByDomain(domain)).toBe(
`https://host.io/${domain}`,
);
expect(subject.searchByDomain(domain)).toBe(`https://host.io/${domain}`);
});
});
});

0 comments on commit 130313e

Please sign in to comment.