vscode-eslint 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/vscode-eslint +24 -1
- package/client/out/client.d.ts +13 -0
- package/client/out/extension.d.ts +3 -0
- package/client/out/extension.js +2 -0
- package/client/out/extension.js.map +1 -0
- package/client/out/node-utils.d.ts +51 -0
- package/client/out/settings.d.ts +41 -0
- package/client/out/shared/customMessages.d.ts +89 -0
- package/client/out/shared/settings.d.ts +106 -0
- package/client/out/tasks.d.ts +31 -0
- package/client/out/tests/glob.test.d.ts +1 -0
- package/client/out/vscode-utils.d.ts +5 -0
- package/package.json +9 -1
- package/server/out/diff.d.ts +134 -0
- package/server/out/eslint.d.ts +298 -0
- package/server/out/eslintServer.d.ts +1 -0
- package/server/out/eslintServer.js +2 -0
- package/server/out/eslintServer.js.map +1 -0
- package/server/out/is.d.ts +3 -0
- package/server/out/languageDefaults.d.ts +6 -0
- package/server/out/linkedMap.d.ts +53 -0
- package/server/out/paths.d.ts +22 -0
- package/server/out/shared/customMessages.d.ts +89 -0
- package/server/out/shared/settings.d.ts +106 -0
- package/$shared/customMessages.ts +0 -113
- package/$shared/settings.ts +0 -189
- package/.CodeQL.yml +0 -5
- package/.azure-pipelines.yml +0 -27
- package/.gemini/agents/vscode-eslint.md +0 -23
- package/.github/commands.yml +0 -127
- package/.github/locker.yml +0 -6
- package/.github/needs_more_info.yml +0 -6
- package/.github/workflows/npm-publish.yml +0 -53
- package/.github/workflows/release-please.yml +0 -22
- package/.lsifrc.json +0 -4
- package/.vscode/launch.json +0 -20
- package/.vscode/settings.json +0 -52
- package/.vscode/spellright.dict +0 -8
- package/.vscode/tasks.json +0 -39
- package/.vscodeignore +0 -23
- package/CHANGELOG.md +0 -524
- package/SECURITY.md +0 -41
- package/agents.md +0 -36
- package/client/.mocharc.json +0 -6
- package/client/agents.md +0 -5
- package/client/package-lock.json +0 -176
- package/client/package.json +0 -29
- package/client/src/client.ts +0 -992
- package/client/src/extension.ts +0 -180
- package/client/src/node-utils.ts +0 -393
- package/client/src/settings.ts +0 -379
- package/client/src/tasks.ts +0 -186
- package/client/src/tests/glob.test.ts +0 -31
- package/client/src/vscode-utils.ts +0 -28
- package/client/test/mocha.opts +0 -3
- package/client/tsconfig.json +0 -20
- package/client/webpack.config.js +0 -25
- package/contributing.md +0 -19
- package/esbuild.js +0 -62
- package/eslint.config.js +0 -129
- package/history/settings_1_9_x.md +0 -110
- package/images/2_1_10/eslint-dialog.png +0 -0
- package/images/2_1_10/eslint-status.png +0 -0
- package/package-json-schema.json +0 -9
- package/playgrounds/7.0/.eslintignore +0 -1
- package/playgrounds/7.0/.eslintrc.json +0 -71
- package/playgrounds/7.0/.vscode/settings.json +0 -85
- package/playgrounds/7.0/app.js +0 -12
- package/playgrounds/7.0/build/.eslintignore +0 -1
- package/playgrounds/7.0/build/.eslintrc.json +0 -30
- package/playgrounds/7.0/build/build.js +0 -11
- package/playgrounds/7.0/jsconfig.json +0 -5
- package/playgrounds/7.0/package-lock.json +0 -2133
- package/playgrounds/7.0/package.json +0 -10
- package/playgrounds/7.0/readme.md +0 -0
- package/playgrounds/7.0/subDir/sub.js +0 -11
- package/playgrounds/7.0/subDir/test.jsx +0 -10
- package/playgrounds/7.0/test.js +0 -11
- package/playgrounds/7.0/test.sh +0 -1
- package/playgrounds/7.0/test.vue +0 -33
- package/playgrounds/7.0/test2.html +0 -8
- package/playgrounds/8.0/.eslintignore +0 -1
- package/playgrounds/8.0/.eslintrc.json +0 -71
- package/playgrounds/8.0/.vscode/settings.json +0 -91
- package/playgrounds/8.0/app.js +0 -12
- package/playgrounds/8.0/build/.eslintignore +0 -1
- package/playgrounds/8.0/build/.eslintrc.json +0 -30
- package/playgrounds/8.0/build/build.js +0 -11
- package/playgrounds/8.0/jsconfig.json +0 -5
- package/playgrounds/8.0/package-lock.json +0 -2321
- package/playgrounds/8.0/package.json +0 -10
- package/playgrounds/8.0/readme.md +0 -17
- package/playgrounds/8.0/subDir/sub.js +0 -11
- package/playgrounds/8.0/subDir/test.jsx +0 -10
- package/playgrounds/8.0/test.ipynb +0 -49
- package/playgrounds/8.0/test.js +0 -3
- package/playgrounds/8.0/test.sh +0 -1
- package/playgrounds/8.0/test.vue +0 -33
- package/playgrounds/8.0/test2.html +0 -8
- package/playgrounds/9.0/flat/.vscode/settings.json +0 -3
- package/playgrounds/9.0/flat/app.js +0 -12
- package/playgrounds/9.0/flat/dist/ignore.js +0 -12
- package/playgrounds/9.0/flat/eslint.config.js +0 -61
- package/playgrounds/9.0/flat/package-lock.json +0 -1053
- package/playgrounds/9.0/flat/package.json +0 -9
- package/playgrounds/9.0/rc/.eslintrc.json +0 -57
- package/playgrounds/9.0/rc/.vscode/settings.json +0 -3
- package/playgrounds/9.0/rc/app.js +0 -12
- package/playgrounds/9.0/rc/package-lock.json +0 -1345
- package/playgrounds/9.0/rc/package.json +0 -9
- package/playgrounds/flat-config/.vscode/settings.json +0 -22
- package/playgrounds/flat-config/app.js +0 -12
- package/playgrounds/flat-config/eslint.config.js +0 -51
- package/playgrounds/flat-config/package-lock.json +0 -2733
- package/playgrounds/flat-config/package.json +0 -12
- package/playgrounds/flat-config/sub/sub.js +0 -2
- package/playgrounds/flat-config/test.ts +0 -7
- package/playgrounds/flat-config/tsconfig.json +0 -11
- package/playgrounds/flat-config-fail/f1/app.js +0 -12
- package/playgrounds/flat-config-fail/f1/eslint.config.js +0 -51
- package/playgrounds/flat-config-fail/package-lock.json +0 -1683
- package/playgrounds/flat-config-fail/package.json +0 -11
- package/playgrounds/flat-config-mjs/.vscode/settings.json +0 -21
- package/playgrounds/flat-config-mjs/app.js +0 -12
- package/playgrounds/flat-config-mjs/eslint.config.mjs +0 -53
- package/playgrounds/flat-config-mjs/package-lock.json +0 -2860
- package/playgrounds/flat-config-mjs/package.json +0 -11
- package/playgrounds/flat-config-mjs/sub/sub.js +0 -2
- package/playgrounds/flat-config-mjs/test.ts +0 -7
- package/playgrounds/flat-config-mjs/tsconfig.json +0 -11
- package/playgrounds/load-eslint/.vscode/settings.json +0 -21
- package/playgrounds/load-eslint/app.js +0 -12
- package/playgrounds/load-eslint/eslint.config.js +0 -51
- package/playgrounds/load-eslint/package-lock.json +0 -2860
- package/playgrounds/load-eslint/package.json +0 -11
- package/playgrounds/load-eslint/sub/sub.js +0 -2
- package/playgrounds/load-eslint/test.ts +0 -7
- package/playgrounds/load-eslint/tsconfig.json +0 -11
- package/playgrounds/noLib/test.js +0 -22
- package/playgrounds/noWD/.vscode/settings.json +0 -2
- package/playgrounds/noWD/src/.eslintrc.json +0 -18
- package/playgrounds/noWD/src/package-lock.json +0 -2812
- package/playgrounds/noWD/src/package.json +0 -12
- package/playgrounds/noWD/src/test.js +0 -3
- package/playgrounds/notebooks/notebook.ipynb +0 -7072
- package/playgrounds/notebooks/notebook2.ipynb +0 -20
- package/playgrounds/testing.code-workspace +0 -28
- package/playgrounds/ts/.eslintrc.base.json +0 -23
- package/playgrounds/ts/.eslintrc.json +0 -191
- package/playgrounds/ts/.vscode/settings.json +0 -12
- package/playgrounds/ts/package-lock.json +0 -2687
- package/playgrounds/ts/package.json +0 -11
- package/playgrounds/ts/test copy.ts +0 -4
- package/playgrounds/ts/test.ipynb +0 -49
- package/playgrounds/ts/test.ts +0 -4
- package/playgrounds/ts/test.tsx +0 -14
- package/playgrounds/ts/tsconfig.json +0 -100
- package/server/agents.md +0 -9
- package/server/package-lock.json +0 -93
- package/server/package.json +0 -32
- package/server/src/diff.ts +0 -1079
- package/server/src/eslint.ts +0 -1471
- package/server/src/eslintServer.ts +0 -865
- package/server/src/is.ts +0 -18
- package/server/src/languageDefaults.ts +0 -40
- package/server/src/linkedMap.ts +0 -448
- package/server/src/paths.ts +0 -128
- package/server/src/thenable.d.ts +0 -5
- package/server/tsconfig.json +0 -21
- package/server/webpack.config.js +0 -25
- package/shared.webpack.config.js +0 -59
- package/tsconfig.base.json +0 -9
- package/tsconfig.json +0 -21
package/server/src/is.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/* --------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
* ------------------------------------------------------------------------------------------ */
|
|
5
|
-
|
|
6
|
-
const toString = Object.prototype.toString;
|
|
7
|
-
|
|
8
|
-
export function boolean(value: any): value is boolean {
|
|
9
|
-
return value === true || value === false;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function nullOrUndefined(value: any): value is null | undefined {
|
|
13
|
-
return value === null || value === undefined;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function string(value: any): value is string {
|
|
17
|
-
return toString.call(value) === '[object String]';
|
|
18
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/* --------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
* ------------------------------------------------------------------------------------------ */
|
|
5
|
-
|
|
6
|
-
// This should either come from LSP or VS Code. That we repeat this is bogus.
|
|
7
|
-
|
|
8
|
-
type LanguageConfig = {
|
|
9
|
-
ext: string;
|
|
10
|
-
lineComment: string;
|
|
11
|
-
blockComment: [string, string];
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const languageId2Config: Map<string, LanguageConfig> = new Map([
|
|
15
|
-
['javascript', { ext: 'js', lineComment: '//', blockComment: ['/*', '*/'] }],
|
|
16
|
-
['javascriptreact', { ext: 'jsx', lineComment: '//', blockComment: ['/*', '*/'] }],
|
|
17
|
-
['typescript', { ext: 'ts', lineComment: '//', blockComment: ['/*', '*/'] } ],
|
|
18
|
-
['typescriptreact', { ext: 'tsx', lineComment: '//', blockComment: ['/*', '*/'] } ],
|
|
19
|
-
['html', { ext: 'html', lineComment: '//', blockComment: ['<!--', '-->'] }],
|
|
20
|
-
['vue', { ext: 'vue', lineComment: '//', blockComment: ['<!--', '-->'] }],
|
|
21
|
-
['coffeescript', { ext: 'coffee', lineComment: '#', blockComment: ['###', '###'] }],
|
|
22
|
-
['yaml', { ext: 'yaml', lineComment: '#', blockComment: ['#', ''] }],
|
|
23
|
-
['graphql', { ext: 'graphql', lineComment: '#', blockComment: ['#', ''] }]
|
|
24
|
-
]);
|
|
25
|
-
|
|
26
|
-
namespace LanguageDefaults {
|
|
27
|
-
export function getLineComment(languageId: string): string {
|
|
28
|
-
return languageId2Config.get(languageId)?.lineComment ?? '//';
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function getBlockComment(languageId: string): [string, string] {
|
|
32
|
-
return languageId2Config.get(languageId)?.blockComment ?? ['/*', '*/'];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function getExtension(languageId: string): string | undefined {
|
|
36
|
-
return languageId2Config.get(languageId)?.ext;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default LanguageDefaults;
|
package/server/src/linkedMap.ts
DELETED
|
@@ -1,448 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
|
|
6
|
-
interface Item<K, V> {
|
|
7
|
-
previous: Item<K, V> | undefined;
|
|
8
|
-
next: Item<K, V> | undefined;
|
|
9
|
-
key: K;
|
|
10
|
-
value: V;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export namespace Touch {
|
|
14
|
-
export const None: 0 = 0;
|
|
15
|
-
export const First: 1 = 1;
|
|
16
|
-
export const AsOld: 1 = Touch.First;
|
|
17
|
-
export const Last: 2 = 2;
|
|
18
|
-
export const AsNew: 2 = Touch.Last;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type Touch = 0 | 1 | 2;
|
|
22
|
-
|
|
23
|
-
export class LinkedMap<K, V> implements Map<K, V> {
|
|
24
|
-
|
|
25
|
-
readonly [Symbol.toStringTag] = 'LinkedMap';
|
|
26
|
-
|
|
27
|
-
private _map: Map<K, Item<K, V>>;
|
|
28
|
-
private _head: Item<K, V> | undefined;
|
|
29
|
-
private _tail: Item<K, V> | undefined;
|
|
30
|
-
private _size: number;
|
|
31
|
-
|
|
32
|
-
private _state: number;
|
|
33
|
-
|
|
34
|
-
public constructor() {
|
|
35
|
-
this._map = new Map<K, Item<K, V>>();
|
|
36
|
-
this._head = undefined;
|
|
37
|
-
this._tail = undefined;
|
|
38
|
-
this._size = 0;
|
|
39
|
-
this._state = 0;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public clear(): void {
|
|
43
|
-
this._map.clear();
|
|
44
|
-
this._head = undefined;
|
|
45
|
-
this._tail = undefined;
|
|
46
|
-
this._size = 0;
|
|
47
|
-
this._state++;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public isEmpty(): boolean {
|
|
51
|
-
return !this._head && !this._tail;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public get size(): number {
|
|
55
|
-
return this._size;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public get first(): V | undefined {
|
|
59
|
-
return this._head?.value;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public get last(): V | undefined {
|
|
63
|
-
return this._tail?.value;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
public has(key: K): boolean {
|
|
67
|
-
return this._map.has(key);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public get(key: K, touch: Touch = Touch.None): V | undefined {
|
|
71
|
-
const item = this._map.get(key);
|
|
72
|
-
if (!item) {
|
|
73
|
-
return undefined;
|
|
74
|
-
}
|
|
75
|
-
if (touch !== Touch.None) {
|
|
76
|
-
this.touch(item, touch);
|
|
77
|
-
}
|
|
78
|
-
return item.value;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public set(key: K, value: V, touch: Touch = Touch.None): this {
|
|
82
|
-
let item = this._map.get(key);
|
|
83
|
-
if (item) {
|
|
84
|
-
item.value = value;
|
|
85
|
-
if (touch !== Touch.None) {
|
|
86
|
-
this.touch(item, touch);
|
|
87
|
-
}
|
|
88
|
-
} else {
|
|
89
|
-
item = { key, value, next: undefined, previous: undefined };
|
|
90
|
-
switch (touch) {
|
|
91
|
-
case Touch.None:
|
|
92
|
-
this.addItemLast(item);
|
|
93
|
-
break;
|
|
94
|
-
case Touch.First:
|
|
95
|
-
this.addItemFirst(item);
|
|
96
|
-
break;
|
|
97
|
-
case Touch.Last:
|
|
98
|
-
this.addItemLast(item);
|
|
99
|
-
break;
|
|
100
|
-
default:
|
|
101
|
-
this.addItemLast(item);
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
this._map.set(key, item);
|
|
105
|
-
this._size++;
|
|
106
|
-
}
|
|
107
|
-
return this;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
public delete(key: K): boolean {
|
|
111
|
-
return !!this.remove(key);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
public remove(key: K): V | undefined {
|
|
115
|
-
const item = this._map.get(key);
|
|
116
|
-
if (!item) {
|
|
117
|
-
return undefined;
|
|
118
|
-
}
|
|
119
|
-
this._map.delete(key);
|
|
120
|
-
this.removeItem(item);
|
|
121
|
-
this._size--;
|
|
122
|
-
return item.value;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
public shift(): V | undefined {
|
|
126
|
-
if (!this._head && !this._tail) {
|
|
127
|
-
return undefined;
|
|
128
|
-
}
|
|
129
|
-
if (!this._head || !this._tail) {
|
|
130
|
-
throw new Error('Invalid list');
|
|
131
|
-
}
|
|
132
|
-
const item = this._head;
|
|
133
|
-
this._map.delete(item.key);
|
|
134
|
-
this.removeItem(item);
|
|
135
|
-
this._size--;
|
|
136
|
-
return item.value;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
public forEach(callbackfn: (value: V, key: K, map: LinkedMap<K, V>) => void, thisArg?: any): void {
|
|
140
|
-
const state = this._state;
|
|
141
|
-
let current = this._head;
|
|
142
|
-
while (current) {
|
|
143
|
-
if (thisArg) {
|
|
144
|
-
callbackfn.bind(thisArg)(current.value, current.key, this);
|
|
145
|
-
} else {
|
|
146
|
-
callbackfn(current.value, current.key, this);
|
|
147
|
-
}
|
|
148
|
-
if (this._state !== state) {
|
|
149
|
-
throw new Error(`LinkedMap got modified during iteration.`);
|
|
150
|
-
}
|
|
151
|
-
current = current.next;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
public keys(): IterableIterator<K> {
|
|
156
|
-
const map = this;
|
|
157
|
-
const state = this._state;
|
|
158
|
-
let current = this._head;
|
|
159
|
-
const iterator: IterableIterator<K> = {
|
|
160
|
-
[Symbol.iterator]() {
|
|
161
|
-
return iterator;
|
|
162
|
-
},
|
|
163
|
-
next(): IteratorResult<K> {
|
|
164
|
-
if (map._state !== state) {
|
|
165
|
-
throw new Error(`LinkedMap got modified during iteration.`);
|
|
166
|
-
}
|
|
167
|
-
if (current) {
|
|
168
|
-
const result = { value: current.key, done: false };
|
|
169
|
-
current = current.next;
|
|
170
|
-
return result;
|
|
171
|
-
} else {
|
|
172
|
-
return { value: undefined, done: true };
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
return iterator;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
public values(): IterableIterator<V> {
|
|
180
|
-
const map = this;
|
|
181
|
-
const state = this._state;
|
|
182
|
-
let current = this._head;
|
|
183
|
-
const iterator: IterableIterator<V> = {
|
|
184
|
-
[Symbol.iterator]() {
|
|
185
|
-
return iterator;
|
|
186
|
-
},
|
|
187
|
-
next(): IteratorResult<V> {
|
|
188
|
-
if (map._state !== state) {
|
|
189
|
-
throw new Error(`LinkedMap got modified during iteration.`);
|
|
190
|
-
}
|
|
191
|
-
if (current) {
|
|
192
|
-
const result = { value: current.value, done: false };
|
|
193
|
-
current = current.next;
|
|
194
|
-
return result;
|
|
195
|
-
} else {
|
|
196
|
-
return { value: undefined, done: true };
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
return iterator;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
public entries(): IterableIterator<[K, V]> {
|
|
204
|
-
const map = this;
|
|
205
|
-
const state = this._state;
|
|
206
|
-
let current = this._head;
|
|
207
|
-
const iterator: IterableIterator<[K, V]> = {
|
|
208
|
-
[Symbol.iterator]() {
|
|
209
|
-
return iterator;
|
|
210
|
-
},
|
|
211
|
-
next(): IteratorResult<[K, V]> {
|
|
212
|
-
if (map._state !== state) {
|
|
213
|
-
throw new Error(`LinkedMap got modified during iteration.`);
|
|
214
|
-
}
|
|
215
|
-
if (current) {
|
|
216
|
-
const result: IteratorResult<[K, V]> = { value: [current.key, current.value], done: false };
|
|
217
|
-
current = current.next;
|
|
218
|
-
return result;
|
|
219
|
-
} else {
|
|
220
|
-
return { value: undefined, done: true };
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
return iterator;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
public [Symbol.iterator](): IterableIterator<[K, V]> {
|
|
228
|
-
return this.entries();
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
protected trimOld(newSize: number) {
|
|
232
|
-
if (newSize >= this.size) {
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
if (newSize === 0) {
|
|
236
|
-
this.clear();
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
let current = this._head;
|
|
240
|
-
let currentSize = this.size;
|
|
241
|
-
while (current && currentSize > newSize) {
|
|
242
|
-
this._map.delete(current.key);
|
|
243
|
-
current = current.next;
|
|
244
|
-
currentSize--;
|
|
245
|
-
}
|
|
246
|
-
this._head = current;
|
|
247
|
-
this._size = currentSize;
|
|
248
|
-
if (current) {
|
|
249
|
-
current.previous = undefined;
|
|
250
|
-
}
|
|
251
|
-
this._state++;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
private addItemFirst(item: Item<K, V>): void {
|
|
255
|
-
// First time Insert
|
|
256
|
-
if (!this._head && !this._tail) {
|
|
257
|
-
this._tail = item;
|
|
258
|
-
} else if (!this._head) {
|
|
259
|
-
throw new Error('Invalid list');
|
|
260
|
-
} else {
|
|
261
|
-
item.next = this._head;
|
|
262
|
-
this._head.previous = item;
|
|
263
|
-
}
|
|
264
|
-
this._head = item;
|
|
265
|
-
this._state++;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
private addItemLast(item: Item<K, V>): void {
|
|
269
|
-
// First time Insert
|
|
270
|
-
if (!this._head && !this._tail) {
|
|
271
|
-
this._head = item;
|
|
272
|
-
} else if (!this._tail) {
|
|
273
|
-
throw new Error('Invalid list');
|
|
274
|
-
} else {
|
|
275
|
-
item.previous = this._tail;
|
|
276
|
-
this._tail.next = item;
|
|
277
|
-
}
|
|
278
|
-
this._tail = item;
|
|
279
|
-
this._state++;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
private removeItem(item: Item<K, V>): void {
|
|
283
|
-
if (item === this._head && item === this._tail) {
|
|
284
|
-
this._head = undefined;
|
|
285
|
-
this._tail = undefined;
|
|
286
|
-
}
|
|
287
|
-
else if (item === this._head) {
|
|
288
|
-
// This can only happen if size === 1 which is handled
|
|
289
|
-
// by the case above.
|
|
290
|
-
if (!item.next) {
|
|
291
|
-
throw new Error('Invalid list');
|
|
292
|
-
}
|
|
293
|
-
item.next.previous = undefined;
|
|
294
|
-
this._head = item.next;
|
|
295
|
-
}
|
|
296
|
-
else if (item === this._tail) {
|
|
297
|
-
// This can only happen if size === 1 which is handled
|
|
298
|
-
// by the case above.
|
|
299
|
-
if (!item.previous) {
|
|
300
|
-
throw new Error('Invalid list');
|
|
301
|
-
}
|
|
302
|
-
item.previous.next = undefined;
|
|
303
|
-
this._tail = item.previous;
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
const next = item.next;
|
|
307
|
-
const previous = item.previous;
|
|
308
|
-
if (!next || !previous) {
|
|
309
|
-
throw new Error('Invalid list');
|
|
310
|
-
}
|
|
311
|
-
next.previous = previous;
|
|
312
|
-
previous.next = next;
|
|
313
|
-
}
|
|
314
|
-
item.next = undefined;
|
|
315
|
-
item.previous = undefined;
|
|
316
|
-
this._state++;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
private touch(item: Item<K, V>, touch: Touch): void {
|
|
320
|
-
if (!this._head || !this._tail) {
|
|
321
|
-
throw new Error('Invalid list');
|
|
322
|
-
}
|
|
323
|
-
if ((touch !== Touch.First && touch !== Touch.Last)) {
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
if (touch === Touch.First) {
|
|
328
|
-
if (item === this._head) {
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
const next = item.next;
|
|
333
|
-
const previous = item.previous;
|
|
334
|
-
|
|
335
|
-
// Unlink the item
|
|
336
|
-
if (item === this._tail) {
|
|
337
|
-
// previous must be defined since item was not head but is tail
|
|
338
|
-
// So there are more than on item in the map
|
|
339
|
-
previous!.next = undefined;
|
|
340
|
-
this._tail = previous;
|
|
341
|
-
}
|
|
342
|
-
else {
|
|
343
|
-
// Both next and previous are not undefined since item was neither head nor tail.
|
|
344
|
-
next!.previous = previous;
|
|
345
|
-
previous!.next = next;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// Insert the node at head
|
|
349
|
-
item.previous = undefined;
|
|
350
|
-
item.next = this._head;
|
|
351
|
-
this._head.previous = item;
|
|
352
|
-
this._head = item;
|
|
353
|
-
this._state++;
|
|
354
|
-
} else if (touch === Touch.Last) {
|
|
355
|
-
if (item === this._tail) {
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
const next = item.next;
|
|
360
|
-
const previous = item.previous;
|
|
361
|
-
|
|
362
|
-
// Unlink the item.
|
|
363
|
-
if (item === this._head) {
|
|
364
|
-
// next must be defined since item was not tail but is head
|
|
365
|
-
// So there are more than on item in the map
|
|
366
|
-
next!.previous = undefined;
|
|
367
|
-
this._head = next;
|
|
368
|
-
} else {
|
|
369
|
-
// Both next and previous are not undefined since item was neither head nor tail.
|
|
370
|
-
next!.previous = previous;
|
|
371
|
-
previous!.next = next;
|
|
372
|
-
}
|
|
373
|
-
item.next = undefined;
|
|
374
|
-
item.previous = this._tail;
|
|
375
|
-
this._tail.next = item;
|
|
376
|
-
this._tail = item;
|
|
377
|
-
this._state++;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
public toJSON(): [K, V][] {
|
|
382
|
-
const data: [K, V][] = [];
|
|
383
|
-
|
|
384
|
-
this.forEach((value, key) => {
|
|
385
|
-
data.push([key, value]);
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
return data;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
public fromJSON(data: [K, V][]): void {
|
|
392
|
-
this.clear();
|
|
393
|
-
|
|
394
|
-
for (const [key, value] of data) {
|
|
395
|
-
this.set(key, value);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
export class LRUCache<K, V> extends LinkedMap<K, V> {
|
|
401
|
-
|
|
402
|
-
private _limit: number;
|
|
403
|
-
private _ratio: number;
|
|
404
|
-
|
|
405
|
-
public constructor(limit: number, ratio: number = 1) {
|
|
406
|
-
super();
|
|
407
|
-
this._limit = limit;
|
|
408
|
-
this._ratio = Math.min(Math.max(0, ratio), 1);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
public get limit(): number {
|
|
412
|
-
return this._limit;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
public set limit(limit: number) {
|
|
416
|
-
this._limit = limit;
|
|
417
|
-
this.checkTrim();
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
public get ratio(): number {
|
|
421
|
-
return this._ratio;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
public set ratio(ratio: number) {
|
|
425
|
-
this._ratio = Math.min(Math.max(0, ratio), 1);
|
|
426
|
-
this.checkTrim();
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
public get(key: K, touch: Touch = Touch.AsNew): V | undefined {
|
|
430
|
-
return super.get(key, touch);
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
public peek(key: K): V | undefined {
|
|
434
|
-
return super.get(key, Touch.None);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
public set(key: K, value: V): this {
|
|
438
|
-
super.set(key, value, Touch.Last);
|
|
439
|
-
this.checkTrim();
|
|
440
|
-
return this;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
private checkTrim() {
|
|
444
|
-
if (this.size > this._limit) {
|
|
445
|
-
this.trimOld(Math.round(this._limit * this._ratio));
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
}
|
package/server/src/paths.ts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/* --------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
* ------------------------------------------------------------------------------------------ */
|
|
5
|
-
|
|
6
|
-
import * as fs from 'fs';
|
|
7
|
-
|
|
8
|
-
import { URI } from 'vscode-uri';
|
|
9
|
-
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
10
|
-
|
|
11
|
-
import * as Is from './is';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Special functions to deal with path conversions in the context of ESLint
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Normalizes the drive letter to upper case which is the default in Node but not in
|
|
19
|
-
* VS Code.
|
|
20
|
-
*/
|
|
21
|
-
export function normalizeDriveLetter(path: string): string {
|
|
22
|
-
if (process.platform !== 'win32' || path.length < 2 || path[1] !== ':') {
|
|
23
|
-
return path;
|
|
24
|
-
}
|
|
25
|
-
return path[0].toUpperCase() + path.substring(1);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const enum CharCode {
|
|
29
|
-
/**
|
|
30
|
-
* The `\` character.
|
|
31
|
-
*/
|
|
32
|
-
Backslash = 92,
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Check if the path follows this pattern: `\\hostname\sharename`.
|
|
37
|
-
*
|
|
38
|
-
* @see https://msdn.microsoft.com/en-us/library/gg465305.aspx
|
|
39
|
-
* @return A boolean indication if the path is a UNC path, on none-windows
|
|
40
|
-
* always false.
|
|
41
|
-
*/
|
|
42
|
-
export function isUNC(path: string): boolean {
|
|
43
|
-
if (process.platform !== 'win32') {
|
|
44
|
-
// UNC is a windows concept
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (!path || path.length < 5) {
|
|
49
|
-
// at least \\a\b
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let code = path.charCodeAt(0);
|
|
54
|
-
if (code !== CharCode.Backslash) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
code = path.charCodeAt(1);
|
|
58
|
-
if (code !== CharCode.Backslash) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
let pos = 2;
|
|
62
|
-
const start = pos;
|
|
63
|
-
for (; pos < path.length; pos++) {
|
|
64
|
-
code = path.charCodeAt(pos);
|
|
65
|
-
if (code === CharCode.Backslash) {
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (start === pos) {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
code = path.charCodeAt(pos + 1);
|
|
73
|
-
if (isNaN(code) || code === CharCode.Backslash) {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function getFileSystemPath(uri: URI, useRealpaths: boolean): string {
|
|
80
|
-
let result = uri.fsPath;
|
|
81
|
-
if (process.platform === 'win32' && result.length >= 2 && result[1] === ':') {
|
|
82
|
-
// Node by default uses an upper case drive letter and ESLint uses
|
|
83
|
-
// === to compare paths which results in the equal check failing
|
|
84
|
-
// if the drive letter is lower case in th URI. Ensure upper case.
|
|
85
|
-
result = result[0].toUpperCase() + result.substr(1);
|
|
86
|
-
}
|
|
87
|
-
if (useRealpaths) {
|
|
88
|
-
result = tryRealpath(result);
|
|
89
|
-
} else if (process.platform === 'win32' || process.platform === 'darwin') {
|
|
90
|
-
const realpath = tryRealpath(result);
|
|
91
|
-
// Only use the real path if only the casing has changed.
|
|
92
|
-
if (realpath.toLowerCase() === result.toLowerCase()) {
|
|
93
|
-
result = realpath;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return result;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function tryRealpath(path: string): string {
|
|
100
|
-
try {
|
|
101
|
-
return fs.realpathSync.native(path);
|
|
102
|
-
} catch (error) {
|
|
103
|
-
// Silently ignore errors from `fs.realpathSync` to handle scenarios where
|
|
104
|
-
// the file being linted is not yet written to disk. This occurs in editors
|
|
105
|
-
// such as Neovim for non-written buffers.
|
|
106
|
-
return path;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export function normalizePath(path: string): string;
|
|
111
|
-
export function normalizePath(path: undefined): undefined;
|
|
112
|
-
export function normalizePath(path: string | undefined): string | undefined {
|
|
113
|
-
if (path === undefined) {
|
|
114
|
-
return undefined;
|
|
115
|
-
}
|
|
116
|
-
if (process.platform === 'win32') {
|
|
117
|
-
return path.replace(/\\/g, '/');
|
|
118
|
-
}
|
|
119
|
-
return path;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export function getUri(documentOrUri: string | TextDocument | URI): URI {
|
|
123
|
-
return Is.string(documentOrUri)
|
|
124
|
-
? URI.parse(documentOrUri)
|
|
125
|
-
: documentOrUri instanceof URI
|
|
126
|
-
? documentOrUri
|
|
127
|
-
: URI.parse(documentOrUri.uri);
|
|
128
|
-
}
|
package/server/src/thenable.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/* --------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
* ------------------------------------------------------------------------------------------ */
|
|
5
|
-
interface Thenable<T> extends PromiseLike<T> {}
|
package/server/tsconfig.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"module": "Node16",
|
|
5
|
-
"moduleResolution": "Node16",
|
|
6
|
-
"target": "ES2022",
|
|
7
|
-
"sourceMap": true,
|
|
8
|
-
"outDir": "out",
|
|
9
|
-
"rootDir": "src",
|
|
10
|
-
"lib": [ "ES2023" ],
|
|
11
|
-
"tsBuildInfoFile": "out/compile.tsbuildinfo",
|
|
12
|
-
"incremental": true,
|
|
13
|
-
"composite": true
|
|
14
|
-
},
|
|
15
|
-
"include": [
|
|
16
|
-
"src"
|
|
17
|
-
],
|
|
18
|
-
"exclude": [
|
|
19
|
-
"node_modules"
|
|
20
|
-
]
|
|
21
|
-
}
|
package/server/webpack.config.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
|
|
6
|
-
//@ts-check
|
|
7
|
-
|
|
8
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
const withDefaults = require('../shared.webpack.config');
|
|
11
|
-
const path = require('path');
|
|
12
|
-
|
|
13
|
-
module.exports = withDefaults({
|
|
14
|
-
context: path.join(__dirname),
|
|
15
|
-
entry: {
|
|
16
|
-
extension: './src/eslintServer.ts',
|
|
17
|
-
},
|
|
18
|
-
resolve: {
|
|
19
|
-
symlinks: false
|
|
20
|
-
},
|
|
21
|
-
output: {
|
|
22
|
-
filename: 'eslintServer.js',
|
|
23
|
-
path: path.join(__dirname, 'out')
|
|
24
|
-
}
|
|
25
|
-
});
|