diff --git a/compiler/.eslintrc.js b/compiler/.eslintrc.js index 2f68f5c3103c..9122ed55765e 100644 --- a/compiler/.eslintrc.js +++ b/compiler/.eslintrc.js @@ -17,7 +17,7 @@ module.exports = { extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"], rules: { /* - * We prefer using const where variables are not reassigned, but occassional mistakes + * We prefer using const where variables are not reassigned, but occasional mistakes * aren't a major issue */ "prefer-const": "off", @@ -99,7 +99,7 @@ module.exports = { }, /* * If rules need to be disabled then the rule is insufficiently high signal - * and should be diasbled altogether or customized (in either case via a standalone PR) + * and should be disabled altogether or customized (in either case via a standalone PR) */ noInlineConfig: true, reportUnusedDisableDirectives: true, diff --git a/compiler/apps/playground/lib/createContext.ts b/compiler/apps/playground/lib/createContext.ts index e1a455fe4b1b..ead4a2959c9d 100644 --- a/compiler/apps/playground/lib/createContext.ts +++ b/compiler/apps/playground/lib/createContext.ts @@ -17,7 +17,7 @@ import React from 'react'; * const StoreDispatchContext = useContext>(null); * const dispatchStore = useContext(StoreDispatchContext); * ... - * dipatchStore!({ ... }); + * dispatchStore!({ ... }); * ``` * * Instead, it throws an error when `useContext` is not called within a diff --git a/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts b/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts index 452aa0ce329d..a986436b645a 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts @@ -1028,7 +1028,7 @@ function lowerStatement( const conditionalBlock = builder.reserve('loop'); // Block for code following the loop const continuationBlock = builder.reserve('block'); - // Loop body, executed at least once uncondtionally prior to exit + // Loop body, executed at least once unconditionally prior to exit const loopBlock = builder.enter('block', _loopBlockId => { return builder.loop( label, diff --git a/compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts b/compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts index 98cf1ed57d9f..20fb8dc44f0a 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts @@ -344,7 +344,7 @@ export const EnvironmentConfigSchema = z.object({ * When enabled, the compiler assumes that any values are not subsequently * modified after they are captured by a function passed to React. For example, * if a value `x` is referenced inside a function expression passed to `useEffect`, - * then this flag will assume that `x` is not subusequently modified. + * then this flag will assume that `x` is not subsequently modified. */ enableTransitivelyFreezeFunctionExpressions: z.boolean().default(true), enableEmitHookGuards: ExternalFunctionSchema.nullable().default(null), diff --git a/compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts b/compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts index faf7c9f2b72b..a99f09ce0f81 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts @@ -895,7 +895,7 @@ TYPED_GLOBALS.push( 'createRef', addFunction(DEFAULT_SHAPES, [], { positionalParams: [], - restParam: Effect.Capture, // createRef takes no paramters + restParam: Effect.Capture, // createRef takes no parameters returnType: {kind: 'Object', shapeId: BuiltInUseRefId}, calleeEffect: Effect.Read, returnValueKind: ValueKind.Mutable, diff --git a/compiler/packages/babel-plugin-react-compiler/src/Inference/AliasingEffects.ts b/compiler/packages/babel-plugin-react-compiler/src/Inference/AliasingEffects.ts index 7f30e25a5c06..ae43b6353ad7 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Inference/AliasingEffects.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Inference/AliasingEffects.ts @@ -164,7 +164,7 @@ export type AliasingEffect = */ | {kind: 'Impure'; place: Place; error: CompilerDiagnostic} /** - * Indicates that a given place is accessed during render. Used to distingush + * Indicates that a given place is accessed during render. Used to distinguish * hook arguments that are known to be called immediately vs those used for * event handlers/effects, and for JSX values known to be called during render * (tags, children) vs those that may be events/effect (other props). diff --git a/compiler/packages/babel-plugin-react-compiler/src/Inference/InlineImmediatelyInvokedFunctionExpressions.ts b/compiler/packages/babel-plugin-react-compiler/src/Inference/InlineImmediatelyInvokedFunctionExpressions.ts index d71f6ebc8a06..2b3aab32f9ac 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Inference/InlineImmediatelyInvokedFunctionExpressions.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Inference/InlineImmediatelyInvokedFunctionExpressions.ts @@ -76,8 +76,8 @@ import {retainWhere} from '../Utils/utils'; * StoreLocal to the temporary we allocated before plus a Goto to the fallthrough * block (code following the CallExpression). * - * Note that if the inliined function has only one return, we avoid the labeled block - * and fully inline the code. The original return is replaced with an assignmen to the + * Note that if the inlined function has only one return, we avoid the labeled block + * and fully inline the code. The original return is replaced with an assignment to the * IIFE's call expression lvalue. */ export function inlineImmediatelyInvokedFunctionExpressions( diff --git a/compiler/packages/babel-plugin-react-compiler/src/Optimization/OptimizeForSSR.ts b/compiler/packages/babel-plugin-react-compiler/src/Optimization/OptimizeForSSR.ts index 16644ec7a872..1df5b5c555d1 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Optimization/OptimizeForSSR.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Optimization/OptimizeForSSR.ts @@ -28,7 +28,7 @@ import {retainWhere} from '../Utils/utils'; /** * Optimizes the code for running specifically in an SSR environment. This optimization - * asssumes that setState will not be called during render during initial mount, which + * assumes that setState will not be called during render during initial mount, which * allows inlining useState/useReducer. * * Optimizations: diff --git a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MergeReactiveScopesThatInvalidateTogether.ts b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MergeReactiveScopesThatInvalidateTogether.ts index f6cf491220c1..be5c632c9645 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MergeReactiveScopesThatInvalidateTogether.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MergeReactiveScopesThatInvalidateTogether.ts @@ -78,7 +78,7 @@ import { * Note that PropagateScopeDependencies propagates scope dependencies upwards. This ensures * that parent scopes have the union of their own direct dependencies as well as those of * their (transitive) children. As a result nested scopes may have the same or fewer - * dependencies than their parents, but not more dependencies. If they have fewer dependncies, + * dependencies than their parents, but not more dependencies. If they have fewer dependencies, * it means that the inner scope does not always invalidate with the parent and we should not * flatten. If they inner scope has the exact same dependencies, however, then it's always * better to flatten. diff --git a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PruneNonEscapingScopes.ts b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PruneNonEscapingScopes.ts index a3408f580b58..8d02153dafd1 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PruneNonEscapingScopes.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PruneNonEscapingScopes.ts @@ -100,7 +100,7 @@ import {getFunctionCallSignature} from '../Inference/InferMutationAliasingEffect * scopes and inputs involved in creating that identifier. Individual nodes are marked * as definitely aliased, conditionally aliased, or unaliased: * a. Arrays, objects, function calls all produce a new value and are always marked as aliased - * b. Conditional and logical expressions (and a few others) are conditinally aliased, + * b. Conditional and logical expressions (and a few others) are conditionally aliased, * depending on whether their result value is aliased. * c. JSX is always unaliased (though its props children may be) * 2. The same pass which builds the graph also stores the set of returned identifiers and set of @@ -1026,7 +1026,7 @@ class PruneScopesTransform extends ReactiveFunctionTransform< /** * Scopes may initially appear "empty" because the value being memoized - * is early-returned from within the scope. For now we intentionaly keep + * is early-returned from within the scope. For now we intentionally keep * these scopes, and let them get pruned later by PruneUnusedScopes * _after_ handling the early-return case in PropagateEarlyReturns. * diff --git a/compiler/packages/babel-plugin-react-compiler/src/SSA/EnterSSA.ts b/compiler/packages/babel-plugin-react-compiler/src/SSA/EnterSSA.ts index b5f586032b0e..5e63a5c30536 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/SSA/EnterSSA.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/SSA/EnterSSA.ts @@ -139,7 +139,7 @@ class SSABuilder { if (block.preds.size == 0) { /* - * We're at the entry block and haven't found our defintion yet. + * We're at the entry block and haven't found our definition yet. * console.log( * `Unable to find "${printPlace( * oldPlace diff --git a/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateHooksUsage.ts b/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateHooksUsage.ts index a243929ddefd..b81df6274162 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateHooksUsage.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateHooksUsage.ts @@ -110,7 +110,7 @@ export function validateHooksUsage(fn: HIRFunction): void { /* * In some circumstances such as optional calls, we may first encounter a "hook may not be referenced as normal values" error. - * If that same place is also used as a conditional call, upgrade the error to a conditonal hook error + * If that same place is also used as a conditional call, upgrade the error to a conditional hook error */ if (previousError === undefined || previousError.reason !== reason) { trackError( diff --git a/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoSetStateInEffects.ts b/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoSetStateInEffects.ts index 2457e0d7b99e..b3d2e2accf7c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoSetStateInEffects.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoSetStateInEffects.ts @@ -106,7 +106,7 @@ export function validateNoSetStateInEffects( const setState = setStateFunctions.get(arg.identifier.id); if (setState !== undefined) { /** - * This effect event function calls setState synchonously, + * This effect event function calls setState synchronously, * treat it as a setState function for transitive tracking */ setStateFunctions.set(instr.lvalue.identifier.id, setState); diff --git a/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoSetStateInRender.ts b/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoSetStateInRender.ts index 43db75110798..3b2057253a93 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoSetStateInRender.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoSetStateInRender.ts @@ -91,7 +91,7 @@ function validateNoSetStateInRenderImpl( isSetStateType(operand.identifier) || unconditionalSetStateFunctions.has(operand.identifier.id), ) && - // if yes, does it unconditonally call it? + // if yes, does it unconditionally call it? validateNoSetStateInRenderImpl( instr.value.loweredFunc.func, unconditionalSetStateFunctions, diff --git a/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidatePreservedManualMemoization.ts b/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidatePreservedManualMemoization.ts index d39aa307dfb3..d57f22dd36a4 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidatePreservedManualMemoization.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidatePreservedManualMemoization.ts @@ -218,7 +218,7 @@ function compareDeps( * identifier must be also named in source, as DropManualMemoization, which * runs before any renaming passes, only records loads from named variables. * - and one of the following holds: - * - pathA and pathB are identifical + * - pathA and pathB are identical * - pathB is a subpath of pathA and neither read into a `ref` type* * * We do not allow for partial matches on ref types because they are not immutable diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/function-expression-mutation-edge-case.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/function-expression-mutation-edge-case.js index 856209928d1c..939e4f47dfb0 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/function-expression-mutation-edge-case.js +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/function-expression-mutation-edge-case.js @@ -9,7 +9,7 @@ function Component() { * if we don't bail out of effect mutation derivation tracking, isChanged * will inherit the sources of the effect's function expression. * - * This is innacurate and with the multiple passes ends up causing an infinite loop. + * This is inaccurate and with the multiple passes ends up causing an infinite loop. */ useEffect(() => { let isChanged = false; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.js index 895c881cec45..ec6101f5e450 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.js +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.js @@ -1,6 +1,6 @@ function Component(props) { // a can be independently memoized, is not mutated later - // but a is a dependnecy of b, which is a dependency of c. + // but a is a dependency of b, which is a dependency of c. // we have to memoize a to avoid breaking memoization of b, // to avoid breaking memoization of c. const a = [props.a];