Skip to content

Commit

Permalink
switch from babel-eslint to hermes-eslint for flow code
Browse files Browse the repository at this point in the history
Reviewed By: motiz88

Differential Revision: D37181192

fbshipit-source-id: 1f59e01f306792e67a4977435c5c77e0000d960a
  • Loading branch information
bradzacher authored and facebook-github-bot committed Jun 16, 2022
1 parent 506fbde commit 3281299
Show file tree
Hide file tree
Showing 4 changed files with 555 additions and 148 deletions.
50 changes: 0 additions & 50 deletions .eslintrc

This file was deleted.

72 changes: 72 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/

'use strict';

module.exports = {
extends: ['fbjs'],
parser: 'hermes-eslint',
rules: {
// Consistency with internal config
'no-class-assign': 'off',

// This is very noisy, so disable
'consistent-return': 'off',

// Flow declares trip up the no-redeclare rule
'no-redeclare': 'off',

// Prettier and ESLint may disagree on the following rules
indent: 'off',
'array-bracket-spacing': 'off',
'comma-dangle': 'off',
'max-len': 'off',
'space-before-function-paren': 'off',
'flowtype/object-type-delimiter': 'off',
'babel/flow-object-type': 'off',

// Tests do not need to follow relay naming rules
'relay/graphql-naming': 'off',

// TODO T31139228: remove or re-enable these once eslint-plugin-flowtype
// is compatible with babel-eslint >= 8
'no-undef': 'off',
'no-unused-vars': 'off',

// This has a different name internally
'no-label-var': 'off',

// Relay uses console statements for debugging and compile feedback
'no-console': [
'warn',
{
allow: [
'warn',
'error',
'debug',
'time',
'timeEnd',
'timeStamp',
'groupCollapsed',
'groupEnd',
],
},
],

// Duplicating some errors that are enforced internally
'prefer-const': 'error',
'no-trailing-spaces': 'error',

// These rules are not required with hermes-eslint
'ft-flow/define-flow-type': 0,
'ft-flow/use-flow-type': 0,
'flowtype/define-flow-type': 0,
'flowtype/use-flow-type': 0,
},
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"gulp-header": "2.0.9",
"gulp-rename": "^2.0.0",
"gulp-util": "3.0.8",
"hermes-eslint": "0.8.0",
"invariant": "^2.2.4",
"jest": "^26.6.3",
"nullthrows": "^1.1.1",
Expand Down
Loading

0 comments on commit 3281299

Please sign in to comment.