Skip to content

Commit 019bc02

Browse files
committed
updated to version of eslint offering rule 'no-restricted-imports', added linting rule preventing imports from 'vscode-jsonrpc'
1 parent d8c6327 commit 019bc02

File tree

4 files changed

+52
-28
lines changed

4 files changed

+52
-28
lines changed

.eslintrc.json

+16
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@
5050
"block",
5151
{ "pattern": "MIT License|DO NOT EDIT MANUALLY!" }
5252
],
53+
"no-restricted-imports": ["error", {
54+
"paths": [{
55+
"name": "vscode-jsonrpc",
56+
"importNames": [ "CancellationToken" ],
57+
"message": "Import 'CancellationToken' via 'Cancellation.CancellationToken' from 'langium', or directly from './utils/cancellation.ts' within Langium."
58+
}, {
59+
"name": "vscode-jsonrpc/",
60+
"importNames": [ "CancellationToken"],
61+
"message": "Import 'CancellationToken' via 'Cancellation.CancellationToken' from 'langium', or directly from './utils/cancellation.ts' within Langium."
62+
}],
63+
"patterns": [ {
64+
"group": [ "vscode-jsonrpc" ],
65+
"importNamePattern": "^(?!CancellationToken)",
66+
"message": "Don't import types or symbols from 'vscode-jsonrpc' (package index), as that brings a large overhead in bundle size. Import from 'vscode-jsonrpc/lib/common/...js' and add a // eslint-disable..., if really necessary."
67+
}]
68+
}],
5369
// List of [@typescript-eslint rules](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules)
5470
"@typescript-eslint/adjacent-overload-signatures": "error", // grouping same method names
5571
"@typescript-eslint/array-type": ["error", { // string[] instead of Array<string>

package-lock.json

+34-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@vitest/ui": "~1.0.0",
3232
"concurrently": "~8.2.1",
3333
"esbuild": "~0.19.2",
34-
"eslint": "~8.47.0",
34+
"eslint": "~8.56.0",
3535
"eslint-plugin-header": "~3.1.1",
3636
"editorconfig": "~2.0.0",
3737
"shx": "~0.3.4",

packages/langium/src/utils/cancellation.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
* terms of the MIT License, which is available in the project root.
55
******************************************************************************/
66

7+
// eslint-disable-next-line no-restricted-imports
78
export * from 'vscode-jsonrpc/lib/common/cancellation.js';

0 commit comments

Comments
 (0)