Skip to content

Commit

Permalink
chore: Enable ESLint rule "no-empty-function" (#1413)
Browse files Browse the repository at this point in the history
  • Loading branch information
krisztianb committed Dec 7, 2020
1 parent 2118052 commit 9c85db0
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 21 deletions.
1 change: 0 additions & 1 deletion .eslintrc
Expand Up @@ -25,7 +25,6 @@
"@typescript-eslint/no-namespace": 0,

// Feel free to turn one of these back on and submit a PR!
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/explicit-module-boundary-types": 0
},
Expand Down
10 changes: 9 additions & 1 deletion scripts/rebuild_specs.js
Expand Up @@ -30,7 +30,15 @@ const base = path.join(__dirname, "../dist/test/converter");

/** @type {[string, () => void, () => void][]} */
const conversions = [
["specs", () => {}, () => {}],
[
"specs",
() => {
// nop
},
() => {
// nop
},
],
[
"specs.d",
() => app.options.setValue("includeDeclarations", true),
Expand Down
4 changes: 3 additions & 1 deletion src/lib/models/reflections/abstract.ts
Expand Up @@ -570,7 +570,9 @@ export abstract class Reflection {
* @param callback The callback function that should be applied for each child reflection.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- This abstract class defines the interface.
traverse(callback: TraverseCallback) {}
traverse(callback: TraverseCallback) {
// empty default implementation
}

/**
* Return a string representation of this reflection.
Expand Down
7 changes: 0 additions & 7 deletions src/lib/output/renderer.ts
Expand Up @@ -85,13 +85,6 @@ export class Renderer extends ChildableComponent<
@BindOption("toc")
toc!: string[];

/**
* Create a new Renderer instance.
*
* @param application The application this dispatcher is attached to.
*/
initialize() {}

/**
* Render the given project reflection to the specified output directory.
*
Expand Down
4 changes: 3 additions & 1 deletion src/lib/utils/component.ts
Expand Up @@ -144,7 +144,9 @@ export abstract class AbstractComponent<O extends ComponentHost>
/**
* Initialize this component.
*/
protected initialize() {}
protected initialize() {
// empty default implementation
}

protected bubble(name: Event | EventMap | string, ...args: any[]) {
super.trigger(name, ...args);
Expand Down
10 changes: 9 additions & 1 deletion src/test/converter.test.ts
Expand Up @@ -30,7 +30,15 @@ describe("Converter", function () {
});

const checks: [string, () => void, () => void][] = [
["specs", () => {}, () => {}],
[
"specs",
() => {
// nop
},
() => {
// nop
},
],
[
"specs.d",
() => app.options.setValue("includeDeclarations", true),
Expand Down
20 changes: 15 additions & 5 deletions src/test/events.test.ts
Expand Up @@ -315,7 +315,9 @@ describe("Events", function () {
it("stopListening cleans up references", function () {
const a: any = new Events();
const b: any = new Events();
const fn = function () {};
const fn = function () {
// nop
};
b.on("event", fn);

a.listenTo(b, "event", fn).stopListening();
Expand All @@ -342,7 +344,9 @@ describe("Events", function () {
it("stopListening cleans up references from listenToOnce", function () {
const a: any = new Events();
const b: any = new Events();
const fn = function () {};
const fn = function () {
// nop
};
b.on("event", fn);

a.listenToOnce(b, "event", fn).stopListening();
Expand All @@ -369,7 +373,9 @@ describe("Events", function () {
it("listenTo and off cleaning up references", function () {
const a: any = new Events();
const b: any = new Events();
const fn = function () {};
const fn = function () {
// nop
};

a.listenTo(b, "event", fn);
b.off();
Expand Down Expand Up @@ -835,7 +841,9 @@ describe("Events", function () {
this.off("event", f);
};
obj.on("event", f);
obj.once("event", function () {});
obj.once("event", function () {
// nop
});
obj.on("event", function () {
count += 1;
});
Expand Down Expand Up @@ -869,7 +877,9 @@ describe("Events", function () {
it("event functions are chainable", function () {
const obj = new Events();
const obj2 = new Events();
const fn = function () {};
const fn = function () {
// nop
};

Assert.equal(obj, obj.trigger("noeventssetyet"));
Assert.equal(obj, obj.off("noeventssetyet"));
Expand Down
8 changes: 6 additions & 2 deletions src/test/plugin-host.test.ts
Expand Up @@ -9,8 +9,12 @@ describe("PluginHost", function () {
warnOnReplace: false,
warnOnUnregistered: false,
});
mockery.registerMock("typedoc-plugin-1", () => {});
mockery.registerMock("typedoc-plugin-2", () => {});
mockery.registerMock("typedoc-plugin-1", () => {
// nop
});
mockery.registerMock("typedoc-plugin-2", () => {
// nop
});
});

after(function () {
Expand Down
4 changes: 3 additions & 1 deletion src/test/plugins/absolute.ts
@@ -1 +1,3 @@
module.exports = () => {};
module.exports = () => {
// nop
};
4 changes: 3 additions & 1 deletion src/test/plugins/relative.ts
@@ -1 +1,3 @@
module.exports = () => {};
module.exports = () => {
// nop
};

0 comments on commit 9c85db0

Please sign in to comment.