mirror of
https://github.com/facebook/react-native.git
synced 2024-11-22 06:29:46 +00:00
5aead70e80
Summary: The [monorepo RFC](https://github.com/react-native-community/discussions-and-proposals/pull/480) calls for renaming: * `react-native-community/eslint-config` -> `react-native/eslint-config` * `react-native-community/eslint-plugin` -> `react-native/eslint-plugin` It also calls for the versions to be aligned with the rest of main -- currently `0.72.0`. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [General][Changed] - Renamed `react-native-community/eslint-config` to `react-native/eslint-config` v0.72.0 to align with other packages [General][Changed] - Renamed `react-native-community/eslint-plugin` to `react-native/eslint-plugin` v0.72.0 to align with other packages Pull Request resolved: https://github.com/facebook/react-native/pull/34581 Test Plan: First test is to run `yarn lint`, and verify that output matches before and after this change. Second test is to change the ESLint config to use the "old" packages (under `react-native-commnuity`) and run `yarn lint` to make sure that they work as expected. This is what customers will experience, until they manually move to the new ESLint packages. Reviewed By: cortinico Differential Revision: D41520500 Pulled By: hoxyq fbshipit-source-id: a61e5ae15d5aaf11f0143a3b0257a60a03b1550b
96 lines
2.3 KiB
JavaScript
96 lines
2.3 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 eslint-config-react-native-community 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: ['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: ['flow-typed/**/*.js'],
|
|
rules: {
|
|
'lint/valid-flow-typed-signature': 2,
|
|
'no-unused-vars': 0,
|
|
quotes: 0,
|
|
},
|
|
},
|
|
{
|
|
files: [
|
|
'**/__fixtures__/**/*.js',
|
|
'**/__mocks__/**/*.js',
|
|
'**/__tests__/**/*.js',
|
|
'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',
|
|
},
|
|
},
|
|
],
|
|
};
|