-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tests] add test for flow prettier formated
- Loading branch information
Simon Mollweide
committed
Jul 18, 2017
1 parent
9843c0f
commit 4475090
Showing
23 changed files
with
529 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module.exports = { | ||
extends: [ | ||
"../../configurations/es6-react.js", | ||
"../../configurations/es6-react-disable-styles.js", | ||
], | ||
"../../configurations/es6-react.js", | ||
"../../configurations/es6-react-disable-styles.js" | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
extends: [ | ||
"../../configurations/es6-browser.js", | ||
"../../configurations/es6-browser-disable-styles.js", | ||
"../../configurations/flow.js", | ||
"../../configurations/flow-disable-styles.js", | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// @flow | ||
// DESCRIPTION = enforces a particular style for boolean type annotations. This rule takes one argument. | ||
// STATUS = 2 | ||
|
||
/* eslint max-len: 0*/ | ||
/* eslint require-jsdoc: 0*/ | ||
/* eslint no-use-before-define: 0*/ | ||
/* eslint no-undef: 0*/ | ||
/* eslint no-unused-vars: 0*/ | ||
/* eslint no-unreachable: 0*/ | ||
/* eslint no-empty: 0*/ | ||
/* eslint no-empty-function: 0*/ | ||
/* eslint no-shadow: 0*/ | ||
/* eslint no-redeclare: 0*/ | ||
/* eslint react/react-in-jsx-scope: 0*/ | ||
/* eslint react/prefer-stateless-function: 0*/ | ||
/* eslint react/prefer-es6-class: 0*/ | ||
/* eslint react/prop-types: 0*/ | ||
/* eslint object-shorthand: 0*/ | ||
// <!START | ||
// GOOD | ||
type AeType = boolean; | ||
|
||
// BAD | ||
/* | ||
type BeType = bool; | ||
type CeType = Boolean; | ||
*/ | ||
// END!> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// @flow | ||
// DESCRIPTION = marks Flow type identifiers as defined. Used to suppress [`no-undef`](https://github.com/gajus/eslint-plugin-flowtypedocs/rules/no-undef) reporting of type identifiers. | ||
// STATUS = 2 | ||
|
||
/* eslint max-len: 0*/ | ||
/* eslint require-jsdoc: 0*/ | ||
/* eslint no-use-before-define: 0*/ | ||
/* eslint no-undef: 0*/ | ||
/* eslint no-unused-vars: 0*/ | ||
/* eslint no-unreachable: 0*/ | ||
/* eslint no-empty: 0*/ | ||
/* eslint no-empty-function: 0*/ | ||
/* eslint no-shadow: 0*/ | ||
/* eslint no-redeclare: 0*/ | ||
/* eslint react/react-in-jsx-scope: 0*/ | ||
/* eslint react/prefer-stateless-function: 0*/ | ||
/* eslint react/prefer-es6-class: 0*/ | ||
/* eslint react/prop-types: 0*/ | ||
/* eslint object-shorthand: 0*/ | ||
// <!START | ||
// BAD | ||
/* | ||
const a: AeType = ''; | ||
*/ | ||
// GOOD | ||
type BeType = string; | ||
const b: BeType = ""; | ||
// END!> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// @flow | ||
// DESCRIPTION = enforces consistent use of trailing commas in Object and Tuple annotations. | ||
// STATUS = 2 | ||
|
||
/* eslint max-len: 0*/ | ||
/* eslint require-jsdoc: 0*/ | ||
/* eslint no-use-before-define: 0*/ | ||
/* eslint no-undef: 0*/ | ||
/* eslint no-unused-vars: 0*/ | ||
/* eslint no-unreachable: 0*/ | ||
/* eslint no-empty: 0*/ | ||
/* eslint no-empty-function: 0*/ | ||
/* eslint no-shadow: 0*/ | ||
/* eslint no-redeclare: 0*/ | ||
/* eslint object-shorthand: 0*/ | ||
// <!START | ||
// BAD | ||
/* | ||
type AeType = { | ||
foo: string | ||
}; | ||
*/ | ||
// GOOD | ||
type BeType = { | ||
foo: string | ||
}; | ||
// END!> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// @flow | ||
// DESCRIPTION = enforces consistent spacing within generic type annotation parameters. | ||
// STATUS = 2 | ||
|
||
/* eslint max-len: 0*/ | ||
/* eslint require-jsdoc: 0*/ | ||
/* eslint no-use-before-define: 0*/ | ||
/* eslint no-undef: 0*/ | ||
/* eslint no-unused-vars: 0*/ | ||
/* eslint no-unreachable: 0*/ | ||
/* eslint no-empty: 0*/ | ||
/* eslint no-empty-function: 0*/ | ||
/* eslint no-shadow: 0*/ | ||
/* eslint no-redeclare: 0*/ | ||
/* eslint react/react-in-jsx-scope: 0*/ | ||
/* eslint react/prefer-stateless-function: 0*/ | ||
/* eslint react/prefer-es6-class: 0*/ | ||
/* eslint react/prop-types: 0*/ | ||
/* eslint object-shorthand: 0*/ | ||
// <!START | ||
// BAD | ||
/* | ||
type AeType = Promise< string>; | ||
*/ | ||
// GOOD | ||
type BeType = Promise<string>; | ||
// END!> |
32 changes: 32 additions & 0 deletions
32
test/flow-disable-styles/rules/flow/no-primitive-constructor-types.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// @flow | ||
// DESCRIPTION = disallows use of primitive constructors as types, such as `Boolean`, `Number` and `String`. [See more](https://flowtype.org/docs/builtins.html). | ||
// STATUS = 2 | ||
|
||
/* eslint max-len: 0*/ | ||
/* eslint require-jsdoc: 0*/ | ||
/* eslint no-use-before-define: 0*/ | ||
/* eslint no-undef: 0*/ | ||
/* eslint no-unused-vars: 0*/ | ||
/* eslint no-unreachable: 0*/ | ||
/* eslint no-empty: 0*/ | ||
/* eslint no-empty-function: 0*/ | ||
/* eslint no-shadow: 0*/ | ||
/* eslint no-redeclare: 0*/ | ||
/* eslint react/react-in-jsx-scope: 0*/ | ||
/* eslint react/prefer-stateless-function: 0*/ | ||
/* eslint react/prefer-es6-class: 0*/ | ||
/* eslint react/prop-types: 0*/ | ||
/* eslint object-shorthand: 0*/ | ||
// <!START | ||
// BAD | ||
/* | ||
type NumberType = Number; | ||
type StringType = String; | ||
type BooleanType = Boolean; | ||
*/ | ||
|
||
// GOOD | ||
type NumberType = number; | ||
type StringType = string; | ||
type BooleanType = boolean; | ||
// END!> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// @flow | ||
// DESCRIPTION = Warns against weak type annotations *any*, *Object* and *Function*. These types can cause flow to silently skip over portions of your code, which would have otherwise caused type errors. | ||
// STATUS = 0 | ||
|
||
/* eslint max-len: 0*/ | ||
/* eslint require-jsdoc: 0*/ | ||
/* eslint no-use-before-define: 0*/ | ||
/* eslint no-undef: 0*/ | ||
/* eslint no-unused-vars: 0*/ | ||
/* eslint no-unreachable: 0*/ | ||
/* eslint no-empty: 0*/ | ||
/* eslint no-empty-function: 0*/ | ||
/* eslint no-shadow: 0*/ | ||
/* eslint no-redeclare: 0*/ | ||
/* eslint react/react-in-jsx-scope: 0*/ | ||
/* eslint react/prefer-stateless-function: 0*/ | ||
/* eslint react/prefer-es6-class: 0*/ | ||
/* eslint react/prop-types: 0*/ | ||
/* eslint object-shorthand: 0*/ | ||
// <!START | ||
// BAD | ||
function foo(thing: string): any { | ||
return true; | ||
} | ||
|
||
// GOOD | ||
function foo(thing: string): boolean { | ||
return true; | ||
} | ||
// END!> |
35 changes: 35 additions & 0 deletions
35
test/flow-disable-styles/rules/flow/object-type-delimiter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// @flow | ||
// DESCRIPTION = enforces consistent separators between properties in Flow object types. | ||
// STATUS = 2 | ||
|
||
/* eslint max-len: 0*/ | ||
/* eslint require-jsdoc: 0*/ | ||
/* eslint no-use-before-define: 0*/ | ||
/* eslint no-undef: 0*/ | ||
/* eslint no-unused-vars: 0*/ | ||
/* eslint no-unreachable: 0*/ | ||
/* eslint no-empty: 0*/ | ||
/* eslint no-empty-function: 0*/ | ||
/* eslint no-shadow: 0*/ | ||
/* eslint no-redeclare: 0*/ | ||
/* eslint react/react-in-jsx-scope: 0*/ | ||
/* eslint react/prefer-stateless-function: 0*/ | ||
/* eslint react/prefer-es6-class: 0*/ | ||
/* eslint react/prop-types: 0*/ | ||
/* eslint object-shorthand: 0*/ | ||
// <!START | ||
// BAD | ||
/* | ||
type FooType = { a: string; b: string }; | ||
type Foo2Type = { | ||
a: string, | ||
b: string | ||
}; | ||
*/ | ||
// GOOD | ||
type FooType = { a: string, b: string }; | ||
type Foo2Type = { | ||
a: string, | ||
b: string | ||
}; | ||
// END!> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// @flow | ||
// DESCRIPTION = Overwrite require-jsdoc rule | ||
// STATUS = 0 | ||
|
||
/* eslint max-len: 0*/ | ||
/* eslint require-jsdoc: 0*/ | ||
/* eslint no-use-before-define: 0*/ | ||
/* eslint no-undef: 0*/ | ||
/* eslint no-unused-vars: 0*/ | ||
/* eslint no-unreachable: 0*/ | ||
/* eslint no-empty: 0*/ | ||
/* eslint no-empty-function: 0*/ | ||
/* eslint no-shadow: 0*/ | ||
/* eslint no-redeclare: 0*/ | ||
/* eslint react/react-in-jsx-scope: 0*/ | ||
/* eslint react/prefer-stateless-function: 0*/ | ||
/* eslint react/prefer-es6-class: 0*/ | ||
/* eslint react/prop-types: 0*/ | ||
/* eslint object-shorthand: 0*/ | ||
// <!START | ||
// jsdoc is not required if you are using flow | ||
function foo(thing: string): any { | ||
return true; | ||
} | ||
// END!> |
27 changes: 27 additions & 0 deletions
27
test/flow-disable-styles/rules/flow/require-parameter-type.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// @flow | ||
// DESCRIPTION = requires that all function parameters have type annotations. | ||
// STATUS = 2 | ||
|
||
/* eslint max-len: 0*/ | ||
/* eslint require-jsdoc: 0*/ | ||
/* eslint no-use-before-define: 0*/ | ||
/* eslint no-undef: 0*/ | ||
/* eslint no-unused-vars: 0*/ | ||
/* eslint no-unreachable: 0*/ | ||
/* eslint no-empty: 0*/ | ||
/* eslint no-empty-function: 0*/ | ||
/* eslint no-shadow: 0*/ | ||
/* eslint no-redeclare: 0*/ | ||
/* eslint react/react-in-jsx-scope: 0*/ | ||
/* eslint react/prefer-stateless-function: 0*/ | ||
/* eslint react/prefer-es6-class: 0*/ | ||
/* eslint react/prop-types: 0*/ | ||
/* eslint object-shorthand: 0*/ | ||
// <!START | ||
// BAD | ||
/* | ||
function x(foo) {} | ||
*/ | ||
// GOOD | ||
function x(foo: string) {} | ||
// END!> |
29 changes: 29 additions & 0 deletions
29
test/flow-disable-styles/rules/flow/require-return-type.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// @flow | ||
// DESCRIPTION = requires that functions have return type annotation. | ||
// STATUS = 2 | ||
|
||
/* eslint max-len: 0*/ | ||
/* eslint require-jsdoc: 0*/ | ||
/* eslint no-use-before-define: 0*/ | ||
/* eslint no-undef: 0*/ | ||
/* eslint no-unused-vars: 0*/ | ||
/* eslint no-unreachable: 0*/ | ||
/* eslint no-empty: 0*/ | ||
/* eslint no-empty-function: 0*/ | ||
/* eslint no-shadow: 0*/ | ||
/* eslint no-redeclare: 0*/ | ||
/* eslint react/react-in-jsx-scope: 0*/ | ||
/* eslint react/prefer-stateless-function: 0*/ | ||
/* eslint react/prefer-es6-class: 0*/ | ||
/* eslint react/prop-types: 0*/ | ||
/* eslint object-shorthand: 0*/ | ||
// <!START | ||
// BAD | ||
/* | ||
const a = (foo: string) => { return 'foo'; }; | ||
*/ | ||
// GOOD | ||
const b = (foo: string): string => { | ||
return "foo"; | ||
}; | ||
// END!> |
24 changes: 24 additions & 0 deletions
24
test/flow-disable-styles/rules/flow/require-valid-file-annotation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// @flow | ||
// DESCRIPTION = this rule validates Flow file annotations. | ||
// STATUS = 2 | ||
|
||
/* eslint max-len: 0*/ | ||
/* eslint require-jsdoc: 0*/ | ||
/* eslint no-use-before-define: 0*/ | ||
/* eslint no-undef: 0*/ | ||
/* eslint no-unused-vars: 0*/ | ||
/* eslint no-unreachable: 0*/ | ||
/* eslint no-empty: 0*/ | ||
/* eslint no-empty-function: 0*/ | ||
/* eslint no-shadow: 0*/ | ||
/* eslint no-redeclare: 0*/ | ||
/* eslint react/react-in-jsx-scope: 0*/ | ||
/* eslint react/prefer-stateless-function: 0*/ | ||
/* eslint react/prefer-es6-class: 0*/ | ||
/* eslint react/prop-types: 0*/ | ||
/* eslint object-shorthand: 0*/ | ||
// <!START | ||
// @flow | ||
// or | ||
/* @flow */ | ||
// END!> |
Oops, something went wrong.