Skip to content

Commit

Permalink
ESLint upgrade to use hermes-eslint (#25915)
Browse files Browse the repository at this point in the history
Hermes parser is the preferred parser for Flow code going forward. We
need to upgrade to this parser to support new Flow syntax like function
`this` context type annotations or `ObjectType['prop']` syntax.

Unfortunately, there's quite a few upgrades here to make it work somehow
(dependencies between the changes)

- ~Upgrade `eslint` to `8.*`~ reverted this as the React eslint plugin
tests depend on the older version and there's a [yarn
bug](yarnpkg/yarn#6285) that prevents
`devDependencies` and `peerDependencies` to different versions.
- Remove `eslint-config-fbjs` preset dependency and inline the rules,
imho this makes it a lot clearer what the rules are.
- Remove the turned off `jsx-a11y/*` rules and it's dependency instead
of inlining those from the `fbjs` config.
- Update parser and dependency from `babel-eslint` to `hermes-eslint`.
- `ft-flow/no-unused-expressions` rule replaces `no-unused-expressions`
which now allows standalone type asserts, e.g. `(foo: number);`
- Bunch of globals added to the eslint config
- Disabled `no-redeclare`, seems like the eslint upgrade started making
this more precise and warn against re-defined globals like
`__EXPERIMENTAL__` (in rollup scripts) or `fetch` (when importing fetch
from node-fetch).
- Minor lint fixes like duplicate keys in objects.

DiffTrain build for [2b1fb91](2b1fb91)
[View git log for this commit](https://github.com/facebook/react/commits/2b1fb91a55deb9b7b60452cb57184c2f182a42fd)
  • Loading branch information
kassens committed Dec 20, 2022
1 parent 40ea970 commit ecbf597
Show file tree
Hide file tree
Showing 30 changed files with 78 additions and 56 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fabef7a6b71798fe2477720e59d090a0e74e0009
2b1fb91a55deb9b7b60452cb57184c2f182a42fd
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fabef7a6b71798fe2477720e59d090a0e74e0009
2b1fb91a55deb9b7b60452cb57184c2f182a42fd
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-classic-fabef7a6b-20221215";
var ReactVersion = "18.3.0-www-classic-2b1fb91a5-20221220";

// ATTENTION
// When adding new symbols to this file,
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-modern-fabef7a6b-20221215";
var ReactVersion = "18.3.0-www-modern-2b1fb91a5-20221220";

// ATTENTION
// When adding new symbols to this file,
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,4 +643,4 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-classic-fabef7a6b-20221215";
exports.version = "18.3.0-www-classic-2b1fb91a5-20221220";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,4 +635,4 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-modern-fabef7a6b-20221215";
exports.version = "18.3.0-www-modern-2b1fb91a5-20221220";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-classic-fabef7a6b-20221215";
exports.version = "18.3.0-www-classic-2b1fb91a5-20221220";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-modern-fabef7a6b-20221215";
exports.version = "18.3.0-www-modern-2b1fb91a5-20221220";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = "18.3.0-www-classic-fabef7a6b-20221215";
var ReactVersion = "18.3.0-www-classic-2b1fb91a5-20221220";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -2926,7 +2926,7 @@ function getInstanceFromNode(node) {
}
function preparePortalMount(portalInstance) {
// noop
}
} // eslint-disable-next-line no-undef

var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
var prefix;
Expand Down Expand Up @@ -24093,6 +24093,7 @@ function getExecutionContext() {
return executionContext;
}
// Warning, this opts-out of checking the function body.
// eslint-disable-next-line no-unused-vars

// eslint-disable-next-line no-redeclare
function flushSync(fn) {
Expand Down
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = "18.3.0-www-modern-fabef7a6b-20221215";
var ReactVersion = "18.3.0-www-modern-2b1fb91a5-20221220";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -2923,7 +2923,7 @@ function getInstanceFromNode(node) {
}
function preparePortalMount(portalInstance) {
// noop
}
} // eslint-disable-next-line no-undef

var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
var prefix;
Expand Down Expand Up @@ -23782,6 +23782,7 @@ function getExecutionContext() {
return executionContext;
}
// Warning, this opts-out of checking the function body.
// eslint-disable-next-line no-unused-vars

// eslint-disable-next-line no-redeclare
function flushSync(fn) {
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9827,7 +9827,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "18.3.0-www-classic-fabef7a6b-20221215",
version: "18.3.0-www-classic-2b1fb91a5-20221220",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1338 = {
Expand Down Expand Up @@ -9858,7 +9858,7 @@ var internals$jscomp$inline_1338 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-fabef7a6b-20221215"
reconcilerVersion: "18.3.0-next-2b1fb91a5-20221220"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1339 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -9494,7 +9494,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "18.3.0-www-modern-fabef7a6b-20221215",
version: "18.3.0-www-modern-2b1fb91a5-20221220",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1329 = {
Expand Down Expand Up @@ -9525,7 +9525,7 @@ var internals$jscomp$inline_1329 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-fabef7a6b-20221215"
reconcilerVersion: "18.3.0-next-2b1fb91a5-20221220"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1330 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
7 changes: 4 additions & 3 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6607,10 +6607,10 @@ function getOffsets(outerNode) {
// https://bugzilla.mozilla.org/show_bug.cgi?id=208427

try {
/* eslint-disable no-unused-expressions */
/* eslint-disable ft-flow/no-unused-expressions */
anchorNode.nodeType;
focusNode.nodeType;
/* eslint-enable no-unused-expressions */
/* eslint-enable ft-flow/no-unused-expressions */
} catch (e) {
return null;
}
Expand Down Expand Up @@ -39076,6 +39076,7 @@ function discreteUpdates(fn, a, b, c, d) {
}
} // Overload the definition to the two valid signatures.
// Warning, this opts-out of checking the function body.
// eslint-disable-next-line no-unused-vars

// eslint-disable-next-line no-redeclare
function flushSync(fn) {
Expand Down Expand Up @@ -42642,7 +42643,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-classic-fabef7a6b-20221215";
var ReactVersion = "18.3.0-www-classic-2b1fb91a5-20221220";

function createPortal(
children,
Expand Down
7 changes: 4 additions & 3 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -9940,10 +9940,10 @@ function getOffsets(outerNode) {
// https://bugzilla.mozilla.org/show_bug.cgi?id=208427

try {
/* eslint-disable no-unused-expressions */
/* eslint-disable ft-flow/no-unused-expressions */
anchorNode.nodeType;
focusNode.nodeType;
/* eslint-enable no-unused-expressions */
/* eslint-enable ft-flow/no-unused-expressions */
} catch (e) {
return null;
}
Expand Down Expand Up @@ -38800,6 +38800,7 @@ function discreteUpdates(fn, a, b, c, d) {
}
} // Overload the definition to the two valid signatures.
// Warning, this opts-out of checking the function body.
// eslint-disable-next-line no-unused-vars

// eslint-disable-next-line no-redeclare
function flushSync(fn) {
Expand Down Expand Up @@ -42366,7 +42367,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-modern-fabef7a6b-20221215";
var ReactVersion = "18.3.0-www-modern-2b1fb91a5-20221220";

function createPortal(
children,
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -15580,7 +15580,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1770 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-fabef7a6b-20221215",
version: "18.3.0-www-classic-2b1fb91a5-20221220",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2157 = {
Expand Down Expand Up @@ -15610,7 +15610,7 @@ var internals$jscomp$inline_2157 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-fabef7a6b-20221215"
reconcilerVersion: "18.3.0-next-2b1fb91a5-20221220"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2158 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -15852,4 +15852,4 @@ exports.unstable_renderSubtreeIntoContainer = function(
);
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-next-fabef7a6b-20221215";
exports.version = "18.3.0-next-2b1fb91a5-20221220";
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactDOM-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -15141,7 +15141,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1738 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-fabef7a6b-20221215",
version: "18.3.0-www-modern-2b1fb91a5-20221220",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2132 = {
Expand Down Expand Up @@ -15172,7 +15172,7 @@ var internals$jscomp$inline_2132 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-fabef7a6b-20221215"
reconcilerVersion: "18.3.0-next-2b1fb91a5-20221220"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2133 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -15360,4 +15360,4 @@ exports.unstable_flushControlled = function(fn) {
}
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-next-fabef7a6b-20221215";
exports.version = "18.3.0-next-2b1fb91a5-20221220";
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactDOM-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -16352,7 +16352,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1844 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-fabef7a6b-20221215",
version: "18.3.0-www-classic-2b1fb91a5-20221220",
rendererPackageName: "react-dom"
};
(function(internals) {
Expand Down Expand Up @@ -16396,7 +16396,7 @@ var devToolsConfig$jscomp$inline_1844 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-fabef7a6b-20221215"
reconcilerVersion: "18.3.0-next-2b1fb91a5-20221220"
});
assign(Internals, {
ReactBrowserEventEmitter: {
Expand Down Expand Up @@ -16625,7 +16625,7 @@ exports.unstable_renderSubtreeIntoContainer = function(
);
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-next-fabef7a6b-20221215";
exports.version = "18.3.0-next-2b1fb91a5-20221220";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactDOM-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -15903,7 +15903,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1812 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-fabef7a6b-20221215",
version: "18.3.0-www-modern-2b1fb91a5-20221220",
rendererPackageName: "react-dom"
};
(function(internals) {
Expand Down Expand Up @@ -15948,7 +15948,7 @@ var devToolsConfig$jscomp$inline_1812 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-fabef7a6b-20221215"
reconcilerVersion: "18.3.0-next-2b1fb91a5-20221220"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
exports.createPortal = function(children, container) {
Expand Down Expand Up @@ -16123,7 +16123,7 @@ exports.unstable_flushControlled = function(fn) {
}
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-next-fabef7a6b-20221215";
exports.version = "18.3.0-next-2b1fb91a5-20221220";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOMServer-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (__DEV__) {
var React = require("react");
var ReactDOM = require("react-dom");

var ReactVersion = "18.3.0-www-classic-fabef7a6b-20221215";
var ReactVersion = "18.3.0-www-classic-2b1fb91a5-20221220";

// This refers to a WWW module.
var warningWWW = require("warning");
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOMServer-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (__DEV__) {
var React = require("react");
var ReactDOM = require("react-dom");

var ReactVersion = "18.3.0-www-modern-fabef7a6b-20221215";
var ReactVersion = "18.3.0-www-modern-2b1fb91a5-20221220";

// This refers to a WWW module.
var warningWWW = require("warning");
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOMServer-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -3633,4 +3633,4 @@ exports.renderToString = function(children, options) {
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
);
};
exports.version = "18.3.0-www-classic-fabef7a6b-20221215";
exports.version = "18.3.0-www-classic-2b1fb91a5-20221220";
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOMServer-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -3546,4 +3546,4 @@ exports.renderToString = function(children, options) {
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
);
};
exports.version = "18.3.0-www-modern-fabef7a6b-20221215";
exports.version = "18.3.0-www-modern-2b1fb91a5-20221220";
7 changes: 4 additions & 3 deletions compiled/facebook-www/ReactDOMTesting-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6564,10 +6564,10 @@ function getOffsets(outerNode) {
// https://bugzilla.mozilla.org/show_bug.cgi?id=208427

try {
/* eslint-disable no-unused-expressions */
/* eslint-disable ft-flow/no-unused-expressions */
anchorNode.nodeType;
focusNode.nodeType;
/* eslint-enable no-unused-expressions */
/* eslint-enable ft-flow/no-unused-expressions */
} catch (e) {
return null;
}
Expand Down Expand Up @@ -28204,6 +28204,7 @@ function discreteUpdates(fn, a, b, c, d) {
}
} // Overload the definition to the two valid signatures.
// Warning, this opts-out of checking the function body.
// eslint-disable-next-line no-unused-vars

// eslint-disable-next-line no-redeclare
function flushSync(fn) {
Expand Down Expand Up @@ -31167,7 +31168,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-classic-fabef7a6b-20221215";
var ReactVersion = "18.3.0-www-classic-2b1fb91a5-20221220";

function createPortal(
children,
Expand Down
7 changes: 4 additions & 3 deletions compiled/facebook-www/ReactDOMTesting-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -9174,10 +9174,10 @@ function getOffsets(outerNode) {
// https://bugzilla.mozilla.org/show_bug.cgi?id=208427

try {
/* eslint-disable no-unused-expressions */
/* eslint-disable ft-flow/no-unused-expressions */
anchorNode.nodeType;
focusNode.nodeType;
/* eslint-enable no-unused-expressions */
/* eslint-enable ft-flow/no-unused-expressions */
} catch (e) {
return null;
}
Expand Down Expand Up @@ -35492,6 +35492,7 @@ function discreteUpdates(fn, a, b, c, d) {
}
} // Overload the definition to the two valid signatures.
// Warning, this opts-out of checking the function body.
// eslint-disable-next-line no-unused-vars

// eslint-disable-next-line no-redeclare
function flushSync(fn) {
Expand Down Expand Up @@ -38455,7 +38456,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-modern-fabef7a6b-20221215";
var ReactVersion = "18.3.0-www-modern-2b1fb91a5-20221220";

function createPortal(
children,
Expand Down
Loading

0 comments on commit ecbf597

Please sign in to comment.