Граф коммитов

13 Коммитов

Автор SHA1 Сообщение Дата
Chang Yan d8a0d30e70 Build and sync lint/sort-imports from WWW (#44824)
Summary:
X-link: https://github.com/facebook/relay/pull/4708

X-link: https://github.com/facebook/metro/pull/1285

Pull Request resolved: https://github.com/facebook/react-native/pull/44824

Run the build script based on the commit in D58271034.

Changelog: [Internal]

NOTE: Test plan and summary intentionally obfuscated because it's exported to an external github pull request, but trust me.

Reviewed By: yungsters

Differential Revision: D58271323

fbshipit-source-id: be19c63d630281b9f6feca00b24f45d000e07089
2024-06-07 10:01:49 -07:00
Moti Zilberman 5df1940225 Update sort-imports lint rule to latest (#41841)
Summary:
@public

TSIA

Pull Request resolved: https://github.com/facebook/react-native/pull/41841

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D51946720

fbshipit-source-id: 28b55c3555b4757f13b896068c5b43ac761fc5cf
2023-12-08 11:07:55 -08:00
Tim Yung ffc9ff066a RN: Enforce Manifest Constraints w/ ESLint (#39064)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39064

Creates a new lint rule that enforces the following constraints:

- `react-native/monorepo` cannot have `dependencies`.
- `react-native` cannot have `devDependencies`.

This also includes a lengthy comment in the rule definition explaining why these constraints exist, so that future contributors can make an informed decision when reconsidering these constraints.

Changelog:
[Internal]

Reviewed By: NickGerleman

Differential Revision: D48448633

fbshipit-source-id: 26b0d74b9120ddfd2a6a72bb91f86a98c8d679ef
2023-08-18 07:48:56 -07:00
Pranav Yadav 8a49754cda Refactor: JS `substr()` is deprecated, using `slice()` instead (#37136)
Summary:
Fixes: https://github.com/facebook/react-native/issues/37135

- `substr()` is not part of the core JS since ~2018
- No wonder why no one noticed this :)
- Though its supported by modern browsers, its deprecated
- Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr

### Why `slice()` and not `substring()`?
> Beacuse I like pizza ;) jk

The reason, that I'm not using the most obvious alternative `substring()` is;
- It _swaps the args_ passed, when; `startIndex > endIndex` —which I think is not a property of _good_ fn
  and also does not reflects the same in it's name.
- It _doesn't support negative args_, which I think reduces flexibility to work with it.
- It could lead to more bugs in most of the cases.

### Refecrences:
- Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring#differences_between_substring_and_slice
- Ref. for `slice()`: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice
- Ref. for `substring()`: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring

## Changelog:

[GENERAL][FIXED] - Refactor: `substr()` is deprecated, using `slice()` instead across RN codebase

Pull Request resolved: https://github.com/facebook/react-native/pull/37136

Test Plan: - `yarn lint && yarn flow && yarn test-ci` --> _should be green_

Reviewed By: christophpurrer

Differential Revision: D45477910

Pulled By: jacdebug

fbshipit-source-id: 96a80893477599b9a549918924157627b9b0c3f4
2023-05-02 11:28:56 -07:00
Ruslan Lesiutin 714b502b0c | RN Monorepo | Migrate to package (#36434)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36434

Changelog: [Internal]

This is a squashed stack of 18 commits, starting from D43202126

allow-large-files

Reviewed By: cortinico

Differential Revision: D43977381

fbshipit-source-id: 0da552ddb85f2f61a0be0ef071915b35f3f8555c
2023-03-17 05:03:25 -07:00
Jordan Eldredge 83743e1edf Update React Native's synced sort-imports lint rule
Summary:
Changelog:
[Internal][Changed] - Update synced sort-import lint rule to newest version

Reviewed By: yungsters

Differential Revision: D42779224

fbshipit-source-id: bd388c258e5882331fd20d7313b4717a6b88f611
2023-01-30 17:05:25 -08:00
Rubén Norte 7c36d0b6a0 Specify command to regenerate bundled sort-imports ESLint rule
Summary: Changelog: [internal]

Reviewed By: yungsters

Differential Revision: D40138586

fbshipit-source-id: 2d593f6064680beec810ee608852895fdfff4f3b
2022-10-06 09:40:09 -07:00
Tim Yung 4363626701 RN: Enforce `flow-typed` Signatures
Summary:
Creates a new `valid-flow-typed-signature` ESLint rule that validates the `flow-typed` signatures at the top of each file.

This lint rule will discourage contributors from locally forking the `flow-typed` definitions. Instead, any changes should be submitted as patches to the upstream definition in: https://github.com/flow-typed/flow-typed

Changelog:
[Internal]

Reviewed By: rickhanlonii

Differential Revision: D39868721

fbshipit-source-id: e5e3ffe7568dbe52c9b598b53110b0fcbcad3e38
2022-09-30 14:28:48 -07:00
Tim Yung 868be00d8c RN: Create Portable `sort-imports` ESLint Rule
Summary:
Introduces a portable bundle that implements the `sort-imports` ESLint rule that we use internally at Meta, to the React Native repository.

As a consequence of the rapid changes that occur to this rule internally (and the desire to minimize red tape for Meta engineers), the portable bundle is built with Rollup with a lot of context omitted.

Changelog:
[Internal]

Reviewed By: skinsshark

Differential Revision: D39907799

fbshipit-source-id: 58fb6dc08030f20ac02c0e3fd1b175e22e4d74c0
2022-09-30 14:28:48 -07:00
Tim Yung 85f3e2416f RN: Fix `no-react-native-imports` for Windows
Summary:
This lint rule (and the associated Jest test) fails because `path` on Windows outputs backslashes. This diff fixes the rule.

Changelog:
[Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D39887464

fbshipit-source-id: b75480ccf4dcc384e2f7b91d8dcaf3af5f341434
2022-09-28 08:16:49 -07:00
Tim Yung 4f83498462 RN: Replace `error-subclass-name` with `require-extends-error` ESLint Rule
Summary:
Removes the `error-subclass-name` ESLint rule from `react-native/eslint-plugin`, and implements a new `require-extends-error` ESLint rule inside the React Native repository. This rule was only intended to be used for internal development of React Native.

This will change `react-native/eslint-plugin` to no longer provide the `error-subclass-name` rule.

NOTE: One behavior difference here is that I also implemented the desired behavior of checking classes that extend `Library.SomeError`.

Changelog:
[General][Removed] - `react-native/eslint-plugin` no longer provides the `error-subclass-name` rule.

Reviewed By: lunaleaps

Differential Revision: D39858882

fbshipit-source-id: 27b53216d77a15b3425bd9669dbc9d954c1c61da
2022-09-27 14:37:29 -07:00
Tim Yung 1ec69b1823 RN: Move `no-haste-imports` ESLint Rule into Repository
Summary:
Moves the `no-haste-imports` ESLint rule into the React Native repository because it was only intended to be used for internal development of React Native.

This will change `react-native/eslint-plugin` to no longer provide the `no-haste-imports` rule.

Changelog:
[General][Removed] - `react-native/eslint-plugin` no longer provides the `no-haste-imports` rule.

Reviewed By: lunaleaps

Differential Revision: D39858883

fbshipit-source-id: b8d91ce5996b615341cf60c6f839afac1e26dac9
2022-09-27 14:37:29 -07:00
Tim Yung 80b8cefb26 RN: Lint for Internal Package Imports
Summary:
Creates an ESLint rule that prohibits (and autofixes) imports from `react-native` or `react-native/path/to/file`, within the React Native repository.

The ESLint rule is configured using the `eslint-plugin-lint` package instead of `react-native/eslint-plugin` because the rule is only applicable to the React Native repository. The rule does not (and should not) be publicly facing, and changes to the rule should not require publishing new versions of `react-native/eslint-plugin`. (As a follow-up, the `no-haste-imports` rule should be migrated over from `react-native/eslint-plugin`.)

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D39831222

fbshipit-source-id: 566330e6df77fdff5ce755324b9f592b9365019e
2022-09-27 09:22:58 -07:00