eslint-plugin-typescript
Advanced tools
Comparing version 0.0.1 to 0.1.0
# Enforces spacing around type annotations (type-annotation-spacing) | ||
Please describe the origin of the rule here. | ||
Type annotations in TypeScript tend to have a very specific format, where the colon appears directly after the identifier or function, followed by a space, followed by the type. For example: | ||
```ts | ||
var foo: string = "bar"; | ||
function foo(a: string): string { | ||
// code | ||
} | ||
``` | ||
This convention is carried through TypeScript documentation and is the most common convention used for TypeScript code. | ||
## Rule Details | ||
This rule aims to... | ||
This rule aims to enforce specific spacing patterns around type annotations. As such, it will warn when there is a space before the colon or a space is missing after the colon of a type annotation. | ||
The following patterns are considered warnings: | ||
```js | ||
```ts | ||
var foo:string = "bar"; | ||
// fill me in | ||
function foo(a : string):string { | ||
// code | ||
} | ||
``` | ||
@@ -21,17 +32,11 @@ | ||
```js | ||
var foo: string = "bar"; | ||
// fill me in | ||
function foo(a: string): string { | ||
// code | ||
} | ||
``` | ||
### Options | ||
If there are any options, describe them here. Otherwise, delete this section. | ||
## When Not To Use It | ||
Give a short description of when it would be appropriate to turn off this rule. | ||
## Further Reading | ||
If there are other links that describe the issue this rule addresses, please include them here in a bulleted list. | ||
If you don't want to enforce spacing for your type annotations, you can safely turn this rule off. |
{ | ||
"name": "eslint-plugin-typescript", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "TypeScript plugin for ESLint", | ||
@@ -24,3 +24,3 @@ "keywords": [ | ||
"mocha": "^2.4.5", | ||
"typescript-eslint-parser": "~0.1.1" | ||
"typescript-eslint-parser": "^0.4.0" | ||
}, | ||
@@ -27,0 +27,0 @@ "engines": { |
@@ -53,6 +53,2 @@ # eslint-plugin-typescript | ||
* `typescript/type-annotation-spacing` - enforces one space after the colon and zero spaces before the colon of a type annotation. | ||
* `typescript/explicit-member-accessibility` - enforces accessibility modifiers on class properties and methods. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15570
13
295
54