diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 9573b524728..8ef343dfd13 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -8,7 +8,7 @@ body: label: Describe the bug description: | If swc crashed or panicked, you can gain error message by running `swc --sync `. - Also, you can get backtrace by invoking swc by setting an environment varaible `SWC_DEBUG` to `1`. + Also, you can get backtrace by invoking swc by setting an environment variable `SWC_DEBUG` to `1`. validations: required: true - type: textarea diff --git a/crates/swc/benches/bugs/1/input.tsx b/crates/swc/benches/bugs/1/input.tsx index 974e074efa4..0dabcdb9505 100644 --- a/crates/swc/benches/bugs/1/input.tsx +++ b/crates/swc/benches/bugs/1/input.tsx @@ -9,7 +9,7 @@ export default function HiddenComponent() { diff --git a/crates/swc/src/config/mod.rs b/crates/swc/src/config/mod.rs index ad1470d0202..9ccfa5ef7e2 100644 --- a/crates/swc/src/config/mod.rs +++ b/crates/swc/src/config/mod.rs @@ -324,7 +324,7 @@ impl Options { // Do a resolver pass before everything. // - // We do this before creating custom passses, so custom passses can use the + // We do this before creating custom passes, so custom passses can use the // variable management system based on the syntax contexts. if syntax.typescript() { assumptions.set_class_methods = !transform.use_define_for_class_fields; diff --git a/crates/swc/src/dropped_comments_preserver.rs b/crates/swc/src/dropped_comments_preserver.rs index b4227d97692..3899ef2f244 100644 --- a/crates/swc/src/dropped_comments_preserver.rs +++ b/crates/swc/src/dropped_comments_preserver.rs @@ -10,7 +10,7 @@ use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWit /// If during compilation an ast node associated with /// a comment is dropped, the comment will not appear in the final emitted /// output. This can create problems in the JavaScript ecosystem, particularly -/// around instanbul coverage and other tooling that relies on comment +/// around istanbul coverage and other tooling that relies on comment /// directives. /// /// This transformer shifts orphaned comments to the next closest known span diff --git a/crates/swc/src/plugin.rs b/crates/swc/src/plugin.rs index 27314bee235..3069a5a9078 100644 --- a/crates/swc/src/plugin.rs +++ b/crates/swc/src/plugin.rs @@ -21,7 +21,7 @@ use swc_ecma_visit::{noop_fold_type, Fold}; #[serde(deny_unknown_fields, rename_all = "camelCase")] pub struct PluginConfig(String, serde_json::Value); -/// Struct represents arbitary `context` or `state` to be passed to plugin's +/// Struct represents arbitrary `context` or `state` to be passed to plugin's /// entrypoint. /// While internally this is strongly typed, it is not exposed as public /// interface to plugin's entrypoint but instead will be passed as JSON string. diff --git a/crates/swc/tests/deno-unit/chown_test.ts b/crates/swc/tests/deno-unit/chown_test.ts index bcd5ab9fe87..a2ace2ef72d 100644 --- a/crates/swc/tests/deno-unit/chown_test.ts +++ b/crates/swc/tests/deno-unit/chown_test.ts @@ -107,7 +107,7 @@ if (Deno.build.os !== "windows") { { perms: { run: true, write: true } }, async function chownSyncSucceed(): Promise { // TODO: when a file's owner is actually being changed, - // chown only succeeds if run under priviledged user (root) + // chown only succeeds if run under privileged user (root) // The test script has no such privilege, so need to find a better way to test this case const { uid, gid } = await getUidAndGid(); @@ -118,7 +118,7 @@ if (Deno.build.os !== "windows") { Deno.writeFileSync(filePath, fileData); // the test script creates this file with the same uid and gid, - // here chown is a noop so it succeeds under non-priviledged user + // here chown is a noop so it succeeds under non-privileged user Deno.chownSync(filePath, uid, gid); Deno.removeSync(dirPath, { recursive: true }); @@ -138,7 +138,7 @@ if (Deno.build.os !== "windows") { Deno.writeFileSync(fileUrl, fileData); // the test script creates this file with the same uid and gid, - // here chown is a noop so it succeeds under non-priviledged user + // here chown is a noop so it succeeds under non-privileged user Deno.chownSync(fileUrl, uid, gid); Deno.removeSync(dirPath, { recursive: true }); @@ -158,7 +158,7 @@ if (Deno.build.os !== "windows") { await Deno.writeFile(filePath, fileData); // the test script creates this file with the same uid and gid, - // here chown is a noop so it succeeds under non-priviledged user + // here chown is a noop so it succeeds under non-privileged user await Deno.chown(filePath, uid, gid); Deno.removeSync(dirPath, { recursive: true }); @@ -178,7 +178,7 @@ if (Deno.build.os !== "windows") { await Deno.writeFile(fileUrl, fileData); // the test script creates this file with the same uid and gid, - // here chown is a noop so it succeeds under non-priviledged user + // here chown is a noop so it succeeds under non-privileged user await Deno.chown(fileUrl, uid, gid); Deno.removeSync(dirPath, { recursive: true }); diff --git a/crates/swc/tests/deno-unit/console_test.ts b/crates/swc/tests/deno-unit/console_test.ts index d7281fbb282..590eec351a2 100644 --- a/crates/swc/tests/deno-unit/console_test.ts +++ b/crates/swc/tests/deno-unit/console_test.ts @@ -124,7 +124,8 @@ unitTest(function consoleTestStringifyCircular(): void { }; nestedObj.o = circularObj; - const nestedObjExpected = `{ + const nestedObjExpected = `\ +{ num: 1, bool: true, str: "a", @@ -209,7 +210,8 @@ unitTest(function consoleTestStringifyCircular(): void { assertEquals(stringify(JSON), 'JSON { Symbol(Symbol.toStringTag): "JSON" }'); assertEquals( stringify(console), - `{ + `\ +{ log: [Function], debug: [Function], info: [Function], @@ -286,7 +288,8 @@ unitTest(function consoleTestStringifyLargeObject(): void { }; assertEquals( stringify(obj), - `{ + `\ +{ a: 2, o: { a: "1", @@ -311,7 +314,8 @@ unitTest(function consoleTestStringifyIterable() { const longArray = new Array(200).fill(0); assertEquals( stringify(longArray), - `[ + `\ +[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -326,7 +330,8 @@ unitTest(function consoleTestStringifyIterable() { const obj = { a: "a", longArray }; assertEquals( stringify(obj), - `{ + `\ +{ a: "a", longArray: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -353,7 +358,8 @@ unitTest(function consoleTestStringifyIterable() { } assertEquals( stringify(longMap), - `Map { + `\ +Map { "0" => 0, "1" => 1, "2" => 2, @@ -466,7 +472,8 @@ unitTest(function consoleTestStringifyIterable() { } assertEquals( stringify(longSet), - `Set { + `\ +Set { 0, 1, 2, @@ -858,7 +865,8 @@ unitTest(function consoleGroup(): void { assertEquals( out.toString(), - `1 + `\ +1 2 3 4 @@ -887,7 +895,8 @@ unitTest(function consoleGroupWarn(): void { console.warn("7"); assertEquals( both.toString(), - `1 + `\ +1 2 3 4 @@ -905,7 +914,8 @@ unitTest(function consoleTable(): void { console.table({ a: "test", b: 1 }); assertEquals( stripColor(out.toString()), - `┌───────┬────────┐ + `\ +┌───────┬────────┐ │ (idx) │ Values │ ├───────┼────────┤ │ a │ "test" │ @@ -918,7 +928,8 @@ unitTest(function consoleTable(): void { console.table({ a: { b: 10 }, b: { b: 20, c: 30 } }, ["c"]); assertEquals( stripColor(out.toString()), - `┌───────┬────┐ + `\ +┌───────┬────┐ │ (idx) │ c │ ├───────┼────┤ │ a │ │ @@ -931,7 +942,8 @@ unitTest(function consoleTable(): void { console.table([1, 2, [3, [4]], [5, 6], [[7], [8]]]); assertEquals( stripColor(out.toString()), - `┌───────┬───────┬───────┬────────┐ + `\ +┌───────┬───────┬───────┬────────┐ │ (idx) │ 0 │ 1 │ Values │ ├───────┼───────┼───────┼────────┤ │ 0 │ │ │ 1 │ @@ -947,7 +959,8 @@ unitTest(function consoleTable(): void { console.table(new Set([1, 2, 3, "test"])); assertEquals( stripColor(out.toString()), - `┌────────────┬────────┐ + `\ +┌────────────┬────────┐ │ (iter idx) │ Values │ ├────────────┼────────┤ │ 0 │ 1 │ @@ -967,7 +980,8 @@ unitTest(function consoleTable(): void { ); assertEquals( stripColor(out.toString()), - `┌────────────┬─────┬────────┐ + `\ +┌────────────┬─────┬────────┐ │ (iter idx) │ Key │ Values │ ├────────────┼─────┼────────┤ │ 0 │ 1 │ "one" │ @@ -986,7 +1000,8 @@ unitTest(function consoleTable(): void { }); assertEquals( stripColor(out.toString()), - `┌───────┬───────────┬───────────────────┬────────┐ + `\ +┌───────┬───────────┬───────────────────┬────────┐ │ (idx) │ c │ e │ Values │ ├───────┼───────────┼───────────────────┼────────┤ │ a │ │ │ true │ @@ -1008,7 +1023,8 @@ unitTest(function consoleTable(): void { ]); assertEquals( stripColor(out.toString()), - `┌───────┬────────┬──────────────────────┬────┬────────┐ + `\ +┌───────┬────────┬──────────────────────┬────┬────────┐ │ (idx) │ 0 │ 1 │ a │ Values │ ├───────┼────────┼──────────────────────┼────┼────────┤ │ 0 │ │ │ │ 1 │ @@ -1024,7 +1040,8 @@ unitTest(function consoleTable(): void { console.table([]); assertEquals( stripColor(out.toString()), - `┌───────┐ + `\ +┌───────┐ │ (idx) │ ├───────┤ └───────┘ @@ -1035,7 +1052,8 @@ unitTest(function consoleTable(): void { console.table({}); assertEquals( stripColor(out.toString()), - `┌───────┐ + `\ +┌───────┐ │ (idx) │ ├───────┤ └───────┘ @@ -1046,7 +1064,8 @@ unitTest(function consoleTable(): void { console.table(new Set()); assertEquals( stripColor(out.toString()), - `┌────────────┐ + `\ +┌────────────┐ │ (iter idx) │ ├────────────┤ └────────────┘ @@ -1057,7 +1076,8 @@ unitTest(function consoleTable(): void { console.table(new Map()); assertEquals( stripColor(out.toString()), - `┌────────────┐ + `\ +┌────────────┐ │ (iter idx) │ ├────────────┤ └────────────┘ @@ -1072,7 +1092,8 @@ unitTest(function consoleTable(): void { console.table(["Hello", "你好", "Amapá"]); assertEquals( stripColor(out.toString()), - `┌───────┬─────────┐ + `\ +┌───────┬─────────┐ │ (idx) │ Values │ ├───────┼─────────┤ │ 0 │ "Hello" │ @@ -1089,7 +1110,8 @@ unitTest(function consoleTable(): void { ]); assertEquals( stripColor(out.toString()), - `┌───────┬───┬───┐ + `\ +┌───────┬───┬───┐ │ (idx) │ 0 │ 1 │ ├───────┼───┼───┤ │ 0 │ 1 │ 2 │ @@ -1102,7 +1124,8 @@ unitTest(function consoleTable(): void { console.table({ 1: { a: 4, b: 5 }, 2: null, 3: { b: 6, c: 7 } }, ["b"]); assertEquals( stripColor(out.toString()), - `┌───────┬───┐ + `\ +┌───────┬───┐ │ (idx) │ b │ ├───────┼───┤ │ 1 │ 5 │ diff --git a/crates/swc/tests/deno-unit/fetch_test.ts b/crates/swc/tests/deno-unit/fetch_test.ts index a52a7809a43..7539510d8fb 100644 --- a/crates/swc/tests/deno-unit/fetch_test.ts +++ b/crates/swc/tests/deno-unit/fetch_test.ts @@ -679,7 +679,7 @@ unitTest( try { await response.text(); fail( - "Reponse.text() didn't throw on a filtered response without a body (type opaqueredirect)" + "Response.text() didn't throw on a filtered response without a body (type opaqueredirect)" ); } catch (e) { return; @@ -702,7 +702,7 @@ unitTest( try { await response.text(); fail( - "Reponse.text() didn't throw on a filtered response without a body (type error)" + "Response.text() didn't throw on a filtered response without a body (type error)" ); } catch (e) { return; diff --git a/crates/swc/tests/deno-unit/fs_events_test.ts b/crates/swc/tests/deno-unit/fs_events_test.ts index ec146f185f7..5d29394171d 100644 --- a/crates/swc/tests/deno-unit/fs_events_test.ts +++ b/crates/swc/tests/deno-unit/fs_events_test.ts @@ -13,14 +13,14 @@ unitTest({ perms: { read: true } }, function watchFsInvalidPath() { if (Deno.build.os === "windows") { assertThrows( () => { - Deno.watchFs("non-existant.file"); + Deno.watchFs("non-existent.file"); }, Error, "Input watch path is neither a file nor a directory" ); } else { assertThrows(() => { - Deno.watchFs("non-existant.file"); + Deno.watchFs("non-existent.file"); }, Deno.errors.NotFound); } }); @@ -42,7 +42,7 @@ unitTest( const testDir = await Deno.makeTempDir(); const iter = Deno.watchFs(testDir); - // Asynchornously capture two fs events. + // Asynchronously capture two fs events. const eventsPromise = getTwoEvents(iter); // Make some random file system activity. diff --git a/crates/swc/tests/deno-unit/streams_transform_test.ts b/crates/swc/tests/deno-unit/streams_transform_test.ts index c8b4528e848..f9d5c61284e 100644 --- a/crates/swc/tests/deno-unit/streams_transform_test.ts +++ b/crates/swc/tests/deno-unit/streams_transform_test.ts @@ -48,7 +48,7 @@ unitTest(function transformStreamConstructedNoTransform() { new TransformStream({}); }); -unitTest(function transformStreamIntstancesHaveProperProperties() { +unitTest(function transformStreamInstancesHaveProperProperties() { const ts = new TransformStream({ transform(): void {} }); const proto = Object.getPrototypeOf(ts); @@ -425,7 +425,7 @@ unitTest(async function transformStreamCallTransformSync() { await writePromise; }); -unitTest(function transformStreamCloseWriteCloesesReadWithNoChunks() { +unitTest(function transformStreamCloseWriteClosesReadWithNoChunks() { const ts = new TransformStream({}, undefined, { highWaterMark: 0 }); const writer = ts.writable.getWriter(); @@ -514,7 +514,7 @@ unitTest(function transformStreamReadableTypeThrows() { ); }); -unitTest(function transformStreamWirtableTypeThrows() { +unitTest(function transformStreamWritableTypeThrows() { assertThrows( // eslint-disable-next-line @typescript-eslint/no-explicit-any () => new TransformStream({ writableType: "bytes" as any }), diff --git a/crates/swc/tests/errors/lints/no-empty-function/no-consider-comments/input.js b/crates/swc/tests/errors/lints/no-empty-function/no-consider-comments/input.js index 04697c7413f..19c29b3817f 100644 --- a/crates/swc/tests/errors/lints/no-empty-function/no-consider-comments/input.js +++ b/crates/swc/tests/errors/lints/no-empty-function/no-consider-comments/input.js @@ -1,3 +1,3 @@ function foo1() { - // commnet into + // comment into } diff --git a/crates/swc/tests/errors/lints/no-empty-function/no-consider-comments/output.swc-stderr b/crates/swc/tests/errors/lints/no-empty-function/no-consider-comments/output.swc-stderr index 1a7b4d37fe2..5a184fd1adc 100644 --- a/crates/swc/tests/errors/lints/no-empty-function/no-consider-comments/output.swc-stderr +++ b/crates/swc/tests/errors/lints/no-empty-function/no-consider-comments/output.swc-stderr @@ -2,6 +2,6 @@ x Unexpected empty function pattern ,-[1:1] 1 | ,-> function foo1() { - 2 | | // commnet into + 2 | | // comment into 3 | `-> } `---- diff --git a/crates/swc/tests/errors/lints/no-restricted-syntax/binary-operation/.swcrc b/crates/swc/tests/errors/lints/no-restricted-syntax/binary-operation/.swcrc index 295c49ff71b..4b4f0372d83 100644 --- a/crates/swc/tests/errors/lints/no-restricted-syntax/binary-operation/.swcrc +++ b/crates/swc/tests/errors/lints/no-restricted-syntax/binary-operation/.swcrc @@ -6,7 +6,7 @@ { "BinaryExpression": [ { - "message": "no 'in' expession", + "message": "no 'in' expression", "operator": "in" } ] @@ -14,4 +14,4 @@ ] } } -} \ No newline at end of file +} diff --git a/crates/swc/tests/errors/lints/no-restricted-syntax/binary-operation/output.swc-stderr b/crates/swc/tests/errors/lints/no-restricted-syntax/binary-operation/output.swc-stderr index e9710209bd1..b41134f03b2 100644 --- a/crates/swc/tests/errors/lints/no-restricted-syntax/binary-operation/output.swc-stderr +++ b/crates/swc/tests/errors/lints/no-restricted-syntax/binary-operation/output.swc-stderr @@ -1,11 +1,11 @@ - x no 'in' expession + x no 'in' expression ,---- 1 | 'a' in { a: 10 }; : ^^^^^^^^^^^^^^^^ `---- - x no 'in' expession + x no 'in' expression ,---- 6 | if ('a' in { a: 10 }) {} : ^^^^^^^^^^^^^^^^ diff --git a/crates/swc/tests/errors/lints/no-restricted-syntax/for-in-expr/.swcrc b/crates/swc/tests/errors/lints/no-restricted-syntax/for-in-expr/.swcrc index be6be7ce977..3964d7cbf68 100644 --- a/crates/swc/tests/errors/lints/no-restricted-syntax/for-in-expr/.swcrc +++ b/crates/swc/tests/errors/lints/no-restricted-syntax/for-in-expr/.swcrc @@ -5,10 +5,10 @@ "error", { "ForInExpression": { - "message": "no 'for-in' expession" + "message": "no 'for-in' expression" } } ] } } -} \ No newline at end of file +} diff --git a/crates/swc/tests/errors/lints/no-restricted-syntax/for-in-expr/output.swc-stderr b/crates/swc/tests/errors/lints/no-restricted-syntax/for-in-expr/output.swc-stderr index 90b91ac98a2..77c61665a3b 100644 --- a/crates/swc/tests/errors/lints/no-restricted-syntax/for-in-expr/output.swc-stderr +++ b/crates/swc/tests/errors/lints/no-restricted-syntax/for-in-expr/output.swc-stderr @@ -1,5 +1,5 @@ - x no 'for-in' expession + x no 'for-in' expression ,---- 1 | for (var x in {}) {} : ^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/swc/tests/errors/lints/no-restricted-syntax/for-of-expr/.swcrc b/crates/swc/tests/errors/lints/no-restricted-syntax/for-of-expr/.swcrc index d7c4d9454ee..e512ff0af7a 100644 --- a/crates/swc/tests/errors/lints/no-restricted-syntax/for-of-expr/.swcrc +++ b/crates/swc/tests/errors/lints/no-restricted-syntax/for-of-expr/.swcrc @@ -5,10 +5,10 @@ "error", { "ForOfExpression": { - "message": "no 'for-of' expession" + "message": "no 'for-of' expression" } } ] } } -} \ No newline at end of file +} diff --git a/crates/swc/tests/errors/lints/no-restricted-syntax/for-of-expr/output.swc-stderr b/crates/swc/tests/errors/lints/no-restricted-syntax/for-of-expr/output.swc-stderr index 3b2ab0bf5bf..6a7c3243eed 100644 --- a/crates/swc/tests/errors/lints/no-restricted-syntax/for-of-expr/output.swc-stderr +++ b/crates/swc/tests/errors/lints/no-restricted-syntax/for-of-expr/output.swc-stderr @@ -1,5 +1,5 @@ - x no 'for-of' expession + x no 'for-of' expression ,---- 1 | for (var x of {}) {} : ^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/swc/tests/fixture/issues-3xxx/issue-3686/1/input/index.ts b/crates/swc/tests/fixture/issues-3xxx/issue-3686/1/input/index.ts index 38f0d2e191f..21f258b1d7e 100644 --- a/crates/swc/tests/fixture/issues-3xxx/issue-3686/1/input/index.ts +++ b/crates/swc/tests/fixture/issues-3xxx/issue-3686/1/input/index.ts @@ -1,7 +1,7 @@ const CD: ClassDecorator = () => { } const PD: PropertyDecorator = () => { } -// Commenting out the decorators creates valid ouput. +// Commenting out the decorators creates valid output. @CD export class ServiceError extends Error { @PD diff --git a/crates/swc/tests/tsc.rs b/crates/swc/tests/tsc.rs index da9c73dbefb..44f2d1b8630 100644 --- a/crates/swc/tests/tsc.rs +++ b/crates/swc/tests/tsc.rs @@ -26,7 +26,7 @@ use testing::{NormalizedOutput, Tester}; "privateNameAndAny.ts", "privateNameAndIndexSignature.ts", "privateNameImplicitDeclaration.ts", - "privateNameStaticAccessorssDerivedClasses.ts", + "privateNameStaticAccessorsDerivedClasses.ts", "privateNameErrorsOnNotUseDefineForClassFieldsInEsNext.ts", "enumConstantMembers.ts", ) diff --git a/crates/swc/tests/vercel/full/ms/1/input/index.ts b/crates/swc/tests/vercel/full/ms/1/input/index.ts index 4bdba69597b..a097f8fd9e3 100644 --- a/crates/swc/tests/vercel/full/ms/1/input/index.ts +++ b/crates/swc/tests/vercel/full/ms/1/input/index.ts @@ -71,7 +71,7 @@ function ms(value: StringValue | number, options?: Options): number | string { } catch (error) { const message = isError(error) ? `${error.message}. value=${JSON.stringify(value)}` - : 'An unknown error has occured.'; + : 'An unknown error has occurred.'; throw new Error(message); } } @@ -195,4 +195,4 @@ function plural( */ function isError(error: unknown): error is Error { return typeof error === 'object' && error !== null && 'message' in error; -} \ No newline at end of file +} diff --git a/crates/swc/tests/vercel/full/ms/1/output/index.ts b/crates/swc/tests/vercel/full/ms/1/output/index.ts index 42fe2ea8891..fae6b9f1591 100644 --- a/crates/swc/tests/vercel/full/ms/1/output/index.ts +++ b/crates/swc/tests/vercel/full/ms/1/output/index.ts @@ -51,7 +51,7 @@ export default function(c, e) { if ("number" == typeof c && isFinite(c)) return (null == e ? void 0 : e.long) ? b(c) : a(c); throw new Error("Value is not a string or number."); } catch (f) { - var g = d(f) ? "".concat(f.message, ". value=").concat(JSON.stringify(c)) : "An unknown error has occured."; + var g = d(f) ? "".concat(f.message, ". value=").concat(JSON.stringify(c)) : "An unknown error has occurred."; throw new Error(g); } }; diff --git a/crates/swc_bundler/src/bundler/optimize.rs b/crates/swc_bundler/src/bundler/optimize.rs index 0d57f30b20e..c0a93d709b5 100644 --- a/crates/swc_bundler/src/bundler/optimize.rs +++ b/crates/swc_bundler/src/bundler/optimize.rs @@ -1,6 +1,6 @@ use swc_common::pass::Repeat; use swc_ecma_ast::*; -use swc_ecma_transforms_optimization::simplify::{const_propgation::constant_propagation, dce}; +use swc_ecma_transforms_optimization::simplify::{const_propagation::constant_propagation, dce}; use swc_ecma_visit::FoldWith; use crate::{Bundler, Load, Resolve}; diff --git a/crates/swc_bundler/tests/deno-exec/deno-9307/.case1/input/src/graphql/interfaceExtension.ts b/crates/swc_bundler/tests/deno-exec/deno-9307/.case1/input/src/graphql/interfaceExtension.ts index 86b7e1dbe8f..96775020785 100644 --- a/crates/swc_bundler/tests/deno-exec/deno-9307/.case1/input/src/graphql/interfaceExtension.ts +++ b/crates/swc_bundler/tests/deno-exec/deno-9307/.case1/input/src/graphql/interfaceExtension.ts @@ -30,22 +30,22 @@ const interfaceToAST = ( /** * We treat `anyOf` or `allOf` JsonSchema compositions as a _object extension_ * mechanism. - * + * * Example: - * + * * title: FooBar * allOf: * - $ref: "#/components/schemas/Foo" * - $ref: "#/components/schemas/Bar" - * + * * You could read the example as the object "FooBar" extends "Foo" and "Bar". - * + * * We use GraphQL _interface_ to improve query definitions, the "FooBar" object * type will implement "Foo" and "Bar" interfaces and if "Foo" exists somewhere * else, programmer can create single "FooInterface" GraphQL Fragment and use - * it for all occurences of "Foo" as well as for all types, which implements + * it for all occurrences of "Foo" as well as for all types, which implements * "FooInterface". - * + * * We must use schema extension for this task. During GraphQL distillation, if * "Foo" is distilled sooner than we reach "FooBar", the "Foo" object type is * already created, but we need the "Foo" object to self-extend "FooInterface". diff --git a/crates/swc_bundler/tests/deno-exec/deno-9307/.case1/input/src/graphql/validName test.ts b/crates/swc_bundler/tests/deno-exec/deno-9307/.case1/input/src/graphql/validName test.ts index 849113ac6c7..6271dd95b89 100644 --- a/crates/swc_bundler/tests/deno-exec/deno-9307/.case1/input/src/graphql/validName test.ts +++ b/crates/swc_bundler/tests/deno-exec/deno-9307/.case1/input/src/graphql/validName test.ts @@ -12,7 +12,7 @@ Deno.test({ }); Deno.test({ - name: `"toValidGraphQLName" shoud convert invalid GraphQL name to valid`, + name: `"toValidGraphQLName" should convert invalid GraphQL name to valid`, fn() { Object.entries({ "9foo": `foo`, diff --git a/crates/swc_bundler/tests/deno-exec/deno-9307/.case1/input/src/mod.ts b/crates/swc_bundler/tests/deno-exec/deno-9307/.case1/input/src/mod.ts index b61641ac350..b2d8197a923 100644 --- a/crates/swc_bundler/tests/deno-exec/deno-9307/.case1/input/src/mod.ts +++ b/crates/swc_bundler/tests/deno-exec/deno-9307/.case1/input/src/mod.ts @@ -20,7 +20,7 @@ export const main = async ( { loadFile, writeTextFile }: PlatformSpecificApi, ) => { const writeOutputFile = (path: string, data: string) => { - log(color.blue(`Writting file:\t${path}`)); + log(color.blue(`Writing file:\t${path}`)); return writeTextFile(path, data); }; diff --git a/crates/swc_common/src/plugin.rs b/crates/swc_common/src/plugin.rs index c689847e1d9..1937a2aea27 100644 --- a/crates/swc_common/src/plugin.rs +++ b/crates/swc_common/src/plugin.rs @@ -24,13 +24,13 @@ use crate::{syntax_pos::Mark, SyntaxContext}; pub enum PluginError { /// Occurs when failed to convert size passed from host / guest into usize /// or similar for the conversion. This is an internal error rasied via - /// plugin_macro, noramlly plugin author should not raise this manually. + /// plugin_macro, normally plugin author should not raise this manually. SizeInteropFailure(String), /// Occurs when failed to reconstruct a struct from `Serialized`. Deserialize(String), /// Occurs when failed to serialize a struct into `Serialized`. /// Unlike deserialize error, this error cannot forward any context for the - /// raw bytes: when serialze failed, there's nothing we can pass between + /// raw bytes: when serialize failed, there's nothing we can pass between /// runtime. Serialize(String), } @@ -104,7 +104,7 @@ impl Serialized { .with_context(|| format!("failed to deserialize `{}`", type_name::())) } - /// Convinient wrapper to Serialized::* to construct actual struct from raw + /// Convenient wrapper to Serialized::* to construct actual struct from raw /// ptr. This is common workflow on both of runtime (host / plugin) to /// deserialize struct from allocated / copied ptr. /// diff --git a/crates/swc_common/src/source_map.rs b/crates/swc_common/src/source_map.rs index 8c837fd3468..684770358fa 100644 --- a/crates/swc_common/src/source_map.rs +++ b/crates/swc_common/src/source_map.rs @@ -108,7 +108,7 @@ pub(super) struct SourceMapFiles { /// The interner for spans. /// -/// As most spans are simply stored, we store them as interend form. +/// As most spans are simply stored, we store them as interned form. /// /// - Each ast node only stores pointer to actual data ([BytePos]). /// - The pointers ([BytePos]) can be converted to file name, line and column diff --git a/crates/swc_common/src/syntax_pos/hygiene.rs b/crates/swc_common/src/syntax_pos/hygiene.rs index a5813e9cc04..392220b1a51 100644 --- a/crates/swc_common/src/syntax_pos/hygiene.rs +++ b/crates/swc_common/src/syntax_pos/hygiene.rs @@ -77,7 +77,7 @@ pub struct MutableMarkContext(pub u32, pub u32, pub u32); // proxies instead which'll call actual host fn. extern "C" { // Instead of trying to copy-serialize `Mark`, this fn directly consume - // inner raw value as well as fn and let each context constrcuts struct + // inner raw value as well as fn and let each context constructs struct // on their side. fn __mark_fresh_proxy(mark: u32) -> u32; fn __mark_parent_proxy(self_mark: u32) -> u32; diff --git a/crates/swc_css_lints/src/rules/color_hex_alpha.rs b/crates/swc_css_lints/src/rules/color_hex_alpha.rs index 9be4f3ea71e..9777febf820 100644 --- a/crates/swc_css_lints/src/rules/color_hex_alpha.rs +++ b/crates/swc_css_lints/src/rules/color_hex_alpha.rs @@ -43,7 +43,7 @@ impl Visit for ColorHexAlpha { Preference::Never if length == 4 || length == 8 => { self.ctx.report( hex_color, - format!("Unxpected alpha channel in '#{}'.", hex_color.value), + format!("Unexpected alpha channel in '#{}'.", hex_color.value), ); } _ => {} diff --git a/crates/swc_css_lints/src/rules/declaration_no_important.rs b/crates/swc_css_lints/src/rules/declaration_no_important.rs index 6a6531065c4..b34ea6797f5 100644 --- a/crates/swc_css_lints/src/rules/declaration_no_important.rs +++ b/crates/swc_css_lints/src/rules/declaration_no_important.rs @@ -20,7 +20,7 @@ const MESSAGE: &str = "Unexpected '!important'."; struct DeclarationNoImportant { ctx: LintRuleContext<()>, - // rule interal + // rule internal keyframe_rules: Vec, } diff --git a/crates/swc_css_lints/tests/rules/fail/color-hex-alpha/never/output.stderr b/crates/swc_css_lints/tests/rules/fail/color-hex-alpha/never/output.stderr index b44620bea4b..ecf902858ac 100644 --- a/crates/swc_css_lints/tests/rules/fail/color-hex-alpha/never/output.stderr +++ b/crates/swc_css_lints/tests/rules/fail/color-hex-alpha/never/output.stderr @@ -1,11 +1,11 @@ - x Unxpected alpha channel in '#ffff'. + x Unexpected alpha channel in '#ffff'. ,-[$DIR/tests/rules/fail/color-hex-alpha/never/input.css:1:1] 1 | a { color: #ffff; } : ^^^^^ `---- - x Unxpected alpha channel in '#ffffffff'. + x Unexpected alpha channel in '#ffffffff'. ,-[$DIR/tests/rules/fail/color-hex-alpha/never/input.css:2:1] 2 | a { color: #ffffffff; } : ^^^^^^^^^ diff --git a/crates/swc_css_parser/README.md b/crates/swc_css_parser/README.md index d5eca05587d..53506c89bf0 100644 --- a/crates/swc_css_parser/README.md +++ b/crates/swc_css_parser/README.md @@ -25,4 +25,4 @@ The name of a test is `base64_url(md5(name))`. Apache 2.0 / MIT, at your option. -Lots of tests are copied from rome toools and esbuild. If you want to use tests, please consult license of those libraries. +Lots of tests are copied from rome tools and esbuild. If you want to use tests, please consult license of those libraries. diff --git a/crates/swc_css_parser/src/lib.rs b/crates/swc_css_parser/src/lib.rs index 185d6e9d56d..9e49a6bae38 100644 --- a/crates/swc_css_parser/src/lib.rs +++ b/crates/swc_css_parser/src/lib.rs @@ -37,7 +37,7 @@ where /// Parse a given string as `T`. /// -/// If there are syntax errors but if it was recoverable, it will be appendend +/// If there are syntax errors but if it was recoverable, it will be appended /// to `errors`. pub fn parse_str<'a, T>( src: &'a str, @@ -59,7 +59,7 @@ where /// Parse a given file as `T`. /// -/// If there are syntax errors but if it was recoverable, it will be appendend +/// If there are syntax errors but if it was recoverable, it will be appended /// to `errors`. pub fn parse_file<'a, T>( fm: &'a SourceFile, @@ -79,7 +79,7 @@ where /// Parse a given file as `T`. /// -/// If there are syntax errors but if it was recoverable, it will be appendend +/// If there are syntax errors but if it was recoverable, it will be appended /// to `errors`. pub fn parse_tokens<'a, T>( tokens: &'a Tokens, diff --git a/crates/swc_ecma_codegen/examples/gen.rs b/crates/swc_ecma_codegen/examples/gen.rs index 0b24e49f661..af5cc1bbf5a 100644 --- a/crates/swc_ecma_codegen/examples/gen.rs +++ b/crates/swc_ecma_codegen/examples/gen.rs @@ -49,7 +49,7 @@ fn parse_and_gen(entry: &Path) { .expect("failed to process a module"); } -/// Usage: ./scripts/instruements path/to/input/file +/// Usage: ./scripts/instruments path/to/input/file fn main() { let main_file = env::args().nth(1).unwrap(); diff --git a/crates/swc_ecma_codegen/tests/test262.rs b/crates/swc_ecma_codegen/tests/test262.rs index 6d05a5cf57d..202c83b24db 100644 --- a/crates/swc_ecma_codegen/tests/test262.rs +++ b/crates/swc_ecma_codegen/tests/test262.rs @@ -15,7 +15,7 @@ use swc_ecma_parser::{lexer::Lexer, Parser, StringInput, Syntax}; use testing::NormalizedOutput; const IGNORED_PASS_TESTS: &[&str] = &[ - // Temporalily ignored + // Temporally ignored "431ecef8c85d4d24.js", "8386fbff927a9e0e.js", "5654d4106d7025c2.js", diff --git a/crates/swc_ecma_lints/src/rules/no_empty_function.rs b/crates/swc_ecma_lints/src/rules/no_empty_function.rs index bf310cfe543..cf593d75483 100644 --- a/crates/swc_ecma_lints/src/rules/no_empty_function.rs +++ b/crates/swc_ecma_lints/src/rules/no_empty_function.rs @@ -29,7 +29,7 @@ enum FunctionModifiers { } impl FunctionModifiers { - fn get_human_redable(&self) -> &'static str { + fn get_human_readable(&self) -> &'static str { match self { FunctionModifiers::Generator => "generator", FunctionModifiers::Getter => "getter", @@ -189,7 +189,7 @@ impl NoEmptyFunction { let message = if let Some(fn_modifier) = function_type { format!( "Unexpected empty {} {} pattern", - fn_modifier.get_human_redable(), + fn_modifier.get_human_readable(), target_type ) } else { diff --git a/crates/swc_ecma_lints/src/rules/no_loop_func.rs b/crates/swc_ecma_lints/src/rules/no_loop_func.rs index 3990ba97b0d..6fd8a5ff538 100644 --- a/crates/swc_ecma_lints/src/rules/no_loop_func.rs +++ b/crates/swc_ecma_lints/src/rules/no_loop_func.rs @@ -92,7 +92,7 @@ impl NoLoopFunc { .any(|scope| self.scoped_unsafe_vars.get(scope).unwrap().contains(id)) } - fn extact_vars(&mut self, pat: &Pat) { + fn extract_vars(&mut self, pat: &Pat) { match pat { Pat::Ident(ident) => { self.scoped_unsafe_vars @@ -103,7 +103,7 @@ impl NoLoopFunc { Pat::Array(ArrayPat { elems, .. }) => { elems.iter().for_each(|elem| { if let Some(elem) = elem { - self.extact_vars(elem); + self.extract_vars(elem); } }); } @@ -116,18 +116,18 @@ impl NoLoopFunc { .insert(key.to_id()); } ObjectPatProp::KeyValue(KeyValuePatProp { value, .. }) => { - self.extact_vars(value.as_ref()); + self.extract_vars(value.as_ref()); } ObjectPatProp::Rest(RestPat { arg, .. }) => { - self.extact_vars(arg.as_ref()); + self.extract_vars(arg.as_ref()); } }); } Pat::Rest(RestPat { arg, .. }) => { - self.extact_vars(arg.as_ref()); + self.extract_vars(arg.as_ref()); } Pat::Assign(AssignPat { left, .. }) => { - self.extact_vars(left.as_ref()); + self.extract_vars(left.as_ref()); } Pat::Invalid(_) => {} Pat::Expr(_) => {} @@ -262,7 +262,7 @@ impl Visit for NoLoopFunc { _ => {} }; - self.extact_vars(&var_declarator.name); + self.extract_vars(&var_declarator.name); } fn visit_function(&mut self, function: &Function) { diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/input.js b/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/input.js index 2065ed1b0d3..5877db96e5e 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/input.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/input.js @@ -3786,7 +3786,7 @@ var Set = (global_window__WEBPACK_IMPORTED_MODULE_0___default().Set) ? (global_w var Component$1 = /*#__PURE__*/function () { /** * A callback that is called when a component is ready. Does not have any - * paramters and any callback value will be ignored. + * parameters and any callback value will be ignored. * * @callback Component~ReadyCallback * @this Component @@ -54620,4 +54620,4 @@ if (!videojs.getPlugin || !videojs.getPlugin('reloadSourceOnError')) { /***/ }) -}]); \ No newline at end of file +}]); diff --git a/crates/swc_ecma_parser/benches/lexer.rs b/crates/swc_ecma_parser/benches/lexer.rs index a6b7fde8ae6..b65cdeec52d 100644 --- a/crates/swc_ecma_parser/benches/lexer.rs +++ b/crates/swc_ecma_parser/benches/lexer.rs @@ -40,7 +40,7 @@ fn bench_files(c: &mut Criterion) { ) }); - c.bench_function("jqeury", |b| { + c.bench_function("jquery", |b| { bench_module( b, Default::default(), diff --git a/crates/swc_ecma_parser/benches/parser.rs b/crates/swc_ecma_parser/benches/parser.rs index 3d71378b838..b3f0e97502a 100644 --- a/crates/swc_ecma_parser/benches/parser.rs +++ b/crates/swc_ecma_parser/benches/parser.rs @@ -47,7 +47,7 @@ fn bench_files(c: &mut Criterion) { ) }); - c.bench_function("jqeury", |b| { + c.bench_function("jquery", |b| { bench_module( b, Default::default(), diff --git a/crates/swc_ecma_parser/src/lib.rs b/crates/swc_ecma_parser/src/lib.rs index ab0015febb8..f4d61d9d7cb 100644 --- a/crates/swc_ecma_parser/src/lib.rs +++ b/crates/swc_ecma_parser/src/lib.rs @@ -426,7 +426,7 @@ macro_rules! expose { $T:ty, $($t:tt)* ) => { - /// Note: This is reccomended way to parse a file. + /// Note: This is recommended way to parse a file. /// /// This is an alias for [Parser], [Lexer] and [SourceFileInput], but /// instantiation of generics occur in `swc_ecma_parser` crate. diff --git a/crates/swc_ecma_parser/tests/tsc/privateNameStaticAccessorssDerivedClasses.json b/crates/swc_ecma_parser/tests/tsc/privateNameStaticAccessorsDerivedClasses.json similarity index 100% rename from crates/swc_ecma_parser/tests/tsc/privateNameStaticAccessorssDerivedClasses.json rename to crates/swc_ecma_parser/tests/tsc/privateNameStaticAccessorsDerivedClasses.json diff --git a/crates/swc_ecma_parser/tests/tsc/privateNameStaticAccessorssDerivedClasses.ts b/crates/swc_ecma_parser/tests/tsc/privateNameStaticAccessorsDerivedClasses.ts similarity index 100% rename from crates/swc_ecma_parser/tests/tsc/privateNameStaticAccessorssDerivedClasses.ts rename to crates/swc_ecma_parser/tests/tsc/privateNameStaticAccessorsDerivedClasses.ts diff --git a/crates/swc_ecma_preset_env/src/lib.rs b/crates/swc_ecma_preset_env/src/lib.rs index 74f650723ff..97b06a8d024 100644 --- a/crates/swc_ecma_preset_env/src/lib.rs +++ b/crates/swc_ecma_preset_env/src/lib.rs @@ -177,7 +177,7 @@ where ); // ES2016 - let pass = add!(pass, ExponentiationOperator, es2016::exponentation()); + let pass = add!(pass, ExponentiationOperator, es2016::exponentiation()); // ES2015 let pass = add!(pass, BlockScopedFunctions, es2015::block_scoped_functions()); diff --git a/crates/swc_ecma_transforms/tests/decorators.rs b/crates/swc_ecma_transforms/tests/decorators.rs index ca1c08cfca3..78110e3d82e 100644 --- a/crates/swc_ecma_transforms/tests/decorators.rs +++ b/crates/swc_ecma_transforms/tests/decorators.rs @@ -544,7 +544,7 @@ expect(log).toEqual(numsFrom0to9); "# ); -// transformation_initiailzer_after_super_bug_8808 +// transformation_initializer_after_super_bug_8808 test!( syntax(false), |t| transformation(t), @@ -1997,7 +1997,7 @@ expect(j).toBe(1); "# ); -// element_descriptors_original_own_field_without_initiailzer_exec +// element_descriptors_original_own_field_without_initializer_exec test_exec!( syntax(false), |t| tr(t), diff --git a/crates/swc_ecma_transforms_base/benches/assets/AjaxObservable.ts b/crates/swc_ecma_transforms_base/benches/assets/AjaxObservable.ts index 7ff070c1e4c..c628acabb60 100644 --- a/crates/swc_ecma_transforms_base/benches/assets/AjaxObservable.ts +++ b/crates/swc_ecma_transforms_base/benches/assets/AjaxObservable.ts @@ -204,7 +204,7 @@ export class AjaxSubscriber extends Subscriber { progressSubscriber?.error?.(e); let error; try { - error = new AjaxTimeoutError(xhr, request); // TODO: Make betterer. + error = new AjaxTimeoutError(xhr, request); // TODO: Make better. } catch (err) { error = err; } @@ -402,7 +402,7 @@ const AjaxTimeoutErrorImpl = (() => { })(); /** - * Thrown when an AJAX request timesout. Not to be confused with {@link TimeoutError}. + * Thrown when an AJAX request timeout. Not to be confused with {@link TimeoutError}. * * This is exported only because it is useful for checking to see if errors are an * `instanceof AjaxTimeoutError`. DO NOT use the constructor to create an instance of @@ -411,4 +411,4 @@ const AjaxTimeoutErrorImpl = (() => { * @class AjaxTimeoutError * @see ajax */ -export const AjaxTimeoutError: AjaxTimeoutErrorCtor = AjaxTimeoutErrorImpl as any; \ No newline at end of file +export const AjaxTimeoutError: AjaxTimeoutErrorCtor = AjaxTimeoutErrorImpl as any; diff --git a/crates/swc_ecma_transforms_base/src/fixer.rs b/crates/swc_ecma_transforms_base/src/fixer.rs index 626d4816785..8e6c947383e 100644 --- a/crates/swc_ecma_transforms_base/src/fixer.rs +++ b/crates/swc_ecma_transforms_base/src/fixer.rs @@ -577,7 +577,7 @@ impl VisitMut for Fixer<'_> { fn visit_mut_stmt(&mut self, s: &mut Stmt) { let old = self.ctx; - // only ExprStmt would have unparened expr, + // only ExprStmt would have unparented expr, // which would be handled in its own visit function self.ctx = Context::FreeExpr; s.visit_mut_children_with(self); diff --git a/crates/swc_ecma_transforms_compat/src/es2015/for_of.rs b/crates/swc_ecma_transforms_compat/src/es2015/for_of.rs index 5075fe32796..c9bd8b0d2d4 100644 --- a/crates/swc_ecma_transforms_compat/src/es2015/for_of.rs +++ b/crates/swc_ecma_transforms_compat/src/es2015/for_of.rs @@ -141,7 +141,7 @@ impl ForOf { assert_eq!( var.decls.len(), 1, - "Variable declarator of for of loop cannot contain multiple entires" + "Variable declarator of for of loop cannot contain multiple entries" ); prepend( &mut body.stmts, @@ -384,7 +384,6 @@ impl ForOf { } /// ```js -/// /// try { /// if (!_iteratorNormalCompletion && _iterator.return != null) { /// _iterator.return(); diff --git a/crates/swc_ecma_transforms_compat/src/es2016/exponentation.rs b/crates/swc_ecma_transforms_compat/src/es2016/exponentiation.rs similarity index 92% rename from crates/swc_ecma_transforms_compat/src/es2016/exponentation.rs rename to crates/swc_ecma_transforms_compat/src/es2016/exponentiation.rs index 00dd1d3473d..ad4dd1ca6a6 100644 --- a/crates/swc_ecma_transforms_compat/src/es2016/exponentation.rs +++ b/crates/swc_ecma_transforms_compat/src/es2016/exponentiation.rs @@ -26,16 +26,16 @@ use swc_trace_macro::swc_trace; /// x = Math.pow(x, 3); /// ``` #[tracing::instrument(level = "info", skip_all)] -pub fn exponentation() -> impl Fold + VisitMut { - as_folder(Exponentation::default()) +pub fn exponentiation() -> impl Fold + VisitMut { + as_folder(Exponentiation::default()) } #[derive(Default)] -struct Exponentation { +struct Exponentiation { vars: Vec, } -impl Parallel for Exponentation { +impl Parallel for Exponentiation { fn create(&self) -> Self { Self::default() } @@ -46,7 +46,7 @@ impl Parallel for Exponentation { } #[swc_trace] -impl ParExplode for Exponentation { +impl ParExplode for Exponentiation { fn after_one_stmt(&mut self, stmts: &mut Vec) { if !self.vars.is_empty() { stmts.push(Stmt::Decl(Decl::Var(VarDecl { @@ -72,7 +72,7 @@ impl ParExplode for Exponentation { #[swc_trace] #[parallel(explode)] -impl VisitMut for Exponentation { +impl VisitMut for Exponentiation { noop_visit_mut_type!(); fn visit_mut_expr(&mut self, e: &mut Expr) { @@ -148,7 +148,7 @@ mod tests { test!( ::swc_ecma_parser::Syntax::default(), - |_| exponentation(), + |_| exponentiation(), babel_binary, "2 ** 2", "Math.pow(2, 2)" @@ -157,7 +157,7 @@ mod tests { test_exec!( ignore, ::swc_ecma_parser::Syntax::default(), - |_| exponentation(), + |_| exponentiation(), babel_comprehensive, r#"expect(2 ** 3).toBe(8); expect(3 * 2 ** 3).toBe(24); @@ -186,7 +186,7 @@ expect(2 ** 3 ** 2).toBe(512);"# // FIXME ignore, ::swc_ecma_parser::Syntax::default(), - |_| exponentation(), + |_| exponentiation(), babel_memoize_object, r#"var counters = 0; Object.defineProperty(global, "reader", { @@ -202,7 +202,7 @@ expect(counters).toBe(1);"# test!( ::swc_ecma_parser::Syntax::default(), - |_| exponentation(), + |_| exponentiation(), assign, r#"x **= 3"#, r#"x = Math.pow(x, 3)"#, @@ -210,7 +210,7 @@ expect(counters).toBe(1);"# ); // test!(::swc_ecma_parser::Syntax::default(), - // |_| exponentation(), + // |_| exponentiation(), // babel_4403, // "var a, b; // a[`${b++}`] **= 1;", @@ -222,7 +222,7 @@ expect(counters).toBe(1);"# test!( ::swc_ecma_parser::Syntax::default(), - |_| exponentation(), + |_| exponentiation(), issue_740, "self.a = 10 ** 2", "self.a = Math.pow(10, 2)", @@ -233,7 +233,7 @@ expect(counters).toBe(1);"# // bu JakeChampion test!( ::swc_ecma_parser::Syntax::default(), - |_| exponentation(), + |_| exponentiation(), babel_binary_member_assignment_expression, "var x = {}; x.a = 2 ** 2", "var x = {}; x.a = Math.pow(2, 2)" @@ -241,7 +241,7 @@ expect(counters).toBe(1);"# test!( ::swc_ecma_parser::Syntax::default(), - |_| exponentation(), + |_| exponentiation(), assign_to_object_property, r#"var self = {}; self.x **= 3"#, r#"var self = {}; var ref = self.x; self.x = Math.pow(ref, 3);"#, diff --git a/crates/swc_ecma_transforms_compat/src/es2016/mod.rs b/crates/swc_ecma_transforms_compat/src/es2016/mod.rs index ea9100d6c61..c242409fa0a 100644 --- a/crates/swc_ecma_transforms_compat/src/es2016/mod.rs +++ b/crates/swc_ecma_transforms_compat/src/es2016/mod.rs @@ -1,10 +1,10 @@ use swc_ecma_visit::Fold; -pub use self::exponentation::exponentation; +pub use self::exponentiation::exponentiation; -mod exponentation; +mod exponentiation; #[tracing::instrument(level = "info", skip_all)] pub fn es2016() -> impl Fold { - exponentation() + exponentiation() } diff --git a/crates/swc_ecma_transforms_compat/tests/es2015_classes.rs b/crates/swc_ecma_transforms_compat/tests/es2015_classes.rs index 0e2bbf674ff..2642ff6b8a5 100644 --- a/crates/swc_ecma_transforms_compat/tests/es2015_classes.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2015_classes.rs @@ -110,7 +110,7 @@ let Sub = function(Foo) { _inherits(Sub, Foo); var _super = _createSuper(Sub); - + function Sub() { _classCallCheck(this, Sub); var _this; @@ -788,7 +788,7 @@ var Foo = function(Bar) { _inherits(Foo, Bar); var _super = _createSuper(Foo); - + function Foo() { _classCallCheck(this, Foo); var _this; @@ -826,28 +826,28 @@ class Test extends Foo { var Test = /*#__PURE__*/function (Foo) { "use strict"; _inherits(Test, Foo); - + var _super = _createSuper(Test); - + function Test() { _classCallCheck(this, Test); - + var _this = _super.call(this); _get((_assertThisInitialized(_this), _getPrototypeOf(Test.prototype)), "test", _this).whatever(); - + _get((_assertThisInitialized(_this), _getPrototypeOf(Test.prototype)), "test", _this).call(_this); return _this; } - + _createClass(Test, null, [{ key: "test", value: function test() { return _get(_getPrototypeOf(Test), "wow", this).call(this); } }]); - + return Test; }(Foo); "# @@ -1690,7 +1690,7 @@ expect(new Outer().hello()).toBe('hello'); "# ); -// spec_super_reference_in_prop_exression +// spec_super_reference_in_prop_expression test!( syntax(), |t| spec_tr(t), @@ -1706,19 +1706,19 @@ class Foo extends Bar { var Foo = /*#__PURE__*/function (Bar) { "use strict"; _inherits(Foo, Bar); - + var _super = _createSuper(Foo); - + function Foo() { _classCallCheck(this, Foo); var _this; - _get((_assertThisInitialized(_this), _getPrototypeOf(Foo.prototype)), (_this = _super.call(this)).method, _this).call(_this); + _get((_assertThisInitialized(_this), _getPrototypeOf(Foo.prototype)), (_this = _super.call(this)).method, _this).call(_this); return _possibleConstructorReturn(_this); } - + return Foo; }(Bar); "# @@ -1857,8 +1857,8 @@ class Test extends Foo { _inherits(Test, Foo); var _super = _createSuper(Test); - - function Test() { + + function Test() { _classCallCheck(this, Test); var _this = _super.call(this); @@ -2509,7 +2509,7 @@ expect(obj.test).toBe(3); "# ); -// spec_derived_constructor_no_super_return_falsey +// spec_derived_constructor_no_super_return_falsy test!( syntax(), |t| spec_tr(t), @@ -4831,7 +4831,7 @@ expect(t2).toBeInstanceOf(Array); "# ); -// spec_super_reference_in_prop_exression_exec +// spec_super_reference_in_prop_expression_exec test_exec!( // babel also fails on this ignore, @@ -5123,7 +5123,7 @@ let Foo = /*#__PURE__*/function (Bar) { // extend_builtins_shadowed test!( - // Cost is too high while being uesless + // Cost is too high while being useless ignore, syntax(), |t| tr(t), @@ -7212,9 +7212,9 @@ test!( r#" class Test extends Foo { "foo"() {} - + get foo() {} - + set foo(a) {} } "#, diff --git a/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs b/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs index 347e2769f0a..0869e4e6cad 100644 --- a/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs @@ -774,7 +774,7 @@ test!( ); test!( - // optimiation is not implemented + // optimization is not implemented ignore, syntax(), |_| tr(Default::default()), @@ -1873,8 +1873,8 @@ test!( " class A { a = 1 + ((...a) => a) - b = (...b) => b + this - static c = (c = 123) => c + this + b = (...b) => b + this + static c = (c = 123) => c + this } ", " diff --git a/crates/swc_ecma_transforms_compat/tests/es2022_class_properties.rs b/crates/swc_ecma_transforms_compat/tests/es2022_class_properties.rs index fcb6637211f..aa19ce41745 100644 --- a/crates/swc_ecma_transforms_compat/tests/es2022_class_properties.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2022_class_properties.rs @@ -7,7 +7,7 @@ use swc_ecma_parser::{EsConfig, Syntax}; use swc_ecma_transforms_base::resolver::resolver; use swc_ecma_transforms_compat::{ es2015::{arrow, block_scoping, classes, function_name, template_literal}, - es2016::exponentation, + es2016::exponentiation, es2017::async_to_generator, es2022::class_properties, es3::reserved_words, @@ -3557,7 +3557,7 @@ for (let i = 0; i <= 10; ++i) { return this.#bar; } } - + classes.push(A) } @@ -4514,7 +4514,7 @@ test!( syntax(), |t| chain!( class_properties(Some(t.comments.clone()), Default::default()), - exponentation(), + exponentiation(), classes(Some(t.comments.clone()), Default::default()), block_scoping(), ), diff --git a/crates/swc_ecma_transforms_module/src/path.rs b/crates/swc_ecma_transforms_module/src/path.rs index 3d194eb9457..b510be4dc28 100644 --- a/crates/swc_ecma_transforms_module/src/path.rs +++ b/crates/swc_ecma_transforms_module/src/path.rs @@ -58,7 +58,7 @@ pub trait ImportResolver { fn resolve_import(&self, base: &FileName, module_specifier: &str) -> Result; } -/// [ImportResolver] implementation which just uses orignal source. +/// [ImportResolver] implementation which just uses original source. #[derive(Debug, Clone, Copy, Default)] pub struct NoopImportResolver; diff --git a/crates/swc_ecma_transforms_module/src/system_js.rs b/crates/swc_ecma_transforms_module/src/system_js.rs index f7d420ffcb6..f4f89b14861 100644 --- a/crates/swc_ecma_transforms_module/src/system_js.rs +++ b/crates/swc_ecma_transforms_module/src/system_js.rs @@ -392,12 +392,12 @@ impl SystemJs { fn hoist_var_decl(&mut self, var_decl: VarDecl) -> Option { let mut exprs = vec![]; - for var_declartor in var_decl.decls { + for var_declarator in var_decl.decls { let mut tos = vec![]; - var_declartor.visit_with(&mut VarCollector { to: &mut tos }); + var_declarator.visit_with(&mut VarCollector { to: &mut tos }); for (sym, ctxt) in tos { - if var_declartor.init.is_none() { + if var_declarator.init.is_none() { for (k, v) in self.export_map.iter_mut() { if (sym.clone(), ctxt) == *k { for value in v.iter() { @@ -412,11 +412,11 @@ impl SystemJs { .push(Ident::new(sym, DUMMY_SP.with_ctxt(ctxt))); } - if let Some(init) = var_declartor.init { + if let Some(init) = var_declarator.init { exprs.push(Box::new(Expr::Assign(AssignExpr { span: DUMMY_SP, op: op!("="), - left: PatOrExpr::Pat(Box::new(var_declartor.name)), + left: PatOrExpr::Pat(Box::new(var_declarator.name)), right: init, }))); } @@ -433,12 +433,12 @@ impl SystemJs { fn hoist_for_var_decl(&mut self, var_decl_or_pat: VarDeclOrPat) -> VarDeclOrPat { if let VarDeclOrPat::VarDecl(mut var_decl) = var_decl_or_pat { if var_decl.kind == VarDeclKind::Var { - let var_declartor = var_decl.decls.remove(0); + let var_declarator = var_decl.decls.remove(0); let mut tos = vec![]; - var_declartor.visit_with(&mut VarCollector { to: &mut tos }); + var_declarator.visit_with(&mut VarCollector { to: &mut tos }); for to in tos { - if var_declartor.init.is_none() { + if var_declarator.init.is_none() { for (k, v) in self.export_map.iter_mut() { if to == *k { for value in v.iter() { @@ -453,7 +453,7 @@ impl SystemJs { .push(Ident::new(to.0, DUMMY_SP.with_ctxt(to.1))); } - VarDeclOrPat::Pat(var_declartor.name) + VarDeclOrPat::Pat(var_declarator.name) } else { VarDeclOrPat::VarDecl(var_decl) } @@ -834,15 +834,15 @@ impl Fold for SystemJs { decls: vec![], ..var_decl }; - for var_declartor in var_decl.decls { + for var_declarator in var_decl.decls { let mut tos = vec![]; - var_declartor.visit_with(&mut VarCollector { to: &mut tos }); + var_declarator.visit_with(&mut VarCollector { to: &mut tos }); for to in tos { let ident = Ident::new(to.0.clone(), DUMMY_SP.with_ctxt(to.1)); self.add_export_name(to, ident.sym.clone()); } - decl.decls.push(var_declartor); + decl.decls.push(var_declarator); } execute_stmts.push(Stmt::Decl(Decl::Var(decl))); } diff --git a/crates/swc_ecma_transforms_optimization/src/json_parse.rs b/crates/swc_ecma_transforms_optimization/src/json_parse.rs index 73e8e086818..27797e7fe48 100644 --- a/crates/swc_ecma_transforms_optimization/src/json_parse.rs +++ b/crates/swc_ecma_transforms_optimization/src/json_parse.rs @@ -23,7 +23,7 @@ use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWit /// JSON.parse('{"a":1, "b"}') /// ``` /// -/// # COnditions +/// # Conditions /// If any of the conditions below is matched, pure object literal is converter /// to `JSON.parse` /// diff --git a/crates/swc_ecma_transforms_optimization/src/simplify/const_propgation.rs b/crates/swc_ecma_transforms_optimization/src/simplify/const_propagation.rs similarity index 100% rename from crates/swc_ecma_transforms_optimization/src/simplify/const_propgation.rs rename to crates/swc_ecma_transforms_optimization/src/simplify/const_propagation.rs diff --git a/crates/swc_ecma_transforms_optimization/src/simplify/expr/mod.rs b/crates/swc_ecma_transforms_optimization/src/simplify/expr/mod.rs index 769b46623cb..27ca0a21936 100644 --- a/crates/swc_ecma_transforms_optimization/src/simplify/expr/mod.rs +++ b/crates/swc_ecma_transforms_optimization/src/simplify/expr/mod.rs @@ -50,7 +50,7 @@ pub fn expr_simplifier(config: Config) -> impl RepeatedJsPass + VisitMut + 'stat struct SimplifyExpr { config: Config, changed: bool, - /// Uninitializd variables. + /// Uninitialized variables. vars: Vec, is_arg_of_update: bool, is_modifying: bool, diff --git a/crates/swc_ecma_transforms_optimization/src/simplify/mod.rs b/crates/swc_ecma_transforms_optimization/src/simplify/mod.rs index 57432145f94..f3054bb6cc1 100644 --- a/crates/swc_ecma_transforms_optimization/src/simplify/mod.rs +++ b/crates/swc_ecma_transforms_optimization/src/simplify/mod.rs @@ -8,7 +8,7 @@ pub use self::{ }; mod branch; -pub mod const_propgation; +pub mod const_propagation; pub mod dce; mod expr; pub mod inlining; diff --git a/crates/swc_ecma_transforms_testing/src/lib.rs b/crates/swc_ecma_transforms_testing/src/lib.rs index 00231dbb1e2..66049f4e757 100644 --- a/crates/swc_ecma_transforms_testing/src/lib.rs +++ b/crates/swc_ecma_transforms_testing/src/lib.rs @@ -396,7 +396,7 @@ where let src_without_helpers = tester.print(&module, &tester.comments.clone()); module = module.fold_with(&mut inject_helpers()); - let transfromed_src = tester.print(&module, &tester.comments.clone()); + let transformed_src = tester.print(&module, &tester.comments.clone()); println!( "\t>>>>> Orig <<<<<\n{}\n\t>>>>> Code <<<<<\n{}", @@ -407,7 +407,7 @@ where println!("\t>>>>> Expected stdout <<<<<\n{}", expected); - let actual = stdout_of(&transfromed_src).unwrap(); + let actual = stdout_of(&transformed_src).unwrap(); assert_eq!(expected, actual); diff --git a/crates/swc_ecma_transforms_typescript/benches/assets/AjaxObservable.ts b/crates/swc_ecma_transforms_typescript/benches/assets/AjaxObservable.ts index 48bd50e8aca..9019dac22bc 100644 --- a/crates/swc_ecma_transforms_typescript/benches/assets/AjaxObservable.ts +++ b/crates/swc_ecma_transforms_typescript/benches/assets/AjaxObservable.ts @@ -204,7 +204,7 @@ export class AjaxSubscriber extends Subscriber { progressSubscriber?.error?.(e); let error; try { - error = new AjaxTimeoutError(xhr, request); // TODO: Make betterer. + error = new AjaxTimeoutError(xhr, request); // TODO: Make better. } catch (err) { error = err; } @@ -402,7 +402,7 @@ const AjaxTimeoutErrorImpl = (() => { })(); /** - * Thrown when an AJAX request timesout. Not to be confused with {@link TimeoutError}. + * Thrown when an AJAX request timeout. Not to be confused with {@link TimeoutError}. * * This is exported only because it is useful for checking to see if errors are an * `instanceof AjaxTimeoutError`. DO NOT use the constructor to create an instance of @@ -411,4 +411,4 @@ const AjaxTimeoutErrorImpl = (() => { * @class AjaxTimeoutError * @see ajax */ -export const AjaxTimeoutError: AjaxTimeoutErrorCtor = AjaxTimeoutErrorImpl as any; \ No newline at end of file +export const AjaxTimeoutError: AjaxTimeoutErrorCtor = AjaxTimeoutErrorImpl as any; diff --git a/crates/swc_ecma_transforms_typescript/benches/compat.rs b/crates/swc_ecma_transforms_typescript/benches/compat.rs index 8d9f85cd13a..cb0eaba2818 100644 --- a/crates/swc_ecma_transforms_typescript/benches/compat.rs +++ b/crates/swc_ecma_transforms_typescript/benches/compat.rs @@ -108,7 +108,7 @@ fn single_tr_group(c: &mut Criterion) { es2019_optional_catch_binding, ); c.bench_function("es2017_async_to_generator", es2017_async_to_generator); - c.bench_function("es2016_exponentation", es2016_exponentation); + c.bench_function("es2016_exponentiation", es2016_exponentiation); c.bench_function("es2015_arrow", es2015_arrow); c.bench_function("es2015_block_scoped_fn", es2015_block_scoped_fn); c.bench_function("es2015_block_scoping", es2015_block_scoping); @@ -190,8 +190,8 @@ fn es2016(b: &mut Bencher) { run(b, swc_ecma_transforms_compat::es2016); } -fn es2016_exponentation(b: &mut Bencher) { - run(b, swc_ecma_transforms_compat::es2016::exponentation); +fn es2016_exponentiation(b: &mut Bencher) { + run(b, swc_ecma_transforms_compat::es2016::exponentiation); } fn es2015(b: &mut Bencher) { diff --git a/crates/swc_ecma_utils/src/function/fn_env_hoister.rs b/crates/swc_ecma_utils/src/function/fn_env_hoister.rs index 3aa101851a8..9e0523e1e44 100644 --- a/crates/swc_ecma_utils/src/function/fn_env_hoister.rs +++ b/crates/swc_ecma_utils/src/function/fn_env_hoister.rs @@ -12,7 +12,7 @@ struct SuperField { ident: IndexMap, } -/// Don't use it aginst function, it will stop if come across any function +/// Don't use it against function, it will stop if come across any function /// use it against function body #[derive(Default)] diff --git a/crates/swc_estree_ast/src/class.rs b/crates/swc_estree_ast/src/class.rs index 4d18c4e8745..c374e2d0ead 100644 --- a/crates/swc_estree_ast/src/class.rs +++ b/crates/swc_estree_ast/src/class.rs @@ -135,7 +135,7 @@ struct BabelClassMethod<'a> { #[derive(Serialize)] struct AcornClassMethodValue<'a> { - /// `FuncionExpression` + /// `FunctionExpression` #[serde(rename = "type")] type_: &'a str, #[serde(flatten)] diff --git a/crates/swc_estree_ast/src/decl.rs b/crates/swc_estree_ast/src/decl.rs index 59d65676aae..1aa94498c5c 100644 --- a/crates/swc_estree_ast/src/decl.rs +++ b/crates/swc_estree_ast/src/decl.rs @@ -40,7 +40,7 @@ pub enum Declaration { ImportDecl(ImportDeclaration), #[tag("DeclareClass")] DeclClass(DeclareClass), - #[tag("DeclareFuncction")] + #[tag("DeclareFunction")] DeclFunc(DeclareFunction), #[tag("DeclareInterface")] DeclInterface(DeclareInterface), @@ -68,7 +68,7 @@ pub enum Declaration { EnumDecl(EnumDeclaration), #[tag("TSDeclareFunction")] TSDeclFunc(TSDeclareFunction), - #[tag("TSIterfaceDeclaration")] + #[tag("TSInterfaceDeclaration")] TSInterfaceDecl(TSInterfaceDeclaration), #[tag("TSTypeAliasDeclaration")] TSTypeAliasDecl(TSTypeAliasDeclaration), diff --git a/crates/swc_estree_ast/src/object.rs b/crates/swc_estree_ast/src/object.rs index e2cbb8783c9..7fea8ede3b9 100644 --- a/crates/swc_estree_ast/src/object.rs +++ b/crates/swc_estree_ast/src/object.rs @@ -148,7 +148,7 @@ impl Serialize for ObjectMethod { #[derive(Serialize)] struct AcornObjectMethodValue<'a> { - /// `FuncionExpression` + /// `FunctionExpression` #[serde(rename = "type")] type_: &'static str, #[serde(flatten)] diff --git a/crates/swc_estree_ast/src/typescript.rs b/crates/swc_estree_ast/src/typescript.rs index fba2112bd19..128238cc968 100644 --- a/crates/swc_estree_ast/src/typescript.rs +++ b/crates/swc_estree_ast/src/typescript.rs @@ -324,7 +324,7 @@ pub struct TSIndexSignature { #[serde(flatten)] pub base: BaseNode, #[serde(default)] - pub paramters: Vec, + pub parameters: Vec, #[serde(default)] pub type_annotation: Option>, #[serde(default)] diff --git a/crates/swc_estree_compat/benches/assets/AjaxObservable.ts b/crates/swc_estree_compat/benches/assets/AjaxObservable.ts index 7ff070c1e4c..c628acabb60 100644 --- a/crates/swc_estree_compat/benches/assets/AjaxObservable.ts +++ b/crates/swc_estree_compat/benches/assets/AjaxObservable.ts @@ -204,7 +204,7 @@ export class AjaxSubscriber extends Subscriber { progressSubscriber?.error?.(e); let error; try { - error = new AjaxTimeoutError(xhr, request); // TODO: Make betterer. + error = new AjaxTimeoutError(xhr, request); // TODO: Make better. } catch (err) { error = err; } @@ -402,7 +402,7 @@ const AjaxTimeoutErrorImpl = (() => { })(); /** - * Thrown when an AJAX request timesout. Not to be confused with {@link TimeoutError}. + * Thrown when an AJAX request timeout. Not to be confused with {@link TimeoutError}. * * This is exported only because it is useful for checking to see if errors are an * `instanceof AjaxTimeoutError`. DO NOT use the constructor to create an instance of @@ -411,4 +411,4 @@ const AjaxTimeoutErrorImpl = (() => { * @class AjaxTimeoutError * @see ajax */ -export const AjaxTimeoutError: AjaxTimeoutErrorCtor = AjaxTimeoutErrorImpl as any; \ No newline at end of file +export const AjaxTimeoutError: AjaxTimeoutErrorCtor = AjaxTimeoutErrorImpl as any; diff --git a/crates/swc_estree_compat/src/babelify/jsx.rs b/crates/swc_estree_compat/src/babelify/jsx.rs index 95279629425..518c899f83e 100644 --- a/crates/swc_estree_compat/src/babelify/jsx.rs +++ b/crates/swc_estree_compat/src/babelify/jsx.rs @@ -213,7 +213,7 @@ impl Babelify for JSXAttrValue { fn babelify(self, ctx: &Context) -> Self::Output { match self { JSXAttrValue::Lit(lit) => { - // TODO(dwoznicki): Babel only seems to accept string literals here. Is taht + // TODO(dwoznicki): Babel only seems to accept string literals here. Is that // right? match lit { Lit::Str(s) => JSXAttrVal::String(s.babelify(ctx)), diff --git a/crates/swc_estree_compat/src/babelify/typescript.rs b/crates/swc_estree_compat/src/babelify/typescript.rs index 75f46b63ed5..d70c037d32a 100644 --- a/crates/swc_estree_compat/src/babelify/typescript.rs +++ b/crates/swc_estree_compat/src/babelify/typescript.rs @@ -296,7 +296,7 @@ impl Babelify for TsIndexSignature { fn babelify(self, ctx: &Context) -> Self::Output { TSIndexSignature { base: ctx.base(self.span), - paramters: self + parameters: self .params .into_iter() .map(|param| param.babelify(ctx).into()) diff --git a/crates/swc_plugin_proxy/src/comments/plugin_comments_proxy.rs b/crates/swc_plugin_proxy/src/comments/plugin_comments_proxy.rs index b9f18db040b..dff3bdfefd2 100644 --- a/crates/swc_plugin_proxy/src/comments/plugin_comments_proxy.rs +++ b/crates/swc_plugin_proxy/src/comments/plugin_comments_proxy.rs @@ -24,7 +24,7 @@ extern "C" { fn __add_pure_comment_proxy(byte_pos: u32); } -/// A struct to exchance allocated Vec between memory spaces. +/// A struct to exchange allocated Vec between memory spaces. #[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)] pub struct CommentsVecPtr(pub i32, pub i32); @@ -70,7 +70,7 @@ impl PluginCommentsProxy { } } - /// Utiilty wrapper to call host fn which returns a Comment or Vec. + /// Utility wrapper to call host fn which returns a Comment or Vec. #[cfg_attr(not(target_arch = "wasm32"), allow(unused))] fn read_returned_comments_from_host(&self, f: F) -> Option where @@ -90,7 +90,7 @@ impl PluginCommentsProxy { { let ret = f(serialized_comments_vec_ptr_raw_ptr as _); - // Host fn call completes: by contract in commments_proxy, if return value is 0 + // Host fn call completes: by contract in comments_proxy, if return value is 0 // we know there's no value to read. Otherwise, we know host filled in // CommentsVecPtr to the pointer for the actual value for the // results. diff --git a/crates/swc_plugin_runner/src/cache.rs b/crates/swc_plugin_runner/src/cache.rs index b2d71fe4949..56e756fa248 100644 --- a/crates/swc_plugin_runner/src/cache.rs +++ b/crates/swc_plugin_runner/src/cache.rs @@ -83,7 +83,7 @@ fn create_filesystem_cache(filesystem_cache_root: &Option) -> Option(env: &CommentHostEnvironment, f: F, default: R) -> R where @@ -113,11 +113,11 @@ fn allocate_return_values_into_guest( let (allocated_ptr, allocated_ptr_len) = write_into_memory_view(memory, serialized_bytes, |_| { - // In most cases our host-plugin tranmpoline works in a way that + // In most cases our host-plugin trampoline works in a way that // plugin pre-allocates // memory before calling host imported fn. But in case of // comments return value is Vec which - // guest cannot predetermine size to allocate, intead + // guest cannot predetermine size to allocate, instead // let host allocate by calling guest's alloc via attached // hostenvironment. alloc_guest_memory diff --git a/crates/swc_plugin_runner/src/imported_fn/handler.rs b/crates/swc_plugin_runner/src/imported_fn/handler.rs index a3110505298..988f0cf2e81 100644 --- a/crates/swc_plugin_runner/src/imported_fn/handler.rs +++ b/crates/swc_plugin_runner/src/imported_fn/handler.rs @@ -12,7 +12,7 @@ pub fn emit_diagnostics(env: &BaseHostEnvironment, bytes_ptr: i32, bytes_ptr_len let diagnostics_bytes = copy_bytes_into_host(memory, bytes_ptr, bytes_ptr_len); let serialized = Serialized::new_for_plugin(&diagnostics_bytes[..], bytes_ptr_len); let diagnostic = Serialized::deserialize::(&serialized) - .expect("Should able to be deserialized into diagnsotic"); + .expect("Should able to be deserialized into diagnostic"); let mut builder = swc_common::errors::DiagnosticBuilder::new_diagnostic(handler, diagnostic); diff --git a/crates/swc_plugin_runner/src/imported_fn/hygiene.rs b/crates/swc_plugin_runner/src/imported_fn/hygiene.rs index ce55b6919f0..7c4e9506956 100644 --- a/crates/swc_plugin_runner/src/imported_fn/hygiene.rs +++ b/crates/swc_plugin_runner/src/imported_fn/hygiene.rs @@ -3,7 +3,7 @@ use swc_common::{hygiene::MutableMarkContext, plugin::Serialized, Mark, SyntaxCo use crate::{host_environment::BaseHostEnvironment, memory_interop::write_into_memory_view}; /// A proxy to Mark::fresh() that can be used in plugin. -/// This it not direcly called by plugin, instead `impl Mark` will selectively +/// This it not directly called by plugin, instead `impl Mark` will selectively /// call this depends on the running context. pub fn mark_fresh_proxy(parent: u32) -> u32 { Mark::fresh(Mark::from_u32(parent)).as_u32() @@ -22,7 +22,7 @@ pub fn mark_set_builtin_proxy(self_mark: u32, is_builtin: u32) { } /// A proxy to Mark::is_descendant_of_() that can be used in plugin. -/// Origianl call site have mutable param, which we'll pass over as return value +/// Original call site have mutable param, which we'll pass over as return value /// via serialized MutableMarkContext. /// Inside of guest context, once this host function returns it'll assign params /// with return value accordingly. diff --git a/crates/swc_plugin_runner/src/imported_fn/mod.rs b/crates/swc_plugin_runner/src/imported_fn/mod.rs index c136c32d771..0089840aa94 100644 --- a/crates/swc_plugin_runner/src/imported_fn/mod.rs +++ b/crates/swc_plugin_runner/src/imported_fn/mod.rs @@ -31,7 +31,7 @@ * 2. `get_leading()` internally calls `__get_leading_comments_proxy`, which is * imported fn `get_leading_comments_proxy` exists in the host. * 3. Host access necessary values in its memory space (COMMENTS) -* 4. Host copies value to be returned into plguin's memory space. Memory +* 4. Host copies value to be returned into plugin's memory space. Memory * allocation for the value should be manually performed. * 5. Host completes imported fn, `PluginCommentsProxy::get_leading()` now can * read, deserialize memory host wrote. @@ -79,7 +79,7 @@ pub(crate) fn build_import_object( ) -> ImportObject { let wasmer_store = module.store(); - // transfrom_result + // transform_result let set_transform_result_fn_decl = Function::new_native_with_env( wasmer_store, TransformResultHostEnvironment::new(transform_result), diff --git a/crates/swc_plugin_runner/src/imported_fn/set_transform_result.rs b/crates/swc_plugin_runner/src/imported_fn/set_transform_result.rs index a4c0211e92e..27100be03b3 100644 --- a/crates/swc_plugin_runner/src/imported_fn/set_transform_result.rs +++ b/crates/swc_plugin_runner/src/imported_fn/set_transform_result.rs @@ -26,9 +26,9 @@ impl TransformResultHostEnvironment { } } -/// Set plugin's transformed result into host's enviroment. +/// Set plugin's transformed result into host's environment. /// This is an `imported` fn - when we instantiate plugin module, we inject this -/// fn into pluging's export space. Once transform completes, plugin will call +/// fn into plugin's export space. Once transform completes, plugin will call /// this to set its result back to host. pub fn set_transform_result( env: &TransformResultHostEnvironment, diff --git a/crates/swc_plugin_runner/src/memory_interop.rs b/crates/swc_plugin_runner/src/memory_interop.rs index dc25bd5b0bc..ec5e34f322e 100644 --- a/crates/swc_plugin_runner/src/memory_interop.rs +++ b/crates/swc_plugin_runner/src/memory_interop.rs @@ -44,7 +44,7 @@ where // Get a subarray for current memoryview starting from ptr address we just // allocated above, perform copying into specified ptr. Wasm's memory layout - // is linear and we have atomic gaurantee by not having any thread access, + // is linear and we have atomic guarantee by not having any thread access, // so can safely get subarray from allocated ptr address. // // If we want safer operation instead, refer previous implementation diff --git a/crates/swc_plugin_runner/src/transform_executor.rs b/crates/swc_plugin_runner/src/transform_executor.rs index 4769b6f2000..6cbbd56751b 100644 --- a/crates/swc_plugin_runner/src/transform_executor.rs +++ b/crates/swc_plugin_runner/src/transform_executor.rs @@ -18,7 +18,7 @@ pub struct TransformExecutor { // memory space exported_plugin_alloc: wasmer::NativeFunc, instance: Instance, - // Reference to the pointers succesfully allocated which'll be freed by Drop. + // Reference to the pointers successfully allocated which'll be freed by Drop. allocated_ptr_vec: Vec<(i32, i32)>, transform_result: Arc>>, } diff --git a/crates/swc_webpack_ast/tests/fixture/process-shim/1/input.js b/crates/swc_webpack_ast/tests/fixture/process-shim/1/input.js index 2b047ef579e..fcb0a1e02a1 100644 --- a/crates/swc_webpack_ast/tests/fixture/process-shim/1/input.js +++ b/crates/swc_webpack_ast/tests/fixture/process-shim/1/input.js @@ -37,7 +37,7 @@ function defaultClearTimeout() { }()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations + //normal environments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined @@ -46,7 +46,7 @@ function runTimeout(fun) { return setTimeout(fun, 0); } try { - // when when somebody has screwed with setTimeout but no I.E. maddness + // when when somebody has screwed with setTimeout but no I.E. madness return cachedSetTimeout(fun, 0); } catch (e) { try { @@ -62,7 +62,7 @@ function runTimeout(fun) { } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations + //normal environments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined @@ -71,14 +71,14 @@ function runClearTimeout(marker) { return clearTimeout(marker); } try { - // when when somebody has screwed with setTimeout but no I.E. maddness + // when when somebody has screwed with setTimeout but no I.E. madness return cachedClearTimeout(marker); } catch (e) { try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // same as above but when it's a version of I.E. that must have the global object for 'this', hopefully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } @@ -144,7 +144,7 @@ process.nextTick = function (fun) { } }; -// v8 likes predictible objects +// v8 likes predictable objects function Item(fun, array) { this.fun = fun; this.array = array; @@ -181,4 +181,4 @@ process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; -process.umask = function () { return 0; }; \ No newline at end of file +process.umask = function () { return 0; }; diff --git a/cspell.json b/cspell.json index 2307c371bac..51245bedbcf 100644 --- a/cspell.json +++ b/cspell.json @@ -63,7 +63,7 @@ "estree", "eval", "Eval", - "exponentation", + "exponentiation", "fargs", "finalizer", "fnames", diff --git a/docs/adr/00002-support-event-trace-profiling.md b/docs/adr/00002-support-event-trace-profiling.md index d5b01b0b36c..2c8e2063a8c 100644 --- a/docs/adr/00002-support-event-trace-profiling.md +++ b/docs/adr/00002-support-event-trace-profiling.md @@ -22,11 +22,11 @@ SWC wants to provide user-level feature to collect diagnostic information for it - [option 1] Run profilers like [`perf`](https://perf.wiki.kernel.org/index.php/Main_Page), [`instruments`](https://developer.apple.com/forums/tags/instruments) -- [option 2] Provide a `traceable` binary enables tracing capabilites all time, emits trace event format compatible output +- [option 2] Provide a `traceable` binary enables tracing capabilities all time, emits trace event format compatible output - **[option 3] Release binary provides runtime flags to enable tracing, emits trace event format compatible output** -- [option 4] Either creating separate binary or provide runtime flags, emits raw trace outputs let user convert into own preferrable way +- [option 4] Either creating separate binary or provide runtime flags, emits raw trace outputs let user convert into own preferable way ## Decision Outcome @@ -36,7 +36,7 @@ This decision is taken because - It was relatively easy to the users who want to run performance profiling against real world codebases, by opt-in via specific flag, or initialization interfaces - It was edge://tracing/ easy to visualize, diagnose via familiar UI (edge://tracing, chrome devtools) -- Trace event format have well-defined [spec](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#!), widely used not only limited to chroium's internal traces +- Trace event format have well-defined [spec](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#!), widely used not only limited to chromium's internal traces - It doesn't require special setup for running profiling, like installing a new binary, or setting up per-platform tools which could be widely different between local dev machine to CI systems. ## Pros and Cons of the Options @@ -50,25 +50,25 @@ SWC does not implement any internal tracing features, let user rely on own profi - Bad, depends on build config some of symbols might missing in release binary - Bad, user have to setup per-platform specific profilers then have to translate its results -### [option 2] Provide a `traceable` binary enables tracing capabilites all time, emits trace event format compatible output +### [option 2] Provide a `traceable` binary enables tracing capabilities all time, emits trace event format compatible output SWC implements internal logics to generate traceable outputs, which is compatible to trace event format. However, it is not included in normal release binary (`@swc/core`) but requires to install specific custom binary to opt in. - Good, SWC does not have any overhead for its release binary to support trace. - Good, users does not need to setup complex per-platform profilers - Good, users can use existing visualization tools (chromium). -- Bad, it is non-trivial to setup programattic opt-in to enabling traces, or setting up continous monitoring on CI systems with normal release binary +- Bad, it is non-trivial to setup programmatic opt-in to enabling traces, or setting up continuous monitoring on CI systems with normal release binary ### [option 3] Release binary provides runtime flags to enable tracing, emits trace event format compatible output -SWC implements internal logics to generate traceble outputs, which is compatible to trace event format. It is included in release binary by default which can be enabled via cli flags, or programmatic interfaces. +SWC implements internal logics to generate traceable outputs, which is compatible to trace event format. It is included in release binary by default which can be enabled via cli flags, or programmatic interfaces. - Good, users does not need to setup complex per-platform profilers - Good, users can use existing visualization tools (chromium). - Good, opt-in profiling is trivial as it can be controlled via programmatic interfaces without having separate binary - Bad, there are runtime overheads by having traceable logics, even when trace is not enabled -### [option 4] Either creating separate binary or provide runtime flags, emits raw trace outputs let user convert into own preferrable way +### [option 4] Either creating separate binary or provide runtime flags, emits raw trace outputs let user convert into own preferable way SWC follows option 2 or 3, however its emitted output is not compatible to trace event format but raw values from [tracing infrastructure](https://github.com/tokio-rs/tracing) diff --git a/node-swc/__tests__/minify_test.mjs b/node-swc/__tests__/minify_test.mjs index 79bcc9cc077..c97ef79b216 100644 --- a/node-swc/__tests__/minify_test.mjs +++ b/node-swc/__tests__/minify_test.mjs @@ -25,7 +25,7 @@ it("should accept object", async () => { ); }); -it("should accpept { mangle = true }", async () => { +it("should accept { mangle = true }", async () => { const { code } = await swc.minify( ` import foo from '@src/app'; @@ -42,7 +42,7 @@ it("should accpept { mangle = true }", async () => { ); }); -it("should accpept { mangle = object }", async () => { +it("should accept { mangle = object }", async () => { const { code } = await swc.minify( ` import foo from '@src/app'; @@ -87,7 +87,7 @@ it("should mangle locals", async () => { ); }); -describe("soruce map", () => { +describe("source map", () => { it("should have `names`", async () => { const { map } = await swc.minify( ` @@ -110,7 +110,7 @@ describe("soruce map", () => { expect(JSON.parse(map).names).not.toEqual([]); }); - it("should have `sources` if file name is speicified", async () => { + it("should have `sources` if file name is specified", async () => { const { map } = await swc.minify( { "foo.js": `(function(){ diff --git a/node-swc/__tests__/module_test.js b/node-swc/__tests__/module_test.js index a319c3e7458..9d50d4b01d2 100644 --- a/node-swc/__tests__/module_test.js +++ b/node-swc/__tests__/module_test.js @@ -28,7 +28,7 @@ it("should emit _interopRequireWildcard", () => { ); }); -it("should work with amd and expternal helpers", () => { +it("should work with amd and external helpers", () => { const out = swc.transformSync( `class Foo {} class Bar extends Foo {}`, diff --git a/node-swc/__tests__/transform/issue834_test.js b/node-swc/__tests__/transform/issue834_test.js index c8d7fea1ffb..79d9af1760c 100644 --- a/node-swc/__tests__/transform/issue834_test.js +++ b/node-swc/__tests__/transform/issue834_test.js @@ -1,6 +1,6 @@ const swc = require('../../../'); -it('should work without parser.sytax', () => { +it('should work without parser.syntax', () => { const out = swc.transformSync(`const someValue = "test" ?? "default value";`, { jsc: { parser: { @@ -26,4 +26,4 @@ it('should work with parser.syntax', () => { } ); expect(out.map).toBeFalsy(); -}); \ No newline at end of file +}); diff --git a/node-swc/__tests__/transform/sourcemap_test.js b/node-swc/__tests__/transform/sourcemap_test.js index b76b044e3f6..df9bc2fc442 100644 --- a/node-swc/__tests__/transform/sourcemap_test.js +++ b/node-swc/__tests__/transform/sourcemap_test.js @@ -113,7 +113,7 @@ it('should handle input sourcemap correctly', async () => { }) -describe('soruceMaps: true in .swcrc', () => { +describe('sourceMaps: true in .swcrc', () => { it(`should be respected`, async () => { const out = await swc.transformFile(path.join(__dirname, '..', '..', 'tests', 'issue-2120', 'input.js')); diff --git a/node-swc/benches/typescript.js b/node-swc/benches/typescript.js index df5463e402c..702354580ef 100644 --- a/node-swc/benches/typescript.js +++ b/node-swc/benches/typescript.js @@ -86,8 +86,8 @@ function intToHex( int: number ) * Converts a hex string containing a color such as '#00DEAD' to * an integer, such as 0x00DEAD; * - * @param {Number} num - * @return {String} + * @param {String} hex + * @return {Number} */ function hexToInt( hex: string ) { diff --git a/node-swc/src/Visitor.ts b/node-swc/src/Visitor.ts index 7724de8742e..7b6cbb4a5eb 100644 --- a/node-swc/src/Visitor.ts +++ b/node-swc/src/Visitor.ts @@ -1091,12 +1091,12 @@ export class Visitor { } visitAssignmentExpression(n: AssignmentExpression): Expression { - n.left = this.visitPatternOrExpressison(n.left); + n.left = this.visitPatternOrExpression(n.left); n.right = this.visitExpression(n.right); return n; } - visitPatternOrExpressison(n: Pattern | Expression): Pattern | Expression { + visitPatternOrExpression(n: Pattern | Expression): Pattern | Expression { switch (n.type) { case "ObjectPattern": case "ArrayPattern": diff --git a/node-swc/src/index.ts b/node-swc/src/index.ts index 11b3d745cb1..fa354ce6eb2 100644 --- a/node-swc/src/index.ts +++ b/node-swc/src/index.ts @@ -339,7 +339,7 @@ export function __experimental_registerGlobalTraceConfig(traceConfig: { * * Returns current binary's metadata to determine which binary is actually loaded. * - * This is undocumented interface, does not gaurantee stability across `@swc/core`'s semver + * This is undocumented interface, does not guarantee stability across `@swc/core`'s semver * as internal representation may change anytime. Use it with caution. */ export function getBinaryMetadata() { diff --git a/node-swc/src/types.ts b/node-swc/src/types.ts index d4ea465583b..925edf7f5b8 100644 --- a/node-swc/src/types.ts +++ b/node-swc/src/types.ts @@ -211,7 +211,7 @@ export interface TerserMangleOptions { ie8?: boolean, safari10?: boolean, - + reserved?: string[], } @@ -272,7 +272,7 @@ export interface Options extends Config { * * "root" - Passes the "root" value through as unchanged. * "upward" - Walks upward from the "root" directory, looking for a directory - * containinga swc.config.js file, and throws an error if a swc.config.js + * containing a swc.config.js file, and throws an error if a swc.config.js * is not found. * "upward-optional" - Walk upward from the "root" directory, looking for * a directory containing a swc.config.js file, and falls back to "root" @@ -333,7 +333,7 @@ export interface Options extends Config { * a package that matches one of the "swcrcRoots" packages. * * - * Defaults to true as long as the filename option has been specificed + * Defaults to true as long as the filename option has been specified */ swcrc?: boolean; @@ -403,11 +403,11 @@ export type Swcrc = Config | Config[]; */ export interface Config { /** - * Note: The type is string because it follow rust's regex syntax. + * Note: The type is string because it follows rust's regex syntax. */ test?: string | string[]; /** - * Note: The type is string because it follow rust's regex syntax. + * Note: The type is string because it follows rust's regex syntax. */ exclude?: string | string[]; env?: EnvConfig; @@ -464,7 +464,7 @@ export interface EnvConfig { shippedProposals?: boolean; /** - * Enable all trnasforms + * Enable all transforms */ forceAllTransforms?: boolean; } @@ -483,7 +483,7 @@ export interface JscConfig { externalHelpers?: boolean; /** - * Defaults to `es3` (which enableds **all** pass). + * Defaults to `es3` (which enabled **all** pass). */ target?: JscTarget; @@ -496,7 +496,7 @@ export interface JscConfig { optimizeHygiene?: boolean, keepImportAssertions?: boolean, /** - * Specify the location where SWC stores its intermidiate cache files. + * Specify the location where SWC stores its intermediate cache files. * Currently only transform plugin uses this. If not specified, SWC will * create `.swc` directories. */ @@ -1012,7 +1012,7 @@ export interface VariableDeclarator extends Node, HasSpan { id: Pattern; - /// Initialization expresion. + /// Initialization expression. init?: Expression; /// Typescript only @@ -1525,7 +1525,7 @@ export interface ExportNamedDeclaration extends Node, HasSpan { specifiers: ExportSpecifier[]; source?: StringLiteral; - + typeOnly: boolean; } diff --git a/packages/swc-helpers/src/_async_generator_delegate.js b/packages/swc-helpers/src/_async_generator_delegate.js index 8689265cfc8..5e04899276b 100644 --- a/packages/swc-helpers/src/_async_generator_delegate.js +++ b/packages/swc-helpers/src/_async_generator_delegate.js @@ -13,8 +13,6 @@ export default function _asyncGeneratorDelegate(inner, awaitWrap) { }; } - ; - if (typeof Symbol === "function" && Symbol.iterator) { iter[Symbol.iterator] = function () { return this; diff --git a/packages/swc-helpers/src/_get.js b/packages/swc-helpers/src/_get.js index 2ba817925e3..2ddccc14a36 100644 --- a/packages/swc-helpers/src/_get.js +++ b/packages/swc-helpers/src/_get.js @@ -20,6 +20,6 @@ function get(target, property, receiver) { return get(target, property, receiver); } -export default function _get(target, property, reciever) { - return get(target, property, reciever); +export default function _get(target, property, receiver) { + return get(target, property, receiver); } diff --git a/scripts/bot/src/cargo/ensure-comment.ts b/scripts/bot/src/cargo/ensure-comment.ts index 689b85d39f8..4ebb7d46002 100644 --- a/scripts/bot/src/cargo/ensure-comment.ts +++ b/scripts/bot/src/cargo/ensure-comment.ts @@ -1,4 +1,4 @@ -import { getCurrentPrNumber, octokit } from "../util/octokit"; +import { getCurrentPrNumber } from "../util/octokit"; import { parsePrComments } from "./comment-parser"; @@ -11,4 +11,4 @@ import { parsePrComments } from "./comment-parser"; if (actions.length === 0) { throw new Error('PR does not have a review comment to parse. Please wait for a comment by @kdy1 to be added.'); } -})() \ No newline at end of file +})() diff --git a/scripts/crev/diff.sh b/scripts/crev/diff.sh index 86ba0529e99..bbfe8b69b15 100755 --- a/scripts/crev/diff.sh +++ b/scripts/crev/diff.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Script used to verify the depdencies of the project. +# Script used to verify the dependencies of the project. # set -eu @@ -10,4 +10,4 @@ set -eu echo "Opening the crate $1" cargo crev crate diff $@ | code - --wait -cargo crev review $@ --diff \ No newline at end of file +cargo crev review $@ --diff diff --git a/scripts/crev/verify.sh b/scripts/crev/verify.sh index 22f858f9720..850e942b359 100755 --- a/scripts/crev/verify.sh +++ b/scripts/crev/verify.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Script used to verify the depdencies of the project. +# Script used to verify the dependencies of the project. # set -eu @@ -16,9 +16,9 @@ if [ ! -z "${1-}" ] ; then else if [ ! -z "$TEXT" ]; then - echo "Found a depenedncy requires verification" + echo "Found a dependency requires verification" # exit 1 else echo "All dependencies are verified" fi -fi \ No newline at end of file +fi