Socket
Socket
Sign inDemoInstall

eslint-plugin-flowtype

Package Overview
Dependencies
Maintainers
1
Versions
185
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-flowtype - npm Package Compare versions

Comparing version 2.8.0 to 2.9.0

dist/rules/spaceBeforeGenericBracket.js

6

dist/index.js

@@ -27,2 +27,6 @@ 'use strict';

var _spaceBeforeGenericBracket = require('./rules/spaceBeforeGenericBracket');
var _spaceBeforeGenericBracket2 = _interopRequireDefault(_spaceBeforeGenericBracket);
var _spaceBeforeTypeColon = require('./rules/spaceBeforeTypeColon');

@@ -53,2 +57,3 @@

'space-after-type-colon': _spaceAfterTypeColon2.default,
'space-before-generic-bracket': _spaceBeforeGenericBracket2.default,
'space-before-type-colon': _spaceBeforeTypeColon2.default,

@@ -64,2 +69,3 @@ 'type-id-match': _typeIdMatch2.default,

'space-after-type-colon': 0,
'space-before-generic-bracket': 0,
'space-before-type-colon': 0,

@@ -66,0 +72,0 @@ 'type-id-match': 0,

2

package.json
{
"name": "eslint-plugin-flowtype",
"description": "Flowtype linting rules for ESLint.",
"version": "2.8.0",
"version": "2.9.0",
"main": "./dist/index.js",

@@ -6,0 +6,0 @@ "repository": {

@@ -21,2 +21,3 @@ <h1 id="eslint-plugin-flowtype">eslint-plugin-flowtype</h1>

* [`space-before-type-colon`](#eslint-plugin-flowtype-rules-space-before-type-colon)
* [`space-before-generic-bracket`](#eslint-plugin-flowtype-rules-space-before-generic-bracket)
* [`type-id-match`](#eslint-plugin-flowtype-rules-type-id-match)

@@ -562,2 +563,8 @@ * [`use-flow-type`](#eslint-plugin-flowtype-rules-use-flow-type)

// @NoFlow
// Message: Malformed flow file annotation.
// @nofloweeeeeee
// Message: Malformed flow file annotation.
// Options: ["always"]

@@ -593,2 +600,5 @@ a;

// @noflow
a;
// Options: ["always"]

@@ -615,18 +625,3 @@ a;

// Options: ["never"]
export default function (foo: string) {}
// Message: There must be no space after "foo" parameter type annotation colon.
// Options: ["never"]
function foo (foo: string) {}
// Message: There must be no space after "foo" parameter type annotation colon.
// Options: ["always"]
(foo:string) => {}
// Message: There must be a space after "foo" parameter type annotation colon.
function foo (foo:string) {}
// Message: There must be a space after "foo" parameter type annotation colon.
// Options: ["always"]
(foo: string) => {}

@@ -647,2 +642,14 @@ // Message: There must be 1 space after "foo" parameter type annotation colon.

({ lorem, ipsum, dolor } : SomeType) => {}
// Message: There must be 1 space after "{ lorem, ipsum, dolor }" parameter type annotation colon.
(foo:{ a: string, b: number }) => {}
// Message: There must be a space after "foo" parameter type annotation colon.
({ a, b } :{ a: string, b: number }) => {}
// Message: There must be a space after "{ a, b }" parameter type annotation colon.
([ a, b ] :string[]) => {}
// Message: There must be a space after "[ a, b ]" parameter type annotation colon.
// Options: ["always"]

@@ -672,44 +679,49 @@ ():Object => {}

// Options: ["never"]
export default function (foo: string) {}
// Message: There must be no space after "foo" parameter type annotation colon.
// Options: ["never"]
function foo (foo: string) {}
// Message: There must be no space after "foo" parameter type annotation colon.
// Options: ["always"]
(foo:string) => {}
// Message: There must be a space after "foo" parameter type annotation colon.
function foo (foo:string) {}
// Message: There must be a space after "foo" parameter type annotation colon.
async function foo({ lorem, ipsum, dolor }:SomeType) {}
// Message: There must be a space after "{ lorem, ipsum, dolor }" parameter type annotation colon.
({ lorem, ipsum, dolor } : SomeType) => {}
// Message: There must be 1 space after "{ lorem, ipsum, dolor }" parameter type annotation colon.
(foo:{ a: string, b: number }) => {}
type X = (foo:number) => string
// Message: There must be a space after "foo" parameter type annotation colon.
({ a, b } :{ a: string, b: number }) => {}
// Message: There must be a space after "{ a, b }" parameter type annotation colon.
// Options: ["never"]
type X = (foo: number) => string
// Message: There must be no space after "foo" parameter type annotation colon.
([ a, b ] :string[]) => {}
// Message: There must be a space after "[ a, b ]" parameter type annotation colon.
type X = (foo: number) => string
// Message: There must be 1 space after "foo" parameter type annotation colon.
type X = { foo:string }
// Message: There must be a space after "foo" type annotation colon.
type X = (foo:?number) => string
// Message: There must be a space after "foo" parameter type annotation colon.
// Options: ["always"]
type X = { foo:string }
// Message: There must be a space after "foo" type annotation colon.
type X = (foo:(number)) => string
// Message: There must be a space after "foo" parameter type annotation colon.
// Options: ["never"]
type X = { foo: string }
// Message: There must be no space after "foo" type annotation colon.
type X = (foo:((number))) => string
// Message: There must be a space after "foo" parameter type annotation colon.
type X = { foo: string }
// Message: There must be 1 space after "foo" type annotation colon.
type X = (foo: ((number))) => string
// Message: There must be 1 space after "foo" parameter type annotation colon.
type X = { foo?:string }
// Message: There must be a space after "foo" type annotation colon.
// Options: ["never"]
type X = { foo?: string }
// Message: There must be no space after "foo" type annotation colon.
type X = (foo: ((number))) => string
// Message: There must be no space after "foo" parameter type annotation colon.
type X = { foo?:?string }
// Message: There must be a space after "foo" type annotation colon.
type X = (foo:?(number)) => string
// Message: There must be a space after "foo" parameter type annotation colon.
type X = { foo?: ?string }
// Message: There must be 1 space after "foo" type annotation colon.
class X { foo:string }

@@ -729,15 +741,2 @@ // Message: There must be a space after "foo" class property type annotation colon.

type X = (foo:number) => string
// Message: There must be a space after "foo" parameter type annotation colon.
// Options: ["never"]
type X = (foo: number) => string
// Message: There must be no space after "foo" parameter type annotation colon.
type X = (foo: number) => string
// Message: There must be 1 space after "foo" parameter type annotation colon.
type X = (foo:?number) => string
// Message: There must be a space after "foo" parameter type annotation colon.
class X { static foo:number }

@@ -770,2 +769,45 @@ // Message: There must be a space after "foo" class property type annotation colon.

// Message: There must be no space after "foo" type annotation colon.
type X = { foo:string }
// Message: There must be a space after "foo" type annotation colon.
// Options: ["always"]
type X = { foo:string }
// Message: There must be a space after "foo" type annotation colon.
// Options: ["never"]
type X = { foo: string }
// Message: There must be no space after "foo" type annotation colon.
type X = { foo: string }
// Message: There must be 1 space after "foo" type annotation colon.
type X = { foo?:string }
// Message: There must be a space after "foo" type annotation colon.
// Options: ["never"]
type X = { foo?: string }
// Message: There must be no space after "foo" type annotation colon.
type X = { foo?:?string }
// Message: There must be a space after "foo" type annotation colon.
type X = { foo?: ?string }
// Message: There must be 1 space after "foo" type annotation colon.
type Foo = { barType:(string | () => void) }
// Message: There must be a space after "barType" type annotation colon.
type Foo = { barType:(((string | () => void))) }
// Message: There must be a space after "barType" type annotation colon.
// Options: ["never"]
type Foo = { barType: (string | () => void) }
// Message: There must be no space after "barType" type annotation colon.
type Foo = { barType: (string | () => void) }
// Message: There must be 1 space after "barType" type annotation colon.
type Foo = { barType: ((string | () => void)) }
// Message: There must be 1 space after "barType" type annotation colon.
```

@@ -780,6 +822,2 @@

function x(foo: string) {}
class Foo { constructor(foo: string) {} }
(foo: (string|number)) => {}

@@ -790,8 +828,2 @@

// Options: ["never"]
function x(foo:string) {}
// Options: ["never"]
class Foo { constructor(foo:string) {} }
// Options: ["always"]

@@ -806,2 +838,10 @@ (foo: string) => {}

({ lorem, ipsum, dolor }: SomeType) => {}
(foo: { a: string, b: number }) => {}
({ a, b }: ?{ a: string, b: number }) => {}
([ a, b ]: string[]) => {}
// Options: ["never"]

@@ -837,31 +877,49 @@ ():Object => {}

async function foo({ lorem, ipsum, dolor }: SomeType) {}
(): { a: number, b: string } => {}
({ lorem, ipsum, dolor }: SomeType) => {}
// Options: ["never"]
() :{ a:number, b:string } => {}
(foo: { a: string, b: number }) => {}
function x(foo: string) {}
({ a, b }: ?{ a: string, b: number }) => {}
class Foo { constructor(foo: string) {} }
// Options: ["never"]
function x(foo:string) {}
// Options: ["never"]
class Foo { constructor(foo:string) {} }
async function foo({ lorem, ipsum, dolor }: SomeType) {}
function x({ a, b }: { a: string, b: number }) {}
(): { a: number, b: string } => {}
type X = (foo: number) => string;
// Options: ["never"]
() :{ a:number, b:string } => {}
type X = (foo : number) => string;
([ a, b ]: string[]) => {}
type X = (foo: ?number) => string;
type X = { foo: string }
type X = (foo? : ?number) => string;
type X = (foo: ?{ x: number }) => string;
// Options: ["never"]
type X = { foo:string }
type X = (foo:number) => string;
type X = { foo?: string }
// Options: ["never"]
type X = (foo:?{ x:number }) => string;
type X = { foo?: ?string }
type X = (foo: (number)) => string
type X = (foo: ((number))) => string
// Options: ["never"]
type X = { foo?:?string }
type X = (foo:((number))) => string
type X = ?(foo: ((number))) => string
// Options: ["never"]
type X = ?(foo:((number))) => string
class Foo { bar }

@@ -881,27 +939,33 @@

type X = (foo: number) => string;
class X { static foo : number }
type X = (foo : number) => string;
// Options: ["never"]
class X { static foo :number }
type X = (foo: ?number) => string;
declare class X { static foo : number }
type X = (foo? : ?number) => string;
// Options: ["never"]
declare class X { static foo :number }
type X = (foo: ?{ x: number }) => string;
type X = { foo: string }
// Options: ["never"]
type X = (foo:number) => string;
type X = { foo:string }
// Options: ["never"]
type X = (foo:?{ x:number }) => string;
type X = { foo?: string }
class X { static foo : number }
type X = { foo?: ?string }
// Options: ["never"]
class X { static foo :number }
type X = { foo?:?string }
declare class X { static foo : number }
type Foo = { barType: (string | () => void) }
type Foo = { barType: ((string | () => void)) }
// Options: ["never"]
declare class X { static foo :number }
type Foo = { barType:(string | () => void) }
// Options: ["never"]
type Foo = { barType:((string | () => void)) }
```

@@ -950,2 +1014,14 @@

({ lorem, ipsum, dolor } : SomeType) => {}
// Message: There must be no space before "{ lorem, ipsum, dolor }" parameter type annotation colon.
(foo : { a: string, b: number }) => {}
// Message: There must be no space before "foo" parameter type annotation colon.
({ a, b } : { a: string, b: number }) => {}
// Message: There must be no space before "{ a, b }" parameter type annotation colon.
([ a, b ] : string[]) => {}
// Message: There must be no space before "[ a, b ]" parameter type annotation colon.
function x(foo : string) {}

@@ -975,43 +1051,25 @@ // Message: There must be no space before "foo" parameter type annotation colon.

({ lorem, ipsum, dolor } : SomeType) => {}
// Message: There must be no space before "{ lorem, ipsum, dolor }" parameter type annotation colon.
(foo : { a: string, b: number }) => {}
type X = (foo :string) => string;
// Message: There must be no space before "foo" parameter type annotation colon.
({ a, b } : { a: string, b: number }) => {}
// Message: There must be no space before "{ a, b }" parameter type annotation colon.
([ a, b ] : string[]) => {}
// Message: There must be no space before "[ a, b ]" parameter type annotation colon.
type X = { foo : string }
// Message: There must be no space before "foo" type annotation colon.
// Options: ["never"]
type X = { foo : string }
// Message: There must be no space before "foo" type annotation colon.
// Options: ["always"]
type X = { foo: string }
// Message: There must be a space before "foo" type annotation colon.
type X = (foo:string) => string;
// Message: There must be a space before "foo" parameter type annotation colon.
// Options: ["always"]
type X = { foo : string }
// Message: There must be 1 space before "foo" type annotation colon.
type X = (foo :string) => string;
// Message: There must be 1 space before "foo" parameter type annotation colon.
type X = { foo? : string }
// Message: There must be no space before "foo" type annotation colon.
type X = (foo? :string) => string;
// Message: There must be no space before "foo" parameter type annotation colon.
// Options: ["always"]
type X = { foo?: string }
// Message: There must be a space before "foo" type annotation colon.
type X = (foo? :string) => string;
// Message: There must be no space before "foo" parameter type annotation colon.
// Options: ["always"]
type X = { foo? : string }
// Message: There must be 1 space before "foo" type annotation colon.
type X = (foo?:string) => string;
// Message: There must be a space before "foo" parameter type annotation colon.
// Options: ["always"]
type X = { foo ?: string }
// Message: There must be a space before "foo" type annotation colon.
type X = (foo? :?string) => string;
// Message: There must be no space before "foo" parameter type annotation colon.

@@ -1032,26 +1090,2 @@ class X { foo :string }

type X = (foo :string) => string;
// Message: There must be no space before "foo" parameter type annotation colon.
// Options: ["always"]
type X = (foo:string) => string;
// Message: There must be a space before "foo" parameter type annotation colon.
// Options: ["always"]
type X = (foo :string) => string;
// Message: There must be 1 space before "foo" parameter type annotation colon.
type X = (foo? :string) => string;
// Message: There must be no space before "foo" parameter type annotation colon.
type X = (foo? :string) => string;
// Message: There must be no space before "foo" parameter type annotation colon.
// Options: ["always"]
type X = (foo?:string) => string;
// Message: There must be a space before "foo" parameter type annotation colon.
type X = (foo? :?string) => string;
// Message: There must be no space before "foo" parameter type annotation colon.
class X { static foo : number }

@@ -1084,2 +1118,32 @@ // Message: There must be no space before "foo" class property type annotation colon.

// Message: There must be a space before "bar" type annotation colon.
type X = { foo : string }
// Message: There must be no space before "foo" type annotation colon.
// Options: ["never"]
type X = { foo : string }
// Message: There must be no space before "foo" type annotation colon.
// Options: ["always"]
type X = { foo: string }
// Message: There must be a space before "foo" type annotation colon.
// Options: ["always"]
type X = { foo : string }
// Message: There must be 1 space before "foo" type annotation colon.
type X = { foo? : string }
// Message: There must be no space before "foo" type annotation colon.
// Options: ["always"]
type X = { foo?: string }
// Message: There must be a space before "foo" type annotation colon.
// Options: ["always"]
type X = { foo? : string }
// Message: There must be 1 space before "foo" type annotation colon.
// Options: ["always"]
type X = { foo ?: string }
// Message: There must be a space before "foo" type annotation colon.
```

@@ -1113,2 +1177,15 @@

({ lorem, ipsum, dolor }: SomeType) => {}
(foo: { a: string, b: number }) => {}
({ a, b }: ?{ a: string, b: number }) => {}
(): { a: number, b: string } => {}
// Options: ["always"]
() : { a : number, b : string } => {}
([ a, b ]: string[]) => {}
function x(foo: string) {}

@@ -1133,28 +1210,21 @@

({ lorem, ipsum, dolor }: SomeType) => {}
function x({ a, b }: { a: string, b: number }) {}
(foo: { a: string, b: number }) => {}
type X = (foo:string) => number;
({ a, b }: ?{ a: string, b: number }) => {}
type X = (foo: string) => number;
function x({ a, b }: { a: string, b: number }) {}
type X = (foo: ?string) => number;
(): { a: number, b: string } => {}
type X = (foo?: string) => number;
// Options: ["always"]
() : { a : number, b : string } => {}
type X = (foo?: ?string) => number;
([ a, b ]: string[]) => {}
type X = (foo ?: string) => number;
type X = { foo: string }
// Options: ["always"]
type X = { foo : string }
type X = (foo? : string) => number
type X = { foo?: string }
type X = { foo ?: string }
// Options: ["always"]
type X = { foo? : string }
type X = (foo? : ?string) => number

@@ -1174,39 +1244,76 @@ class Foo { bar }

type X = (foo:string) => number;
class X { static foo:number }
type X = (foo: string) => number;
class X { static foo: number }
type X = (foo: ?string) => number;
// Options: ["always"]
class X { static foo :number }
type X = (foo?: string) => number;
// Options: ["always"]
class X { static foo : number }
type X = (foo?: ?string) => number;
declare class Foo { static bar:number; }
type X = (foo ?: string) => number;
// Options: ["always"]
declare class Foo { static bar :number; }
declare class Foo { static bar: number; }
// Options: ["always"]
type X = (foo? : string) => number
declare class Foo { static bar : number; }
type X = { foo: string }
// Options: ["always"]
type X = (foo? : ?string) => number
type X = { foo : string }
class X { static foo:number }
type X = { foo?: string }
class X { static foo: number }
type X = { foo ?: string }
// Options: ["always"]
class X { static foo :number }
type X = { foo? : string }
```
// Options: ["always"]
class X { static foo : number }
declare class Foo { static bar:number; }
<h3 id="eslint-plugin-flowtype-rules-space-before-generic-bracket"><code>space-before-generic-bracket</code></h3>
_The `--fix` option on the command line automatically fixes problems reported by this rule._
Enforces consistent spacing before the opening `<` of generic type annotation parameters.
This rule takes one argument. If it is `'never'` then a problem is raised when there is a space before the `<`. If it is `'always'` then a problem is raised when there is no space before the `<`.
The default value is `'never'`.
The following patterns are considered problems:
```js
type X = Promise <string>
// Message: There must be no space before "Promise" generic type annotation bracket
// Options: ["never"]
type X = Promise <string>
// Message: There must be no space before "Promise" generic type annotation bracket
type X = Promise <string>
// Message: There must be no space before "Promise" generic type annotation bracket
// Options: ["always"]
declare class Foo { static bar :number; }
type X = Promise<string>
// Message: There must be a space before "Promise" generic type annotation bracket
declare class Foo { static bar: number; }
// Options: ["always"]
type X = Promise <string>
// Message: There must be one space before "Promise" generic type annotation bracket
```
The following patterns are not considered problems:
```js
type X = Promise<string>
// Options: ["always"]
declare class Foo { static bar : number; }
type X = Promise <string>
```

@@ -1213,0 +1320,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc