Skip to content

Commit

Permalink
updated to version of eslint offering rule 'no-restricted-imports', a…
Browse files Browse the repository at this point in the history
…dded linting rule preventing imports from 'vscode-jsonrpc'
  • Loading branch information
sailingKieler committed Feb 13, 2024
1 parent 2f5e1d2 commit 329217b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 28 deletions.
16 changes: 16 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@
"block",
{ "pattern": "MIT License|DO NOT EDIT MANUALLY!" }
],
"no-restricted-imports": ["error", {
"paths": [{
"name": "vscode-jsonrpc",
"importNames": [ "CancellationToken" ],
"message": "Import 'CancellationToken' via 'Cancellation.CancellationToken' from 'langium', or directly from './utils/cancellation.ts' within Langium."
}, {
"name": "vscode-jsonrpc/",
"importNames": [ "CancellationToken"],
"message": "Import 'CancellationToken' via 'Cancellation.CancellationToken' from 'langium', or directly from './utils/cancellation.ts' within Langium."
}],
"patterns": [ {
"group": [ "vscode-jsonrpc" ],
"importNamePattern": "^(?!CancellationToken)",
"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."
}]
}],
// List of [@typescript-eslint rules](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules)
"@typescript-eslint/adjacent-overload-signatures": "error", // grouping same method names
"@typescript-eslint/array-type": ["error", { // string[] instead of Array<string>
Expand Down
61 changes: 34 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@vitest/ui": "~1.0.0",
"concurrently": "~8.2.1",
"esbuild": "~0.19.2",
"eslint": "~8.47.0",
"eslint": "~8.56.0",
"eslint-plugin-header": "~3.1.1",
"editorconfig": "~2.0.0",
"shx": "~0.3.4",
Expand Down
1 change: 1 addition & 0 deletions packages/langium/src/utils/cancellation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
* terms of the MIT License, which is available in the project root.
******************************************************************************/

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

0 comments on commit 329217b

Please sign in to comment.