mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 22:10:14 +00:00
4540668c15
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37636 Moves `flow-typed/` directory from `packages/react-native/flow-typed/` to the repo root. - This is a more suitable location for `flow-typed` definitions for 3P dependencies to be used across React Native packages. - **Breaking**: We no longer publish these 3P libdefs as part of the `react-native` package (assuming that external use of React Native with Flow is extremely rare, and that these projects can manage their own package libdefs). Changelog: [General][Breaking] Remove included `flow-typed/` directory from the `react-native` package - **Upgrade instructions**: Projects using Flow should install or replicate third party `flow-typed` definitions for React Native dependencies — see https://github.com/facebook/react-native/tree/main/flow-typed and [#37636](https://github.com/facebook/react-native/pull/37636). Reviewed By: hoxyq Differential Revision: D46313482 fbshipit-source-id: 3d97d5408e44dd43132664c4933f3ff1075f90a1
105 lines
2.6 KiB
JavaScript
105 lines
2.6 KiB
JavaScript
/**
|
|
* 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';
|
|
|
|
const path = require('node:path');
|
|
|
|
require('eslint-plugin-lint').load(path.join(__dirname, 'tools/eslint/rules'));
|
|
|
|
module.exports = {
|
|
root: true,
|
|
|
|
extends: ['@react-native'],
|
|
|
|
plugins: ['@react-native/eslint-plugin-specs', 'lint'],
|
|
|
|
overrides: [
|
|
// overriding the JS config from @react-native/eslint-config to ensure
|
|
// that we use hermes-eslint for all js files
|
|
{
|
|
files: ['*.js'],
|
|
parser: 'hermes-eslint',
|
|
rules: {
|
|
// These rules are not required with hermes-eslint
|
|
'ft-flow/define-flow-type': 0,
|
|
'ft-flow/use-flow-type': 0,
|
|
// flow handles this check for us, so it's not required
|
|
'no-undef': 0,
|
|
},
|
|
},
|
|
{
|
|
files: ['flow-typed/**/*.js'],
|
|
rules: {
|
|
'lint/valid-flow-typed-signature': 2,
|
|
'no-unused-vars': 0,
|
|
quotes: 0,
|
|
},
|
|
},
|
|
{
|
|
files: ['packages/react-native/Libraries/**/*.js'],
|
|
rules: {
|
|
'@react-native/platform-colors': 2,
|
|
'@react-native/specs/react-native-modules': 2,
|
|
'lint/no-haste-imports': 2,
|
|
'lint/no-react-native-imports': 2,
|
|
'lint/require-extends-error': 2,
|
|
'lint/sort-imports': 1,
|
|
},
|
|
},
|
|
{
|
|
files: [
|
|
'**/__fixtures__/**/*.js',
|
|
'**/__mocks__/**/*.js',
|
|
'**/__tests__/**/*.js',
|
|
'packages/react-native/jest/**/*.js',
|
|
'packages/rn-tester/**/*.js',
|
|
],
|
|
globals: {
|
|
// Expose some Jest globals for test helpers
|
|
afterAll: true,
|
|
afterEach: true,
|
|
beforeAll: true,
|
|
beforeEach: true,
|
|
expect: true,
|
|
jest: true,
|
|
},
|
|
},
|
|
{
|
|
files: ['**/__tests__/**/*-test.js'],
|
|
env: {
|
|
jasmine: true,
|
|
jest: true,
|
|
},
|
|
},
|
|
{
|
|
files: ['**/*.{ts,tsx}'],
|
|
parser: '@typescript-eslint/parser',
|
|
plugins: ['@typescript-eslint/eslint-plugin'],
|
|
rules: {
|
|
'@typescript-eslint/no-unused-vars': 'off',
|
|
'react-native/no-inline-styles': 'off',
|
|
'@typescript-eslint/no-shadow': 'off',
|
|
'no-self-compare': 'off',
|
|
'react/self-closing-comp': 'off',
|
|
},
|
|
},
|
|
{
|
|
files: ['**/*.d.ts'],
|
|
plugins: ['redundant-undefined'],
|
|
rules: {
|
|
'redundant-undefined/redundant-undefined': [
|
|
'error',
|
|
{followExactOptionalPropertyTypes: true},
|
|
],
|
|
},
|
|
},
|
|
],
|
|
};
|