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

15 Коммитов

Автор SHA1 Сообщение Дата
Tim Yung b8425c8ee5 RN: Cleanup Existing ESLint Warnings
Summary:
Sometime over the past few months (and with changes such as migrating to the `hermes-eslint` parser), a bunch of lint warnings crept into the codebase.

This does a pass to clean them all up, ignore generated files, and refactor some code to be... better.

There should be no observable behavior changes as a result of this.

Changelog:
[Internal]

Reviewed By: NickGerleman

Differential Revision: D38646643

fbshipit-source-id: a7b55d1e4cd5700340cc5c21f928baf3ea1d5a58
2022-08-12 17:16:40 -07:00
simek 6c21f15d71 Lint: fix few "no-unused-var" warnings for imports (#30157)
Summary:
This small PR fixes few "no-unused-var" issues and  and removes two old entries for no longer existing files from the `.eslintignore`.

## Changelog

[Internal] [Fixed] - Lint: fix few "no-unused-var" warnings for imports

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

Test Plan: Successfully run of `yarn lint` script. Warnings count has been reduced from `61` to `58`.

Reviewed By: yungsters

Differential Revision: D24288226

Pulled By: appden

fbshipit-source-id: 06e4ef015a331e3f2eac3b9aa6f757a3764e3ed9
2020-10-26 17:19:14 -07:00
Christoph Nakazawa 4d4992c790 Upgrade to Jest 26.5.2.
Summary: Changelog: [Internal]

Reviewed By: kacieb

Differential Revision: D24154865

fbshipit-source-id: 04d637a3944b6f030fee342c4e8a181eb4b14458
2020-10-07 02:14:55 -07:00
empyrical c67e1fe42f Codegen: Add prepublish script to build Flow files (#28827)
Summary:
*This is a follow-up to https://github.com/facebook/react-native/issues/28645, redone using a build script based off of Metro's build script instead of using `flow-remove-types` and `flow-copy-source`.*

This pull request adds a build step to `react-native-codegen` that builds the Flow-annotated JS files so that users of the NPM module `react-native-codegen` do not need to use require hooks to be able to import it.

A new build script, `scripts/build.js` is added that builds every JS file in `src/` into a `lib/` folder, and also copies over the original Flow annotated files to `lib/` with a `.js.flow` extension, so users of `react-native-codegen` can still typecheck against it using Flow. The shell scripts in `src` are also copied over. It is based off of the [build script from Metro](00867816eb/scripts/build.js)

## Changelog

[General] [Added] - Codegen: Add prepublish script to build Flow files
Pull Request resolved: https://github.com/facebook/react-native/pull/28827

Test Plan:
I am able to make use of the Codegen scripts without needing to use the `flow-node` CLI or the `flow-remove-types/register`
require hook.

Reviewed By: cpojer

Differential Revision: D21412173

Pulled By: hramos

fbshipit-source-id: 26ae67cdd04652ca4700a069a234a25558773cb1
2020-05-08 15:41:35 -07:00
Jesse Katsumata 5b8f4ef195 Clear some lint warnings (#27893)
Summary:
Applied linting for warnings that seemed trivial.

## Changelog

[Internal] [Fixed] - clear lint warnings
Pull Request resolved: https://github.com/facebook/react-native/pull/27893

Test Plan: yarn lint

Differential Revision: D19619569

Pulled By: cpojer

fbshipit-source-id: f9f02838c56e94abc1590686c8443c6c6e6f44ca
2020-01-29 04:36:28 -08:00
Matt Hargett e67aa427a8 Eliminate eslint npm version mismatch warnings and bump some to latest (#23969)
Summary:
I was annoyed by warnings from yarn/npm about eslint peer dependencies not being met, so I dived in to try and get rid of some of them. Sometimes it meant bumping a plugin, but then that plugin needed a newer babel-eslint, so it was a dance.

Some we can't easily update to latest (eslint-plugin-prettier) because the rule format has changed a bit. Happy to do that in this PR if folks think its a good idea. eslint-config-fbjs itself needs to be updated and republished to eliminate the last few warnings.

There are a few new warnings (the repo wasn't linting cleanly for me from the start). I can fix those in this PR, or a separate one, based on people's preferences.

[internal] [chore] - Eliminate some peer dependency warnings and bump some eslint packages to latest.
Pull Request resolved: https://github.com/facebook/react-native/pull/23969

Differential Revision: D14519076

Pulled By: cpojer

fbshipit-source-id: aa44cfd05814d7b79069414aa78d089e448c2235
2019-03-19 11:14:30 -07:00
Héctor Ramos 937c79e2f2 Suggest running yarn lint --fix (#23413)
Summary:
This PR expands the code analysis script to allow for customizing the GitHub Review left by analysis-bot whenever it finds code-level issues.

Some, but not all, `eslint` errors are fixable by running `yarn lint --fix`. When the `eslint` converter finds warnings or errors, the bot will suggest running the command as part of the review.

The script could be adjusted to only suggest this when `eslint` returns a non-zero `fixableErrorCount` or `fixableWarningCount`, but I think this is a good first step to get people to unblock themselves when they see this type of review from the bot.

I've also excluded `bots/` and `scripts/` from eslint as these have several `eslint` errors that need to be addressed. These directories do not contain core RN code, so they can be excluded for now.

[GENERAL] [Changed] - analysis-bot will suggest fixing eslint warnings on code reviews
Pull Request resolved: https://github.com/facebook/react-native/pull/23413

Differential Revision: D14065757

Pulled By: cpojer

fbshipit-source-id: cc588643f7ddb3c4631d89c26b799f7a7244e616
2019-02-13 08:46:03 -08:00
Héctor Ramos 2d86618e7e Split out docs to their own repo
Reviewed By: yungsters

Differential Revision: D6462045

fbshipit-source-id: c4fe1e3bd2ccf4dbd344587456f027d6404ccbe7
2017-12-05 13:02:54 -08:00
Hector Ramos d5fe05fd67 Exclude the dangerfile from eslint.
Summary:
Before:

```
$ npm run lint

> react-native@1000.0.0 lint /Users/hramos/git/react-native
> eslint .

Cannot find module 'ljharb/eslint-config'
Referenced from: /Users/hramos/git/react-native/danger/node_modules/extend/.eslintrc
Error: Cannot find module 'ljharb/eslint-config'
Referenced from: /Users/hramos/git/react-native/danger/node_modules/extend/.eslintrc
    at ModuleResolver.resolve (/Users/hramos/git/react-native/node_modules/eslint/lib/util/module-resolver.js:74:19)
    at resolve (/Users/hramos/git/react-native/node_modules/eslint/lib/config/config-file.js:515:25)
    at load (/Users/hramos/git/react-native/node_modules/eslint/lib/config/config-file.js:532:26)
    at configExtends.reduceRight (/Users/hramos/git/react-native/node_modules/eslint/lib/config/config-file.js:424:36)
    at Array.reduceRight (native)
    at applyExtends (/Users/hramos/git/react-native/node_modules/eslint/lib/config/config-file.js:408:28)
    at Object.load (/Users/hramos/git/react-native/node_modules/eslint/lib/config/config-file.js:566:22)
    at loadConfig (/Users/hramos/git/react-native/node_modules/eslint/lib/config.js:63:33)
    at getLocalConfig (/Users/hramos/git/react-native/node_modules/eslint/lib/config.js:130:29)
    at Config.getConfig (/Users/hramos/git/react-native/node_modules/eslint/lib/config.js:260:26)

```

After:

```
$ npm run lint

> react-native@1000.0.0 lint /Users/hramos/git/react-native
> eslint .

/Users/hramos/git/react-native/babel-preset/configs/internal.js
  11:5  warning  'resolvePlugins' is assigned a value but never used  no-unused-vars
  16:2  warning  Missing semicolon
...
✖ 5047 problems (1001 errors, 4046 warnings)
```
Closes https://github.com/facebook/react-native/pull/15109

Differential Revision: D5455350

Pulled By: hramos

fbshipit-source-id: e76dae2804018ccb3da526f14cc0df2424e0d6b4
2017-07-19 13:49:32 -07:00
Eli White fc86f25f9a Run eslint on all js files
Reviewed By: zertosh

Differential Revision: D5405047

fbshipit-source-id: 5ade9d8beb3688d8bb08a208709c0dbf1ec671b2
2017-07-12 14:09:53 -07:00
Eli White 40fdd6d91c Enable eslint on circle ci
Reviewed By: zertosh

Differential Revision: D5374369

fbshipit-source-id: 5ffd246bc6fa735d781ed71cd293b7883184b786
2017-07-10 12:08:32 -07:00
James Ide 6e13adbf56 Remove remnants of the packager
Summary:
There were still some references to "packager/" that are no longer used since the `packager` directory has been deleted after moving to Metro. Cleaned up the ones that were doing nothing and updated the references that are still meaningful.
Closes https://github.com/facebook/react-native/pull/14881

Reviewed By: cpojer

Differential Revision: D5380731

Pulled By: javache

fbshipit-source-id: 1355268f48db47343d0d38fae2598b64c8c01475
2017-07-07 03:06:21 -07:00
Jean Lauliac e5920e710c packager: fork local version of worker-farm
Summary:
I suggest we grab our own version of worker-farm, since there are a few changes we'd like to do. There are two reasons for forking:

* the original project does not seem maintained anymore, with a PR remaining unanswered (https://github.com/rvagg/node-worker-farm/pull/42);
* we don't need to keep the level of genericity of the original project: for example, we don't need the option `maxConcurrentCallsPerWorker`, that we always keep to one.

Forking gives us opportunity to simplify the code for our use case. Later on we could reuse it for other projects such as `jest`.

A few things we'd like to do:

* remove special node options from the forks, such as `--inspect`, or even, allow adding special options (if you want to debug a worker specifically for example);
* allow us to pipe `stdout` and `stderr` instead of having transform spit stuff out to the parent process output;
* remove code managing `maxConcurrentCallsPerWorker` and clean up the code in general;
* add `flow` typing.

Reviewed By: davidaurelio

Differential Revision: D4993300

fbshipit-source-id: 10f0c2a18b010c2a8b2e2afebcb3aab3504d7923
2017-05-03 09:46:04 -07:00
Spencer Ahrens 11b515b1b0 [ReactNative] clean lint in all of Libraries/ 2015-05-19 13:47:04 -08:00
Ben Alpert a15603d8f1 Initial commit 2015-01-29 17:10:49 -08:00