@atlaskit/eslint-plugin-platform 2.8.0 → 2.9.1
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/CHANGELOG.md +16 -0
- package/dist/cjs/index.js +8 -1
- package/dist/cjs/rules/ensure-critical-dependency-resolutions/index.js +0 -1
- package/dist/cjs/rules/ensure-use-sync-external-store-server-snapshot/index.js +41 -0
- package/dist/cjs/rules/import/no-barrel-entry-imports/index.js +534 -74
- package/dist/cjs/rules/import/no-barrel-entry-jest-mock/index.js +428 -119
- package/dist/cjs/rules/import/no-jest-mock-barrel-files/index.js +3 -2
- package/dist/cjs/rules/import/no-relative-barrel-file-imports/index.js +7 -3
- package/dist/cjs/rules/import/shared/jest-utils.js +62 -9
- package/dist/cjs/rules/import/shared/package-resolution.js +300 -22
- package/dist/cjs/rules/no-restricted-fedramp-imports/index.js +65 -0
- package/dist/cjs/rules/visit-example-type-import-required/index.js +409 -0
- package/dist/es2019/index.js +8 -1
- package/dist/es2019/rules/ensure-critical-dependency-resolutions/index.js +0 -1
- package/dist/es2019/rules/ensure-use-sync-external-store-server-snapshot/index.js +43 -0
- package/dist/es2019/rules/import/no-barrel-entry-imports/index.js +431 -25
- package/dist/es2019/rules/import/no-barrel-entry-jest-mock/index.js +287 -25
- package/dist/es2019/rules/import/no-jest-mock-barrel-files/index.js +3 -2
- package/dist/es2019/rules/import/no-relative-barrel-file-imports/index.js +7 -3
- package/dist/es2019/rules/import/shared/jest-utils.js +44 -0
- package/dist/es2019/rules/import/shared/package-resolution.js +211 -4
- package/dist/es2019/rules/no-restricted-fedramp-imports/index.js +47 -0
- package/dist/es2019/rules/visit-example-type-import-required/index.js +375 -0
- package/dist/esm/index.js +8 -1
- package/dist/esm/rules/ensure-critical-dependency-resolutions/index.js +0 -1
- package/dist/esm/rules/ensure-use-sync-external-store-server-snapshot/index.js +35 -0
- package/dist/esm/rules/import/no-barrel-entry-imports/index.js +535 -75
- package/dist/esm/rules/import/no-barrel-entry-jest-mock/index.js +430 -121
- package/dist/esm/rules/import/no-jest-mock-barrel-files/index.js +3 -2
- package/dist/esm/rules/import/no-relative-barrel-file-imports/index.js +7 -3
- package/dist/esm/rules/import/shared/jest-utils.js +61 -9
- package/dist/esm/rules/import/shared/package-resolution.js +298 -24
- package/dist/esm/rules/no-restricted-fedramp-imports/index.js +59 -0
- package/dist/esm/rules/visit-example-type-import-required/index.js +402 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/rules/ensure-use-sync-external-store-server-snapshot/index.d.ts +3 -0
- package/dist/types/rules/import/shared/jest-utils.d.ts +8 -0
- package/dist/types/rules/import/shared/package-resolution.d.ts +47 -2
- package/dist/types/rules/no-restricted-fedramp-imports/index.d.ts +3 -0
- package/dist/types/rules/visit-example-type-import-required/index.d.ts +4 -0
- package/dist/types-ts4.5/index.d.ts +14 -0
- package/dist/types-ts4.5/rules/ensure-use-sync-external-store-server-snapshot/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/import/shared/jest-utils.d.ts +8 -0
- package/dist/types-ts4.5/rules/import/shared/package-resolution.d.ts +47 -2
- package/dist/types-ts4.5/rules/no-restricted-fedramp-imports/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/visit-example-type-import-required/index.d.ts +4 -0
- package/package.json +3 -1
|
@@ -29,11 +29,14 @@ declare const rules: {
|
|
|
29
29
|
'no-direct-document-usage': import("eslint").Rule.RuleModule;
|
|
30
30
|
'no-set-immediate': import("eslint").Rule.RuleModule;
|
|
31
31
|
'prefer-crypto-random-uuid': import("eslint").Rule.RuleModule;
|
|
32
|
+
'no-restricted-fedramp-imports': import("eslint").Rule.RuleModule;
|
|
32
33
|
'no-barrel-entry-imports': import("eslint").Rule.RuleModule;
|
|
33
34
|
'no-barrel-entry-jest-mock': import("eslint").Rule.RuleModule;
|
|
34
35
|
'no-jest-mock-barrel-files': import("eslint").Rule.RuleModule;
|
|
35
36
|
'no-relative-barrel-file-imports': import("eslint").Rule.RuleModule;
|
|
36
37
|
'no-conversation-assistant-barrel-imports': import("eslint").Rule.RuleModule;
|
|
38
|
+
'visit-example-type-import-required': import("eslint").Rule.RuleModule;
|
|
39
|
+
'ensure-use-sync-external-store-server-snapshot': import("eslint").Rule.RuleModule;
|
|
37
40
|
};
|
|
38
41
|
declare const plugin: {
|
|
39
42
|
meta: {
|
|
@@ -70,11 +73,14 @@ declare const plugin: {
|
|
|
70
73
|
'no-direct-document-usage': import("eslint").Rule.RuleModule;
|
|
71
74
|
'no-set-immediate': import("eslint").Rule.RuleModule;
|
|
72
75
|
'prefer-crypto-random-uuid': import("eslint").Rule.RuleModule;
|
|
76
|
+
'no-restricted-fedramp-imports': import("eslint").Rule.RuleModule;
|
|
73
77
|
'no-barrel-entry-imports': import("eslint").Rule.RuleModule;
|
|
74
78
|
'no-barrel-entry-jest-mock': import("eslint").Rule.RuleModule;
|
|
75
79
|
'no-jest-mock-barrel-files': import("eslint").Rule.RuleModule;
|
|
76
80
|
'no-relative-barrel-file-imports': import("eslint").Rule.RuleModule;
|
|
77
81
|
'no-conversation-assistant-barrel-imports': import("eslint").Rule.RuleModule;
|
|
82
|
+
'visit-example-type-import-required': import("eslint").Rule.RuleModule;
|
|
83
|
+
'ensure-use-sync-external-store-server-snapshot': import("eslint").Rule.RuleModule;
|
|
78
84
|
};
|
|
79
85
|
configs: {
|
|
80
86
|
recommended: {
|
|
@@ -90,6 +96,7 @@ declare const plugin: {
|
|
|
90
96
|
'@atlaskit/platform/ensure-feature-flag-registration': "error";
|
|
91
97
|
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
92
98
|
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
99
|
+
'@atlaskit/platform/ensure-use-sync-external-store-server-snapshot': "error";
|
|
93
100
|
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
94
101
|
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
95
102
|
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
@@ -125,6 +132,7 @@ declare const plugin: {
|
|
|
125
132
|
'@atlaskit/platform/ensure-feature-flag-registration': "error";
|
|
126
133
|
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
127
134
|
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
135
|
+
'@atlaskit/platform/ensure-use-sync-external-store-server-snapshot': "error";
|
|
128
136
|
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
129
137
|
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
130
138
|
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
@@ -149,6 +157,7 @@ declare const plugin: {
|
|
|
149
157
|
rules: {
|
|
150
158
|
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
151
159
|
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
160
|
+
'@atlaskit/platform/ensure-use-sync-external-store-server-snapshot': "error";
|
|
152
161
|
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
153
162
|
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
154
163
|
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
@@ -176,6 +185,7 @@ declare const plugin: {
|
|
|
176
185
|
rules: {
|
|
177
186
|
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
178
187
|
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
188
|
+
'@atlaskit/platform/ensure-use-sync-external-store-server-snapshot': "error";
|
|
179
189
|
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
180
190
|
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
181
191
|
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
@@ -215,6 +225,7 @@ declare const configs: {
|
|
|
215
225
|
'@atlaskit/platform/ensure-feature-flag-registration': "error";
|
|
216
226
|
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
217
227
|
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
228
|
+
'@atlaskit/platform/ensure-use-sync-external-store-server-snapshot': "error";
|
|
218
229
|
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
219
230
|
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
220
231
|
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
@@ -250,6 +261,7 @@ declare const configs: {
|
|
|
250
261
|
'@atlaskit/platform/ensure-feature-flag-registration': "error";
|
|
251
262
|
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
252
263
|
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
264
|
+
'@atlaskit/platform/ensure-use-sync-external-store-server-snapshot': "error";
|
|
253
265
|
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
254
266
|
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
255
267
|
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
@@ -274,6 +286,7 @@ declare const configs: {
|
|
|
274
286
|
rules: {
|
|
275
287
|
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
276
288
|
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
289
|
+
'@atlaskit/platform/ensure-use-sync-external-store-server-snapshot': "error";
|
|
277
290
|
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
278
291
|
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
279
292
|
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
@@ -301,6 +314,7 @@ declare const configs: {
|
|
|
301
314
|
rules: {
|
|
302
315
|
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
303
316
|
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
317
|
+
'@atlaskit/platform/ensure-use-sync-external-store-server-snapshot': "error";
|
|
304
318
|
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
305
319
|
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
306
320
|
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
@@ -33,6 +33,14 @@ export declare function findJestRequireMockCalls({ ast, matchPath, }: {
|
|
|
33
33
|
ast: TSESTree.Program;
|
|
34
34
|
matchPath: (candidatePath: string) => boolean;
|
|
35
35
|
}): TSESTree.CallExpression[];
|
|
36
|
+
/**
|
|
37
|
+
* Find all jest.requireActual() calls in the AST whose import path matches a given target.
|
|
38
|
+
* Works identically to findJestRequireMockCalls but for requireActual.
|
|
39
|
+
*/
|
|
40
|
+
export declare function findJestRequireActualCalls({ ast, matchPath, }: {
|
|
41
|
+
ast: TSESTree.Program;
|
|
42
|
+
matchPath: (candidatePath: string) => boolean;
|
|
43
|
+
}): TSESTree.CallExpression[];
|
|
36
44
|
/**
|
|
37
45
|
* Determine the best new import path for a jest.requireMock() call by inspecting
|
|
38
46
|
* the destructured symbols or property access at the call site.
|
|
@@ -6,14 +6,59 @@ export declare function parsePackageExports({ packageDir, fs, }: {
|
|
|
6
6
|
packageDir: string;
|
|
7
7
|
fs: FileSystem;
|
|
8
8
|
}): Map<string, string>;
|
|
9
|
+
export interface ExportMatchResult {
|
|
10
|
+
exportPath: string;
|
|
11
|
+
/**
|
|
12
|
+
* When resolved through an entry-point wrapper, the name under which
|
|
13
|
+
* the symbol is exported from the entry-point file.
|
|
14
|
+
* Callers use this to override the barrel's `originalName` so the
|
|
15
|
+
* generated import matches the entry-point's export shape.
|
|
16
|
+
*/
|
|
17
|
+
entryPointExportName?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Check whether a subpath export key (e.g. `"./checkbox-select"`) is kebab-case.
|
|
21
|
+
*
|
|
22
|
+
* A key is considered kebab-case when the portion after the leading `"./"` prefix
|
|
23
|
+
* consists only of lowercase letters, digits, hyphens, dots, and forward-slash
|
|
24
|
+
* separators — i.e. no uppercase letters, underscores, or camelCase humps.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isKebabCaseExportKey(key: string): boolean;
|
|
9
27
|
/**
|
|
10
28
|
* Find a matching export entry for a given source file path.
|
|
11
29
|
* Returns the export path (e.g., "./controllers/analytics") or null if not found.
|
|
30
|
+
*
|
|
31
|
+
* When multiple export paths resolve to the same source file **and** point to an
|
|
32
|
+
* entry-point file, kebab-case keys are preferred over other casing styles.
|
|
33
|
+
*
|
|
34
|
+
* When `fs` is provided, also checks entry-point wrapper files. If an export resolves
|
|
35
|
+
* to a file inside a recognized entry-points folder (entry-points, entrypoints, etc.),
|
|
36
|
+
* the wrapper is parsed to see if it re-exports from `sourceFilePath`.
|
|
37
|
+
*
|
|
38
|
+
* `sourceExportName` is the name under which the symbol is exported from the source file
|
|
39
|
+
* (e.g. `'default'`). Used to look up the corresponding entry-point export name so the
|
|
40
|
+
* caller can generate the correct import style.
|
|
12
41
|
*/
|
|
13
|
-
export declare function findExportForSourceFile({ sourceFilePath, exportsMap, }: {
|
|
42
|
+
export declare function findExportForSourceFile({ sourceFilePath, exportsMap, fs, sourceExportName, }: {
|
|
14
43
|
sourceFilePath: string;
|
|
15
44
|
exportsMap: Map<string, string>;
|
|
16
|
-
|
|
45
|
+
fs?: FileSystem;
|
|
46
|
+
sourceExportName?: string;
|
|
47
|
+
}): ExportMatchResult | null;
|
|
48
|
+
/**
|
|
49
|
+
* When a symbol reaches the consumer through a barrel package that re-exports from
|
|
50
|
+
* `crossPackageName`, find a `package.json` export subpath of that barrel whose entry
|
|
51
|
+
* file directly re-exports the symbol from `crossPackageName` (named exports only).
|
|
52
|
+
*
|
|
53
|
+
* This enables rewriting imports to `@scope/barrel/subpath` instead of
|
|
54
|
+
* `@scope/cross-package/...` when the barrel exposes such a subpath (e.g. `@atlaskit/select/react-select`).
|
|
55
|
+
*/
|
|
56
|
+
export declare function findCrossPackageBridgeExportPath({ exportsMap, crossPackageName, exportedName, fs, }: {
|
|
57
|
+
exportsMap: Map<string, string>;
|
|
58
|
+
crossPackageName: string;
|
|
59
|
+
exportedName: string;
|
|
60
|
+
fs: FileSystem;
|
|
61
|
+
}): ExportMatchResult | null;
|
|
17
62
|
/**
|
|
18
63
|
* Extract the package name and subpath from an import specifier.
|
|
19
64
|
* Returns null if the import is not a scoped package import.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/eslint-plugin-platform",
|
|
3
3
|
"description": "The essential plugin for use with Atlassian frontend platform tools",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.9.1",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"atlassian": {
|
|
7
7
|
"team": "Build Infra",
|
|
@@ -35,6 +35,8 @@
|
|
|
35
35
|
"@compiled/eslint-plugin": "^0.18.2",
|
|
36
36
|
"@manypkg/find-root": "^1.1.0",
|
|
37
37
|
"@manypkg/get-packages": "^1.1.3",
|
|
38
|
+
"@typescript-eslint/typescript-estree": "^5.56.0",
|
|
39
|
+
"@typescript-eslint/utils": "^7.1.0",
|
|
38
40
|
"fuse.js": "^6.6.2",
|
|
39
41
|
"read-pkg-up": "^7.0.1",
|
|
40
42
|
"typescript": "5.9.2"
|