diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2017-12-20 13:44:08 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-20 22:30:25 +0800 |
commit | cb11aec84df346d5180c7d5874859c1c34f0bf1c (patch) | |
tree | b959a65bdcfc3e8b01dca1bc160f93a0df8a4bf9 /packages/website/ts/pages | |
parent | 972e1675f6490bc10e8d9fd64cce2f7945cd4840 (diff) | |
download | dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar.gz dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar.bz2 dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar.lz dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar.xz dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar.zst dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.zip |
Add new underscore-privates rule to @0xproject/tslint-config and fix lint errors
Diffstat (limited to 'packages/website/ts/pages')
15 files changed, 125 insertions, 125 deletions
diff --git a/packages/website/ts/pages/about/about.tsx b/packages/website/ts/pages/about/about.tsx index e9e876f45..722e819ff 100644 --- a/packages/website/ts/pages/about/about.tsx +++ b/packages/website/ts/pages/about/about.tsx @@ -188,10 +188,10 @@ export class About extends React.Component<AboutProps, AboutState> { </div> <div className="pt3 md-px4 lg-px0"> <div className="clearfix pb3"> - {this.renderProfiles(teamRow1)} + {this._renderProfiles(teamRow1)} </div> <div className="clearfix"> - {this.renderProfiles(teamRow2)} + {this._renderProfiles(teamRow2)} </div> </div> <div className="pt3 pb2"> @@ -202,7 +202,7 @@ export class About extends React.Component<AboutProps, AboutState> { Advisors: </div> <div className="clearfix"> - {this.renderProfiles(advisors)} + {this._renderProfiles(advisors)} </div> </div> <div className="mx-auto py4 sm-px3" style={{maxWidth: 308}}> @@ -232,7 +232,7 @@ export class About extends React.Component<AboutProps, AboutState> { </div> ); } - private renderProfiles(profiles: ProfileInfo[]) { + private _renderProfiles(profiles: ProfileInfo[]) { const numIndiv = profiles.length; const colSize = utils.getColSize(numIndiv); return _.map(profiles, profile => { 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, }); diff --git a/packages/website/ts/pages/faq/faq.tsx b/packages/website/ts/pages/faq/faq.tsx index 296e63f1d..c5afcb79f 100644 --- a/packages/website/ts/pages/faq/faq.tsx +++ b/packages/website/ts/pages/faq/faq.tsx @@ -459,26 +459,26 @@ export class FAQ extends React.Component<FAQProps, FAQState> { > <h1 className="center" style={{...styles.thin}}>0x FAQ</h1> <div className="sm-px2 md-px2 lg-px0 pb4"> - {this.renderSections()} + {this._renderSections()} </div> </div> <Footer /> </div> ); } - private renderSections() { + private _renderSections() { const renderedSections = _.map(sections, (section: FAQSection, i: number) => { const isFirstSection = i === 0; return ( <div key={section.name}> <h3>{section.name}</h3> - {this.renderQuestions(section.questions, isFirstSection)} + {this._renderQuestions(section.questions, isFirstSection)} </div> ); }); return renderedSections; } - private renderQuestions(questions: FAQQuestion[], isFirstSection: boolean) { + private _renderQuestions(questions: FAQQuestion[], isFirstSection: boolean) { const renderedQuestions = _.map(questions, (question: FAQQuestion, i: number) => { const isFirstQuestion = i === 0; return ( diff --git a/packages/website/ts/pages/faq/question.tsx b/packages/website/ts/pages/faq/question.tsx index 534304cc8..54ae1a592 100644 --- a/packages/website/ts/pages/faq/question.tsx +++ b/packages/website/ts/pages/faq/question.tsx @@ -27,7 +27,7 @@ export class Question extends React.Component<QuestionProps, QuestionState> { > <Card initiallyExpanded={this.props.shouldDisplayExpanded} - onExpandChange={this.onExchangeChange.bind(this)} + onExpandChange={this._onExchangeChange.bind(this)} > <CardHeader title={this.props.prompt} @@ -45,7 +45,7 @@ export class Question extends React.Component<QuestionProps, QuestionState> { </div> ); } - private onExchangeChange() { + private _onExchangeChange() { this.setState({ isExpanded: !this.state.isExpanded, }); diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 3d9ebe099..1e97ae240 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -138,20 +138,20 @@ interface LandingState { } export class Landing extends React.Component<LandingProps, LandingState> { - private throttledScreenWidthUpdate: () => void; + private _throttledScreenWidthUpdate: () => void; constructor(props: LandingProps) { super(props); this.state = { screenWidth: utils.getScreenWidth(), }; - this.throttledScreenWidthUpdate = _.throttle(this.updateScreenWidth.bind(this), THROTTLE_TIMEOUT); + this._throttledScreenWidthUpdate = _.throttle(this._updateScreenWidth.bind(this), THROTTLE_TIMEOUT); } public componentDidMount() { - window.addEventListener('resize', this.throttledScreenWidthUpdate); + window.addEventListener('resize', this._throttledScreenWidthUpdate); window.scrollTo(0, 0); } public componentWillUnmount() { - window.removeEventListener('resize', this.throttledScreenWidthUpdate); + window.removeEventListener('resize', this._throttledScreenWidthUpdate); } public render() { return ( @@ -163,19 +163,19 @@ export class Landing extends React.Component<LandingProps, LandingState> { isNightVersion={true} style={{backgroundColor: colors.heroGrey, position: 'relative'}} /> - {this.renderHero()} - {this.renderProjects()} - {this.renderTokenizationSection()} - {this.renderProtocolSection()} - {this.renderInfoBoxes()} - {this.renderBuildingBlocksSection()} - {this.renderUseCases()} - {this.renderCallToAction()} + {this._renderHero()} + {this._renderProjects()} + {this._renderTokenizationSection()} + {this._renderProtocolSection()} + {this._renderInfoBoxes()} + {this._renderBuildingBlocksSection()} + {this._renderUseCases()} + {this._renderCallToAction()} <Footer /> </div> ); } - private renderHero() { + private _renderHero() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const buttonLabelStyle: React.CSSProperties = { textTransform: 'none', @@ -259,7 +259,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private renderProjects() { + private _renderProjects() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const isMediumScreen = this.state.screenWidth === ScreenWidths.Md; const projectList = _.map(projects, (project: Project, i: number) => { @@ -323,7 +323,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private renderTokenizationSection() { + private _renderTokenizationSection() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; return ( <div @@ -332,7 +332,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { > <div className="mx-auto max-width-4 py4 clearfix"> {isSmallScreen && - this.renderTokenCloud() + this._renderTokenCloud() } <div className="col lg-col-6 md-col-6 col-12"> <div className="mx-auto" style={{maxWidth: 385, paddingTop: 7}}> @@ -365,18 +365,18 @@ export class Landing extends React.Component<LandingProps, LandingState> { } </div> <div className="flex pt1 sm-px3"> - {this.renderAssetTypes()} + {this._renderAssetTypes()} </div> </div> </div> {!isSmallScreen && - this.renderTokenCloud() + this._renderTokenCloud() } </div> </div> ); } - private renderProtocolSection() { + private _renderProtocolSection() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; return ( <div @@ -462,7 +462,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private renderBuildingBlocksSection() { + private _renderBuildingBlocksSection() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const descriptionStyle: React.CSSProperties = { fontFamily: 'Roboto Mono', @@ -484,7 +484,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { > <div className="mx-auto max-width-4 lg-pt4 md-pt4 lg-mb4 md-mb4 sm-mb2 clearfix"> {isSmallScreen && - this.renderBlockChipImage() + this._renderBlockChipImage() } <div className="col lg-col-6 md-col-6 col-12 lg-pr3 md-pr3 sm-px3" @@ -528,13 +528,13 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> </div> {!isSmallScreen && - this.renderBlockChipImage() + this._renderBlockChipImage() } </div> </div> ); } - private renderBlockChipImage() { + private _renderBlockChipImage() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; return ( <div className="col lg-col-6 md-col-6 col-12 sm-center"> @@ -545,7 +545,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private renderTokenCloud() { + private _renderTokenCloud() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; return ( <div className="col lg-col-6 md-col-6 col-12 center"> @@ -556,7 +556,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private renderAssetTypes() { + private _renderAssetTypes() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const assetTypes: AssetType[] = [ { @@ -595,7 +595,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { }); return assets; } - private renderInfoBoxes() { + private _renderInfoBoxes() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const boxStyle: React.CSSProperties = { maxWidth: 252, @@ -648,7 +648,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private renderUseCases() { + private _renderUseCases() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const useCases: UseCase[] = [ @@ -759,7 +759,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private renderCallToAction() { + private _renderCallToAction() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const buttonLabelStyle: React.CSSProperties = { textTransform: 'none', @@ -805,7 +805,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private updateScreenWidth() { + private _updateScreenWidth() { const newScreenWidth = utils.getScreenWidth(); if (newScreenWidth !== this.state.screenWidth) { this.setState({ diff --git a/packages/website/ts/pages/shared/anchor_title.tsx b/packages/website/ts/pages/shared/anchor_title.tsx index 0a3674fd9..0c1e8f4b7 100644 --- a/packages/website/ts/pages/shared/anchor_title.tsx +++ b/packages/website/ts/pages/shared/anchor_title.tsx @@ -79,14 +79,14 @@ export class AnchorTitle extends React.Component<AnchorTitleProps, AnchorTitleSt className="zmdi zmdi-link" onClick={utils.setUrlHash.bind(utils, this.props.id)} style={{...styles.anchor, opacity}} - onMouseOver={this.setHoverState.bind(this, true)} - onMouseOut={this.setHoverState.bind(this, false)} + onMouseOver={this._setHoverState.bind(this, true)} + onMouseOut={this._setHoverState.bind(this, false)} /> </ScrollLink> </div> ); } - private setHoverState(isHovering: boolean) { + private _setHoverState(isHovering: boolean) { this.setState({ isHovering, }); diff --git a/packages/website/ts/pages/shared/markdown_section.tsx b/packages/website/ts/pages/shared/markdown_section.tsx index 8686e80b6..e81920fc3 100644 --- a/packages/website/ts/pages/shared/markdown_section.tsx +++ b/packages/website/ts/pages/shared/markdown_section.tsx @@ -35,8 +35,8 @@ export class MarkdownSection extends React.Component<MarkdownSectionProps, Markd return ( <div className="pt2 pr3 md-pl2 sm-pl3 overflow-hidden" - onMouseOver={this.setAnchorVisibility.bind(this, true)} - onMouseOut={this.setAnchorVisibility.bind(this, false)} + onMouseOver={this._setAnchorVisibility.bind(this, true)} + onMouseOut={this._setAnchorVisibility.bind(this, false)} > <ScrollElement name={id}> <div className="clearfix"> @@ -69,7 +69,7 @@ export class MarkdownSection extends React.Component<MarkdownSectionProps, Markd </div> ); } - private setAnchorVisibility(shouldShowAnchor: boolean) { + private _setAnchorVisibility(shouldShowAnchor: boolean) { this.setState({ shouldShowAnchor, }); diff --git a/packages/website/ts/pages/shared/nested_sidebar_menu.tsx b/packages/website/ts/pages/shared/nested_sidebar_menu.tsx index fcbfaf1cf..60686c0aa 100644 --- a/packages/website/ts/pages/shared/nested_sidebar_menu.tsx +++ b/packages/website/ts/pages/shared/nested_sidebar_menu.tsx @@ -61,13 +61,13 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N {finalSectionName.toUpperCase()} </div> </ScrollLink> - {this.renderMenuItems(menuItems)} + {this._renderMenuItems(menuItems)} </div> ); } else { return ( <div key={`section-${sectionName}`} > - {this.renderMenuItems(menuItems)} + {this._renderMenuItems(menuItems)} </div> ); } @@ -87,7 +87,7 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N </div> ); } - private renderMenuItems(menuItemNames: string[]): React.ReactNode[] { + private _renderMenuItems(menuItemNames: string[]): React.ReactNode[] { const menuItemStyles = this.props.shouldDisplaySectionHeaders ? styles.menuItemWithHeaders : styles.menuItemWithoutHeaders; @@ -105,7 +105,7 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N containerId={constants.DOCS_CONTAINER_ID} > <MenuItem - onTouchTap={this.onMenuItemClick.bind(this, menuItemName)} + onTouchTap={this._onMenuItemClick.bind(this, menuItemName)} style={menuItemStyles} innerDivStyle={menuItemInnerDivStyles} > @@ -114,19 +114,19 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N </span> </MenuItem> </ScrollLink> - {this.renderMenuItemSubsections(menuItemName)} + {this._renderMenuItemSubsections(menuItemName)} </div> ); }); return menuItems; } - private renderMenuItemSubsections(menuItemName: string): React.ReactNode { + private _renderMenuItemSubsections(menuItemName: string): React.ReactNode { if (_.isUndefined(this.props.menuSubsectionsBySection[menuItemName])) { return null; } - return this.renderMenuSubsectionsBySection(menuItemName, this.props.menuSubsectionsBySection[menuItemName]); + return this._renderMenuSubsectionsBySection(menuItemName, this.props.menuSubsectionsBySection[menuItemName]); } - private renderMenuSubsectionsBySection(menuItemName: string, entityNames: string[]): React.ReactNode { + private _renderMenuSubsectionsBySection(menuItemName: string, entityNames: string[]): React.ReactNode { return ( <ul style={{margin: 0, listStyleType: 'none', paddingLeft: 0}} key={menuItemName}> {_.map(entityNames, entityName => { @@ -138,10 +138,10 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N offset={0} duration={constants.DOCS_SCROLL_DURATION_MS} containerId={constants.DOCS_CONTAINER_ID} - onTouchTap={this.onMenuItemClick.bind(this, entityName)} + onTouchTap={this._onMenuItemClick.bind(this, entityName)} > <MenuItem - onTouchTap={this.onMenuItemClick.bind(this, menuItemName)} + onTouchTap={this._onMenuItemClick.bind(this, menuItemName)} style={{minHeight: 35}} innerDivStyle={{paddingLeft: 36, fontSize: 14, lineHeight: '35px'}} > @@ -154,7 +154,7 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N </ul> ); } - private onMenuItemClick(menuItemName: string): void { + private _onMenuItemClick(menuItemName: string): void { const id = utils.getIdFromName(menuItemName); utils.setUrlHash(id); this.props.onMenuItemClick(); diff --git a/packages/website/ts/pages/shared/section_header.tsx b/packages/website/ts/pages/shared/section_header.tsx index b5119b128..5ea9fc681 100644 --- a/packages/website/ts/pages/shared/section_header.tsx +++ b/packages/website/ts/pages/shared/section_header.tsx @@ -28,8 +28,8 @@ export class SectionHeader extends React.Component<SectionHeaderProps, SectionHe const id = utils.getIdFromName(sectionName); return ( <div - onMouseOver={this.setAnchorVisibility.bind(this, true)} - onMouseOut={this.setAnchorVisibility.bind(this, false)} + onMouseOver={this._setAnchorVisibility.bind(this, true)} + onMouseOut={this._setAnchorVisibility.bind(this, false)} > <ScrollElement name={id}> <AnchorTitle @@ -42,7 +42,7 @@ export class SectionHeader extends React.Component<SectionHeaderProps, SectionHe </div> ); } - private setAnchorVisibility(shouldShowAnchor: boolean) { + private _setAnchorVisibility(shouldShowAnchor: boolean) { this.setState({ shouldShowAnchor, }); diff --git a/packages/website/ts/pages/shared/version_drop_down.tsx b/packages/website/ts/pages/shared/version_drop_down.tsx index e63ad19cd..8d3322d72 100644 --- a/packages/website/ts/pages/shared/version_drop_down.tsx +++ b/packages/website/ts/pages/shared/version_drop_down.tsx @@ -18,14 +18,14 @@ export class VersionDropDown extends React.Component<VersionDropDownProps, Versi <DropDownMenu maxHeight={300} value={this.props.selectedVersion} - onChange={this.updateSelectedVersion.bind(this)} + onChange={this._updateSelectedVersion.bind(this)} > - {this.renderDropDownItems()} + {this._renderDropDownItems()} </DropDownMenu> </div> ); } - private renderDropDownItems() { + private _renderDropDownItems() { const items = _.map(this.props.versions, version => { return ( <MenuItem @@ -37,7 +37,7 @@ export class VersionDropDown extends React.Component<VersionDropDownProps, Versi }); return items; } - private updateSelectedVersion(e: any, index: number, value: string) { + private _updateSelectedVersion(e: any, index: number, value: string) { window.location.href = `${this.props.docPath}/${value}${window.location.hash}`; } } diff --git a/packages/website/ts/pages/wiki/wiki.tsx b/packages/website/ts/pages/wiki/wiki.tsx index af5b26631..4ddb11008 100644 --- a/packages/website/ts/pages/wiki/wiki.tsx +++ b/packages/website/ts/pages/wiki/wiki.tsx @@ -46,7 +46,7 @@ const styles: Styles = { }; export class Wiki extends React.Component<WikiProps, WikiState> { - private wikiBackoffTimeoutId: number; + private _wikiBackoffTimeoutId: number; constructor(props: WikiProps) { super(props); this.state = { @@ -55,15 +55,15 @@ export class Wiki extends React.Component<WikiProps, WikiState> { } public componentWillMount() { // tslint:disable-next-line:no-floating-promises - this.fetchArticlesBySectionAsync(); + this._fetchArticlesBySectionAsync(); } public componentWillUnmount() { - clearTimeout(this.wikiBackoffTimeoutId); + clearTimeout(this._wikiBackoffTimeoutId); } public render() { const menuSubsectionsBySection = _.isUndefined(this.state.articlesBySection) ? {} - : this.getMenuSubsectionsBySection(this.state.articlesBySection); + : this._getMenuSubsectionsBySection(this.state.articlesBySection); return ( <div> <DocumentTitle title="0x Protocol Wiki"/> @@ -117,7 +117,7 @@ export class Wiki extends React.Component<WikiProps, WikiState> { </a> </h1> <div id="wiki"> - {this.renderWikiArticles()} + {this._renderWikiArticles()} </div> </div> </div> @@ -126,12 +126,12 @@ export class Wiki extends React.Component<WikiProps, WikiState> { </div> ); } - private renderWikiArticles(): React.ReactNode { + private _renderWikiArticles(): React.ReactNode { const sectionNames = _.keys(this.state.articlesBySection); - const sections = _.map(sectionNames, sectionName => this.renderSection(sectionName)); + const sections = _.map(sectionNames, sectionName => this._renderSection(sectionName)); return sections; } - private renderSection(sectionName: string) { + private _renderSection(sectionName: string) { const articles = this.state.articlesBySection[sectionName]; const renderedArticles = _.map(articles, (article: Article) => { const githubLink = `${constants.URL_GITHUB_WIKI}/edit/master/${sectionName}/${article.fileName}`; @@ -165,7 +165,7 @@ export class Wiki extends React.Component<WikiProps, WikiState> { </div> ); } - private scrollToHash(): void { + private _scrollToHash(): void { const hashWithPrefix = this.props.location.hash; let hash = hashWithPrefix.slice(1); if (_.isEmpty(hash)) { @@ -174,14 +174,14 @@ export class Wiki extends React.Component<WikiProps, WikiState> { scroller.scrollTo(hash, {duration: 0, offset: 0, containerId: 'documentation'}); } - private async fetchArticlesBySectionAsync(): Promise<void> { + private async _fetchArticlesBySectionAsync(): Promise<void> { const endpoint = `${configs.BACKEND_BASE_URL}${WebsitePaths.Wiki}`; const response = await fetch(endpoint); if (response.status === constants.HTTP_NO_CONTENT_STATUS_CODE) { // We need to backoff and try fetching again later - this.wikiBackoffTimeoutId = window.setTimeout(() => { + this._wikiBackoffTimeoutId = window.setTimeout(() => { // tslint:disable-next-line:no-floating-promises - this.fetchArticlesBySectionAsync(); + this._fetchArticlesBySectionAsync(); }, WIKI_NOT_READY_BACKOUT_TIMEOUT_MS); return; } @@ -195,10 +195,10 @@ export class Wiki extends React.Component<WikiProps, WikiState> { this.setState({ articlesBySection, }, () => { - this.scrollToHash(); + this._scrollToHash(); }); } - private getMenuSubsectionsBySection(articlesBySection: ArticlesBySection) { + private _getMenuSubsectionsBySection(articlesBySection: ArticlesBySection) { const sectionNames = _.keys(articlesBySection); const menuSubsectionsBySection: {[section: string]: string[]} = {}; for (const sectionName of sectionNames) { |