Skip to content

Commit

Permalink
Build: Generate files d.ts (#448)
Browse files Browse the repository at this point in the history
Related #432
  • Loading branch information
Jesus David García Gomez authored and molant committed Aug 23, 2017
1 parent ac7a3c3 commit fa17ab5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/lib/sonar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { EventEmitter2 as EventEmitter } from 'eventemitter2';

import { debug as d } from './utils/debug';
import { getSeverity } from './config/config-rules';
import { IAsyncHTMLElement, IConnector, IConnectorBuilder, IConfig, IEvent, IProblem, IProblemLocation, IRule, IRuleBuilder, IRuleConfigList, IPlugin, RuleConfig, Severity, URL } from './types'; // eslint-disable-line no-unused-vars
import { IAsyncHTMLElement, IConnector, IConnectorBuilder, INetworkData, IConfig, IEvent, IProblem, IProblemLocation, IRule, IRuleBuilder, IRuleConfigList, IPlugin, RuleConfig, Severity, URL } from './types'; // eslint-disable-line no-unused-vars
import * as logger from './utils/logging';
import * as resourceLoader from './utils/resource-loader';
import normalizeRules from './utils/normalize-rules';
Expand Down Expand Up @@ -223,7 +223,7 @@ export class Sonar extends EventEmitter {
debug(`Rules loaded: ${this.rules.size}`);
}

public fetchContent(target: string | url.Url, headers: object) {
public fetchContent(target: string | url.Url, headers: object): Promise<INetworkData> {
return this.connector.fetchContent(target, headers);
}

Expand Down
3 changes: 3 additions & 0 deletions tests/helpers/connectors.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// We need to import this interface to generate the definition of this file
import { IConnectorBuilder } from '../../src/lib/types'; // eslint-disable-line no-unused-vars

import cdpBuilder from '../../src/lib/connectors/cdp/cdp';
import jsdomBuilder from '../../src/lib/connectors/jsdom/jsdom';

Expand Down
12 changes: 4 additions & 8 deletions tests/helpers/test-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import * as express from 'express';
import * as onHeaders from 'on-headers';
import { promisify } from 'util';

type ServerConfiguration = string | object; //eslint-disable-line
export type ServerConfiguration = string | object; //eslint-disable-line

const startPort = 3000;
const maxPort = 65535;

/** A testing server for Sonar rules */
class Server {
export class Server {
private _app;
private _server: https.Server | http.Server;
private _port: number = startPort;
Expand Down Expand Up @@ -166,10 +166,6 @@ class Server {
}

/** Returns a testing server */
const createServer = (isHTTPS?: boolean) => {
const server = new Server(isHTTPS);

return server;
export const createServer = (isHTTPS?: boolean) => {
return new Server(isHTTPS);
};

export { createServer, Server };
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"allowJs": true,
"alwaysStrict": true,
"module": "commonjs",
"sourceMap": true,
"target": "esnext",
"declaration": true,
"lib": [
"es2017",
"esnext",
Expand Down

0 comments on commit fa17ab5

Please sign in to comment.