Skip to content

Commit 1d51081

Browse files
committed
fix: auto lint to replace let and var in vendored code
1 parent c5c1755 commit 1d51081

8 files changed

Lines changed: 16 additions & 15 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
declare var message: 'hello';
1+
declare let message: 'hello';

apps/playground/src/store/slices/editor.slice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const createEditorSlice: SliceCreator<EditorSlice> = (set, get) => ({
8080
},
8181
updateFile: (name, update) => {
8282
set((state) => {
83-
let index = state.files.findIndex((file) => file.name === name);
83+
const index = state.files.findIndex((file) => file.name === name);
8484
if (index === -1) {
8585
console.error(`Cannot update file '${name}': file does not exist`);
8686
return;

apps/playground/src/vim/adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ export default class EditorAdapter {
680680
let char = key;
681681
const pos = this.getPos_();
682682
let range = makeRange(pos.lineNumber, pos.column, pos.lineNumber, pos.column + 1);
683-
let forceMoveMarkers = true;
683+
const forceMoveMarkers = true;
684684

685685
if (key.startsWith("'")) {
686686
char = key[1]!;

apps/playground/src/vim/default-key-map.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { KeyMapping } from './types';
22

3-
export let defaultKeymap: KeyMapping[] = [
3+
export const defaultKeymap: KeyMapping[] = [
44
// Key to key mapping. This goes first to make it possible to override
55
// existing mappings.
66
{ keys: '<Left>', toKeys: 'h', type: 'keyToKey' },
@@ -838,4 +838,4 @@ export let defaultKeymap: KeyMapping[] = [
838838
{ keys: ':', type: 'ex' }
839839
];
840840

841-
export let defaultKeymapLength = defaultKeymap.length;
841+
export const defaultKeymapLength = defaultKeymap.length;

apps/playground/src/vim/keymap_vim.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ export const exCommands: { [key: string]: ExCommandFunc } = {
10371037

10381038
// Record the streams position at the beginning of the loop for use
10391039
// in error messages.
1040-
let count = stream.pos;
1040+
const count = stream.pos;
10411041

10421042
if (!stream.match(/[a-zA-Z]/, false)) {
10431043
showConfirm(adapter, 'Invalid argument: ' + params.argString.substring(count));

apps/playground/src/vim/motions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export const motions: { [key: string]: MotionFunc } = {
169169
}
170170
let best = head;
171171
for (let i = 0; i < motionArgs.repeat!; i++) {
172-
let cursor = best;
172+
const cursor = best;
173173
for (const key in vim.marks) {
174174
if (!isLowerCase(key)) {
175175
continue;
@@ -220,7 +220,7 @@ export const motions: { [key: string]: MotionFunc } = {
220220
vim.lastHSPos = adapter.charCoords(cur, 'div').left;
221221
}
222222
const repeat = motionArgs.repeat || 0;
223-
let res = adapter.findPosV(
223+
const res = adapter.findPosV(
224224
cur,
225225
motionArgs.forward ? repeat : -repeat,
226226
'line'
@@ -672,8 +672,8 @@ function findParagraph(
672672
inclusive?: boolean
673673
): [Pos, Pos] | Pos {
674674
let line = head.line;
675-
let min = adapter.firstLine();
676-
let max = adapter.lastLine();
675+
const min = adapter.firstLine();
676+
const max = adapter.lastLine();
677677
let i = line;
678678
const isEmpty = (i: number) => {
679679
return !adapter.getLine(i);

apps/playground/src/vim/operators.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export const operators: { [key: string]: OperatorFunc } = {
112112
const vim = adapter.state.vim as VimState;
113113
if (!vim.visualBlock) {
114114
let anchor = ranges[0]!.anchor,
115+
// eslint-disable-next-line prefer-const
115116
head = ranges[0]!.head;
116117
if (
117118
args.linewise &&
@@ -149,7 +150,7 @@ export const operators: { [key: string]: OperatorFunc } = {
149150
let endLine = vim.visualBlock ? ranges[ranges.length - 1]!.anchor.line : ranges[0]!.head.line;
150151
// In visual mode, n> shifts the selection right n times, instead of
151152
// shifting n lines right once.
152-
let repeat = vim.visualMode ? args.repeat || 0 : 1;
153+
const repeat = vim.visualMode ? args.repeat || 0 : 1;
153154
if (args.linewise) {
154155
// The only way to delete a newline is to delete until the start of
155156
// the next line, so in linewise mode evalInput will include the next

apps/playground/src/vim/string-stream.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ export class StringStream {
4040
}
4141

4242
eatSpace() {
43-
var start = this.pos;
43+
const start = this.pos;
4444
while (/[\s\u00a0]/.test(this.str.charAt(this.pos))) {
4545
++this.pos;
4646
}
4747
return this.pos > start;
4848
}
4949

5050
eatWhile(match: ((ch: string) => boolean) | RegExp | string) {
51-
var start = this.pos;
51+
const start = this.pos;
5252
while (this.eat(match)) {
5353
/* empty */
5454
}
@@ -94,7 +94,7 @@ export class StringStream {
9494
}
9595
return null;
9696
} else {
97-
var match = this.str.slice(this.pos).match(pattern);
97+
const match = this.str.slice(this.pos).match(pattern);
9898
if (match?.index && match.index > 0) {
9999
return null;
100100
}
@@ -117,7 +117,7 @@ export class StringStream {
117117
}
118118

119119
skipTo(ch: string) {
120-
var found = this.str.indexOf(ch, this.pos);
120+
const found = this.str.indexOf(ch, this.pos);
121121
if (found > -1) {
122122
this.pos = found;
123123
return true;

0 commit comments

Comments
 (0)