Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ packages/*/dist
packages/*/types_generated
packages/debugger-frontend/dist/**/*
packages/react-native-codegen/lib
tools/eslint/rules/sort-imports.js
**/Pods/*
**/*.macos.js
**/*.windows.js
57 changes: 27 additions & 30 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@

'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'],
plugins: ['@react-native/monorepo', '@react-native/specs'],

overrides: [
// overriding the JS config from @react-native/eslint-config to ensure
Expand All @@ -28,22 +24,23 @@ module.exports = {
files: ['*.js', '*.js.flow', '*.jsx'],
parser: 'hermes-eslint',
rules: {
'ft-flow/require-valid-file-annotation': [2, 'always'],
'no-extra-boolean-cast': 0,
'no-void': 0,
'@react-native/monorepo/sort-imports': 'warn',
'eslint-comments/no-unlimited-disable': 'off',
'ft-flow/require-valid-file-annotation': ['error', 'always'],
'no-extra-boolean-cast': 'off',
'no-void': 'off',
// These rules are not required with hermes-eslint
'ft-flow/define-flow-type': 0,
'ft-flow/use-flow-type': 0,
'lint/sort-imports': 1,
'ft-flow/define-flow-type': 'off',
'ft-flow/use-flow-type': 'off',
// Flow handles these checks for us, so they aren't required
'no-undef': 0,
'no-unreachable': 0,
'no-undef': 'off',
'no-unreachable': 'off',
},
},
{
files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
rules: {
'@react-native/no-deep-imports': 0,
'@react-native/no-deep-imports': 'off',
},
},
{
Expand All @@ -54,7 +51,7 @@ module.exports = {
],
parser: 'hermes-eslint',
rules: {
'lint/no-commonjs-exports': 1,
'@react-native/monorepo/no-commonjs-exports': 'warn',
},
},
{
Expand All @@ -64,17 +61,17 @@ module.exports = {
{
files: ['package.json'],
rules: {
'lint/react-native-manifest': 2,
'@react-native/monorepo/react-native-manifest': 'error',
},
},
{
files: ['flow-typed/**/*.js', 'packages/react-native/flow/**/*'],
rules: {
'ft-flow/require-valid-file-annotation': 0,
'lint/valid-flow-typed-signature': 2,
'no-shadow': 0,
'no-unused-vars': 0,
quotes: 0,
'@react-native/monorepo/valid-flow-typed-signature': 'error',
'ft-flow/require-valid-file-annotation': 'off',
'no-shadow': 'off',
'no-unused-vars': 'off',
quotes: 'off',
},
},
{
Expand All @@ -83,14 +80,14 @@ module.exports = {
'packages/react-native/src/**/*.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/no-react-node-imports': 2,
'lint/no-react-default-imports': 2,
'lint/no-react-named-type-imports': 2,
'@react-native/monorepo/no-haste-imports': 'error',
'@react-native/monorepo/no-react-default-imports': 'error',
'@react-native/monorepo/no-react-named-type-imports': 'error',
'@react-native/monorepo/no-react-native-imports': 'error',
'@react-native/monorepo/no-react-node-imports': 'error',
'@react-native/monorepo/require-extends-error': 'error',
'@react-native/platform-colors': 'error',
'@react-native/specs/react-native-modules': 'error',
},
},
{
Expand Down Expand Up @@ -144,7 +141,7 @@ module.exports = {
{
files: ['**/__tests__/**'],
rules: {
'lint/no-react-native-imports': 'off',
'@react-native/monorepo/no-react-native-imports': 'off',
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion jest/preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

'use strict';

// eslint-disable-next-line lint/sort-imports
// eslint-disable-next-line @react-native/monorepo/sort-imports
const {
transformFromAstSync: babelTransformFromAstSync,
transformSync: babelTransformSync,
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"workspaces": [
"packages/*",
"tools/*",
"private/*",
"!packages/helloworld"
],
"devDependencies": {
Expand Down Expand Up @@ -73,7 +73,6 @@
"eslint-plugin-ft-flow": "^2.0.1",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jsx-a11y": "^6.6.0",
"eslint-plugin-lint": "^1.0.0",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-native": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/assets/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ function getAssetByID(assetId /*: number */) /*: PackagerAsset */ {
return assets[assetId - 1];
}

// eslint-disable-next-line lint/no-commonjs-exports
// eslint-disable-next-line @react-native/monorepo/no-commonjs-exports
module.exports = {registerAsset, getAssetByID};
2 changes: 1 addition & 1 deletion packages/helloworld/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import {Command} from 'commander';
*/

// eslint-disable-next-line lint/sort-imports
// eslint-disable-next-line @react-native/monorepo/sort-imports
const {patchCoreCLIUtilsPackageJSON} = require('./scripts/monorepo');

function injectCoreCLIUtilsRuntimePatch() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

const fixture = require('../__test_fixtures__/fixtures.js');
const rnCodegen = require('../RNCodegen.js');

const packageName = 'na';

describe('RNCodegen.generate', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {
import type {SchemaType} from '../../CodegenSchema';

const core = require('@babel/core');

const t = core.types;

// File path -> contents
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-codegen/src/parsers/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import type {UnionTypeAnnotationMemberType} from '../CodegenSchema';
import type {Parser} from './parser';

export type ParserType = 'Flow' | 'TypeScript';

class ParserError extends Error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
const failureFixtures = require('../__test_fixtures__/failures.js');
const fixtures = require('../__test_fixtures__/fixtures.js');
const {FlowParser} = require('../../parser');

jest.mock('fs', () => ({
readFileSync: filename => {
// Jest in the OSS does not allow to capture variables in closures.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
const failureFixtures = require('../__test_fixtures__/failures.js');
const fixtures = require('../__test_fixtures__/fixtures.js');
const {TypeScriptParser} = require('../../parser');

jest.mock('fs', () => ({
readFileSync: filename => {
// Jest in the OSS does not allow to capture variables in closures.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const {
} = require('../../parsers-primitives');
const {parseTopLevelType} = require('../parseTopLevelType');
const {flattenProperties} = require('./componentsUtils');

function getPropertyType(
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
* LTI update could not be added via codemod */
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-test-library/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
export {default as SampleNativeComponent} from './src/SampleNativeComponent';
export type {NativeComponentType} from './src/SampleNativeComponent';
import {Commands as SampleNativeComponentCommands} from './src/SampleNativeComponent';

export {SampleNativeComponentCommands};
export {default as NativeSampleModule} from './src/NativeSampleModule';
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeActionSheetManager';
import NativeActionSheetManager from '../../src/private/specs_DEPRECATED/modules/NativeActionSheetManager';

export default NativeActionSheetManager;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeAlertManager';
import NativeAlertManager from '../../src/private/specs_DEPRECATED/modules/NativeAlertManager';

export default NativeAlertManager;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeAnimatedModule';
import NativeAnimatedModule from '../../src/private/specs_DEPRECATED/modules/NativeAnimatedModule';

export default NativeAnimatedModule;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeAnimatedTurboModule';
import NativeAnimatedTurboModule from '../../src/private/specs_DEPRECATED/modules/NativeAnimatedTurboModule';

export default NativeAnimatedTurboModule;
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'use strict';

import Easing from '../Easing';

describe('Easing', () => {
it('should work with linear', () => {
const easing = Easing.linear;
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/Libraries/AppState/NativeAppState.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeAppState';
import NativeAppState from '../../src/private/specs_DEPRECATED/modules/NativeAppState';

export default NativeAppState;
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @format
*/

// These don't actually exist anywhere in the code.

'use strict';

import type {ModuleConfig} from '../NativeModules';
Expand All @@ -35,5 +33,5 @@ const MessageQueueTestConfig = {
remoteModuleConfig: remoteModulesConfig,
};

// eslint-disable-next-line lint/no-commonjs-exports
// eslint-disable-next-line @react-native/monorepo/no-commonjs-exports
module.exports = MessageQueueTestConfig;
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ const MessageQueueTestModule = {
testHook2: function () {},
};

// eslint-disable-next-line lint/no-commonjs-exports
// eslint-disable-next-line @react-native/monorepo/no-commonjs-exports
module.exports = MessageQueueTestModule;
1 change: 1 addition & 0 deletions packages/react-native/Libraries/Blob/NativeBlobModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeBlobModule';
import NativeBlobModule from '../../src/private/specs_DEPRECATED/modules/NativeBlobModule';

export default NativeBlobModule;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeFileReaderModule';
import NativeFileReaderModule from '../../src/private/specs_DEPRECATED/modules/NativeFileReaderModule';

export default NativeFileReaderModule;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeBugReporting';
import NativeBugReporting from '../../src/private/specs_DEPRECATED/modules/NativeBugReporting';

export default NativeBugReporting;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../../src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent';
import PullToRefreshViewNativeComponent from '../../../src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent';

export default PullToRefreshViewNativeComponent;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeExceptionsManager';
import NativeExceptionsManager from '../../src/private/specs_DEPRECATED/modules/NativeExceptionsManager';

export default NativeExceptionsManager;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../../src/private/specs_DEPRECATED/modules/NativeSegmentFetcher';
import NativeSegmentFetcher from '../../../src/private/specs_DEPRECATED/modules/NativeSegmentFetcher';

export default NativeSegmentFetcher;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../../src/private/specs_DEPRECATED/modules/NativeTiming';
import NativeTiming from '../../../src/private/specs_DEPRECATED/modules/NativeTiming';

export default NativeTiming;
1 change: 1 addition & 0 deletions packages/react-native/Libraries/Core/checkNativeVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
* You can use this module directly, or just require InitializeCore.
*/
const ReactNativeVersionCheck = require('./ReactNativeVersionCheck');

ReactNativeVersionCheck.checkVersions();
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent';
import DebuggingOverlayNativeComponent from '../../src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent';

export default DebuggingOverlayNativeComponent;
1 change: 1 addition & 0 deletions packages/react-native/Libraries/Image/NativeImageEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeImageEditor';
import NativeImageEditor from '../../src/private/specs_DEPRECATED/modules/NativeImageEditor';

export default NativeImageEditor;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeImageLoaderAndroid';
import NativeImageLoaderAndroid from '../../src/private/specs_DEPRECATED/modules/NativeImageLoaderAndroid';

export default NativeImageLoaderAndroid;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS';
import NativeImageLoaderIOS from '../../src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS';

export default NativeImageLoaderIOS;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeImageStoreAndroid';
import NativeImageStoreAndroid from '../../src/private/specs_DEPRECATED/modules/NativeImageStoreAndroid';

export default NativeImageStoreAndroid;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeImageStoreIOS';
import NativeImageStoreIOS from '../../src/private/specs_DEPRECATED/modules/NativeImageStoreIOS';

export default NativeImageStoreIOS;
2 changes: 1 addition & 1 deletion packages/react-native/Libraries/Image/RelativeImageStub.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ const RelativeImageStub = (AssetRegistry.registerAsset({
type: 'png',
}): number);

// eslint-disable-next-line lint/no-commonjs-exports
// eslint-disable-next-line @react-native/monorepo/no-commonjs-exports
module.exports = RelativeImageStub;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeFrameRateLogger';
import NativeFrameRateLogger from '../../src/private/specs_DEPRECATED/modules/NativeFrameRateLogger';

export default NativeFrameRateLogger;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeIntentAndroid';
import NativeIntentAndroid from '../../src/private/specs_DEPRECATED/modules/NativeIntentAndroid';

export default NativeIntentAndroid;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeLinkingManager';
import NativeLinkingManager from '../../src/private/specs_DEPRECATED/modules/NativeLinkingManager';

export default NativeLinkingManager;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

export * from '../../src/private/specs_DEPRECATED/modules/NativeModalManager';
import NativeModalManager from '../../src/private/specs_DEPRECATED/modules/NativeModalManager';

export default NativeModalManager;
Loading
Loading