typescript/no-angle-bracket-type-assertion

This commit is contained in:
Jed Fox 2017-08-07 17:20:12 -04:00
parent 564bdb9650
commit 60e4a65022
6 changed files with 21 additions and 20 deletions

View file

@ -23,6 +23,7 @@ rules:
typescript/interface-name-prefix:
- error
- always
typescript/no-angle-bracket-type-assertion: error
typescript/explicit-member-accessibility: error
typescript/no-unused-vars: error
typescript/no-use-before-define:

View file

@ -3,7 +3,7 @@ import { formatLogMessage } from '../format-log-message'
const g = global as any
g.log = <IDesktopLogger>{
g.log = {
error(message: string, error?: Error) {
log('error', '[main] ' + formatLogMessage(message, error))
},
@ -16,4 +16,4 @@ g.log = <IDesktopLogger>{
debug(message: string, error?: Error) {
log('debug', '[main] ' + formatLogMessage(message, error))
},
}
} as IDesktopLogger

View file

@ -17,7 +17,7 @@ function log(level: LogLevel, message: string, error?: Error) {
)
}
g.log = <IDesktopLogger>{
g.log = {
error(message: string, error?: Error) {
log('error', message, error)
console.error(formatLogMessage(message, error))
@ -34,4 +34,4 @@ g.log = <IDesktopLogger>{
log('debug', message, error)
console.debug(formatLogMessage(message, error))
},
}
} as IDesktopLogger

View file

@ -16,9 +16,9 @@ g['__RELEASE_CHANNEL__'] = 'development'
g['__UPDATES_URL__'] = ''
g['__SHA__'] = 'test'
g['log'] = <IDesktopLogger>{
g['log'] = {
error: () => {},
warn: () => {},
info: () => {},
debug: () => {},
}
} as IDesktopLogger

View file

@ -72,14 +72,14 @@ describe('GitProgressParser', () => {
const result = parse('remote: Counting objects: 167587')
expect(result).to.deep.equal(
<IGitProgressInfo>{
{
title: 'remote: Counting objects',
text: 'remote: Counting objects: 167587',
value: 167587,
done: false,
percent: undefined,
total: undefined,
}
} as IGitProgressInfo
)
})
@ -87,14 +87,14 @@ describe('GitProgressParser', () => {
const result = parse('remote: Counting objects: 167587, done.')
expect(result).to.deep.equal(
<IGitProgressInfo>{
{
title: 'remote: Counting objects',
text: 'remote: Counting objects: 167587, done.',
value: 167587,
done: true,
percent: undefined,
total: undefined,
}
} as IGitProgressInfo
)
})
@ -102,14 +102,14 @@ describe('GitProgressParser', () => {
const result = parse('remote: Compressing objects: 72% (16/22)')
expect(result).to.deep.equal(
<IGitProgressInfo>{
{
title: 'remote: Compressing objects',
text: 'remote: Compressing objects: 72% (16/22)',
value: 16,
done: false,
percent: 72,
total: 22,
}
} as IGitProgressInfo
)
})
@ -117,14 +117,14 @@ describe('GitProgressParser', () => {
const result = parse('remote: Compressing objects: 100% (22/22), done.')
expect(result).to.deep.equal(
<IGitProgressInfo>{
{
title: 'remote: Compressing objects',
text: 'remote: Compressing objects: 100% (22/22), done.',
value: 22,
done: true,
percent: 100,
total: 22,
}
} as IGitProgressInfo
)
})
@ -134,7 +134,7 @@ describe('GitProgressParser', () => {
)
expect(result).to.deep.equal(
<IGitProgressInfo>{
{
title: 'Receiving objects',
text:
'Receiving objects: 99% (166741/167587), 267.24 MiB | 2.40 MiB/s',
@ -142,7 +142,7 @@ describe('GitProgressParser', () => {
done: false,
percent: 99,
total: 167587,
}
} as IGitProgressInfo
)
})
@ -152,7 +152,7 @@ describe('GitProgressParser', () => {
)
expect(result).to.deep.equal(
<IGitProgressInfo>{
{
title: 'Receiving objects',
text:
'Receiving objects: 100% (167587/167587), 279.67 MiB | 2.43 MiB/s, done.',
@ -160,7 +160,7 @@ describe('GitProgressParser', () => {
done: true,
percent: 100,
total: 167587,
}
} as IGitProgressInfo
)
})

View file

@ -48,7 +48,7 @@ class ReactNoUnboundDispatcherPropsWalker extends Lint.RuleWalker {
// This is some weak sauce, why doesn't JsxAttribute specify a literal kind
// so that it can be narrowed automatically?
const attribute: ts.JsxAttribute = <ts.JsxAttribute>attributeLikeElement
const attribute: ts.JsxAttribute = attributeLikeElement
// This means that the attribute is an inferred boolean true value. See:
//
@ -76,7 +76,7 @@ class ReactNoUnboundDispatcherPropsWalker extends Lint.RuleWalker {
return
}
const propAccess: ts.PropertyAccessExpression = <ts.PropertyAccessExpression>jsxExpression.expression
const propAccess: ts.PropertyAccessExpression = jsxExpression.expression as ts.PropertyAccessExpression
const propAccessText = propAccess.getText()
if (/^this\.props\.dispatcher\./.test(propAccessText)) {