Skip to content

Commit

Permalink
fix: Expose Emitter types (#718)
Browse files Browse the repository at this point in the history
* fix: Expose Emitter types

* div: fix missing type
  • Loading branch information
Jason3S authored Dec 4, 2020
1 parent dd4b342 commit 3ef9030
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/cspell/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
removePathsFromGlobalImports,
} from './link';
import { tableToLines } from './util/table';
import { Emitters, isProgressFileComplete, MessageType, ProgressItem } from './emitters';
import { Emitters, isProgressFileComplete, MessageType, ProgressItem, Issue } from './emitters';

interface Options extends CSpellApplicationOptions {
legacy?: boolean;
Expand All @@ -33,7 +33,7 @@ const templateIssueLegacy = `${chalk.green('${uri}')}[\${row}, \${col}]: Unknown
const templateIssueWordsOnly = '${text}';

function genIssueEmitter(template: string) {
return function issueEmitter(issue: App.Issue) {
return function issueEmitter(issue: Issue) {
console.log(formatIssue(template, issue));
};
}
Expand Down Expand Up @@ -332,7 +332,7 @@ function trimMid(s: string, w: number): string {
return s.substr(0, l) + '...' + s.substr(-r);
}

function formatIssue(template: string, issue: App.Issue) {
function formatIssue(template: string, issue: Issue) {
const { uri = '', row, col, text } = issue;
return template
.replace(/\$\{uri\}/, uri)
Expand Down
6 changes: 3 additions & 3 deletions packages/cspell/src/application.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path';
import * as App from './application';
import { Emitters, ProgressFileComplete } from './emitters';
import { Emitters, ProgressFileComplete, Issue } from './emitters';

const getStdinResult = {
value: '',
Expand Down Expand Up @@ -189,9 +189,9 @@ class Logger implements Emitters {
debugCount = 0;
infoCount = 0;
progressCount = 0;
issues: App.Issue[] = [];
issues: Issue[] = [];

issue = (issue: App.Issue) => {
issue = (issue: Issue) => {
this.issues.push(issue);
this.issueCount += 1;
const { uri, row, col, text } = issue;
Expand Down
3 changes: 1 addition & 2 deletions packages/cspell/src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
MessageTypes,
ProgressEmitter,
SpellingErrorEmitter,
Issue,
} from './emitters';

// cspell:word nocase
Expand Down Expand Up @@ -68,8 +69,6 @@ export interface RunResult {
errors: number;
}

export type Issue = cspell.TextDocumentOffset;

export interface GlobSrcInfo {
matcher: GlobMatcher;
source: string;
Expand Down
1 change: 1 addition & 0 deletions packages/cspell/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './application';
export * from './emitters';

0 comments on commit 3ef9030

Please sign in to comment.