Skip to content

Commit

Permalink
Fix typos found by codespell (#15783)
Browse files Browse the repository at this point in the history
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
  • Loading branch information
3 people committed Jul 18, 2023
1 parent a21be92 commit ee0c795
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/babel-core/test/option-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ describe("option-manager", () => {
expect(options.presets).toHaveLength(0);
});

itBabel7("es2015_named shuold throw", async () => {
itBabel7("es2015_named should throw", async () => {
await expect(
loadOptionsAsync({
presets: [
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-generator/src/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ export default class Buffer {
source(prop: "start" | "end", loc: Loc | undefined): void {
if (!this._map) return;

// Since this is called extremely often, we re-use the same _sourcePosition
// Since this is called extremely often, we reuse the same _sourcePosition
// object for the whole lifetime of the buffer.
this._normalizePosition(prop, loc, 0);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-generator/src/source-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class SourceMap {
private _lastGenLine = 0;
private _lastSourceLine = 0;

// Source columns can be 0, but we ony check in unison with sourceLine, which
// Source columns can be 0, but we only check in unison with sourceLine, which
// inits to an impossible value. So init to 0 is fine.
private _lastSourceColumn = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function getObjRef(
if (isIdentifier(node)) {
if (scope.hasBinding(node.name)) {
// this variable is declared in scope so we can be 100% sure
// that evaluating it multiple times wont trigger a getter
// that evaluating it multiple times won't trigger a getter
// or something else
return node;
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-helper-wrap-function/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function plainFunction(
export default function wrapFunction(
path: NodePath<t.Function>,
callId: t.Expression,
// TODO(Babel 8): Consider defaulting to false for spec compliancy
// TODO(Babel 8): Consider defaulting to false for spec compliance
noNewArrows: boolean = true,
ignoreFunctionLength: boolean = false,
) {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-parser/src/parser/statement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2960,7 +2960,7 @@ export default abstract class StatementParser extends ExpressionParser {
}

/*
* Parse `module` in `import module x fro "x"`, disambiguating
* Parse `module` in `import module x from "x"`, disambiguating
* `import module from "x"` and `import module from from "x"`.
*
* This function might return an identifier representing the `module`
Expand Down
1 change: 1 addition & 0 deletions packages/babel-parser/src/plugins/typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const TSErrors = ParseErrorEnum`typescript`({
propertyName: string;
}) =>
`Property '${propertyName}' cannot have an initializer because it is marked abstract.`,
// TODO: Accesor -> Accessor
AccesorCannotDeclareThisParameter:
"'get' and 'set' accessors cannot declare 'this' parameters.",
AccesorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-plugin-transform-destructuring/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export class DestructuringTransformer {
if (!t.isArrayExpression(arr)) return false;

// pattern has less elements than the array and doesn't have a rest so some
// elements wont be evaluated
// elements won't be evaluated
if (pattern.elements.length > arr.elements.length) return;
if (
pattern.elements.length < arr.elements.length &&
Expand Down Expand Up @@ -434,7 +434,7 @@ export class DestructuringTransformer {
// optimise basic array destructuring of an array expression
//
// we can't do this to a pattern of unequal size to it's right hand
// array expression as then there will be values that wont be evaluated
// array expression as then there will be values that won't be evaluated
//
// eg: let [a, b] = [1, 2];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export function transformOptionalChain(
} else if (scope.isStatic(chain)) {
check = ref = chainWithTypes;
} else {
// We cannot re-use the tmpVar for calls, because we need to
// We cannot reuse the tmpVar for calls, because we need to
// store both the method and the receiver.
if (!tmpVar || isCall) {
tmpVar = scope.generateUidIdentifierBasedOnNode(chain);
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-env/test/regressions.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("regressions", () => {
"regressions",
);

// Unfortunatly, when loading the browserslist config through
// Unfortunately, when loading the browserslist config through
// @babel/preset-env, it's resolved from process.cwd() and not
// from root. Mock it to isolate this test.
const spy = jest.spyOn(process, "cwd").mockReturnValue(root);
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-traverse/src/path/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export function setContext<S = unknown>(
if (context) {
this.context = context;
this.state = context.state;
// Discard the S type parameter from contect.opts
// Discard the S type parameter from context.opts
this.opts = context.opts as typeof this.opts;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/babel-traverse/src/path/conversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export function arrowFunctionToExpression(
allowInsertArrow = true,
allowInsertArrowWithRest = allowInsertArrow,
noNewArrows = process.env.BABEL_8_BREAKING
? // TODO(Babel 8): Consider defaulting to `false` for spec compliancy
? // TODO(Babel 8): Consider defaulting to `false` for spec compliance
true
: !arguments[0]?.specCompliant,
}: {
Expand Down Expand Up @@ -245,7 +245,7 @@ const getSuperCallsVisitor = mergeVisitors<{
*/
function hoistFunctionEnvironment(
fnPath: NodePath<t.Function>,
// TODO(Babel 8): Consider defaulting to `false` for spec compliancy
// TODO(Babel 8): Consider defaulting to `false` for spec compliance
noNewArrows: boolean | void = true,
allowInsertArrow: boolean | void = true,
allowInsertArrowWithRest: boolean | void = true,
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-traverse/src/scope/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ export default class Scope {

/**
* Determine whether evaluating the specific input `node` is a consequenceless reference. ie.
* evaluating it wont result in potentially arbitrary code from being ran. The following are
* evaluating it won't result in potentially arbitrary code from being ran. The following are
* allowed and determined not to cause side effects:
*
* - `this` expressions
Expand Down

0 comments on commit ee0c795

Please sign in to comment.