diff --git a/.changeset/kind-eagles-pay.md b/.changeset/kind-eagles-pay.md new file mode 100644 index 0000000..0d5c0ba --- /dev/null +++ b/.changeset/kind-eagles-pay.md @@ -0,0 +1,6 @@ +--- +"@arethetypeswrong/core": patch +"@arethetypeswrong/cli": patch +--- + +Fix minor typos diff --git a/docs/problems/NamedExports.md b/docs/problems/NamedExports.md index 801f08f..09ae4ac 100644 --- a/docs/problems/NamedExports.md +++ b/docs/problems/NamedExports.md @@ -49,7 +49,7 @@ module.exports = { import { a } from "./api.cjs"; ``` -However, TypeScript has no way of knowing, and no way of indicating in a declaration file, whether CommonJS exports are written in a way that will be statically analyzable. It assumes they _will_ be, and so even a completely correct declaration file for `api.cjs` will indicate that `a` can be imported by name. Since there’s no way to make the types more restrictive without making them incomplete, and since the unalyzable export is an inconvenience for all consumers of the JavaScript, the only solution is to fix the JavaScript. If the JavaScript exports can’t be restructured, it’s possible to “hint” the exports to cjs-module-lexer with an assignment that never executes: +However, TypeScript has no way of knowing, and no way of indicating in a declaration file, whether CommonJS exports are written in a way that will be statically analyzable. It assumes they _will_ be, and so even a completely correct declaration file for `api.cjs` will indicate that `a` can be imported by name. Since there’s no way to make the types more restrictive without making them incomplete, and since the unanalyzable export is an inconvenience for all consumers of the JavaScript, the only solution is to fix the JavaScript. If the JavaScript exports can’t be restructured, it’s possible to “hint” the exports to cjs-module-lexer with an assignment that never executes: ```js module.exports = { diff --git a/packages/cli/README.md b/packages/cli/README.md index 534b457..08a55ac 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -149,7 +149,7 @@ In the config file, `format` can be a string value. ```shell attw --pack . --entrypoints . one two three # Just ".", "./one", "./two", "./three" -attw --pack . --include-entrypoints added # Auto-discovered entyrpoints plus "./added" +attw --pack . --include-entrypoints added # Auto-discovered entrypoints plus "./added" attw --pack . --exclude-entrypoints styles.css # Auto-discovered entrypoints except "./styles.css" attw --pack . --entrypoints-legacy # All published code files ``` diff --git a/packages/cli/src/getExitCode.ts b/packages/cli/src/getExitCode.ts index 712ebbe..ce31575 100644 --- a/packages/cli/src/getExitCode.ts +++ b/packages/cli/src/getExitCode.ts @@ -10,7 +10,10 @@ export function getExitCode(analysis: CheckResult, opts?: RenderOptions): number const ignoreResolutions = opts?.ignoreResolutions ?? []; return analysis.problems.some((problem) => { const notRuleIgnored = !ignoreRules.includes(problemFlags[problem.kind]); - const notResolutionIgnored = "resolutionKind" in problem ? !ignoreResolutions.includes(problem.resolutionKind) : true; + const notResolutionIgnored = + "resolutionKind" in problem ? !ignoreResolutions.includes(problem.resolutionKind) : true; return notRuleIgnored && notResolutionIgnored; - }) ? 1 : 0; + }) + ? 1 + : 0; } diff --git a/packages/core/src/internal/multiCompilerHost.ts b/packages/core/src/internal/multiCompilerHost.ts index 9fb3717..cd9c2eb 100644 --- a/packages/core/src/internal/multiCompilerHost.ts +++ b/packages/core/src/internal/multiCompilerHost.ts @@ -204,7 +204,7 @@ export class CompilerHostWrapper { { ...this.compilerOptions, ...extraOptions }, ) ) { - throw new Error("Cannot override resolution-affecting options for host due to potential cache polution"); + throw new Error("Cannot override resolution-affecting options for host due to potential cache pollution"); } const options = extraOptions ? { ...this.compilerOptions, ...extraOptions } : this.compilerOptions; return this.getProgram(rootNames, options); diff --git a/packages/core/src/problems.ts b/packages/core/src/problems.ts index 62fd3e7..cc922f9 100644 --- a/packages/core/src/problems.ts +++ b/packages/core/src/problems.ts @@ -60,7 +60,7 @@ export const problemKindInfo: Record = { }, FallbackCondition: { emoji: "🐛", - title: "Resloved through fallback condition", + title: "Resolved through fallback condition", shortDescription: "Used fallback condition", description: "Import resolved to types through a conditional package.json export, but only after failing to resolve through an earlier condition. This behavior is a [TypeScript bug](https://github.com/microsoft/TypeScript/issues/50762). It may misrepresent the runtime behavior of this import and should not be relied upon.", diff --git a/packages/core/test/problems/exportDefaultDisagreement.test.ts b/packages/core/test/problems/exportDefaultDisagreement.test.ts index 2d17b70..f2c1af0 100644 --- a/packages/core/test/problems/exportDefaultDisagreement.test.ts +++ b/packages/core/test/problems/exportDefaultDisagreement.test.ts @@ -108,7 +108,7 @@ describe("exportDefaultDisagreement", () => { parentPath.replaceWith(t.numericLiteral(newValue)); } else { const line = parentPath.node.loc.start.line; - + throw new _babelPluginMacros.MacroError(); } } @@ -119,7 +119,7 @@ describe("exportDefaultDisagreement", () => { ); }); - test("lone deafult export is primitive", () => { + test("lone default export is primitive", () => { assert( isOk( `declare const _default: string; @@ -214,7 +214,7 @@ var index_default = { a, b };`, ); }); - test("ignores unalayzable iife", () => { + test("ignores unanalyzable iife", () => { assert( isOk( `export default function foo(): void`, diff --git a/packages/core/test/tsconfig.json b/packages/core/test/tsconfig.json index 41a1fb7..f6f15de 100644 --- a/packages/core/test/tsconfig.json +++ b/packages/core/test/tsconfig.json @@ -4,7 +4,7 @@ "lib": ["es2019"], "module": "nodenext", "outDir": "dist", - "types": ["node", "ts-expose-internals"], + "types": ["node", "ts-expose-internals"] }, "references": [ { diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index 77bd8ab..9195c1c 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -10,7 +10,7 @@ "module": "nodenext", "outDir": "dist", "rootDir": "src", - "types": ["ts-expose-internals"], + "types": ["ts-expose-internals"] }, "include": ["src"] } diff --git a/tsconfig.check-dts.json b/tsconfig.check-dts.json index 2ccb236..9090620 100644 --- a/tsconfig.check-dts.json +++ b/tsconfig.check-dts.json @@ -5,4 +5,4 @@ "strict": true }, "include": ["./packages/core/dist"] -} \ No newline at end of file +}