aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/pages/documentation
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2017-12-20 13:44:08 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-12-20 22:30:25 +0800
commitcb11aec84df346d5180c7d5874859c1c34f0bf1c (patch)
treeb959a65bdcfc3e8b01dca1bc160f93a0df8a4bf9 /packages/website/ts/pages/documentation
parent972e1675f6490bc10e8d9fd64cce2f7945cd4840 (diff)
downloaddexon-0x-contracts-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar.gz
dexon-0x-contracts-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar.zst
dexon-0x-contracts-cb11aec84df346d5180c7d5874859c1c34f0bf1c.zip
Add new underscore-privates rule to @0xproject/tslint-config and fix lint errors
Diffstat (limited to 'packages/website/ts/pages/documentation')
-rw-r--r--packages/website/ts/pages/documentation/docs_info.ts22
-rw-r--r--packages/website/ts/pages/documentation/documentation.tsx40
-rw-r--r--packages/website/ts/pages/documentation/event_definition.tsx10
-rw-r--r--packages/website/ts/pages/documentation/method_block.tsx18
-rw-r--r--packages/website/ts/pages/documentation/type_definition.tsx6
5 files changed, 48 insertions, 48 deletions
diff --git a/packages/website/ts/pages/documentation/docs_info.ts b/packages/website/ts/pages/documentation/docs_info.ts
index 1afcf8aaf..b88b247e8 100644
--- a/packages/website/ts/pages/documentation/docs_info.ts
+++ b/packages/website/ts/pages/documentation/docs_info.ts
@@ -19,7 +19,7 @@ export class DocsInfo {
public menu: DocsMenu;
public sections: SectionsMap;
public sectionNameToMarkdown: {[sectionName: string]: string};
- private docsInfo: DocsInfoConfig;
+ private _docsInfo: DocsInfoConfig;
constructor(config: DocsInfoConfig) {
this.displayName = config.displayName;
this.packageUrl = config.packageUrl;
@@ -28,32 +28,32 @@ export class DocsInfo {
this.docsJsonRoot = config.docsJsonRoot;
this.sections = config.sections;
this.sectionNameToMarkdown = config.sectionNameToMarkdown;
- this.docsInfo = config;
+ this._docsInfo = config;
}
public isPublicType(typeName: string): boolean {
- if (_.isUndefined(this.docsInfo.publicTypes)) {
+ if (_.isUndefined(this._docsInfo.publicTypes)) {
return false;
}
- const isPublic = _.includes(this.docsInfo.publicTypes, typeName);
+ const isPublic = _.includes(this._docsInfo.publicTypes, typeName);
return isPublic;
}
public getModulePathsIfExists(sectionName: string): string[] {
- const modulePathsIfExists = this.docsInfo.sectionNameToModulePath[sectionName];
+ const modulePathsIfExists = this._docsInfo.sectionNameToModulePath[sectionName];
return modulePathsIfExists;
}
public getMenu(selectedVersion?: string): {[section: string]: string[]} {
- if (_.isUndefined(selectedVersion) || _.isUndefined(this.docsInfo.menuSubsectionToVersionWhenIntroduced)) {
- return this.docsInfo.menu;
+ if (_.isUndefined(selectedVersion) || _.isUndefined(this._docsInfo.menuSubsectionToVersionWhenIntroduced)) {
+ return this._docsInfo.menu;
}
- const finalMenu = _.cloneDeep(this.docsInfo.menu);
+ const finalMenu = _.cloneDeep(this._docsInfo.menu);
if (_.isUndefined(finalMenu.contracts)) {
return finalMenu;
}
// TODO: refactor to include more sections then simply the `contracts` section
finalMenu.contracts = _.filter(finalMenu.contracts, (contractName: string) => {
- const versionIntroducedIfExists = this.docsInfo.menuSubsectionToVersionWhenIntroduced[contractName];
+ const versionIntroducedIfExists = this._docsInfo.menuSubsectionToVersionWhenIntroduced[contractName];
if (!_.isUndefined(versionIntroducedIfExists)) {
const existsInSelectedVersion = compareVersions(selectedVersion,
versionIntroducedIfExists) >= 0;
@@ -104,9 +104,9 @@ export class DocsInfo {
return typeDefinitionByName;
}
public isVisibleConstructor(sectionName: string): boolean {
- return _.includes(this.docsInfo.visibleConstructors, sectionName);
+ return _.includes(this._docsInfo.visibleConstructors, sectionName);
}
public convertToDocAgnosticFormat(docObj: DoxityDocObj|TypeDocNode): DocAgnosticFormat {
- return this.docsInfo.convertToDocAgnosticFormatFn(docObj, this);
+ return this._docsInfo.convertToDocAgnosticFormatFn(docObj, this);
}
}
diff --git a/packages/website/ts/pages/documentation/documentation.tsx b/packages/website/ts/pages/documentation/documentation.tsx
index aab14a52c..ad244ef1f 100644
--- a/packages/website/ts/pages/documentation/documentation.tsx
+++ b/packages/website/ts/pages/documentation/documentation.tsx
@@ -93,7 +93,7 @@ export class Documentation extends
const versions = findVersions(lastSegment);
const preferredVersionIfExists = versions.length > 0 ? versions[0] : undefined;
// tslint:disable-next-line:no-floating-promises
- this.fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists);
+ this._fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists);
}
public render() {
const menuSubsectionsBySection = _.isUndefined(this.state.docAgnosticFormat) ?
@@ -157,7 +157,7 @@ export class Documentation extends
{this.props.docsInfo.displayName}
</a>
</h1>
- {this.renderDocumentation()}
+ {this._renderDocumentation()}
</div>
</div>
</div>
@@ -165,16 +165,16 @@ export class Documentation extends
</div>
);
}
- private renderDocumentation(): React.ReactNode {
+ private _renderDocumentation(): React.ReactNode {
const subMenus = _.values(this.props.docsInfo.getMenu());
const orderedSectionNames = _.flatten(subMenus);
const typeDefinitionByName = this.props.docsInfo.getTypeDefinitionsByName(this.state.docAgnosticFormat);
- const renderedSections = _.map(orderedSectionNames, this.renderSection.bind(this, typeDefinitionByName));
+ const renderedSections = _.map(orderedSectionNames, this._renderSection.bind(this, typeDefinitionByName));
return renderedSections;
}
- private renderSection(typeDefinitionByName: TypeDefinitionByName, sectionName: string): React.ReactNode {
+ private _renderSection(typeDefinitionByName: TypeDefinitionByName, sectionName: string): React.ReactNode {
const markdownFileIfExists = this.props.docsInfo.sectionNameToMarkdown[sectionName];
if (!_.isUndefined(markdownFileIfExists)) {
return (
@@ -203,12 +203,12 @@ export class Documentation extends
});
const sortedProperties = _.sortBy(docSection.properties, 'name');
- const propertyDefs = _.map(sortedProperties, this.renderProperty.bind(this));
+ const propertyDefs = _.map(sortedProperties, this._renderProperty.bind(this));
const sortedMethods = _.sortBy(docSection.methods, 'name');
const methodDefs = _.map(sortedMethods, method => {
const isConstructor = false;
- return this.renderMethodBlocks(method, sectionName, isConstructor, typeDefinitionByName);
+ return this._renderMethodBlocks(method, sectionName, isConstructor, typeDefinitionByName);
});
const sortedEvents = _.sortBy(docSection.events, 'name');
@@ -230,7 +230,7 @@ export class Documentation extends
<div style={{marginRight: 7}}>
<SectionHeader sectionName={sectionName} />
</div>
- {this.renderNetworkBadgesIfExists(sectionName)}
+ {this._renderNetworkBadgesIfExists(sectionName)}
</div>
{docSection.comment &&
<Comment
@@ -241,7 +241,7 @@ export class Documentation extends
this.props.docsInfo.isVisibleConstructor(sectionName) &&
<div>
<h2 className="thin">Constructor</h2>
- {this.renderConstructors(docSection.constructors, sectionName, typeDefinitionByName)}
+ {this._renderConstructors(docSection.constructors, sectionName, typeDefinitionByName)}
</div>
}
{docSection.properties.length > 0 &&
@@ -270,7 +270,7 @@ export class Documentation extends
</div>
);
}
- private renderNetworkBadgesIfExists(sectionName: string) {
+ private _renderNetworkBadgesIfExists(sectionName: string) {
const networkToAddressByContractName = configs.CONTRACT_ADDRESS[this.props.docsVersion];
const badges = _.map(networkToAddressByContractName,
(addressByContractName: AddressByContractName, networkName: string) => {
@@ -297,11 +297,11 @@ export class Documentation extends
});
return badges;
}
- private renderConstructors(constructors: SolidityMethod[]|TypescriptMethod[],
- sectionName: string,
- typeDefinitionByName: TypeDefinitionByName): React.ReactNode {
+ private _renderConstructors(constructors: SolidityMethod[]|TypescriptMethod[],
+ sectionName: string,
+ typeDefinitionByName: TypeDefinitionByName): React.ReactNode {
const constructorDefs = _.map(constructors, constructor => {
- return this.renderMethodBlocks(
+ return this._renderMethodBlocks(
constructor, sectionName, constructor.isConstructor, typeDefinitionByName,
);
});
@@ -311,7 +311,7 @@ export class Documentation extends
</div>
);
}
- private renderProperty(property: Property): React.ReactNode {
+ private _renderProperty(property: Property): React.ReactNode {
return (
<div
key={`property-${property.name}-${property.type.name}`}
@@ -337,8 +337,8 @@ export class Documentation extends
</div>
);
}
- private renderMethodBlocks(method: SolidityMethod|TypescriptMethod, sectionName: string,
- isConstructor: boolean, typeDefinitionByName: TypeDefinitionByName): React.ReactNode {
+ private _renderMethodBlocks(method: SolidityMethod|TypescriptMethod, sectionName: string,
+ isConstructor: boolean, typeDefinitionByName: TypeDefinitionByName): React.ReactNode {
return (
<MethodBlock
key={`method-${method.name}-${sectionName}`}
@@ -349,7 +349,7 @@ export class Documentation extends
/>
);
}
- private scrollToHash(): void {
+ private _scrollToHash(): void {
const hashWithPrefix = this.props.location.hash;
let hash = hashWithPrefix.slice(1);
if (_.isEmpty(hash)) {
@@ -358,7 +358,7 @@ export class Documentation extends
scroller.scrollTo(hash, {duration: 0, offset: 0, containerId: 'documentation'});
}
- private async fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists?: string): Promise<void> {
+ private async _fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists?: string): Promise<void> {
const versionToFileName = await docUtils.getVersionToFileNameAsync(this.props.docsInfo.docsJsonRoot);
const versions = _.keys(versionToFileName);
this.props.dispatcher.updateAvailableDocVersions(versions);
@@ -383,7 +383,7 @@ export class Documentation extends
this.setState({
docAgnosticFormat,
}, () => {
- this.scrollToHash();
+ this._scrollToHash();
});
}
}
diff --git a/packages/website/ts/pages/documentation/event_definition.tsx b/packages/website/ts/pages/documentation/event_definition.tsx
index 695debf5b..3d1cc703a 100644
--- a/packages/website/ts/pages/documentation/event_definition.tsx
+++ b/packages/website/ts/pages/documentation/event_definition.tsx
@@ -29,8 +29,8 @@ export class EventDefinition extends React.Component<EventDefinitionProps, Event
id={event.name}
className="pb2"
style={{overflow: 'hidden', width: '100%'}}
- onMouseOver={this.setAnchorVisibility.bind(this, true)}
- onMouseOut={this.setAnchorVisibility.bind(this, false)}
+ onMouseOver={this._setAnchorVisibility.bind(this, true)}
+ onMouseOut={this._setAnchorVisibility.bind(this, false)}
>
<AnchorTitle
headerSize={HeaderSizes.H3}
@@ -41,14 +41,14 @@ export class EventDefinition extends React.Component<EventDefinitionProps, Event
<div style={{fontSize: 16}}>
<pre>
<code className="hljs">
- {this.renderEventCode()}
+ {this._renderEventCode()}
</code>
</pre>
</div>
</div>
);
}
- private renderEventCode() {
+ private _renderEventCode() {
const indexed = <span style={{color: colors.green}}> indexed</span>;
const eventArgs = _.map(this.props.event.eventArgs, (eventArg: EventArg) => {
const type = (
@@ -76,7 +76,7 @@ export class EventDefinition extends React.Component<EventDefinitionProps, Event
</span>
);
}
- private setAnchorVisibility(shouldShowAnchor: boolean) {
+ private _setAnchorVisibility(shouldShowAnchor: boolean) {
this.setState({
shouldShowAnchor,
});
diff --git a/packages/website/ts/pages/documentation/method_block.tsx b/packages/website/ts/pages/documentation/method_block.tsx
index 5163e03ac..0eeb30a69 100644
--- a/packages/website/ts/pages/documentation/method_block.tsx
+++ b/packages/website/ts/pages/documentation/method_block.tsx
@@ -57,19 +57,19 @@ export class MethodBlock extends React.Component<MethodBlockProps, MethodBlockSt
id={method.name}
style={{overflow: 'hidden', width: '100%'}}
className="pb4"
- onMouseOver={this.setAnchorVisibility.bind(this, true)}
- onMouseOut={this.setAnchorVisibility.bind(this, false)}
+ onMouseOver={this._setAnchorVisibility.bind(this, true)}
+ onMouseOut={this._setAnchorVisibility.bind(this, false)}
>
{!method.isConstructor &&
<div className="flex">
{(method as TypescriptMethod).isStatic &&
- this.renderChip('Static')
+ this._renderChip('Static')
}
{(method as SolidityMethod).isConstant &&
- this.renderChip('Constant')
+ this._renderChip('Constant')
}
{(method as SolidityMethod).isPayable &&
- this.renderChip('Payable')
+ this._renderChip('Payable')
}
<AnchorTitle
headerSize={HeaderSizes.H3}
@@ -108,7 +108,7 @@ export class MethodBlock extends React.Component<MethodBlockProps, MethodBlockSt
>
ARGUMENTS
</h4>
- {this.renderParameterDescriptions(method.parameters)}
+ {this._renderParameterDescriptions(method.parameters)}
</div>
}
{method.returnComment &&
@@ -127,7 +127,7 @@ export class MethodBlock extends React.Component<MethodBlockProps, MethodBlockSt
</div>
);
}
- private renderChip(text: string) {
+ private _renderChip(text: string) {
return (
<div
className="p1 mr1"
@@ -137,7 +137,7 @@ export class MethodBlock extends React.Component<MethodBlockProps, MethodBlockSt
</div>
);
}
- private renderParameterDescriptions(parameters: Parameter[]) {
+ private _renderParameterDescriptions(parameters: Parameter[]) {
const descriptions = _.map(parameters, parameter => {
const isOptional = parameter.isOptional;
return (
@@ -166,7 +166,7 @@ export class MethodBlock extends React.Component<MethodBlockProps, MethodBlockSt
});
return descriptions;
}
- private setAnchorVisibility(shouldShowAnchor: boolean) {
+ private _setAnchorVisibility(shouldShowAnchor: boolean) {
this.setState({
shouldShowAnchor,
});
diff --git a/packages/website/ts/pages/documentation/type_definition.tsx b/packages/website/ts/pages/documentation/type_definition.tsx
index 09413faaf..036552693 100644
--- a/packages/website/ts/pages/documentation/type_definition.tsx
+++ b/packages/website/ts/pages/documentation/type_definition.tsx
@@ -107,8 +107,8 @@ export class TypeDefinition extends React.Component<TypeDefinitionProps, TypeDef
id={this.props.shouldAddId ? typeDefinitionAnchorId : ''}
className="pb2"
style={{overflow: 'hidden', width: '100%'}}
- onMouseOver={this.setAnchorVisibility.bind(this, true)}
- onMouseOut={this.setAnchorVisibility.bind(this, false)}
+ onMouseOver={this._setAnchorVisibility.bind(this, true)}
+ onMouseOut={this._setAnchorVisibility.bind(this, false)}
>
<AnchorTitle
headerSize={HeaderSizes.H3}
@@ -132,7 +132,7 @@ export class TypeDefinition extends React.Component<TypeDefinitionProps, TypeDef
</div>
);
}
- private setAnchorVisibility(shouldShowAnchor: boolean) {
+ private _setAnchorVisibility(shouldShowAnchor: boolean) {
this.setState({
shouldShowAnchor,
});