Skip to content

Commit

Permalink
Add description, use safer config check
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Dec 16, 2024
1 parent 101a6ee commit 2da6d24
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>codemirror-ts demo</title>
<meta name='description' content='A set of CodeMirror extensions that give it the powers of TypeScript' />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
Expand Down
2 changes: 1 addition & 1 deletion src/lint/tsLinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function tsLinter({
return linter(
async (view): Promise<readonly Diagnostic[]> => {
const config = view.state.facet(tsFacet);
return config
return config?.env
? getLints({
...config,
diagnosticCodesToIgnore: diagnosticCodesToIgnore || [],
Expand Down
20 changes: 10 additions & 10 deletions src/lint/tsLinterWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import { tsFacetWorker } from "../index.js";
* to the same data.
*/
export function tsLinterWorker({
diagnosticCodesToIgnore,
diagnosticCodesToIgnore,
}: { diagnosticCodesToIgnore?: number[] } = {}) {
return linter(async (view): Promise<readonly Diagnostic[]> => {
const config = view.state.facet(tsFacetWorker);
return config
? config.worker.getLints({
path: config.path,
diagnosticCodesToIgnore: diagnosticCodesToIgnore || [],
})
: [];
});
return linter(async (view): Promise<readonly Diagnostic[]> => {
const config = view.state.facet(tsFacetWorker);
return config?.worker
? config.worker.getLints({
path: config.path,
diagnosticCodesToIgnore: diagnosticCodesToIgnore || [],
})
: [];
});
}

0 comments on commit 2da6d24

Please sign in to comment.