Skip to content

Commit c9a054c

Browse files
committed
Remove public prefix + disable "member-access" tslint rule
1 parent e1e4669 commit c9a054c

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

base/base_inner.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
class EventEmitter {
2-
public addListener(event: string, listener: Function): this;
3-
public on(event: string, listener: Function): this;
4-
public once(event: string, listener: Function): this;
5-
public removeListener(event: string, listener: Function): this;
6-
public removeAllListeners(event?: string): this;
7-
public setMaxListeners(n: number): this;
8-
public getMaxListeners(): number;
9-
public listeners(event: string): Function[];
10-
public emit(event: string, ...args: any[]): boolean;
11-
public listenerCount(type: string): number;
12-
public prependListener(event: string, listener: Function): this;
13-
public prependOnceListener(event: string, listener: Function): this;
14-
public eventNames(): string[];
2+
addListener(event: string, listener: Function): this;
3+
on(event: string, listener: Function): this;
4+
once(event: string, listener: Function): this;
5+
removeListener(event: string, listener: Function): this;
6+
removeAllListeners(event?: string): this;
7+
setMaxListeners(n: number): this;
8+
getMaxListeners(): number;
9+
listeners(event: string): Function[];
10+
emit(event: string, ...args: any[]): boolean;
11+
listenerCount(type: string): number;
12+
prependListener(event: string, listener: Function): this;
13+
prependOnceListener(event: string, listener: Function): this;
14+
eventNames(): string[];
1515
}
1616

1717
class Accelerator extends String {

lib/module-declaration.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const generateModuleDeclaration = (module, index, API) => {
7272
}
7373

7474
for (let method of ['on', 'once', 'addListener', 'removeListener']) {
75-
moduleAPI.push(`${isClass ? 'public ' : ''}${method}(event: '${moduleEvent.name}', listener: ${listener}): this;`)
75+
moduleAPI.push(`${method}(event: '${moduleEvent.name}', listener: ${listener}): this;`)
7676
}
7777
})
7878

@@ -102,7 +102,7 @@ const generateModuleDeclaration = (module, index, API) => {
102102
}
103103

104104
for (let method of ['addEventListener', 'removeEventListener']) {
105-
moduleAPI.push(`${isClass ? 'public ' : ''}${method}(event: '${domEvent.name}', listener: (event: ${eventType}) => void${method === 'addEventListener' ? ', useCapture?: boolean' : ''}): this;`)
105+
moduleAPI.push(`${method}(event: '${domEvent.name}', listener: (event: ${eventType}) => void${method === 'addEventListener' ? ', useCapture?: boolean' : ''}): this;`)
106106
}
107107
})
108108
}
@@ -113,8 +113,6 @@ const generateModuleDeclaration = (module, index, API) => {
113113
if (typeof prefix === 'undefined') {
114114
prefix = ''
115115
}
116-
const markAsPublic = isClass ? 'public ' : ''
117-
prefix = `${markAsPublic}${prefix}` || markAsPublic
118116
utils.extendArray(moduleAPI, utils.wrapComment(moduleMethod.description))
119117
let returnType = returnsThis(moduleMethod) ? 'this' : 'void'
120118

@@ -167,7 +165,7 @@ const generateModuleDeclaration = (module, index, API) => {
167165
module.instanceProperties
168166
.sort((a, b) => a.name.localeCompare(b.name))
169167
.forEach(prop => {
170-
moduleAPI.push(`public ${prop.name}: ${utils.typify(prop)};`)
168+
moduleAPI.push(`${prop.name}: ${utils.typify(prop)};`)
171169
})
172170
}
173171

@@ -177,10 +175,10 @@ const generateModuleDeclaration = (module, index, API) => {
177175
.sort((a, b) => a.name.localeCompare(b.name))
178176
.forEach(prop => {
179177
if (prop.type === 'Class') {
180-
moduleAPI.push(`public static ${prop.name}: typeof ${prop.name};`)
178+
moduleAPI.push(`static ${prop.name}: typeof ${prop.name};`)
181179
generateModuleDeclaration(prop, -1, API)
182180
} else {
183-
moduleAPI.push(`public static ${prop.name}: ${utils.typify(prop)};`)
181+
moduleAPI.push(`static ${prop.name}: ${utils.typify(prop)};`)
184182
}
185183
})
186184
}
@@ -196,14 +194,13 @@ const generateModuleDeclaration = (module, index, API) => {
196194
paramType = paramInterfaces.createParamInterface(p, '')
197195
}
198196

199-
const isPublic = isClass ? 'public ' : ''
200197
const isStatic = isStaticVersion ? 'static ' : ''
201198
const isOptional = utils.isOptional(p) ? '?' : ''
202199
const type = utils.typify(paramType)
203200

204201
utils.extendArray(moduleAPI, utils.wrapComment(p.description))
205202
if (module.name === 'process' && p.name === 'versions') return
206-
moduleAPI.push(`${isPublic}${isStatic}${p.name}${isOptional}: ${type};`)
203+
moduleAPI.push(`${isStatic}${p.name}${isOptional}: ${type};`)
207204
})
208205
}
209206

tslint.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"interface-name": false,
88
"max-classes-per-file": false,
99
"max-line-length": false,
10+
"member-access": false,
1011
"member-ordering": false,
1112
"no-empty-interface": false,
1213
"no-namespace": false,

0 commit comments

Comments
 (0)