Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardoferretti committed Sep 17, 2024
1 parent d0ae234 commit d18d9eb
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('generateStdMdLink', () => {
'[first-document](first-document.md)',
];
expect(actual.length).toEqual(expected.length);
const _ = actual.map((LinkReplace, index) => {
actual.forEach((LinkReplace, index) => {
expect(LinkReplace.newText).toEqual(expected[index]);
});
});
Expand All @@ -64,7 +64,7 @@ describe('generateStdMdLink', () => {
.map(link => convertLinkFormat(link, 'wikilink', _workspace, note));
const expected: string[] = ['[[first-document|file]]'];
expect(actual.length).toEqual(expected.length);
const _ = actual.map((LinkReplace, index) => {
actual.forEach((LinkReplace, index) => {
expect(LinkReplace.newText).toEqual(expected[index]);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/foam-vscode/src/core/model/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ResourceLink } from './note';
import { URI } from './uri';
import { FoamWorkspace } from './workspace';
import { IDisposable } from '../common/lifecycle';
import { Logger, withTiming } from '../utils/log';
import { Logger } from '../utils/log';
import { Emitter } from '../common/event';

export type Connection = {
Expand Down
1 change: 0 additions & 1 deletion packages/foam-vscode/src/core/model/location.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Range } from './range';
import { URI } from './uri';
import { ResourceLink } from './note';

/**
* Represents a location inside a resource, such as a line
Expand Down
1 change: 0 additions & 1 deletion packages/foam-vscode/src/core/model/uri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ function encode(uri: URI, skipEncoding: boolean): string {
: encodeURIComponentMinimal;

let res = '';
// eslint-disable-next-line prefer-const
let { scheme, authority, path, query, fragment } = uri;
if (scheme) {
res += scheme;
Expand Down
4 changes: 2 additions & 2 deletions packages/foam-vscode/src/core/services/markdown-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,9 @@ export const getBlockFor = (
}
});

let nLines = startLine == -1 ? 1 : endLine - startLine;
let nLines = startLine === -1 ? 1 : endLine - startLine;
let block =
startLine == -1
startLine === -1
? lines[searchLine] ?? ''
: lines.slice(startLine, endLine).join('\n');

Expand Down
1 change: 0 additions & 1 deletion packages/foam-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { VsCodeWatcher } from './services/watcher';
import { createMarkdownParser } from './core/services/markdown-parser';
import VsCodeBasedParserCache from './services/cache';
import { createMatcherAndDataStore } from './services/editor';
import { getFoamVsCodeConfig } from './services/config';

export async function activate(context: ExtensionContext) {
const logger = new VsCodeOutputLogger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { CREATE_NOTE_COMMAND, createNote } from './create-note';
import { Location } from '../../core/model/location';
import { Range } from '../../core/model/range';
import { ResourceLink } from '../../core/model/note';
import { MarkdownResourceProvider } from '../../core/services/markdown-provider';
import { createMarkdownParser } from '../../core/services/markdown-parser';

describe('create-note command', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/foam-vscode/src/features/commands/create-note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export async function createNote(args: CreateNoteArgs, foam: Foam) {
const edit = MarkdownLink.createUpdateLinkEdit(args.sourceLink.data, {
target: identifier,
});
if (edit.newText != args.sourceLink.data.rawText) {
if (edit.newText !== args.sourceLink.data.rawText) {
const updateLink = new vscode.WorkspaceEdit();
const uri = toVsCodeUri(args.sourceLink.uri);
updateLink.replace(
Expand Down
3 changes: 0 additions & 3 deletions packages/foam-vscode/src/features/navigation-provider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import { FoamGraph } from '../core/model/graph';
import { commandAsURI } from '../utils/commands';
import { CREATE_NOTE_COMMAND } from './commands/create-note';
import { Location } from '../core/model/location';
import { URI } from '../core/model/uri';
import { Range } from '../core/model/range';
import { ResourceLink } from '../core/model/note';

describe('Document navigation', () => {
const parser = createMarkdownParser([]);
Expand Down
1 change: 0 additions & 1 deletion packages/foam-vscode/src/features/panels/connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export default async function activate(
treeDataProvider: provider,
showCollapseAll: true,
});
const baseTitle = treeView.title;

const updateTreeView = async () => {
provider.target = vscode.window.activeTextEditor
Expand Down
2 changes: 1 addition & 1 deletion packages/foam-vscode/src/features/panels/dataviz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ async function getWebviewContent(
panel.webview.asWebviewUri(vscode.Uri.joinPath(datavizUri, fileName));

const indexHtml =
vscode.env.uiKind == vscode.UIKind.Desktop
vscode.env.uiKind === vscode.UIKind.Desktop
? new TextDecoder('utf-8').decode(
await vscode.workspace.fs.readFile(
vscode.Uri.joinPath(datavizUri, 'index.html')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const markdownItWikilinkEmbed = (
regex: WIKILINK_EMBED_REGEX,
replace: (wikilinkItem: string) => {
try {
const [_, noteEmbedModifier, wikilink] = wikilinkItem.match(
const [, noteEmbedModifier, wikilink] = wikilinkItem.match(
WIKILINK_EMBED_REGEX_GROUPS
);

Expand Down

0 comments on commit d18d9eb

Please sign in to comment.