From 23293a3c00459eb619549e47253c4db766b6e36e Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Thu, 5 Apr 2018 12:21:22 -0700 Subject: [PATCH] New tslint rule: Interfaces must not start with I --- js/react/conversation/Reply.tsx | 6 +++--- js/react/util/BackboneWrapper.tsx | 16 ++++++++-------- js/react/util/MessageParents.tsx | 4 ++-- tslint.json | 23 ++++++++++++----------- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/js/react/conversation/Reply.tsx b/js/react/conversation/Reply.tsx index 364508368..58ff7773e 100644 --- a/js/react/conversation/Reply.tsx +++ b/js/react/conversation/Reply.tsx @@ -1,11 +1,11 @@ import React from 'react'; -interface IProps { name: string; } +interface Props { name: string; } -interface IState { count: number; } +interface State { count: number; } -export class Reply extends React.Component { +export class Reply extends React.Component { public render() { return (
Placeholder
diff --git a/js/react/util/BackboneWrapper.tsx b/js/react/util/BackboneWrapper.tsx index dcdcbaeea..5471dda20 100644 --- a/js/react/util/BackboneWrapper.tsx +++ b/js/react/util/BackboneWrapper.tsx @@ -1,32 +1,32 @@ import React from 'react'; -interface IProps { +interface Props { /** The View class, which will be instantiated then treated like a Backbone View */ - readonly View: IBackboneViewConstructor; + readonly View: BackboneViewConstructor; /** Options to be passed along to the view when constructed */ readonly options: object; } -interface IBackboneView { +interface BackboneView { remove: () => void; render: () => void; el: HTMLElement; } -interface IBackboneViewConstructor { - new (options: object): IBackboneView; +interface BackboneViewConstructor { + new (options: object): BackboneView; } /** * Allows Backbone Views to be rendered inside of React (primarily for the styleguide) * while we slowly replace the internals of a given Backbone view with React. */ -export class BackboneWrapper extends React.Component { +export class BackboneWrapper extends React.Component { protected el: Element | null; - protected view: IBackboneView | null; + protected view: BackboneView | null; protected setEl: (element: HTMLDivElement | null) => void; - constructor(props: IProps) { + constructor(props: Props) { super(props); this.el = null; diff --git a/js/react/util/MessageParents.tsx b/js/react/util/MessageParents.tsx index b828ef18b..4cdf2545a 100644 --- a/js/react/util/MessageParents.tsx +++ b/js/react/util/MessageParents.tsx @@ -1,7 +1,7 @@ import React from 'react'; -interface IProps { +interface Props { /** * Corresponds to the theme setting in the app, and the class added to the root element. */ @@ -12,7 +12,7 @@ interface IProps { * Provides the parent elements necessary to allow the main Signal Desktop stylesheet to * apply (with no changes) to messages in this context. */ -export class MessageParents extends React.Component { +export class MessageParents extends React.Component { public render() { const { theme } = this.props; diff --git a/tslint.json b/tslint.json index 08698f647..a8a569505 100644 --- a/tslint.json +++ b/tslint.json @@ -1,13 +1,14 @@ { - "defaultSeverity": "error", - "extends": [ - "tslint:recommended", - "tslint-react" - ], - "jsRules": {}, - "rules": { - "quotemark": [true, "single", "jsx-double", "avoid-template", "avoid-escape"], - "no-consecutive-blank-lines": [true, 2] - }, - "rulesDirectory": [] + "defaultSeverity": "error", + "extends": [ + "tslint:recommended", + "tslint-react" + ], + "jsRules": {}, + "rules": { + "quotemark": [true, "single", "jsx-double", "avoid-template", "avoid-escape"], + "no-consecutive-blank-lines": [true, 2], + "interface-name": [true, "never-prefix"] + }, + "rulesDirectory": [] }