Turn on all of Microsoft's recommend lint rules
Biggest changes forced by this: alt tags for all images, resulting in new strings added to messages.json, and a new i18n paramter/prop added in a plot of places. Another change of note is that there are two new tslint.json files under ts/test and ts/styleguide to relax our rules a bit there. This required a change to our package.json script, as manually specifying the config file there made it ignore our tslint.json files in subdirectories
This commit is contained in:
parent
23586be6b0
commit
2988da0981
49 changed files with 311 additions and 123 deletions
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import classNames from 'classnames';
|
||||
|
||||
interface Props {
|
||||
/**
|
||||
|
@ -13,13 +13,13 @@ interface Props {
|
|||
* Provides the parent elements necessary to allow the main Signal Desktop stylesheet to
|
||||
* apply (with no changes) to messages in the Style Guide.
|
||||
*/
|
||||
export class ConversationContext extends React.Component<Props, {}> {
|
||||
export class ConversationContext extends React.Component<Props> {
|
||||
public render() {
|
||||
const { theme, type } = this.props;
|
||||
|
||||
return (
|
||||
<div className={theme || 'android'}>
|
||||
<div className={classnames('conversation', type || 'private')}>
|
||||
<div className={classNames('conversation', type || 'private')}>
|
||||
<div className="discussion-container" style={{ padding: '0.5em' }}>
|
||||
<ul className="message-list">{this.props.children}</ul>
|
||||
</div>
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { padStart, sample } from 'lodash';
|
||||
import { default as _, padStart, sample } from 'lodash';
|
||||
import libphonenumber from 'google-libphonenumber';
|
||||
|
||||
import _ from 'lodash';
|
||||
import moment from 'moment';
|
||||
import qs from 'qs';
|
||||
import QueryString from 'qs';
|
||||
|
||||
export { _ };
|
||||
|
||||
|
@ -57,6 +56,7 @@ function makeObjectUrl(data: ArrayBuffer, contentType: string): string {
|
|||
const blob = new Blob([data], {
|
||||
type: contentType,
|
||||
});
|
||||
|
||||
return URL.createObjectURL(blob);
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ export {
|
|||
const parent = window as any;
|
||||
|
||||
const query = window.location.search.replace(/^\?/, '');
|
||||
const urlOptions = qs.parse(query);
|
||||
const urlOptions = QueryString.parse(query);
|
||||
const theme = urlOptions.theme || 'android';
|
||||
const locale = urlOptions.locale || 'en';
|
||||
|
||||
|
@ -99,11 +99,11 @@ import localeMessages from '../../_locales/en/messages.json';
|
|||
|
||||
// @ts-ignore
|
||||
import { setup } from '../../js/modules/i18n';
|
||||
import filesize from 'filesize';
|
||||
import fileSize from 'filesize';
|
||||
|
||||
const i18n = setup(locale, localeMessages);
|
||||
|
||||
parent.filesize = filesize;
|
||||
parent.filesize = fileSize;
|
||||
|
||||
parent.i18n = i18n;
|
||||
parent.React = React;
|
||||
|
@ -137,6 +137,7 @@ const Attachments = {
|
|||
parent.Signal = Signal.setup({
|
||||
Attachments,
|
||||
userDataPath: '/',
|
||||
// tslint:disable-next-line:no-backbone-get-set-outside-model
|
||||
getRegionCode: () => parent.storage.get('regionCode'),
|
||||
});
|
||||
parent.SignalService = SignalService;
|
||||
|
|
11
ts/styleguide/tslint.json
Normal file
11
ts/styleguide/tslint.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"defaultSeverity": "error",
|
||||
"extends": ["../../tslint.json"],
|
||||
"rules": {
|
||||
// To allow the use of devDependencies here
|
||||
"no-implicit-dependencies": false,
|
||||
|
||||
// All tests use arrow functions, and they can be long
|
||||
"max-func-body-length": false
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue