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

34 Коммитов

Автор SHA1 Сообщение Дата
Tim Yung cf763cdf81 RN: Upgrade ESLint Packages (#32560)
Summary:
Upgrades ESLint to v7.28.0. This is the latest version before v8.0.0, which would be a more involved upgrade.

Upgrades all ESLint-related dependencies to their latest version, except for [eslint-plugin-flowtype](https://github.com/gajus/eslint-plugin-flowtype/). This is because eslint-plugin-flowtype@8.0.0 dropped support for ESLint v7.

Configures ESLint for Metro to extend `plugin:prettier/recommended`.

## Changelog

[General][Changed] - Upgraded packages to the latest versions for ESLint v7.

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

Test Plan:
Run this on an open source checkout of `facebook/react-native`:

```
# See no new errors or warnings.
$ yarn run lint
```

Run this internally:

```
$ js1 test xplat/js/tools/__tests__/dependency-constraints-test.js
```

Verify linting works:

```
js1 lint xplat/js/RKJSModules/Libraries/Core/
```

Reviewed By: lunaleaps

Differential Revision: D32258399

Pulled By: yungsters

fbshipit-source-id: d11b3fc3e33770157a90f3dee352cf80b39c442c
2021-11-09 13:16:42 -08:00
Tim Yung 4e587a1b7d JS: Upgrade to Prettier v2.4.1 [1/n]
Summary:
Changelog:
[General][Changed] - Upgraded to `prettier@^2.4.1`.

Reviewed By: zertosh

Differential Revision: D31854010

fbshipit-source-id: 6d7a2e758a3ddf7c758ceffb14d98eb93b0ce4b0
2021-11-02 22:14:16 -07:00
Matt Oakes ed20a85152 Bump the version of @react-native-community/eslint-config (#32117)
Summary:
The version of this package needs to be bumped for me to release the changes from https://github.com/facebook/react-native/issues/28637 to NPM.

## Changelog

[Internal] [Added] - Bump react-native-community/eslint-config version

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

Test Plan: N/A

Reviewed By: cortinico

Differential Revision: D30663708

Pulled By: yungsters

fbshipit-source-id: f433c324f12663d76e55c9395630cd642955b25e
2021-08-31 16:26:52 -07:00
Daiki Ihara de1a72acae move prettier to peerDeps in eslint-config-react-native-community (#28637)
Summary:
In monorepo environment, prettier-plugin in some editor load from nearest `node_modules`. Older version of eslint-config-react-native-community includes prettier v1 in their dependencies. It cause conflict of code style inside the monorepo.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Fixed] - move prettier to peerDependencies in eslint-config-react-native-community

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

Test Plan: I think it would be good with no plan to test.

Reviewed By: yungsters

Differential Revision: D30648134

Pulled By: charlesbdudley

fbshipit-source-id: 6c01226d6e4cc37ddbc86be260563deb093758d0
2021-08-30 16:32:23 -07:00
Tim Yung 92c13f0d1d RN: Replace `master` with `main` in Documentation
Summary:
Updates documentation in React Native to reference `main` (or `HEAD` for URLs) instead of `master`.

Part of https://github.com/facebook/react-native/issues/31788.

Changelog:
[General][Changed] - Update documentation reference from `master` to `main` or `HEAD`.

Reviewed By: JoshuaGross

Differential Revision: D29717128

fbshipit-source-id: 0b0babd8407c6fd3d0e5431f6eaf976059731d6f
2021-07-15 15:22:57 -07:00
Mike Hardy 463ec22bb9 chore(version): major version to go with dependency update (#31732)
Summary:
https://github.com/facebook/react-native/issues/31490 bumped the dependency versions of `typescript-eslint` project across a semver major,
bumping the package version here a semver major to correspond, prior to publishing

This is being done [in concert with](https://github.com/facebook/react-native/pull/31490#issuecomment-862122615) matt-oakes who may hopefully publish the result and PeteTheHeat
who merged https://github.com/facebook/react-native/issues/31490 (thanks!)

I copied the changelog chunk from the last version bump merged here, hopefully it is correct + useful

## Changelog

[General] [Fixed] - Upgrade dependencies / version of eslint package

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

Test Plan: Run in local project

Reviewed By: TheSavior

Differential Revision: D29167289

Pulled By: PeteTheHeat

fbshipit-source-id: 464365b2bff936ad5a33f9a39eb8e56aed8e8715
2021-06-16 11:13:48 -07:00
William Candillon 3b751d396b {emoji:2b06} Upgrade ESLint TS parser and plugin (#31490)
Summary:
I had an issue with the old version of the parser and upgrading it via `yarn resolve` solved it.

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

Reviewed By: kacieb

Differential Revision: D29107863

Pulled By: PeteTheHeat

fbshipit-source-id: f8393dd52c10e6868e626cee75557b17b647bee8
2021-06-15 15:07:59 -07:00
Jesse Katsumata 3cebd35b95 (eslint-config): update eslint-plugin-react-native (#30350)
Summary:
Currently, installing `react-native-community/eslint-config` with projects using eslint v7 causes the following warning

```
warning "react-native-community/eslint-config > eslint-plugin-react-native@3.8.1" has incorrect peer dependency "eslint@^3.17.0 || ^4 || ^5 || ^6".
```

This PR updates the eslint-plugin-react-native module to suppress the warning

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Changed] - update eslint-plugin-react-native for community eslint-config

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

Test Plan: eslint working without error with projects using eslint v7

Reviewed By: GijsWeterings

Differential Revision: D25480912

Pulled By: nadiia

fbshipit-source-id: 2a956070e5bb75168d68501f9ec9486a34011349
2020-12-14 06:12:34 -08:00
Nadiia D 8f5656b347 Update to eslint@7.12
Summary:
Changelog:
[Internal] - Upgrades eslint to 7.12

Reviewed By: cpojer

Differential Revision: D24552901

fbshipit-source-id: ede66ac9367702512436bfe3cf0254686300e10b
2020-11-10 00:08:44 -08:00
simek 29f5dc2ae0 chore: deduplicate lock, update packages repository fields (#30044)
Summary:
This small PR includes the following changes:
* deduplicate yarn lock file using [`yarn-deduplicate`](https://github.com/atlassian/yarn-deduplicate) package
  * deduplicate script has been added as `update-lock`, let me know if you would like also to see this in [`postinstall`](https://docs.npmjs.com/misc/scripts) (to automatically optimize lock on every dependency change)
* according to the [npm docs](https://docs.npmjs.com/files/package.json#repository):
  * main `package.json` repository field has been replaced with shorthand
  * monorepo packages repository field has been extended by `directory`

The main goal of introducing deduplication script was to optimize the dependencies footprint while developing and speed up the initial installation process. Running `yarn-deduplicate` also increase the security in some way, because it enforces usage only of the latest version of the package. You can read more about the benefits in the deduplicate script [repository](https://github.com/atlassian/yarn-deduplicate#duplicated-packages).

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Added] - add yarn lock deduplication script

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

Test Plan: `yarn install` was successful, this also should not affect yarn workspaces in any way.

Reviewed By: GijsWeterings

Differential Revision: D23959812

Pulled By: cpojer

fbshipit-source-id: e2455e3718378e1ce6206e79463d4083f8fe5d47
2020-09-28 22:41:50 -07:00
Dan Abramov ac87e90fa5 Update React Hooks rule
Summary:
Includes better support for optional chaining.

Changelog:
[General][Changed] - Updated the React Hooks ESLint Plugin

Reviewed By: rickhanlonii, trueadm

Differential Revision: D22479305

fbshipit-source-id: 08740449ea797ce0971ccae358eb7de1ae102d7d
2020-07-10 13:28:30 -07:00
William Candillon 93019dc190 ⬆️ Upgrade eslint-config deps (#29048)
Summary:
This dependency upgrade ensures that this eslint config now supports the latest TypeScript syntaxes.

## Changelog

[General] [Fixed] - Upgrade dependencies.
Pull Request resolved: https://github.com/facebook/react-native/pull/29048

Test Plan: Try this new version of the plugin on your project.

Reviewed By: GijsWeterings

Differential Revision: D21879997

Pulled By: cpojer

fbshipit-source-id: cb54c2b56361f7c20994d981c61826f7f50350de
2020-06-08 05:28:27 -07:00
George Zahariev 0b68f3cf77 Upgrade babel-eslint in xplat/js
Summary:
`babel-eslint` is the parser you can supply to ESLint based off of Babel.

`babel-eslint` 10.1.0 is the newest production version of `babel-eslint`.

There are very few changes between 10.0.1 (the lowest previous version) and 10.1.0. There are only 3 non-version-bump commits: 2 bug fixes and enabling parsing of Flow enums.

The only project that was on a lower version than 10.0.1 was `/xplat/js/RKJSModules/Libraries/Relay/oss/__github__` - test below

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D21055850

fbshipit-source-id: bae0d8af5c6d833a4dbb0ad775c8e5e78ead1051
2020-04-21 19:06:05 -07:00
Jesse Katsumata b2d10bc602 (eslint-config) update community eslint plugin in eslint config (#28642)
Summary:
Updating the community eslint-plugin used in the eslint-config to the latest version.

expecting new eslint-config version to be released with this change so that it can be included in new project template for 0.63 https://github.com/react-native-community/releases/issues/186

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Changed] - Update community eslint plugin in the eslint config
Pull Request resolved: https://github.com/facebook/react-native/pull/28642

Test Plan: yarn lint passes

Differential Revision: D21048976

Pulled By: cpojer

fbshipit-source-id: 2c3ec0ef450cf357d8c88db7873f4ca1154b2034
2020-04-16 01:47:47 -07:00
Jesse Katsumata 83fee73ae6 eslint-config: add version badge and add homepage for eslint-config (#28506)
Summary:
Add version badge to README of eslint-config, and add specific url for the homepage so people looking at the npm package can find out where the package is from.

## Changelog

[Internal] [Changed] - Add version badge to README of eslint-config
Pull Request resolved: https://github.com/facebook/react-native/pull/28506

Test Plan: Not required as the only changes are made in README and homepage prop of package.json

Differential Revision: D20837085

Pulled By: cpojer

fbshipit-source-id: 820d3b44b069780ec8764c6152d2e7fd5220933c
2020-04-03 06:40:22 -07:00
Dan Abramov 6ce3f0a4f7 Update React Hooks Plugin
Summary:
Updates `eslint-plugin-react-hooks` to 3.0.0. This introduces a new lint error when you use a Hook inside a class.

Changelog:
[General][Changed] - Updated the React Hooks ESLint Plugin

Reviewed By: cpojer

Differential Revision: D20675528

fbshipit-source-id: d0cbe9748fd15df7a4c6de00bd1462610e0a43d6
2020-03-26 14:02:03 -07:00
Pedro Barbiero 89d04b5e4a Upgrade internal packages to support ESLint >= 6 (#28393)
Summary:
Fixes https://github.com/facebook/react-native/issues/28293

I've tested it with https://github.com/react-native-community/react-native-template-typescript and it seems to be working as expected - no warnings, supports typescript 3.8.

(note: I didn't upgrade the package version as I don't know how the releases work for this package)

## Changelog

[CATEGORY] [TYPE] - Message
Pull Request resolved: https://github.com/facebook/react-native/pull/28393

Reviewed By: hramos

Differential Revision: D20647112

Pulled By: cpojer

fbshipit-source-id: ca6b67971f625dc8125a58f9220dfcd86250ba94
2020-03-26 07:21:40 -07:00
Michael Bolin 0b9ea60b4f Back out "Upgrade Prettier from 1.17 to 2.0.2."
Differential Revision: D20639755

fbshipit-source-id: 5028563f9cf0527a30b4259daac50cdc03934bfd
2020-03-24 21:47:35 -07:00
Michael Bolin cf44650b3f Upgrade Prettier from 1.17 to 2.0.2.
Summary:
This gets us on the latest Prettier 2.x:
https://prettier.io/blog/2020/03/21/2.0.0.html

Notably, this adds support for TypeScript 3.8,
which introduces new syntax, such as `import type`.

Reviewed By: zertosh

Differential Revision: D20636268

fbshipit-source-id: fca5833d003804333a05ba16325bbbe0e06d6c8a
2020-03-24 20:24:47 -07:00
Sonny Piers 7a13a1a88f Add URLSearchParams and Headers to eslint globals (#27853)
Summary:
Fix eslint complaining about `URLSearchParams` and `Headers` not being defined.
Pull Request resolved: https://github.com/facebook/react-native/pull/27853

Differential Revision: D19577641

Pulled By: cpojer

fbshipit-source-id: 7019d1519523c7b99a201c6e0b78d0035c9b35a6
2020-01-27 02:30:29 -08:00
Jesse Katsumata 2c2e35c634 Add community-eslint-plugin to eslint-config dependency (#27680)
Summary:
Added `react-native-community/eslint-plugin` as a dependency for `react-native-community/eslint-config`

The newly published eslint-config has `react-native-community/eslint-plugin` in its `.eslintrc`, but it's not listed under dependency, so when I try to use it in a community package, I'd have to install both `eslint-config` and `eslint-plugin`.
It would be nice to just be able to install `eslint-config` and extend that without additional package listed under devDependency.

## Changelog

[General] [Changed] - Added `react-native-community/eslint-plugin` as a dependency for `react-native-community/eslint-config`
Pull Request resolved: https://github.com/facebook/react-native/pull/27680

Differential Revision: D19287051

Pulled By: cpojer

fbshipit-source-id: 3aea54def7fb4598a21bfc087cc7938ce0662a59
2020-01-06 01:17:27 -08:00
Frieder Bluemle 1353da5a53 Update eslint-config dependencies (#27085)
Summary:
A couple of minor and patch updates to the `eslint-config` package, to avoid warnings and errors with the generated code of the latest RN version templates, such as:

```
warning "react-native-community/eslint-config > eslint-plugin-react@7.12.4" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0".
warning "react-native-community/eslint-config > eslint-plugin-react-native@3.6.0" has incorrect peer dependency "eslint@^3.17.0 || ^4 || ^5".
```

`yarn check` outputs the following errors:

```
error "react-native-community/eslint-config#eslint-plugin-react-native#eslint@^3.17.0 || ^4 || ^5" doesn't satisfy found match of "eslint@6.6.0"
error "react-native-community/eslint-config#eslint-plugin-react#eslint@^3.0.0 || ^4.0.0 || ^5.0.0" doesn't satisfy found match of "eslint@6.6.0"
```

By adding the missing `"license"` field, from now on this also avoids the following warnings:

```
warning package.json: No license field
warning react-native-community/eslint-config@0.0.6: No license field
```

## Changelog

[General] [Fixed] - Fix eslint-config peer dependency warnings
Pull Request resolved: https://github.com/facebook/react-native/pull/27085

Test Plan:
- Publish current `master` package locally (`0.0.6` is [not published](https://www.npmjs.com/package/react-native-community/eslint-config) yet!)
- Create new RN 0.61.3 project, set `eslint-config` to local package, observe errors/warnings running `yarn`/`yarn check`
- `yarn lint` passes cleanly
- Update dependencies (as in this PR), republish locally
- Update RN test project to new `eslint-config` package, **observe no more errors**
- `yarn lint` still passes cleanly

Differential Revision: D18298733

Pulled By: cpojer

fbshipit-source-id: 9a550365521fbaa4b940bc8c02cbeb345d8900b6
2019-11-04 08:17:07 -08:00
Eli White 2dbf42b4a3 Bump eslint-plugin-react-hooks to 2.0.1
Summary: This catches some errors about hooks being used at the top level in a module

Reviewed By: gaearon

Differential Revision: D16945591

fbshipit-source-id: 116ed24b4394b1f516a2ebcd75977d2ba5c57afb
2019-08-21 18:08:26 -07:00
Kant d2b92fffb1 Use eslint-plugin-prettier recommended config (#25674)
Summary:
I created a new test project today using RN 0.60.3 and saw that prettier is now used with eslint. After looking at the `react-native-community` eslint config, I notice that it wasn't using the [recommended configuration](https://github.com/prettier/eslint-plugin-prettier#recommended-configuration) of `eslint-plugin-prettier`

This PR adds the `eslint-config-prettier` to avoid conflicts between eslint and prettier, it also adds the `prettier/react` config to avoid problems with the `eslint-plugin-react`.

## Changelog

[General] [Changed] - Use eslint-plugin-prettier recommended config
Pull Request resolved: https://github.com/facebook/react-native/pull/25674

Test Plan: -  Ensure there is no difference on this repo (no ESLint errors, same number of warnings, and no changes when running prettier).

Differential Revision: D16666178

Pulled By: cpojer

fbshipit-source-id: 70f81db793866acc88388b7b00a496aab5e0b156
2019-08-09 06:41:41 -07:00
Adrian Zgorzalek ff9f8f347d Upgrade prettier to 1.17.0
Summary:
Run `js1 upgrade prettier 1.17.0` and `xplat/js/scripts/update-oss-yarn-lockfile.sh` and `hg revert -r .^ xplat/js/rome`

allow-large-files

Reviewed By: zackargyle, pvdz

Differential Revision: D15164375

fbshipit-source-id: 2fe68733dfa93ea64a67d170ba2f80c5af086917
2019-05-07 10:35:14 -07:00
Florian 2becfabb7d Update eslint-plugin-react-native dependency in eslint-config-react-native-community package (#24686)
Summary:
I need this in my life because version 3.7.0 fixes [this](https://github.com/Intellicode/eslint-plugin-react-native/pull/220) issue.

[General][fixed] - Fix an issue with `no-raw-text` rule for TypeScript by updating the eslint-plugin-react-native dependency to 3.7.0
Pull Request resolved: https://github.com/facebook/react-native/pull/24686

Differential Revision: D15237597

Pulled By: cpojer

fbshipit-source-id: 42ee13997d238025d0c50d154951549392d3abc7
2019-05-07 03:12:44 -07:00
Matt Oakes 2ef56c025d Bump @react-native-community/eslint-config version (#24650)
Summary:
Bump the `react-native-community/eslint-config` version so we can release it.

[General] [Changed] - Bumped react-native-community/eslint-config version
Pull Request resolved: https://github.com/facebook/react-native/pull/24650

Differential Revision: D15146456

Pulled By: cpojer

fbshipit-source-id: 9a6767f502f1b5dcd49cf55b4e35c0d851f33222
2019-04-30 02:31:06 -07:00
michalchudziak 037d16ba72 Bump @react-native-community/eslint-config version (#24389)
Summary:
[General] [Changed] - Bumped react-native-community/eslint-config version
Pull Request resolved: https://github.com/facebook/react-native/pull/24389

Differential Revision: D14870055

Pulled By: cpojer

fbshipit-source-id: 1a8d208757cf433146e71383e59044740321760a
2019-04-10 04:04:51 -07:00
satyajit.happy b49fdd19e4 Add typescript support to the ESLint config (#24100)
Summary:
This adds TypeScript support to the community ESLint config. Our babel preset supports TypeScript by default, so it's nice to have TypeScript support pre-configured in the ESLint config too.

Note: Users need to install `typescript` in their project for linting to work for TypeScript files.

[General] [Added] - Add TypeScript support to the ESLint config
Pull Request resolved: https://github.com/facebook/react-native/pull/24100

Differential Revision: D14597127

Pulled By: cpojer

fbshipit-source-id: dfbf1b97061ed6e8c46aa49adb21630f5acdb5d1
2019-03-25 21:28:26 -07:00
michalchudziak 395197dafe Add .eslintrc to RN project template (#23901)
Summary:
The goal of this PR is to enable eslint checks in the projects generated by `react-native init` command. I added `template/_eslintrc` file, that would be replaced in an initialized project with `.eslintrc` file. This PR comes in parallel with https://github.com/react-native-community/react-native-cli/pull/229

[General] [Added] - Added `.eslintrc` file to generated template.
Pull Request resolved: https://github.com/facebook/react-native/pull/23901

Differential Revision: D14561084

Pulled By: cpojer

fbshipit-source-id: 6eb717bf03c45d83ae8a393e6a0abb79e1e2f915
2019-03-21 07:14:23 -07: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
Peter van der Zee dcd4e90d9a Bump Prettier to 1.16.4
Summary:
@public
This bumps Prettier to v1.16.4
Only format source files were updated.

Reviewed By: mjesun

Differential Revision: D14454893

fbshipit-source-id: 72f9872fe764a79dbf0d9fab9bebb1456b039f2f
2019-03-14 07:00:27 -07:00
michalchudziak 3898ee3a01 Move `@react-native-community/eslint-config` devDependencies to dependencies (#23766)
Summary:
I moved `devDependencies` to `dependencies` section of `packages/eslint-config-react-native-community`, to avoid the need for installation of them in the main projects. Now the installation should match the guide, from https://github.com/facebook/react-native/tree/master/packages/eslint-config-react-native-community

[General] [Changed] - Moved `devDependencies` of eslint config to `dependencies` section.
Pull Request resolved: https://github.com/facebook/react-native/pull/23766

Differential Revision: D14436081

Pulled By: cpojer

fbshipit-source-id: 770110eb4b2b6dfbbb7456fd1b69e20a8473a4e2
2019-03-12 23:37:18 -07:00
michalchudziak 1ed2b82693 Rename eslint config to 'eslint-config-react-native-community' (#23718)
Summary:
Renamed `eslint-config-react-native` to `eslint-config-react-native-community`, due to the fact, that initial name is already taken on `npm`. Additionally, I added very simple `README.md` file, to prepare the package to be published.

[General] [Changed] - Changed `eslint-config-react-native` name to `eslint-config-react-native-community`
Pull Request resolved: https://github.com/facebook/react-native/pull/23718

Differential Revision: D14298553

Pulled By: cpojer

fbshipit-source-id: bad5a42502ccdebf5f95d8217187be23bbf8f26c
2019-03-03 20:39:43 -08:00