Skip to content

Commit

Permalink
eslint: Use better-maintained fork ("ft-flow") of "flowtyped" plugin
Browse files Browse the repository at this point in the history
This has more recent releases, and the repo lives in the actual Flow
Typed org:
  https://github.com/flow-typed/eslint-plugin-ft-flow

(The original, which we've been using until now, lives at
  https://github.com/gajus/eslint-plugin-flowtype .)

Also, the fork brings awareness of Flow enums, so that the
"no-undef" rule doesn't give us spurious errors in enum definitions:
  gajus/eslint-plugin-flowtype#502 (comment)
We'd like to use Flow enums soon.
  • Loading branch information
chrisbobbe committed Jul 26, 2022
1 parent 09eee4e commit 1d7d3a1
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 36 deletions.
40 changes: 20 additions & 20 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extends:

plugins:
- jest
- flowtype
- ft-flow
# - react-native # see commented-out rules config below

env:
Expand Down Expand Up @@ -321,28 +321,28 @@ rules:

#
# ================================================================
# Flow; plugin `flowtype`.
# Flow; plugin `ft-flow`.
#

flowtype/boolean-style: [error, boolean]
flowtype/define-flow-type: warn
flowtype/delimiter-dangle: off
flowtype/no-dupe-keys: error
flowtype/no-primitive-constructor-types: error
flowtype/no-types-missing-file-annotation: error
################# flowtype/no-weak-types: error
# flowtype/require-parameter-type: error
flowtype/require-readonly-react-props: error
# flowtype/require-return-type: [error, always, {annotateUndefined: never}]
flowtype/require-valid-file-annotation: error
flowtype/semi: [error, always]
flowtype/space-before-generic-bracket: [error, never]
flowtype/space-before-type-colon: [error, never]
ft-flow/boolean-style: [error, boolean]
ft-flow/define-flow-type: warn
ft-flow/delimiter-dangle: off
ft-flow/no-dupe-keys: error
ft-flow/no-primitive-constructor-types: error
ft-flow/no-types-missing-file-annotation: error
################# ft-flow/no-weak-types: error
# ft-flow/require-parameter-type: error
ft-flow/require-readonly-react-props: error
# ft-flow/require-return-type: [error, always, {annotateUndefined: never}]
ft-flow/require-valid-file-annotation: error
ft-flow/semi: [error, always]
ft-flow/space-before-generic-bracket: [error, never]
ft-flow/space-before-type-colon: [error, never]
# For more formatting rules, see tools/formatting.eslintrc.yaml.
flowtype/type-id-match: [error, '^([A-Z][a-z0-9]+)+$']
flowtype/union-intersection-spacing: [error, always]
flowtype/use-flow-type: warn
flowtype/valid-syntax: warn
ft-flow/type-id-match: [error, '^([A-Z][a-z0-9]+)+$']
ft-flow/union-intersection-spacing: [error, always]
ft-flow/use-flow-type: warn
ft-flow/valid-syntax: warn

overrides:

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"eslint": "^8.15.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-ft-flow": "^2.0.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^26.1.5",
"eslint-plugin-jsx-a11y": "^6.4.1",
Expand Down
2 changes: 1 addition & 1 deletion src/api/modelTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type * from './idTypes';
* CustomProfileFieldTypeValues for a list of values.
*/
// This is an enum; see discussion on other enums.
// eslint-disable-next-line flowtype/type-id-match
// eslint-disable-next-line ft-flow/type-id-match
export type CustomProfileFieldTypeT = 1 | 2 | 3 | 4 | 5 | 6 | 7;

/**
Expand Down
6 changes: 3 additions & 3 deletions src/api/permissionsTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { objectValues } from '../flowPonyfill';
// Or we could leapfrog TS and make this a Flow enum:
// https://flow.org/en/docs/enums/
// (TS has its own enums, but they are a mess.)
// eslint-disable-next-line flowtype/type-id-match
// eslint-disable-next-line ft-flow/type-id-match
export type RoleT = 100 | 200 | 300 | 400 | 600;

/**
Expand Down Expand Up @@ -49,7 +49,7 @@ export const RoleValues: $ReadOnlyArray<RoleT> = objectValues(Role);
*
* For the policy for web-public streams, see CreateWebPublicStreamPolicyT.
*/
// eslint-disable-next-line flowtype/type-id-match
// eslint-disable-next-line ft-flow/type-id-match
export type CreatePublicOrPrivateStreamPolicyT = 1 | 2 | 3 | 4;

/**
Expand Down Expand Up @@ -94,7 +94,7 @@ export const CreatePublicOrPrivateStreamPolicyValues: $ReadOnlyArray<CreatePubli
// Or we could leapfrog TS and make this a Flow enum:
// https://flow.org/en/docs/enums/
// (TS has its own enums, but they are a mess.)
// eslint-disable-next-line flowtype/type-id-match
// eslint-disable-next-line ft-flow/type-id-match
export type CreateWebPublicStreamPolicyT = 2 | 4 | 6 | 7;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/storage/sqlite.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import invariant from 'invariant';
/* eslint-disable no-use-before-define */
/* eslint-disable no-underscore-dangle */
/* eslint-disable no-void */
/* eslint-disable flowtype/type-id-match */
/* eslint-disable ft-flow/type-id-match */

type SQLArgument = number | string;

Expand Down
2 changes: 1 addition & 1 deletion src/utils/jsonable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* @flow strict */
/* eslint-disable flowtype/type-id-match */
/* eslint-disable ft-flow/type-id-match */

/**
* Type of a round-trip-capable JSONable object.
Expand Down
8 changes: 4 additions & 4 deletions tools/flow-todo.eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
parser: babel-eslint
plugins:
- flowtype
- ft-flow
rules:
flowtype/no-weak-types: error
flowtype/require-parameter-type:
ft-flow/no-weak-types: error
ft-flow/require-parameter-type:
- error
- excludeArrowFunctions: true
flowtype/require-return-type:
ft-flow/require-return-type:
- error
- always
- excludeArrowFunctions: true
Expand Down
2 changes: 1 addition & 1 deletion tools/formatting.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
parser: "@babel/eslint-parser"

plugins:
- flowtype
- ft-flow
- import
- jest
- react
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4671,10 +4671,10 @@ eslint-module-utils@^2.7.3:
debug "^3.2.7"
find-up "^2.1.0"

eslint-plugin-flowtype@^8.0.3:
version "8.0.3"
resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-8.0.3.tgz#e1557e37118f24734aa3122e7536a038d34a4912"
integrity sha512-dX8l6qUL6O+fYPtpNRideCFSpmWOUVx5QcaGLVqe/vlDiBSe4vYljDWDETwnyFzpl7By/WVIu6rcrniCgH9BqQ==
eslint-plugin-ft-flow@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-ft-flow/-/eslint-plugin-ft-flow-2.0.1.tgz#57d9a12ef02b7af8f9bd6ccd6bd8fa4034809716"
integrity sha512-dGBnCo+ok6H9p6Vw2oPFEM4vA9IEclRXQQAA/Zws51/L5zr3FDl9FxQiWGfaw0WaTIX5biiAxp/q1W5bGXjlVA==
dependencies:
lodash "^4.17.21"
string-natural-compare "^3.0.1"
Expand Down

0 comments on commit 1d7d3a1

Please sign in to comment.