UNPKG

2.3 kBJavaScriptView Raw
1// @flow
2// See https://github.com/gajus/eslint-plugin-flowtype
3
4module.exports = {
5 extends: ['prettier/flowtype'],
6 plugins: ['flowtype'],
7 rules: {
8 // 'flowtype/no-primitive-constructor-types': 2,
9 // 'flowtype/require-parameter-type': [1, { excludeArrowFunctions: true }],
10 'flowtype/use-flow-type': 1,
11
12 // うーむ
13 // readonlyarrayは使いづらい
14 'flowtype/no-mutable-array': 0,
15 'flowtype/no-unused-expressions': 0,
16
17 // weak-typesに警告はほしいが、エラーである必要はない
18 'flowtype/no-weak-types': 1,
19
20 // 型が足りないときはflow自身が警告を出す
21 'require-parameter-type': 0,
22
23 // 基本的に推論させる
24 'flowtype/require-return-type': 0,
25
26 // 全ての宣言に型注釈が必要
27 'flowtype/require-variable-type': 0,
28 'flowtype/require-parameter-type': 0,
29
30 // Flow環境の場合、ほとんどの場合flow対象にする
31 'flowtype/require-valid-file-annotation': [1, 'always'],
32
33 // prettier
34 'flowtype/boolean-style': 0,
35
36 'flowtype/no-dupe-keys': 2,
37 'flowtype/define-flow-type': 2,
38 'flowtype/no-types-missing-file-annotation': 2,
39
40 'flowtype/no-primitive-constructor-types': 2,
41
42 'flowtype/type-id-match': 0,
43
44 // flowのコメントタイプのため
45 'spaced-comment': 0,
46
47 'flowtype/sort-keys': 0,
48
49 // FlowFixMeの抑制。使わざる得ない場面が多いあるので許可する
50 'flowtype/no-flow-fix-me-comments': 0,
51
52 // {| |} の強制だが、流石にうるわい
53 'flowtype/require-exact-type': 0,
54
55 // *は制限しない
56 'flowtype/no-existential-type': 0,
57
58 // 型定義は常に一番上。判断は保留でwarningにしておく。
59 'flowtype/require-types-at-top': 1,
60
61 // 悩みどころだが、型定義ファイルからならimport type {}の方がよい
62 'flowtype/type-import-style': 0,
63
64 // importは@flowの後に空行はいらないが、exportするなら空行がほしい
65 'flowtype/newline-after-flow-annotation': 0,
66
67 // 何故かエラーが出る。いずれ有効にする
68 'flowtype/require-types-at-top': 0,
69
70 // Type[]の代わりに、常にArray<Type>を使う.
71 'flowtype/array-style-simple-type': 2,
72 'flowtype/array-style-complex-type': 2,
73 },
74}