diff --git a/.circleci/config.yml b/.circleci/config.yml index 1aad95b12a239..894e52fab609d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -74,38 +74,6 @@ parameters: default: '' jobs: - yarn_lint: - docker: *docker - environment: *environment - - steps: - - checkout - - setup_node_modules - - run: node ./scripts/prettier/index - - run: node ./scripts/tasks/eslint - - run: ./scripts/circleci/check_license.sh - - run: ./scripts/circleci/test_print_warnings.sh - - yarn_flow: - docker: *docker - environment: *environment - parallelism: 5 - - steps: - - checkout - - setup_node_modules - - run: node ./scripts/tasks/flow-ci - - - yarn_flags: - docker: *docker - environment: *environment - - steps: - - checkout - - setup_node_modules - - run: yarn flags - scrape_warning_messages: docker: *docker environment: *environment @@ -464,26 +432,11 @@ workflows: build_and_test: unless: << pipeline.parameters.prerelease_commit_sha >> jobs: - - yarn_flags: - filters: - branches: - ignore: - - builds/facebook-www - - yarn_flow: - filters: - branches: - ignore: - - builds/facebook-www - check_generated_fizz_runtime: filters: branches: ignore: - builds/facebook-www - - yarn_lint: - filters: - branches: - ignore: - - builds/facebook-www - yarn_test: filters: branches: diff --git a/.eslintrc.js b/.eslintrc.js index c92fc4739eded..1d45d68055078 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -17,6 +17,8 @@ module.exports = { // Stop ESLint from looking for a configuration file in parent folders root: true, + reportUnusedDisableDirectives: true, + plugins: [ 'babel', 'ft-flow', diff --git a/.github/workflows/compiler-typescript.yml b/.github/workflows/compiler-typescript.yml index 4b4a668c724e1..71cfe426c171a 100644 --- a/.github/workflows/compiler-typescript.yml +++ b/.github/workflows/compiler-typescript.yml @@ -23,25 +23,6 @@ jobs: - id: set-matrix run: echo "matrix=$(find packages -mindepth 1 -maxdepth 1 -type d | sed 's!packages/!!g' | tr '\n' ',' | sed s/.$// | jq -Rsc '. / "," - [""]')" >> $GITHUB_OUTPUT - # Hardcoded to improve parallelism for babel-plugin-react-compiler - prettier: - name: Run prettier - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18.x - cache: "yarn" - cache-dependency-path: compiler/yarn.lock - - name: Restore cached node_modules - uses: actions/cache@v4 - with: - path: "**/node_modules" - key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('compiler/**/yarn.lock') }} - - run: yarn install --frozen-lockfile - - run: yarn prettier:ci - # Hardcoded to improve parallelism lint: name: Lint babel-plugin-react-compiler diff --git a/.github/workflows/flags.yml b/.github/workflows/flags.yml new file mode 100644 index 0000000000000..66e6c5c211153 --- /dev/null +++ b/.github/workflows/flags.yml @@ -0,0 +1,28 @@ +name: Flags + +on: + push: + branches: [main] + pull_request: + paths-ignore: + - 'compiler/**' + +jobs: + flags: + name: Check flags + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18.x + cache: "yarn" + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: yarn flags diff --git a/.github/workflows/flow.yml b/.github/workflows/flow.yml new file mode 100644 index 0000000000000..11eb1f55e4cb7 --- /dev/null +++ b/.github/workflows/flow.yml @@ -0,0 +1,47 @@ +name: Flow + +on: + push: + branches: [main] + pull_request: + paths-ignore: + - 'compiler/**' + +jobs: + discover_flow_inline_configs: + name: Discover flow inline configs + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.result }} + steps: + - uses: actions/checkout@v4 + - uses: actions/github-script@v7 + id: set-matrix + with: + script: | + const inlinedHostConfigs = require('./scripts/shared/inlinedHostConfigs.js'); + return inlinedHostConfigs.map(config => config.shortName); + + flow: + name: Flow check ${{ matrix.flow_inline_config_shortname }} + needs: discover_flow_inline_configs + runs-on: ubuntu-latest + continue-on-error: true + strategy: + matrix: + flow_inline_config_shortname: ${{ fromJSON(needs.discover_flow_inline_configs.outputs.matrix) }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18.x + cache: "yarn" + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: node ./scripts/tasks/flow-ci-ghaction ${{ matrix.flow_inline_config_shortname }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000000..4313712727913 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,79 @@ +name: Lint + +on: + push: + branches: [main] + pull_request: + +jobs: + prettier: + name: Run prettier + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18.x + cache: "yarn" + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + with: + path: "**/node_modules" + key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: yarn prettier-check + + eslint: + name: Run eslint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18.x + cache: "yarn" + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + with: + path: "**/node_modules" + key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: node ./scripts/tasks/eslint + + check_license: + name: Check license + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18.x + cache: "yarn" + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + with: + path: "**/node_modules" + key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: ./scripts/circleci/check_license.sh + + test_print_warnings: + name: Test print warnings + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18.x + cache: "yarn" + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + with: + path: "**/node_modules" + key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: ./scripts/circleci/test_print_warnings.sh diff --git a/.prettierignore b/.prettierignore index 24caf7a7a1d70..1c461d88c6e51 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,4 @@ +# react runtime build packages/react-devtools-core/dist @@ -13,3 +14,26 @@ packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ packages/react-devtools-shell/dist packages/react-devtools-timeline/dist packages/react-devtools-timeline/static + +# react compiler +compiler/**/dist +compiler/**/__tests__/fixtures/**/*.expect.md +compiler/**/__tests__/fixtures/**/*.flow.js +compiler/**/.next + +compiler/crates +compiler/apps/playground/public + +compiler/**/LICENSE +compiler/.* +compiler/*.md* +compiler/*.json +compiler/*.css +compiler/*.webmanifest +compiler/*.map +compiler/*.sh +compiler/*.txt +compiler/*.ico +compiler/*.svg +compiler/*.lock +compiler/*.toml diff --git a/.prettierrc.js b/.prettierrc.js index 43f9b6671c326..5f3e78b0b83d2 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,6 +1,7 @@ 'use strict'; const { + compilerPaths, esNextPaths, typescriptPaths, } = require('./scripts/shared/pathsByLanguageVersion'); @@ -33,5 +34,19 @@ module.exports = { parser: 'typescript', }, }, + { + files: compilerPaths, + options: { + requirePragma: false, + parser: 'babel-ts', + semi: true, + singleQuote: false, + trailingComma: 'es5', + bracketSpacing: true, + bracketSameLine: false, + printWidth: 80, + arrowParens: 'always', + }, + }, ], }; diff --git a/compiler/.eslintrc.js b/compiler/.eslintrc.js index 996046a130035..2f68f5c3103ce 100644 --- a/compiler/.eslintrc.js +++ b/compiler/.eslintrc.js @@ -43,6 +43,12 @@ module.exports = { "multiline-comment-style": ["error", "starred-block"], + /** + * We sometimes need to check for control characters in regexes for things like preserving input + * strings + */ + "no-control-regex": "off", + "@typescript-eslint/no-empty-function": "off", /* @@ -82,7 +88,7 @@ module.exports = { ], "@typescript-eslint/array-type": ["error", { default: "generic" }], "@typescript-eslint/triple-slash-reference": "off", - "@typescript-eslint/no-var-requires": "off" + "@typescript-eslint/no-var-requires": "off", }, parser: "@typescript-eslint/parser", plugins: ["@typescript-eslint"], diff --git a/compiler/.prettierignore b/compiler/.prettierignore deleted file mode 100644 index 410e88836cb6c..0000000000000 --- a/compiler/.prettierignore +++ /dev/null @@ -1,21 +0,0 @@ -**/dist -**/__tests__/fixtures/**/*.expect.md -**/__tests__/fixtures/**/*.flow.js -**/.next - -crates -apps/playground/public - -**/LICENSE -.* -*.md* -*.json -*.css -*.webmanifest -*.map -*.sh -*.txt -*.ico -*.svg -*.lock -*.toml diff --git a/compiler/.prettierrc.js b/compiler/.prettierrc.js deleted file mode 100644 index 37917d7082fb5..0000000000000 --- a/compiler/.prettierrc.js +++ /dev/null @@ -1,9 +0,0 @@ -const config = { - requirePragma: false, - parser: "babel-ts", - semi: true, - singleQuote: false, - trailingComma: "es5" -} - -module.exports = config; diff --git a/compiler/apps/playground/components/TabbedWindow.tsx b/compiler/apps/playground/components/TabbedWindow.tsx index 6d7ed3517bf77..b77ecb0ecdbe1 100644 --- a/compiler/apps/playground/components/TabbedWindow.tsx +++ b/compiler/apps/playground/components/TabbedWindow.tsx @@ -78,7 +78,9 @@ function TabbedWindowItem({ title="Minimize tab" aria-label="Minimize tab" onClick={toggleTabs} - className={`p-4 duration-150 ease-in border-b cursor-pointer border-grey-200 ${hasChanged ? "font-bold" : "font-light"} text-secondary hover:text-link`} + className={`p-4 duration-150 ease-in border-b cursor-pointer border-grey-200 ${ + hasChanged ? "font-bold" : "font-light" + } text-secondary hover:text-link`} > - {name} @@ -91,7 +93,9 @@ function TabbedWindowItem({ aria-label={`Expand compiler tab: ${name}`} style={{ transform: "rotate(90deg) translate(-50%)" }} onClick={toggleTabs} - className={`flex-grow-0 w-5 transition-colors duration-150 ease-in ${hasChanged ? "font-bold" : "font-light"} text-secondary hover:text-link`} + className={`flex-grow-0 w-5 transition-colors duration-150 ease-in ${ + hasChanged ? "font-bold" : "font-light" + } text-secondary hover:text-link`} > {name} diff --git a/compiler/package.json b/compiler/package.json index 9037808df9877..92100f030dc5e 100644 --- a/compiler/package.json +++ b/compiler/package.json @@ -22,8 +22,6 @@ "build": "yarn workspaces run build", "dev": "concurrently --kill-others -n compiler,runtime,playground \"yarn workspace babel-plugin-react-compiler run build --watch\" \"yarn workspace react-compiler-runtime run build --watch\" \"wait-on packages/babel-plugin-react-compiler/dist/index.js && yarn workspace playground run dev\"", "test": "yarn workspaces run test", - "prettier:write": "prettier --write . --log-level=warn", - "prettier:ci": "prettier --check . --log-level=warn", "snap": "yarn workspace babel-plugin-react-compiler run snap", "snap:build": "yarn workspace snap run build", "postinstall": "perl -p -i -e 's/react\\.element/react.transitional.element/' packages/snap/node_modules/fbt/lib/FbtReactUtil.js && perl -p -i -e 's/didWarnAboutUsingAct = false;/didWarnAboutUsingAct = true;/' packages/babel-plugin-react-compiler/node_modules/react-dom/cjs/react-dom-test-utils.development.js", diff --git a/compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts b/compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts index f1daea1994553..443a2522ee18b 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts @@ -282,9 +282,9 @@ export function printTerminal(terminal: Terminal): Array | string { break; } case "pruned-scope": { - value = ` Scope ${printReactiveScopeSummary(terminal.scope)} block=bb${ - terminal.block - } fallthrough=bb${terminal.fallthrough}`; + value = ` Scope ${printReactiveScopeSummary( + terminal.scope + )} block=bb${terminal.block} fallthrough=bb${terminal.fallthrough}`; break; } case "try": { diff --git a/compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts b/compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts index 37619b4224787..7b90740417ab7 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts @@ -283,7 +283,9 @@ function print( print(env, locals, shared, seen, dep, depth + 1); } console.log( - `${"| ".repeat(depth)}$${id} ${printNode(node)} deps=[${deps.map((x) => `$${x}`).join(", ")}]` + `${"| ".repeat(depth)}$${id} ${printNode(node)} deps=[${deps + .map((x) => `$${x}`) + .join(", ")}]` ); } diff --git a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts index 3886628c8095a..809f773ebda37 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts @@ -565,7 +565,9 @@ function codegenReactiveScope( CompilerError.invariant(identifier.name != null, { reason: `Expected scope declaration identifier to be named`, - description: `Declaration \`${printIdentifier(identifier)}\` is unnamed in scope @${scope.id}`, + description: `Declaration \`${printIdentifier( + identifier + )}\` is unnamed in scope @${scope.id}`, loc: null, suggestions: null, }); @@ -2157,10 +2159,18 @@ function codegenInstructionValue( } /** - * Due to a bug in earlier Babel versions, JSX string attributes with double quotes or with unicode characters - * may be escaped unnecessarily. To avoid trigger this Babel bug, we use a JsxExpressionContainer for such strings. + * Due to a bug in earlier Babel versions, JSX string attributes with double quotes, unicode characters, or special + * control characters such as \n may be escaped unnecessarily. To avoid trigger this Babel bug, we use a + * JsxExpressionContainer for such strings. + * + * u0000 to u001F: C0 control codes + * u007F : Delete character + * u0080 to u009F: C1 control codes + * u00A0 to uFFFF: All non-basic Latin characters + * https://en.wikipedia.org/wiki/List_of_Unicode_characters#Control_codes */ -const STRING_REQUIRES_EXPR_CONTAINER_PATTERN = /[\u{0080}-\u{FFFF}]|"/u; +const STRING_REQUIRES_EXPR_CONTAINER_PATTERN = + /[\u{0000}-\u{001F}|\u{007F}|\u{0080}-\u{FFFF}]|"/u; function codegenJsxAttribute( cx: Context, attribute: JsxAttribute diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-string-attribute-expression-container.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-string-attribute-expression-container.expect.md new file mode 100644 index 0000000000000..ad25964ed83d2 --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-string-attribute-expression-container.expect.md @@ -0,0 +1,77 @@ + +## Input + +```javascript +function Component() { + return ( +
+ + + + + + +
+ ); +} + +function Text({ value }) { + return {value}; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{}], +}; + +``` + +## Code + +```javascript +import { c as _c } from "react/compiler-runtime"; +function Component() { + const $ = _c(1); + let t0; + if ($[0] === Symbol.for("react.memo_cache_sentinel")) { + t0 = ( +
+ + + + + + +
+ ); + $[0] = t0; + } else { + t0 = $[0]; + } + return t0; +} + +function Text(t0) { + const $ = _c(2); + const { value } = t0; + let t1; + if ($[0] !== value) { + t1 = {value}; + $[0] = value; + $[1] = t1; + } else { + t1 = $[1]; + } + return t1; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{}], +}; + +``` + +### Eval output +(kind: ok)
+A E나은Laurenசத்யாSathya
\ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-string-attribute-expression-container.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-string-attribute-expression-container.js new file mode 100644 index 0000000000000..042b95f348195 --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-string-attribute-expression-container.js @@ -0,0 +1,21 @@ +function Component() { + return ( +
+ + + + + + +
+ ); +} + +function Text({ value }) { + return {value}; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{}], +}; diff --git a/package.json b/package.json index fc482724ee7a0..663538b506c44 100644 --- a/package.json +++ b/package.json @@ -127,6 +127,7 @@ "flow-ci": "node ./scripts/tasks/flow-ci.js", "prettier": "node ./scripts/prettier/index.js write-changed", "prettier-all": "node ./scripts/prettier/index.js write", + "prettier-check": "node ./scripts/prettier/index.js", "version-check": "node ./scripts/tasks/version-check.js", "publish-prereleases": "node ./scripts/release/publish-using-ci-workflow.js", "download-build": "node ./scripts/release/download-experimental-build.js", diff --git a/packages/react-client/src/ReactFlightClient.js b/packages/react-client/src/ReactFlightClient.js index e1d43db1ecffa..866805b5578c1 100644 --- a/packages/react-client/src/ReactFlightClient.js +++ b/packages/react-client/src/ReactFlightClient.js @@ -1839,7 +1839,6 @@ function resolveHint( dispatchHint(code, hintModel); } -// eslint-disable-next-line react-internal/no-production-logging const supportsCreateTask = __DEV__ && enableOwnerStacks && !!(console: any).createTask; @@ -1977,7 +1976,6 @@ function initializeFakeTask( ? null : initializeFakeTask(response, componentInfo.owner); - // eslint-disable-next-line react-internal/no-production-logging const createTaskFn = (console: any).createTask.bind( console, getServerComponentTaskName(componentInfo), diff --git a/packages/react-client/src/ReactFlightReplyClient.js b/packages/react-client/src/ReactFlightReplyClient.js index e5f7a559e7a45..ff80f4b310a77 100644 --- a/packages/react-client/src/ReactFlightReplyClient.js +++ b/packages/react-client/src/ReactFlightReplyClient.js @@ -227,14 +227,11 @@ export function processReply( function progress(entry: {done: boolean, value: ReactServerValue, ...}) { if (entry.done) { const blobId = nextPartId++; - // eslint-disable-next-line react-internal/safe-string-coercion data.append(formFieldPrefix + blobId, new Blob(buffer)); - // eslint-disable-next-line react-internal/safe-string-coercion data.append( formFieldPrefix + streamId, '"$o' + blobId.toString(16) + '"', ); - // eslint-disable-next-line react-internal/safe-string-coercion data.append(formFieldPrefix + streamId, 'C'); // Close signal pendingParts--; if (pendingParts === 0) { @@ -262,7 +259,6 @@ export function processReply( function progress(entry: {done: boolean, value: ReactServerValue, ...}) { if (entry.done) { - // eslint-disable-next-line react-internal/safe-string-coercion data.append(formFieldPrefix + streamId, 'C'); // Close signal pendingParts--; if (pendingParts === 0) { @@ -272,7 +268,6 @@ export function processReply( try { // $FlowFixMe[incompatible-type]: While plain JSON can return undefined we never do here. const partJSON: string = JSON.stringify(entry.value, resolveToJSON); - // eslint-disable-next-line react-internal/safe-string-coercion data.append(formFieldPrefix + streamId, partJSON); reader.read().then(progress, reject); } catch (x) { @@ -326,7 +321,6 @@ export function processReply( ) { if (entry.done) { if (entry.value === undefined) { - // eslint-disable-next-line react-internal/safe-string-coercion data.append(formFieldPrefix + streamId, 'C'); // Close signal } else { // Unlike streams, the last value may not be undefined. If it's not @@ -348,7 +342,6 @@ export function processReply( try { // $FlowFixMe[incompatible-type]: While plain JSON can return undefined we never do here. const partJSON: string = JSON.stringify(entry.value, resolveToJSON); - // eslint-disable-next-line react-internal/safe-string-coercion data.append(formFieldPrefix + streamId, partJSON); iterator.next().then(progress, reject); } catch (x) { @@ -441,7 +434,6 @@ export function processReply( const partJSON = serializeModel(resolvedModel, lazyId); // $FlowFixMe[incompatible-type] We know it's not null because we assigned it above. const data: FormData = formData; - // eslint-disable-next-line react-internal/safe-string-coercion data.append(formFieldPrefix + lazyId, partJSON); return serializeByValueID(lazyId); } catch (x) { @@ -461,7 +453,6 @@ export function processReply( const partJSON = serializeModel(value, lazyId); // $FlowFixMe[incompatible-type] We know it's not null because we assigned it above. const data: FormData = formData; - // eslint-disable-next-line react-internal/safe-string-coercion data.append(formFieldPrefix + lazyId, partJSON); pendingParts--; if (pendingParts === 0) { @@ -502,7 +493,6 @@ export function processReply( const partJSON = serializeModel(partValue, promiseId); // $FlowFixMe[incompatible-type] We know it's not null because we assigned it above. const data: FormData = formData; - // eslint-disable-next-line react-internal/safe-string-coercion data.append(formFieldPrefix + promiseId, partJSON); pendingParts--; if (pendingParts === 0) { @@ -784,7 +774,6 @@ export function processReply( } // The reference to this function came from the same client so we can pass it back. const refId = nextPartId++; - // eslint-disable-next-line react-internal/safe-string-coercion formData.set(formFieldPrefix + refId, metaDataJSON); return serializeServerReferenceID(refId); } diff --git a/packages/react-client/src/forks/ReactFlightClientConfig.custom.js b/packages/react-client/src/forks/ReactFlightClientConfig.custom.js index 3add5988aab8a..88694f59324d4 100644 --- a/packages/react-client/src/forks/ReactFlightClientConfig.custom.js +++ b/packages/react-client/src/forks/ReactFlightClientConfig.custom.js @@ -42,7 +42,7 @@ export const usedWithSSR = true; export opaque type Source = mixed; -export opaque type StringDecoder = mixed; // eslint-disable-line no-undef +export opaque type StringDecoder = mixed; export const createStringDecoder = $$$config.createStringDecoder; export const readPartialStringChunk = $$$config.readPartialStringChunk; diff --git a/packages/react-devtools-extensions/flow-typed/jest.js b/packages/react-devtools-extensions/flow-typed/jest.js index cdbe32bee7ba6..66c8f0d41fe55 100644 --- a/packages/react-devtools-extensions/flow-typed/jest.js +++ b/packages/react-devtools-extensions/flow-typed/jest.js @@ -146,13 +146,11 @@ type JestPromiseType = { * Use rejects to unwrap the reason of a rejected promise so any other * matcher can be chained. If the promise is fulfilled the assertion fails. */ - // eslint-disable-next-line no-use-before-define rejects: JestExpectType, /** * Use resolves to unwrap the value of a fulfilled promise so any other * matcher can be chained. If the promise is rejected the assertion fails. */ - // eslint-disable-next-line no-use-before-define resolves: JestExpectType, }; @@ -1098,10 +1096,8 @@ type JestPrettyFormatColors = { }; type JestPrettyFormatIndent = string => string; -// eslint-disable-next-line no-unused-vars type JestPrettyFormatRefs = Array; type JestPrettyFormatPrint = any => string; -// eslint-disable-next-line no-unused-vars type JestPrettyFormatStringOrNull = string | null; type JestPrettyFormatOptions = { @@ -1112,7 +1108,6 @@ type JestPrettyFormatOptions = { indent: number, maxDepth: number, min: boolean, - // eslint-disable-next-line no-use-before-define plugins: JestPrettyFormatPlugins, printFunctionName: boolean, spacing: string, diff --git a/packages/react-devtools-extensions/flow-typed/npm/react-test-renderer_v16.x.x.js b/packages/react-devtools-extensions/flow-typed/npm/react-test-renderer_v16.x.x.js index f706d830ebc00..c9a96b1d4b9f8 100644 --- a/packages/react-devtools-extensions/flow-typed/npm/react-test-renderer_v16.x.x.js +++ b/packages/react-devtools-extensions/flow-typed/npm/react-test-renderer_v16.x.x.js @@ -52,7 +52,6 @@ type TestRendererOptions = { }; declare module 'react-test-renderer' { - // eslint-disable-next-line no-inner-declarations declare export type ReactTestRenderer = { toJSON(): null | ReactTestRendererJSON, toTree(): null | ReactTestRendererTree, diff --git a/packages/react-devtools-inline/__tests__/__e2e__/utils.js b/packages/react-devtools-inline/__tests__/__e2e__/utils.js index 1e0efabb15466..5f0505b71e070 100644 --- a/packages/react-devtools-inline/__tests__/__e2e__/utils.js +++ b/packages/react-devtools-inline/__tests__/__e2e__/utils.js @@ -7,7 +7,6 @@ const config = require('../../playwright.config'); const {test} = require('@playwright/test'); function runOnlyForReactRange(range) { - // eslint-disable-next-line jest/no-disabled-tests test.skip( !semver.satisfies(config.use.react_version, range), `This test requires a React version of ${range} to run. ` + diff --git a/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js b/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js index a49f2d464bc65..ba6bd0ad092af 100644 --- a/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js +++ b/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js @@ -665,7 +665,6 @@ describe('InspectedElement', () => { anonymous_fn={instance.anonymousFunction} array_buffer={arrayBuffer} array_of_arrays={arrayOfArrays} - // eslint-disable-next-line no-undef big_int={BigInt(123)} bound_fn={exampleFunction.bind(this)} data_view={dataView} @@ -1876,7 +1875,7 @@ describe('InspectedElement', () => { xyz: 1, }, }); - const bigInt = BigInt(123); // eslint-disable-line no-undef + const bigInt = BigInt(123); await utils.actAsync(() => render( diff --git a/packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js b/packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js index f05c832c56c15..243759e5b02e7 100644 --- a/packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js +++ b/packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js @@ -185,7 +185,6 @@ describe('InspectedElementContext', () => { anonymous_fn: instance.anonymousFunction, array_buffer: arrayBuffer, array_of_arrays: arrayOfArrays, - // eslint-disable-next-line no-undef big_int: BigInt(123), bound_fn: exampleFunction.bind(this), data_view: dataView, @@ -888,7 +887,7 @@ describe('InspectedElementContext', () => { xyz: 1, }, }); - const bigInt = BigInt(123); // eslint-disable-line no-undef + const bigInt = BigInt(123); act(() => ReactDOM.render( diff --git a/packages/react-devtools-shared/src/backend/DevToolsConsolePatching.js b/packages/react-devtools-shared/src/backend/DevToolsConsolePatching.js index bc133590f89b8..71ede689250ea 100644 --- a/packages/react-devtools-shared/src/backend/DevToolsConsolePatching.js +++ b/packages/react-devtools-shared/src/backend/DevToolsConsolePatching.js @@ -30,7 +30,6 @@ disabledLog.__reactDisabledLog = true; export function disableLogs(): void { if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ prevLog = console.log; prevInfo = console.info; prevWarn = console.warn; @@ -63,7 +62,6 @@ export function disableLogs(): void { export function reenableLogs(): void { disabledDepth--; if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ const props = { configurable: true, enumerable: true, diff --git a/packages/react-devtools-shared/src/backend/renderer.js b/packages/react-devtools-shared/src/backend/renderer.js index fa2b098a81dc2..4ec7de9529548 100644 --- a/packages/react-devtools-shared/src/backend/renderer.js +++ b/packages/react-devtools-shared/src/backend/renderer.js @@ -1604,7 +1604,6 @@ export function attach( return changedKeys; } - // eslint-disable-next-line no-unused-vars function didFiberRender(prevFiber: Fiber, nextFiber: Fiber): boolean { switch (nextFiber.tag) { case ClassComponent: diff --git a/packages/react-devtools-shell/src/app/InspectableElements/UnserializableProps.js b/packages/react-devtools-shell/src/app/InspectableElements/UnserializableProps.js index 906683c0975fb..2c279a1bdbf87 100644 --- a/packages/react-devtools-shell/src/app/InspectableElements/UnserializableProps.js +++ b/packages/react-devtools-shell/src/app/InspectableElements/UnserializableProps.js @@ -31,7 +31,7 @@ const immutable = Immutable.fromJS({ xyz: 1, }, }); -const bigInt = BigInt(123); // eslint-disable-line no-undef +const bigInt = BigInt(123); class Foo { flag = false; diff --git a/packages/react-devtools/app.js b/packages/react-devtools/app.js index 3912a80ef09d5..c427852b408ba 100644 --- a/packages/react-devtools/app.js +++ b/packages/react-devtools/app.js @@ -46,7 +46,7 @@ app.on('ready', function () { }); // and load the index.html of the app. - mainWindow.loadURL('file://' + __dirname + '/app.html'); // eslint-disable-line no-path-concat + mainWindow.loadURL('file://' + __dirname + '/app.html'); // $FlowFixMe[incompatible-use] found when upgrading Flow mainWindow.webContents.executeJavaScript( // We use this so that RN can keep relative JSX __source filenames diff --git a/packages/react-dom-bindings/src/client/DOMPropertyOperations.js b/packages/react-dom-bindings/src/client/DOMPropertyOperations.js index 867eeba4a0869..1d5211e451ff2 100644 --- a/packages/react-dom-bindings/src/client/DOMPropertyOperations.js +++ b/packages/react-dom-bindings/src/client/DOMPropertyOperations.js @@ -30,7 +30,7 @@ export function getValueForAttribute( // shouldRemoveAttribute switch (typeof expected) { case 'function': - case 'symbol': // eslint-disable-line + case 'symbol': return expected; case 'boolean': { const prefix = name.toLowerCase().slice(0, 5); @@ -109,7 +109,7 @@ export function setValueForAttribute( switch (typeof value) { case 'undefined': case 'function': - case 'symbol': // eslint-disable-line + case 'symbol': node.removeAttribute(name); return; case 'boolean': { diff --git a/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js b/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js index 03fcee884186b..3d5c730e428dd 100644 --- a/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js +++ b/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js @@ -443,7 +443,7 @@ export function createInstance( didWarnScriptTags = true; } } - div.innerHTML = '