eslint-plugin-fb-flow
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -0,3 +1,7 @@ | ||
# 0.0.5 | ||
- Added support for `AsExpression`s in rule `no-flow-enums-object-mapping` | ||
- Updated README documentation | ||
# 0.0.4 | ||
- Update README documentation | ||
- Updated README documentation | ||
@@ -4,0 +8,0 @@ # 0.0.3 |
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -7,4 +7,4 @@ * This source code is licensed under the MIT license found in the | ||
* | ||
* @emails oncall+flow | ||
* @format | ||
* @oncall flow | ||
*/ | ||
@@ -11,0 +11,0 @@ |
{ | ||
"name": "eslint-plugin-fb-flow", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"license": "MIT", | ||
@@ -20,3 +20,3 @@ "description": "This is a set of ESLint rules created and published by the Flow team. They are in addition to (not a replacement for) the rules of `eslint-plugin-flowtype` created and published by the open-source community.", | ||
"eslint": "^7.30.0", | ||
"hermes-eslint": "^0.4.8", | ||
"hermes-eslint": "0.17.0", | ||
"jest": "^27.0.6" | ||
@@ -23,0 +23,0 @@ }, |
# eslint-plugin-fb-flow | ||
This is a set of ESLint rules created and published by the Flow team. They are in addition to (not a replacement for) the rules of [`eslint-plugin-flowtype`](https://github.com/gajus/eslint-plugin-flowtype) created and published by the open-source community. | ||
This is a set of ESLint rules created and published by the Flow team. | ||
They are in addition to (not a replacement for) the rules of [`eslint-plugin-flowtype`](https://github.com/gajus/eslint-plugin-flowtype) created and published by the open-source community. | ||
We recommend using the [hermes-eslint](https://www.npmjs.com/package/hermes-eslint) parser plugin for ESLint. | ||
Read our docs on using [ESLint with Flow](https://flow.org/en/docs/tools/eslint/) in general. | ||
@@ -152,3 +155,3 @@ ## Usage | ||
You should use a function with a `switch` instead of an object literal to map [Flow Enums](https://flow.org/en/docs/enums/) to other values - | ||
see the [docs](https://flow.org/en/docs/enums//using-enums/#toc-mapping-enums-to-other-values). | ||
see the [docs](https://flow.org/en/docs/enums/using-enums/#toc-mapping-enums-to-other-values). | ||
This avoids having to cast to `string` and [exhaustively checks the enum](https://flow.org/en/docs/enums/using-enums/#toc-exhaustively-checking-enums-with-a-switch). | ||
@@ -155,0 +158,0 @@ |
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -7,4 +7,4 @@ * This source code is licensed under the MIT license found in the | ||
* | ||
* @emails oncall+flow | ||
* @format | ||
* @oncall flow | ||
*/ | ||
@@ -11,0 +11,0 @@ |
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -7,4 +7,4 @@ * This source code is licensed under the MIT license found in the | ||
* | ||
* @emails oncall+flow | ||
* @format | ||
* @oncall flow | ||
*/ | ||
@@ -77,4 +77,9 @@ | ||
); | ||
} else if (node.type === 'AsExpression') { | ||
const {typeAnnotation, expression} = node; | ||
return ( | ||
typeAnnotation.type == 'StringTypeAnnotation' && isEnumAccess(expression) | ||
); | ||
} | ||
return false; | ||
} |
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -7,4 +7,4 @@ * This source code is licensed under the MIT license found in the | ||
* | ||
* @emails oncall+flow | ||
* @format | ||
* @oncall flow | ||
*/ | ||
@@ -11,0 +11,0 @@ |
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -7,4 +7,4 @@ * This source code is licensed under the MIT license found in the | ||
* | ||
* @emails oncall+flow | ||
* @format | ||
* @oncall flow | ||
*/ | ||
@@ -11,0 +11,0 @@ |
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -7,4 +7,4 @@ * This source code is licensed under the MIT license found in the | ||
* | ||
* @emails oncall+flow | ||
* @format | ||
* @oncall flow | ||
*/ | ||
@@ -62,5 +62,4 @@ | ||
} | ||
const tokenAfterOpeningAngleBracket = sourceCode.getTokenAfter( | ||
openingAngleBracket, | ||
); | ||
const tokenAfterOpeningAngleBracket = | ||
sourceCode.getTokenAfter(openingAngleBracket); | ||
if (tokenAfterOpeningAngleBracket == null) { | ||
@@ -67,0 +66,0 @@ return; |
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -7,4 +7,4 @@ * This source code is licensed under the MIT license found in the | ||
* | ||
* @emails oncall+flow | ||
* @format | ||
* @oncall flow | ||
*/ | ||
@@ -11,0 +11,0 @@ |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
20834
12
470
193
0