@jupyter/eslint-plugin 1.4.0 → 1.5.0
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/README.md +12 -0
- package/lib/index.d.ts +6 -215
- package/lib/index.js +41 -27
- package/lib/rules/command-described-by.js +18 -27
- package/lib/rules/no-untranslated-string.d.ts +2 -1
- package/lib/rules/no-untranslated-string.js +11 -3
- package/lib/rules/plugin-activation-args.js +14 -4
- package/lib/rules/prefer-signal-this-arg.d.ts +1 -0
- package/lib/rules/prefer-signal-this-arg.js +10 -3
- package/lib/rules/require-signal-cleanup.d.ts +1 -0
- package/lib/rules/require-signal-cleanup.js +10 -3
- package/lib/rules/token-format.js +8 -2
- package/lib/utils/ast.d.ts +1 -1
- package/lib/utils/commands.d.ts +1 -2
- package/lib/utils/disposables.d.ts +2 -13
- package/lib/utils/disposables.js +3 -18
- package/lib/utils/lazy-imports.d.ts +1 -2
- package/lib/utils/options.d.ts +9 -0
- package/lib/utils/options.js +22 -0
- package/lib/utils/plugin-utils.d.ts +1 -2
- package/lib/utils/plugin-utils.js +2 -2
- package/lib/utils/signal-lifetime.d.ts +1 -2
- package/lib/utils/signals.d.ts +1 -2
- package/lib/utils/translation.d.ts +1 -1
- package/lib/utils/type-services.d.ts +1 -2
- package/package.json +4 -10
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# eslint-plugin
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@jupyter/eslint-plugin)
|
|
4
|
+
[](https://github.com/jupyterlab/eslint-plugin/actions/workflows/build.yml)
|
|
5
|
+
[](https://eslint-plugin.readthedocs.io/en/latest/)
|
|
6
|
+
|
|
3
7
|
ESLint plugin for Jupyter core and extensions with early error catching and best practices enforcement.
|
|
4
8
|
|
|
5
9
|
## Installation
|
|
@@ -12,6 +16,14 @@ npm install --save-dev @jupyter/eslint-plugin
|
|
|
12
16
|
|
|
13
17
|
Add `@jupyter/eslint-plugin` to the plugins section of your ESLint configuration. For detailed usage instructions and available rules, see the [documentation](https://eslint-plugin.readthedocs.io/en/latest/).
|
|
14
18
|
|
|
19
|
+
## Learn more
|
|
20
|
+
|
|
21
|
+
- [Catching Jupyter-specific bugs before CI does](https://blog.jupyter.org/posts/2026/catching-jupyter-specific-bugs-before-ci-does/) - the announcement post on the Jupyter Blog, covering the motivation and the initial set of rules.
|
|
22
|
+
|
|
23
|
+
## Acknowledgments
|
|
24
|
+
|
|
25
|
+
Development of this plugin was supported by the [Jupyter Foundation](https://jupyterfoundation.org/). The [progress reports](https://jupyter-governance.github.io/funding-proposals/projects/2025/custom-linting-for-jupyterlab/) cover the scope of the Foundation-funded work.
|
|
26
|
+
|
|
15
27
|
## License
|
|
16
28
|
|
|
17
29
|
BSD 3-Clause
|
package/lib/index.d.ts
CHANGED
|
@@ -1,218 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare const
|
|
3
|
-
rules:
|
|
4
|
-
'plugin-activation-args': import("@typescript-eslint/utils/ts-eslint").RuleModule<"mismatchedOrder" | "incorrectType" | "missingArgument" | "extraArgument" | "appNotFirst" | "serviceManagerFirstArgNotNull" | "invalidAppType" | "wrongArgumentCount" | "unresolvableTokenType" | "optionalNotNullable", [{
|
|
5
|
-
allowedFirstArgumentNames: string[];
|
|
6
|
-
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
7
|
-
name: string;
|
|
8
|
-
};
|
|
9
|
-
'command-described-by': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingDescribedBy", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
10
|
-
name: string;
|
|
11
|
-
};
|
|
12
|
-
'command-id-convention': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingNamespace" | "emptySegment", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
13
|
-
name: string;
|
|
14
|
-
};
|
|
15
|
-
'plugin-description': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingDescription" | "emptyDescription", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
16
|
-
name: string;
|
|
17
|
-
};
|
|
18
|
-
'plugin-id-convention': import("@typescript-eslint/utils/ts-eslint").RuleModule<"mismatchedPrefix" | "idEqualsPackageName", [{
|
|
19
|
-
reportIdEqualToPackageName: boolean;
|
|
20
|
-
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
21
|
-
name: string;
|
|
22
|
-
};
|
|
23
|
-
'no-translation-concatenation': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noConcatenation", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
24
|
-
name: string;
|
|
25
|
-
};
|
|
26
|
-
'no-dynamic-translation': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noInterpolation" | "noDynamicMessage", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
27
|
-
name: string;
|
|
28
|
-
};
|
|
29
|
-
'token-format': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingColon" | "invalidTokenSymbol", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
30
|
-
name: string;
|
|
31
|
-
};
|
|
32
|
-
'no-untranslated-string': import("@typescript-eslint/utils/ts-eslint").RuleModule<"untranslatedCommandProp" | "untranslatedSetAttribute" | "untranslatedPropertyAssign" | "untranslatedDialogOption" | "untranslatedDialogButtonLabel" | "untranslatedJsxText" | "untranslatedJsxAttribute" | "untranslatedProperty", [{
|
|
33
|
-
enforcePunctuation: boolean;
|
|
34
|
-
checkProperties: string[];
|
|
35
|
-
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
36
|
-
name: string;
|
|
37
|
-
};
|
|
38
|
-
'no-schema-enum': import("@typescript-eslint/utils/ts-eslint").RuleModule<"forbidEnum" | "requireStringType", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
39
|
-
name: string;
|
|
40
|
-
};
|
|
41
|
-
'require-soft-assertions-before-snapshots': import("@typescript-eslint/utils/ts-eslint").RuleModule<"requireSoftAssertion", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
42
|
-
name: string;
|
|
43
|
-
};
|
|
44
|
-
'no-pageconfig-base-url': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noPageconfigBaseUrl", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
45
|
-
name: string;
|
|
46
|
-
};
|
|
47
|
-
'require-signal-cleanup': import("@typescript-eslint/utils/ts-eslint").RuleModule<"serviceOutlivesReceiver", [{
|
|
48
|
-
additionalCleanupMethods: string[];
|
|
49
|
-
longLivedTypes: string[] | undefined;
|
|
50
|
-
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
51
|
-
name: string;
|
|
52
|
-
};
|
|
53
|
-
'require-signal-this-arg': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingThisArg" | "addThisArg", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
54
|
-
name: string;
|
|
55
|
-
};
|
|
56
|
-
'prefer-signal-this-arg': import("@typescript-eslint/utils/ts-eslint").RuleModule<"addThisArg" | "preferThisArg" | "boundCallback" | "unbindAndAddThisArg", [{
|
|
57
|
-
longLivedTypes: string[] | undefined;
|
|
58
|
-
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
59
|
-
name: string;
|
|
60
|
-
};
|
|
61
|
-
'galata-prefer-context-menu-helper': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferNotebookOpenNoKernel" | "preferFilebrowserOpenFactory" | "preferFilebrowserOpen", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
62
|
-
name: string;
|
|
63
|
-
};
|
|
64
|
-
'galata-prefer-filebrowser-helper': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferNotebookOpenByPath" | "preferOpenHomeDirectory" | "preferOpenDirectory" | "preferFilebrowserHelper", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
65
|
-
name: string;
|
|
66
|
-
};
|
|
67
|
-
'galata-prefer-menu-helper': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferMenuOpen" | "preferClickMenuItem" | "preferMenuHelper", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
68
|
-
name: string;
|
|
69
|
-
};
|
|
70
|
-
'galata-prefer-notebook-cell-helper': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferSetCell" | "preferEnterCellEditingMode" | "preferSelectCells" | "preferRunCell", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
71
|
-
name: string;
|
|
72
|
-
};
|
|
73
|
-
'galata-prefer-sidebar-activity-helper': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferSidebarHelper" | "preferActivityHelper", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
74
|
-
name: string;
|
|
75
|
-
};
|
|
76
|
-
'require-disposable-ownership': import("@typescript-eslint/utils/ts-eslint").RuleModule<"unmanagedDisposable" | "unmanagedDisposableVariable", [{}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
77
|
-
name: string;
|
|
78
|
-
};
|
|
79
|
-
'require-disposable-transfer': import("@typescript-eslint/utils/ts-eslint").RuleModule<"unmanagedDisposableVariable" | "unhandledDisposable", [{}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
80
|
-
name: string;
|
|
81
|
-
};
|
|
82
|
-
'incorrect-translator-usage': import("@typescript-eslint/utils/ts-eslint").RuleModule<"chainedBundleMethod" | "invalidBundleName" | "destructuredBundle", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
83
|
-
name: string;
|
|
84
|
-
};
|
|
85
|
-
'prefer-lazy-imports': import("@typescript-eslint/utils/ts-eslint").RuleModule<string, [import("./utils/lazy-imports").LazyImportOptions], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
86
|
-
name: string;
|
|
87
|
-
};
|
|
88
|
-
};
|
|
1
|
+
import type { ESLint, Linter, Rule } from 'eslint';
|
|
2
|
+
declare const _default: ESLint.Plugin & {
|
|
3
|
+
rules: Record<string, Rule.RuleModule>;
|
|
89
4
|
configs: {
|
|
90
|
-
recommended:
|
|
91
|
-
|
|
92
|
-
rules: {
|
|
93
|
-
'jupyter/plugin-activation-args': string;
|
|
94
|
-
'jupyter/command-described-by': string;
|
|
95
|
-
'jupyter/command-id-convention': string;
|
|
96
|
-
'jupyter/plugin-description': string;
|
|
97
|
-
'jupyter/plugin-id-convention': string;
|
|
98
|
-
'jupyter/no-translation-concatenation': string;
|
|
99
|
-
'jupyter/no-dynamic-translation': string;
|
|
100
|
-
'jupyter/token-format': string;
|
|
101
|
-
'jupyter/no-untranslated-string': string;
|
|
102
|
-
'jupyter/no-pageconfig-base-url': string;
|
|
103
|
-
'jupyter/require-signal-cleanup': string;
|
|
104
|
-
'jupyter/require-signal-this-arg': string;
|
|
105
|
-
'jupyter/prefer-signal-this-arg': string;
|
|
106
|
-
'jupyter/require-disposable-ownership': string;
|
|
107
|
-
'jupyter/require-disposable-transfer': string;
|
|
108
|
-
'jupyter/incorrect-translator-usage': string;
|
|
109
|
-
'jupyter/prefer-lazy-imports': string;
|
|
110
|
-
'jupyter/no-schema-enum'?: undefined;
|
|
111
|
-
'jupyter/require-soft-assertions-before-snapshots'?: undefined;
|
|
112
|
-
'jupyter/galata-prefer-context-menu-helper'?: undefined;
|
|
113
|
-
'jupyter/galata-prefer-filebrowser-helper'?: undefined;
|
|
114
|
-
'jupyter/galata-prefer-menu-helper'?: undefined;
|
|
115
|
-
'jupyter/galata-prefer-notebook-cell-helper'?: undefined;
|
|
116
|
-
'jupyter/galata-prefer-sidebar-activity-helper'?: undefined;
|
|
117
|
-
};
|
|
118
|
-
languageOptions?: undefined;
|
|
119
|
-
} | {
|
|
120
|
-
files: string[];
|
|
121
|
-
languageOptions: {
|
|
122
|
-
parser: typeof jsoncParser;
|
|
123
|
-
};
|
|
124
|
-
rules: {
|
|
125
|
-
'jupyter/no-schema-enum': string;
|
|
126
|
-
'jupyter/plugin-activation-args'?: undefined;
|
|
127
|
-
'jupyter/command-described-by'?: undefined;
|
|
128
|
-
'jupyter/command-id-convention'?: undefined;
|
|
129
|
-
'jupyter/plugin-description'?: undefined;
|
|
130
|
-
'jupyter/plugin-id-convention'?: undefined;
|
|
131
|
-
'jupyter/no-translation-concatenation'?: undefined;
|
|
132
|
-
'jupyter/no-dynamic-translation'?: undefined;
|
|
133
|
-
'jupyter/token-format'?: undefined;
|
|
134
|
-
'jupyter/no-untranslated-string'?: undefined;
|
|
135
|
-
'jupyter/no-pageconfig-base-url'?: undefined;
|
|
136
|
-
'jupyter/require-signal-cleanup'?: undefined;
|
|
137
|
-
'jupyter/require-signal-this-arg'?: undefined;
|
|
138
|
-
'jupyter/prefer-signal-this-arg'?: undefined;
|
|
139
|
-
'jupyter/require-disposable-ownership'?: undefined;
|
|
140
|
-
'jupyter/require-disposable-transfer'?: undefined;
|
|
141
|
-
'jupyter/incorrect-translator-usage'?: undefined;
|
|
142
|
-
'jupyter/prefer-lazy-imports'?: undefined;
|
|
143
|
-
'jupyter/require-soft-assertions-before-snapshots'?: undefined;
|
|
144
|
-
'jupyter/galata-prefer-context-menu-helper'?: undefined;
|
|
145
|
-
'jupyter/galata-prefer-filebrowser-helper'?: undefined;
|
|
146
|
-
'jupyter/galata-prefer-menu-helper'?: undefined;
|
|
147
|
-
'jupyter/galata-prefer-notebook-cell-helper'?: undefined;
|
|
148
|
-
'jupyter/galata-prefer-sidebar-activity-helper'?: undefined;
|
|
149
|
-
};
|
|
150
|
-
} | {
|
|
151
|
-
files: string[];
|
|
152
|
-
rules: {
|
|
153
|
-
'jupyter/require-soft-assertions-before-snapshots': string;
|
|
154
|
-
'jupyter/galata-prefer-context-menu-helper': string;
|
|
155
|
-
'jupyter/galata-prefer-filebrowser-helper': string;
|
|
156
|
-
'jupyter/galata-prefer-menu-helper': string;
|
|
157
|
-
'jupyter/galata-prefer-notebook-cell-helper': string;
|
|
158
|
-
'jupyter/galata-prefer-sidebar-activity-helper': string;
|
|
159
|
-
'jupyter/prefer-lazy-imports': string;
|
|
160
|
-
'jupyter/plugin-id-convention': string;
|
|
161
|
-
'jupyter/command-id-convention': string;
|
|
162
|
-
'jupyter/plugin-activation-args'?: undefined;
|
|
163
|
-
'jupyter/command-described-by'?: undefined;
|
|
164
|
-
'jupyter/plugin-description'?: undefined;
|
|
165
|
-
'jupyter/no-translation-concatenation'?: undefined;
|
|
166
|
-
'jupyter/no-dynamic-translation'?: undefined;
|
|
167
|
-
'jupyter/token-format'?: undefined;
|
|
168
|
-
'jupyter/no-untranslated-string'?: undefined;
|
|
169
|
-
'jupyter/no-pageconfig-base-url'?: undefined;
|
|
170
|
-
'jupyter/require-signal-cleanup'?: undefined;
|
|
171
|
-
'jupyter/require-signal-this-arg'?: undefined;
|
|
172
|
-
'jupyter/prefer-signal-this-arg'?: undefined;
|
|
173
|
-
'jupyter/require-disposable-ownership'?: undefined;
|
|
174
|
-
'jupyter/require-disposable-transfer'?: undefined;
|
|
175
|
-
'jupyter/incorrect-translator-usage'?: undefined;
|
|
176
|
-
'jupyter/no-schema-enum'?: undefined;
|
|
177
|
-
};
|
|
178
|
-
languageOptions?: undefined;
|
|
179
|
-
})[];
|
|
180
|
-
'recommended-legacy': {
|
|
181
|
-
rules: {
|
|
182
|
-
'jupyter/plugin-activation-args': string;
|
|
183
|
-
'jupyter/command-described-by': string;
|
|
184
|
-
'jupyter/command-id-convention': string;
|
|
185
|
-
'jupyter/plugin-description': string;
|
|
186
|
-
'jupyter/plugin-id-convention': string;
|
|
187
|
-
'jupyter/no-translation-concatenation': string;
|
|
188
|
-
'jupyter/no-dynamic-translation': string;
|
|
189
|
-
'jupyter/token-format': string;
|
|
190
|
-
'jupyter/no-untranslated-string': string;
|
|
191
|
-
'jupyter/no-schema-enum': string;
|
|
192
|
-
'jupyter/no-pageconfig-base-url': string;
|
|
193
|
-
'jupyter/require-signal-cleanup': string;
|
|
194
|
-
'jupyter/require-signal-this-arg': string;
|
|
195
|
-
'jupyter/prefer-signal-this-arg': string;
|
|
196
|
-
'jupyter/require-disposable-ownership': string;
|
|
197
|
-
'jupyter/require-disposable-transfer': string;
|
|
198
|
-
'jupyter/incorrect-translator-usage': string;
|
|
199
|
-
'jupyter/prefer-lazy-imports': string;
|
|
200
|
-
};
|
|
201
|
-
overrides: {
|
|
202
|
-
files: string[];
|
|
203
|
-
rules: {
|
|
204
|
-
'jupyter/require-soft-assertions-before-snapshots': string;
|
|
205
|
-
'jupyter/galata-prefer-context-menu-helper': string;
|
|
206
|
-
'jupyter/galata-prefer-filebrowser-helper': string;
|
|
207
|
-
'jupyter/galata-prefer-menu-helper': string;
|
|
208
|
-
'jupyter/galata-prefer-notebook-cell-helper': string;
|
|
209
|
-
'jupyter/galata-prefer-sidebar-activity-helper': string;
|
|
210
|
-
'jupyter/prefer-lazy-imports': string;
|
|
211
|
-
'jupyter/plugin-id-convention': string;
|
|
212
|
-
'jupyter/command-id-convention': string;
|
|
213
|
-
};
|
|
214
|
-
}[];
|
|
215
|
-
};
|
|
5
|
+
recommended: Linter.Config[];
|
|
6
|
+
"recommended-legacy": Linter.LegacyConfig;
|
|
216
7
|
};
|
|
217
8
|
};
|
|
218
|
-
export =
|
|
9
|
+
export = _default;
|
package/lib/index.js
CHANGED
|
@@ -39,6 +39,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
39
39
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
40
40
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
41
41
|
};
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
42
44
|
const jsoncParser = __importStar(require("jsonc-eslint-parser"));
|
|
43
45
|
const plugin_activation_args_1 = __importDefault(require("./rules/plugin-activation-args"));
|
|
44
46
|
const command_described_by_1 = __importDefault(require("./rules/command-described-by"));
|
|
@@ -64,7 +66,16 @@ const require_disposable_ownership_1 = __importDefault(require("./rules/require-
|
|
|
64
66
|
const require_disposable_transfer_1 = __importDefault(require("./rules/require-disposable-transfer"));
|
|
65
67
|
const incorrect_translator_usage_1 = __importDefault(require("./rules/incorrect-translator-usage"));
|
|
66
68
|
const prefer_lazy_imports_1 = __importDefault(require("./rules/prefer-lazy-imports"));
|
|
69
|
+
const { name, version } = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'));
|
|
70
|
+
// Filled in below once `plugin` exists, so that `configs.recommended` registers
|
|
71
|
+
// the plugin itself and works without a separate `plugins` entry.
|
|
72
|
+
const plugins = {};
|
|
67
73
|
const plugin = {
|
|
74
|
+
meta: {
|
|
75
|
+
name,
|
|
76
|
+
version,
|
|
77
|
+
namespace: 'jupyter'
|
|
78
|
+
},
|
|
68
79
|
rules: {
|
|
69
80
|
'plugin-activation-args': plugin_activation_args_1.default,
|
|
70
81
|
'command-described-by': command_described_by_1.default,
|
|
@@ -93,6 +104,7 @@ const plugin = {
|
|
|
93
104
|
},
|
|
94
105
|
configs: {
|
|
95
106
|
recommended: [
|
|
107
|
+
{ plugins },
|
|
96
108
|
{
|
|
97
109
|
files: ['**/*.js', '**/*.ts', '**/*.jsx', '**/*.tsx'],
|
|
98
110
|
rules: {
|
|
@@ -141,25 +153,26 @@ const plugin = {
|
|
|
141
153
|
}
|
|
142
154
|
],
|
|
143
155
|
'recommended-legacy': {
|
|
156
|
+
plugins: ['@jupyter'],
|
|
144
157
|
rules: {
|
|
145
|
-
'jupyter/plugin-activation-args': 'error',
|
|
146
|
-
'jupyter/command-described-by': 'warn',
|
|
147
|
-
'jupyter/command-id-convention': 'warn',
|
|
148
|
-
'jupyter/plugin-description': 'warn',
|
|
149
|
-
'jupyter/plugin-id-convention': 'warn',
|
|
150
|
-
'jupyter/no-translation-concatenation': 'error',
|
|
151
|
-
'jupyter/no-dynamic-translation': 'warn',
|
|
152
|
-
'jupyter/token-format': 'error',
|
|
153
|
-
'jupyter/no-untranslated-string': 'warn',
|
|
154
|
-
'jupyter/no-schema-enum': 'warn',
|
|
155
|
-
'jupyter/no-pageconfig-base-url': 'warn',
|
|
156
|
-
'jupyter/require-signal-cleanup': 'warn',
|
|
157
|
-
'jupyter/require-signal-this-arg': 'error',
|
|
158
|
-
'jupyter/prefer-signal-this-arg': 'warn',
|
|
159
|
-
'jupyter/require-disposable-ownership': 'warn',
|
|
160
|
-
'jupyter/require-disposable-transfer': 'warn',
|
|
161
|
-
'jupyter/incorrect-translator-usage': 'warn',
|
|
162
|
-
'jupyter/prefer-lazy-imports': 'warn'
|
|
158
|
+
'@jupyter/plugin-activation-args': 'error',
|
|
159
|
+
'@jupyter/command-described-by': 'warn',
|
|
160
|
+
'@jupyter/command-id-convention': 'warn',
|
|
161
|
+
'@jupyter/plugin-description': 'warn',
|
|
162
|
+
'@jupyter/plugin-id-convention': 'warn',
|
|
163
|
+
'@jupyter/no-translation-concatenation': 'error',
|
|
164
|
+
'@jupyter/no-dynamic-translation': 'warn',
|
|
165
|
+
'@jupyter/token-format': 'error',
|
|
166
|
+
'@jupyter/no-untranslated-string': 'warn',
|
|
167
|
+
'@jupyter/no-schema-enum': 'warn',
|
|
168
|
+
'@jupyter/no-pageconfig-base-url': 'warn',
|
|
169
|
+
'@jupyter/require-signal-cleanup': 'warn',
|
|
170
|
+
'@jupyter/require-signal-this-arg': 'error',
|
|
171
|
+
'@jupyter/prefer-signal-this-arg': 'warn',
|
|
172
|
+
'@jupyter/require-disposable-ownership': 'warn',
|
|
173
|
+
'@jupyter/require-disposable-transfer': 'warn',
|
|
174
|
+
'@jupyter/incorrect-translator-usage': 'warn',
|
|
175
|
+
'@jupyter/prefer-lazy-imports': 'warn'
|
|
163
176
|
},
|
|
164
177
|
overrides: [
|
|
165
178
|
{
|
|
@@ -170,19 +183,20 @@ const plugin = {
|
|
|
170
183
|
'**/*.test.js'
|
|
171
184
|
],
|
|
172
185
|
rules: {
|
|
173
|
-
'jupyter/require-soft-assertions-before-snapshots': 'warn',
|
|
174
|
-
'jupyter/galata-prefer-context-menu-helper': 'warn',
|
|
175
|
-
'jupyter/galata-prefer-filebrowser-helper': 'warn',
|
|
176
|
-
'jupyter/galata-prefer-menu-helper': 'warn',
|
|
177
|
-
'jupyter/galata-prefer-notebook-cell-helper': 'warn',
|
|
178
|
-
'jupyter/galata-prefer-sidebar-activity-helper': 'warn',
|
|
179
|
-
'jupyter/prefer-lazy-imports': 'off',
|
|
180
|
-
'jupyter/plugin-id-convention': 'off',
|
|
181
|
-
'jupyter/command-id-convention': 'off'
|
|
186
|
+
'@jupyter/require-soft-assertions-before-snapshots': 'warn',
|
|
187
|
+
'@jupyter/galata-prefer-context-menu-helper': 'warn',
|
|
188
|
+
'@jupyter/galata-prefer-filebrowser-helper': 'warn',
|
|
189
|
+
'@jupyter/galata-prefer-menu-helper': 'warn',
|
|
190
|
+
'@jupyter/galata-prefer-notebook-cell-helper': 'warn',
|
|
191
|
+
'@jupyter/galata-prefer-sidebar-activity-helper': 'warn',
|
|
192
|
+
'@jupyter/prefer-lazy-imports': 'off',
|
|
193
|
+
'@jupyter/plugin-id-convention': 'off',
|
|
194
|
+
'@jupyter/command-id-convention': 'off'
|
|
182
195
|
}
|
|
183
196
|
}
|
|
184
197
|
]
|
|
185
198
|
}
|
|
186
199
|
}
|
|
187
200
|
};
|
|
201
|
+
plugins.jupyter = plugin;
|
|
188
202
|
module.exports = plugin;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
const plugin_utils_1 = require("../utils/plugin-utils");
|
|
7
7
|
const commands_1 = require("../utils/commands");
|
|
8
|
+
const type_services_1 = require("../utils/type-services");
|
|
8
9
|
const create_rule_1 = require("../utils/create-rule");
|
|
9
10
|
const jupyterCommandDescribedBy = (0, create_rule_1.createRule)({
|
|
10
11
|
name: 'command-described-by',
|
|
@@ -21,32 +22,17 @@ const jupyterCommandDescribedBy = (0, create_rule_1.createRule)({
|
|
|
21
22
|
},
|
|
22
23
|
defaultOptions: [],
|
|
23
24
|
create(context) {
|
|
25
|
+
const { checker, getTSNode } = (0, type_services_1.getTypeServices)(context);
|
|
24
26
|
return {
|
|
25
27
|
CallExpression(node) {
|
|
26
28
|
// Check if this is <something>.addCommand()
|
|
27
|
-
if (!(0, commands_1.isAddCommandCall)(node)) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
// Get the command ID and options
|
|
31
|
-
if (node.arguments.length < 2) {
|
|
29
|
+
if (!(0, commands_1.isAddCommandCall)(node) || node.arguments.length < 2) {
|
|
32
30
|
return;
|
|
33
31
|
}
|
|
34
32
|
const commandIdArg = node.arguments[0];
|
|
35
33
|
const optionsArg = node.arguments[1];
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (commandIdArg.type === 'Literal' &&
|
|
39
|
-
typeof commandIdArg.value === 'string') {
|
|
40
|
-
commandId = commandIdArg.value;
|
|
41
|
-
}
|
|
42
|
-
else if (commandIdArg.type === 'Identifier') {
|
|
43
|
-
commandId = commandIdArg.name;
|
|
44
|
-
}
|
|
45
|
-
else if (commandIdArg.type === 'MemberExpression') {
|
|
46
|
-
// Handle CommandIDs.something pattern
|
|
47
|
-
if (commandIdArg.property.type === 'Identifier') {
|
|
48
|
-
commandId = commandIdArg.property.name;
|
|
49
|
-
}
|
|
34
|
+
if (commandIdArg.type === 'SpreadElement') {
|
|
35
|
+
return;
|
|
50
36
|
}
|
|
51
37
|
// Options must be an object
|
|
52
38
|
if (optionsArg.type !== 'ObjectExpression') {
|
|
@@ -58,18 +44,23 @@ const jupyterCommandDescribedBy = (0, create_rule_1.createRule)({
|
|
|
58
44
|
if (!executeProp || executeProp.value.type === 'Literal') {
|
|
59
45
|
return;
|
|
60
46
|
}
|
|
61
|
-
|
|
62
|
-
if (!describedByProp) {
|
|
63
|
-
context.report({
|
|
64
|
-
node,
|
|
65
|
-
messageId: 'missingDescribedBy',
|
|
66
|
-
data: { commandId }
|
|
67
|
-
});
|
|
47
|
+
if (properties.has('describedBy')) {
|
|
68
48
|
return;
|
|
69
49
|
}
|
|
70
|
-
|
|
50
|
+
// A registry created on the spot, such as one backing a context
|
|
51
|
+
// menu, is never listed or queried alongside the application's.
|
|
52
|
+
const callee = node.callee;
|
|
53
|
+
if (callee.object.type !== 'Super' &&
|
|
54
|
+
(0, commands_1.isPrivateCommandRegistry)(callee.object, context.sourceCode.getScope(node))) {
|
|
71
55
|
return;
|
|
72
56
|
}
|
|
57
|
+
// Extract command ID for error message
|
|
58
|
+
const commandId = (0, commands_1.resolveCommandId)(commandIdArg, context.sourceCode, checker, getTSNode) ?? context.sourceCode.getText(commandIdArg);
|
|
59
|
+
context.report({
|
|
60
|
+
node,
|
|
61
|
+
messageId: 'missingDescribedBy',
|
|
62
|
+
data: { commandId }
|
|
63
|
+
});
|
|
73
64
|
}
|
|
74
65
|
};
|
|
75
66
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
declare const noUntranslatedString: import("@typescript-eslint/utils/ts-eslint").RuleModule<"untranslatedCommandProp" | "untranslatedSetAttribute" | "untranslatedPropertyAssign" | "untranslatedDialogOption" | "untranslatedDialogButtonLabel" | "untranslatedJsxText" | "untranslatedJsxAttribute" | "untranslatedProperty", [{
|
|
2
2
|
enforcePunctuation: boolean;
|
|
3
|
-
checkProperties: string[];
|
|
3
|
+
checkProperties: string[] | undefined;
|
|
4
|
+
extendDefaultCheckProperties: boolean;
|
|
4
5
|
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
5
6
|
name: string;
|
|
6
7
|
};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
6
|
const commands_1 = require("../utils/commands");
|
|
7
|
+
const options_1 = require("../utils/options");
|
|
7
8
|
const plugin_utils_1 = require("../utils/plugin-utils");
|
|
8
9
|
const translation_1 = require("../utils/translation");
|
|
9
10
|
const create_rule_1 = require("../utils/create-rule");
|
|
@@ -151,7 +152,13 @@ const noUntranslatedString = (0, create_rule_1.createRule)({
|
|
|
151
152
|
checkProperties: {
|
|
152
153
|
type: 'array',
|
|
153
154
|
items: { type: 'string' },
|
|
154
|
-
uniqueItems: true
|
|
155
|
+
uniqueItems: true,
|
|
156
|
+
description: 'Property or attribute names checked for untranslated strings. Added to the built-in defaults unless extendDefaultCheckProperties is false.'
|
|
157
|
+
},
|
|
158
|
+
extendDefaultCheckProperties: {
|
|
159
|
+
type: 'boolean',
|
|
160
|
+
default: true,
|
|
161
|
+
description: 'Whether checkProperties extends the built-in defaults. Set to false to replace them, or to drop them entirely when no list is given.'
|
|
155
162
|
}
|
|
156
163
|
},
|
|
157
164
|
additionalProperties: false
|
|
@@ -161,13 +168,14 @@ const noUntranslatedString = (0, create_rule_1.createRule)({
|
|
|
161
168
|
defaultOptions: [
|
|
162
169
|
{
|
|
163
170
|
enforcePunctuation: false,
|
|
164
|
-
checkProperties:
|
|
171
|
+
checkProperties: undefined,
|
|
172
|
+
extendDefaultCheckProperties: true
|
|
165
173
|
}
|
|
166
174
|
],
|
|
167
175
|
create(context) {
|
|
168
176
|
const options = context.options[0];
|
|
169
177
|
const enforcePunctuation = options?.enforcePunctuation ?? false;
|
|
170
|
-
const checkProperties =
|
|
178
|
+
const checkProperties = (0, options_1.resolveNameListOption)(options?.checkProperties?.map(normalizeName), DEFAULT_CHECK_PROPERTIES.map(normalizeName), options?.extendDefaultCheckProperties !== false);
|
|
171
179
|
function isMonitoredName(name) {
|
|
172
180
|
return checkProperties.has(normalizeName(name));
|
|
173
181
|
}
|
|
@@ -51,10 +51,20 @@ function unwrapParentheses(node) {
|
|
|
51
51
|
return current;
|
|
52
52
|
}
|
|
53
53
|
function extractFunctionInfo(node, fn) {
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
54
|
+
const paramNames = [];
|
|
55
|
+
const paramTypes = [];
|
|
56
|
+
const paramNodes = [];
|
|
57
|
+
for (const param of fn.params) {
|
|
58
|
+
const id = param.type === 'AssignmentPattern' ? param.left : param;
|
|
59
|
+
if (id.type !== 'Identifier') {
|
|
60
|
+
// A destructured parameter has no name to check, and a rest parameter
|
|
61
|
+
// has no fixed position, so leave those functions alone.
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
paramNames.push(id.name);
|
|
65
|
+
paramTypes.push((0, plugin_utils_1.extractParameterType)(id));
|
|
66
|
+
paramNodes.push(id);
|
|
67
|
+
}
|
|
58
68
|
return {
|
|
59
69
|
node,
|
|
60
70
|
paramNames,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare const preferSignalThisArg: import("@typescript-eslint/utils/ts-eslint").RuleModule<"addThisArg" | "preferThisArg" | "boundCallback" | "unbindAndAddThisArg", [{
|
|
2
2
|
longLivedTypes: string[] | undefined;
|
|
3
|
+
extendDefaultLongLivedTypes: boolean;
|
|
3
4
|
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
4
5
|
name: string;
|
|
5
6
|
};
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
const create_rule_1 = require("../utils/create-rule");
|
|
7
7
|
const type_services_1 = require("../utils/type-services");
|
|
8
8
|
const signals_1 = require("../utils/signals");
|
|
9
|
+
const options_1 = require("../utils/options");
|
|
9
10
|
const signal_lifetime_1 = require("../utils/signal-lifetime");
|
|
10
11
|
const preferSignalThisArg = (0, create_rule_1.createRule)({
|
|
11
12
|
name: 'prefer-signal-this-arg',
|
|
@@ -31,7 +32,12 @@ const preferSignalThisArg = (0, create_rule_1.createRule)({
|
|
|
31
32
|
items: {
|
|
32
33
|
type: 'string'
|
|
33
34
|
},
|
|
34
|
-
description: 'Type names treated as application-lifetime services.
|
|
35
|
+
description: 'Type names treated as application-lifetime services. Added to the built-in defaults unless extendDefaultLongLivedTypes is false.'
|
|
36
|
+
},
|
|
37
|
+
extendDefaultLongLivedTypes: {
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
default: true,
|
|
40
|
+
description: 'Whether longLivedTypes extends the built-in defaults. Set to false to replace them, or to drop them entirely when no list is given.'
|
|
35
41
|
}
|
|
36
42
|
},
|
|
37
43
|
additionalProperties: false
|
|
@@ -40,11 +46,12 @@ const preferSignalThisArg = (0, create_rule_1.createRule)({
|
|
|
40
46
|
},
|
|
41
47
|
defaultOptions: [
|
|
42
48
|
{
|
|
43
|
-
longLivedTypes: undefined
|
|
49
|
+
longLivedTypes: undefined,
|
|
50
|
+
extendDefaultLongLivedTypes: true
|
|
44
51
|
}
|
|
45
52
|
],
|
|
46
53
|
create(context, [options]) {
|
|
47
|
-
const longLivedTypes =
|
|
54
|
+
const longLivedTypes = (0, options_1.resolveNameListOption)(options.longLivedTypes, signal_lifetime_1.DEFAULT_LONG_LIVED_TYPES, options.extendDefaultLongLivedTypes !== false);
|
|
48
55
|
const { services, checker } = (0, type_services_1.getTypeServices)(context);
|
|
49
56
|
const sourceCode = context.sourceCode;
|
|
50
57
|
let program = null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
declare const requireSignalCleanup: import("@typescript-eslint/utils/ts-eslint").RuleModule<"serviceOutlivesReceiver", [{
|
|
2
2
|
additionalCleanupMethods: string[];
|
|
3
3
|
longLivedTypes: string[] | undefined;
|
|
4
|
+
extendDefaultLongLivedTypes: boolean;
|
|
4
5
|
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
5
6
|
name: string;
|
|
6
7
|
};
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
const create_rule_1 = require("../utils/create-rule");
|
|
7
7
|
const type_services_1 = require("../utils/type-services");
|
|
8
8
|
const signals_1 = require("../utils/signals");
|
|
9
|
+
const options_1 = require("../utils/options");
|
|
9
10
|
const signal_lifetime_1 = require("../utils/signal-lifetime");
|
|
10
11
|
const requireSignalCleanup = (0, create_rule_1.createRule)({
|
|
11
12
|
name: 'require-signal-cleanup',
|
|
@@ -35,7 +36,12 @@ const requireSignalCleanup = (0, create_rule_1.createRule)({
|
|
|
35
36
|
items: {
|
|
36
37
|
type: 'string'
|
|
37
38
|
},
|
|
38
|
-
description: 'Type names treated as application-lifetime services.
|
|
39
|
+
description: 'Type names treated as application-lifetime services. Added to the built-in defaults unless extendDefaultLongLivedTypes is false.'
|
|
40
|
+
},
|
|
41
|
+
extendDefaultLongLivedTypes: {
|
|
42
|
+
type: 'boolean',
|
|
43
|
+
default: true,
|
|
44
|
+
description: 'Whether longLivedTypes extends the built-in defaults. Set to false to replace them, or to drop them entirely when no list is given.'
|
|
39
45
|
}
|
|
40
46
|
},
|
|
41
47
|
additionalProperties: false
|
|
@@ -45,12 +51,13 @@ const requireSignalCleanup = (0, create_rule_1.createRule)({
|
|
|
45
51
|
defaultOptions: [
|
|
46
52
|
{
|
|
47
53
|
additionalCleanupMethods: [],
|
|
48
|
-
longLivedTypes: undefined
|
|
54
|
+
longLivedTypes: undefined,
|
|
55
|
+
extendDefaultLongLivedTypes: true
|
|
49
56
|
}
|
|
50
57
|
],
|
|
51
58
|
create(context, [options]) {
|
|
52
59
|
const additionalCleanupMethods = options.additionalCleanupMethods || [];
|
|
53
|
-
const longLivedTypes =
|
|
60
|
+
const longLivedTypes = (0, options_1.resolveNameListOption)(options.longLivedTypes, signal_lifetime_1.DEFAULT_LONG_LIVED_TYPES, options.extendDefaultLongLivedTypes !== false);
|
|
54
61
|
const { services, checker } = (0, type_services_1.getTypeServices)(context);
|
|
55
62
|
const sourceCode = context.sourceCode;
|
|
56
63
|
let program = null;
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
6
|
const create_rule_1 = require("../utils/create-rule");
|
|
7
|
+
const plugin_utils_1 = require("../utils/plugin-utils");
|
|
8
|
+
const type_services_1 = require("../utils/type-services");
|
|
7
9
|
/**
|
|
8
10
|
* Token symbol (part after the first ':') must be a valid JavaScript identifier.
|
|
9
11
|
*/
|
|
@@ -25,6 +27,7 @@ const tokenFormat = (0, create_rule_1.createRule)({
|
|
|
25
27
|
},
|
|
26
28
|
defaultOptions: [],
|
|
27
29
|
create(context) {
|
|
30
|
+
const { checker, getTSNode } = (0, type_services_1.getTypeServices)(context);
|
|
28
31
|
return {
|
|
29
32
|
NewExpression(node) {
|
|
30
33
|
if (node.callee.type !== 'Identifier' || node.callee.name !== 'Token') {
|
|
@@ -34,10 +37,13 @@ const tokenFormat = (0, create_rule_1.createRule)({
|
|
|
34
37
|
return;
|
|
35
38
|
}
|
|
36
39
|
const firstArg = node.arguments[0];
|
|
37
|
-
if (firstArg.type
|
|
40
|
+
if (firstArg.type === 'SpreadElement') {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const tokenId = (0, plugin_utils_1.resolveStaticString)(firstArg, context.sourceCode.getScope(node), checker, getTSNode);
|
|
44
|
+
if (tokenId === null) {
|
|
38
45
|
return;
|
|
39
46
|
}
|
|
40
|
-
const tokenId = firstArg.value;
|
|
41
47
|
const colonIndex = tokenId.indexOf(':');
|
|
42
48
|
if (colonIndex === -1) {
|
|
43
49
|
context.report({
|
package/lib/utils/ast.d.ts
CHANGED
package/lib/utils/commands.d.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import { TSESTree } from '@typescript-eslint/
|
|
2
|
-
import { ParserServices, TSESLint } from '@typescript-eslint/utils';
|
|
1
|
+
import { ParserServices, TSESLint, TSESTree } from '@typescript-eslint/utils';
|
|
3
2
|
import * as ts from 'typescript';
|
|
4
|
-
|
|
5
|
-
* Resolves a configurable name list option.
|
|
6
|
-
*
|
|
7
|
-
* A user-supplied list is *added* to the built-in defaults, so a project only
|
|
8
|
-
* has to name its own helpers rather than restate this plugin's list. Passing
|
|
9
|
-
* the matching `extendDefault...` option as `false` drops the defaults, whether
|
|
10
|
-
* or not a replacement list is given, which is also how to ask for the
|
|
11
|
-
* strictest possible checking.
|
|
12
|
-
*/
|
|
13
|
-
export declare function resolveNameListOption(provided: readonly string[] | undefined, defaults: readonly string[], extendDefaults: boolean): Set<string>;
|
|
3
|
+
export { resolveNameListOption } from './options';
|
|
14
4
|
export declare const DEFAULT_OWNERSHIP_FUNCTION_NAMES: string[];
|
|
15
5
|
interface PendingDisposable {
|
|
16
6
|
node: TSESTree.Node;
|
|
@@ -73,4 +63,3 @@ export declare function isDisposableType(type: ts.Type, checker: ts.TypeChecker,
|
|
|
73
63
|
*/
|
|
74
64
|
export declare function constructsDisposable(node: TSESTree.NewExpression, ownership: DisposableOwnershipContext): boolean;
|
|
75
65
|
export declare function shouldCheckReturnedDisposable(node: TSESTree.CallExpression): boolean;
|
|
76
|
-
export {};
|
package/lib/utils/disposables.js
CHANGED
|
@@ -37,8 +37,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
37
37
|
};
|
|
38
38
|
})();
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.DEFAULT_OWNERSHIP_FUNCTION_NAMES = void 0;
|
|
41
|
-
exports.resolveNameListOption = resolveNameListOption;
|
|
40
|
+
exports.DEFAULT_OWNERSHIP_FUNCTION_NAMES = exports.resolveNameListOption = void 0;
|
|
42
41
|
exports.getCalleeName = getCalleeName;
|
|
43
42
|
exports.isDisposableConstructor = isDisposableConstructor;
|
|
44
43
|
exports.isDisposableSetFactoryCall = isDisposableSetFactoryCall;
|
|
@@ -65,22 +64,8 @@ const DISPOSABLE_CONSTRUCTOR_NAMES = [
|
|
|
65
64
|
];
|
|
66
65
|
const DISPOSABLE_SET_NAMES = ['DisposableSet', 'ObservableDisposableSet'];
|
|
67
66
|
const FLUENT_DISPOSABLE_METHOD_NAMES = ['initializeState'];
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
*
|
|
71
|
-
* A user-supplied list is *added* to the built-in defaults, so a project only
|
|
72
|
-
* has to name its own helpers rather than restate this plugin's list. Passing
|
|
73
|
-
* the matching `extendDefault...` option as `false` drops the defaults, whether
|
|
74
|
-
* or not a replacement list is given, which is also how to ask for the
|
|
75
|
-
* strictest possible checking.
|
|
76
|
-
*/
|
|
77
|
-
function resolveNameListOption(provided, defaults, extendDefaults) {
|
|
78
|
-
const names = extendDefaults ? [...defaults] : [];
|
|
79
|
-
if (provided) {
|
|
80
|
-
names.push(...provided);
|
|
81
|
-
}
|
|
82
|
-
return new Set(names);
|
|
83
|
-
}
|
|
67
|
+
var options_1 = require("./options");
|
|
68
|
+
Object.defineProperty(exports, "resolveNameListOption", { enumerable: true, get: function () { return options_1.resolveNameListOption; } });
|
|
84
69
|
exports.DEFAULT_OWNERSHIP_FUNCTION_NAMES = [
|
|
85
70
|
'add',
|
|
86
71
|
'addCell',
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { TSESTree } from '@typescript-eslint/
|
|
2
|
-
import { TSESLint } from '@typescript-eslint/utils';
|
|
1
|
+
import { TSESLint, TSESTree } from '@typescript-eslint/utils';
|
|
3
2
|
export interface LazyImportOptions {
|
|
4
3
|
allowedPackages: string[];
|
|
5
4
|
deferredPackages: string[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves a configurable name list option.
|
|
3
|
+
*
|
|
4
|
+
* A user-supplied list is *added* to the built-in defaults, so a project only
|
|
5
|
+
* has to name its own entries rather than restate this plugin's list. Passing
|
|
6
|
+
* the matching `extendDefault...` option as `false` drops the defaults, whether
|
|
7
|
+
* or not a replacement list is given.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveNameListOption(provided: readonly string[] | undefined, defaults: readonly string[], extendDefaults: boolean): Set<string>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) Jupyter Development Team.
|
|
4
|
+
* Distributed under the terms of the Modified BSD License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.resolveNameListOption = resolveNameListOption;
|
|
8
|
+
/**
|
|
9
|
+
* Resolves a configurable name list option.
|
|
10
|
+
*
|
|
11
|
+
* A user-supplied list is *added* to the built-in defaults, so a project only
|
|
12
|
+
* has to name its own entries rather than restate this plugin's list. Passing
|
|
13
|
+
* the matching `extendDefault...` option as `false` drops the defaults, whether
|
|
14
|
+
* or not a replacement list is given.
|
|
15
|
+
*/
|
|
16
|
+
function resolveNameListOption(provided, defaults, extendDefaults) {
|
|
17
|
+
const names = extendDefaults ? [...defaults] : [];
|
|
18
|
+
if (provided) {
|
|
19
|
+
names.push(...provided);
|
|
20
|
+
}
|
|
21
|
+
return new Set(names);
|
|
22
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { TSESTree } from '@typescript-eslint/
|
|
2
|
-
import { TSESLint } from '@typescript-eslint/utils';
|
|
1
|
+
import { TSESLint, TSESTree } from '@typescript-eslint/utils';
|
|
3
2
|
import * as ts from 'typescript';
|
|
4
3
|
export type JupyterPluginKind = 'frontend' | 'service-manager' | 'mime-renderer' | 'ambiguous';
|
|
5
4
|
/**
|
|
@@ -532,14 +532,14 @@ function getPluginKindFromType(typeNode, checker, getTSNode, options, depth = 0)
|
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
// Handle IPlugin<T, ...> in AST
|
|
535
|
-
const baseName = name ? name.split('.').pop() ?? name : null;
|
|
535
|
+
const baseName = name ? (name.split('.').pop() ?? name) : null;
|
|
536
536
|
if (baseName === 'IPlugin') {
|
|
537
537
|
const firstParam = typeNode.typeArguments?.params?.[0];
|
|
538
538
|
if (firstParam) {
|
|
539
539
|
if (firstParam.type === 'TSTypeReference') {
|
|
540
540
|
const firstParamName = extractTypeName(firstParam.typeName);
|
|
541
541
|
const firstBase = firstParamName
|
|
542
|
-
? firstParamName.split('.').pop() ?? firstParamName
|
|
542
|
+
? (firstParamName.split('.').pop() ?? firstParamName)
|
|
543
543
|
: null;
|
|
544
544
|
if (firstBase && FRONTEND_APPLICATION_TYPES.has(firstBase)) {
|
|
545
545
|
return 'frontend';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { TSESTree } from '@typescript-eslint/
|
|
2
|
-
import { ParserServices, TSESLint } from '@typescript-eslint/utils';
|
|
1
|
+
import { ParserServices, TSESLint, TSESTree } from '@typescript-eslint/utils';
|
|
3
2
|
import * as ts from 'typescript';
|
|
4
3
|
import { ClassLike } from './signals';
|
|
5
4
|
/**
|
package/lib/utils/signals.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { TSESTree } from '@typescript-eslint/
|
|
2
|
-
import { ParserServices } from '@typescript-eslint/utils';
|
|
1
|
+
import { ParserServices, TSESTree } from '@typescript-eslint/utils';
|
|
3
2
|
import * as ts from 'typescript';
|
|
4
3
|
export { walkFrom } from './ast';
|
|
5
4
|
export type { WalkAction } from './ast';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { TSESTree } from '@typescript-eslint/
|
|
2
|
-
import { ParserServices, TSESLint } from '@typescript-eslint/utils';
|
|
1
|
+
import { ParserServices, TSESLint, TSESTree } from '@typescript-eslint/utils';
|
|
3
2
|
import * as ts from 'typescript';
|
|
4
3
|
export interface TypeServices {
|
|
5
4
|
services: ParserServices | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyter/eslint-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "ESLint plugin for Jupyter core and extensions with early error catching and best practices enforcement",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@lumino/signaling": "^2.1.6",
|
|
53
53
|
"@lumino/widgets": "^2.9.0",
|
|
54
|
-
"@types/eslint": "^9.6.1",
|
|
55
54
|
"@types/estree": "^1.0.8",
|
|
56
55
|
"@types/jest": "^30.0.0",
|
|
57
56
|
"@types/node": "^25.3.5",
|
|
@@ -59,9 +58,7 @@
|
|
|
59
58
|
"@typescript-eslint/parser": "^8.54.0",
|
|
60
59
|
"@typescript-eslint/rule-tester": "^8.57.0",
|
|
61
60
|
"eslint": "^9.39.2",
|
|
62
|
-
"eslint-plugin": "^1.0.1",
|
|
63
61
|
"jest": "^30.2.0",
|
|
64
|
-
"pre-commit": "^1.2.2",
|
|
65
62
|
"prettier": "^3.8.1",
|
|
66
63
|
"ts-jest": "^29.4.6",
|
|
67
64
|
"typescript": "^5.9.3"
|
|
@@ -72,13 +69,10 @@
|
|
|
72
69
|
"jsonc-eslint-parser": "^2.4.0"
|
|
73
70
|
},
|
|
74
71
|
"peerDependencies": {
|
|
75
|
-
"eslint": ">=9.0.0"
|
|
72
|
+
"eslint": ">=9.0.0",
|
|
73
|
+
"typescript": "*"
|
|
76
74
|
},
|
|
77
75
|
"engines": {
|
|
78
76
|
"node": ">=16.0.0"
|
|
79
|
-
}
|
|
80
|
-
"pre-commit": [
|
|
81
|
-
"lint",
|
|
82
|
-
"test"
|
|
83
|
-
]
|
|
77
|
+
}
|
|
84
78
|
}
|