Skip to content

Commit d949c05

Browse files
committed
Satisfy the linter
1 parent 9e7e5ec commit d949c05

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/commands/importIdentifier.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import * as vscode from 'vscode';
2-
import { CommandNames } from './constants';
3-
import * as request from 'request-promise-native';
41
import * as cheerio from 'cheerio';
5-
import * as LRU from 'lru-cache';
6-
import * as _ from 'lodash';
72
import * as yaml from 'js-yaml';
3+
import * as _ from 'lodash';
4+
import * as LRU from 'lru-cache';
5+
import * as request from 'request-promise-native';
6+
import * as vscode from 'vscode';
7+
import { CommandNames } from './constants';
88

99
const askHoogle = async (variable: string): Promise<any> => {
1010
return await request({
@@ -13,13 +13,13 @@ const askHoogle = async (variable: string): Promise<any> => {
1313
}).promise();
1414
};
1515

16-
const withCache = <T, U>(cache: LRU.Cache<T, U>, f: (a: T) => U) => (a: T) => {
17-
const maybeB = cache.get(a);
16+
const withCache = <T, U>(theCache: LRU.Cache<T, U>, f: (a: T) => U) => (a: T) => {
17+
const maybeB = theCache.get(a);
1818
if (maybeB) {
1919
return maybeB;
2020
} else {
2121
const b = f(a);
22-
cache.set(a, b);
22+
theCache.set(a, b);
2323
return b;
2424
}
2525
};
@@ -79,15 +79,16 @@ export namespace ImportIdentifier {
7979

8080
export function registerCommand(): vscode.Disposable {
8181
return vscode.commands.registerTextEditorCommand(CommandNames.ImportIdentifierCommandName, async (editor, edit) => {
82-
const identifierRegExp = new RegExp('[' + _.escapeRegExp('!#$%&*+./<=>?@^|-~:') + ']+' + '|' + "[\\w']+");
82+
// \u0027 is ' (satisfies the linter)
83+
const identifierRegExp = new RegExp('[' + _.escapeRegExp('!#$%&*+./<=>?@^|-~:') + ']+' + '|' + '[\\w\u0027]+');
8384

8485
const identifierRange = editor.selection.isEmpty
8586
? editor.document.getWordRangeAtPosition(editor.selections[0].active, identifierRegExp)
8687
: new vscode.Range(editor.selection.start, editor.selection.end);
8788

8889
if (!identifierRange) {
8990
vscode.window.showErrorMessage(
90-
"No Haskell identifier found at the cursor (here's the regex used: " + identifierRegExp + ' )'
91+
'No Haskell identifier found at the cursor (here is the regex used: ' + identifierRegExp + ' )'
9192
);
9293
return;
9394
}

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import {
1919
ServerOptions,
2020
TransportKind
2121
} from 'vscode-languageclient';
22+
import { ImportIdentifier } from './commands/importIdentifier';
2223
import { InsertType } from './commands/insertType';
2324
import { ShowTypeCommand, ShowTypeHover } from './commands/showType';
2425
import { DocsBrowser } from './docsBrowser';
25-
import { ImportIdentifier } from './commands/importIdentifier';
2626

2727
let docsBrowserRegistered: boolean = false;
2828
let hieCommandsRegistered: boolean = false;

0 commit comments

Comments
 (0)