@atlaskit/eslint-plugin-platform 2.8.0 → 2.9.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/index.js +6 -1
  3. package/dist/cjs/rules/ensure-use-sync-external-store-server-snapshot/index.js +41 -0
  4. package/dist/cjs/rules/import/no-barrel-entry-imports/index.js +475 -67
  5. package/dist/cjs/rules/import/no-barrel-entry-jest-mock/index.js +387 -112
  6. package/dist/cjs/rules/import/no-jest-mock-barrel-files/index.js +3 -2
  7. package/dist/cjs/rules/import/no-relative-barrel-file-imports/index.js +7 -3
  8. package/dist/cjs/rules/import/shared/jest-utils.js +62 -9
  9. package/dist/cjs/rules/import/shared/package-resolution.js +156 -23
  10. package/dist/cjs/rules/visit-example-type-import-required/index.js +409 -0
  11. package/dist/es2019/index.js +6 -1
  12. package/dist/es2019/rules/ensure-use-sync-external-store-server-snapshot/index.js +43 -0
  13. package/dist/es2019/rules/import/no-barrel-entry-imports/index.js +372 -15
  14. package/dist/es2019/rules/import/no-barrel-entry-jest-mock/index.js +245 -17
  15. package/dist/es2019/rules/import/no-jest-mock-barrel-files/index.js +3 -2
  16. package/dist/es2019/rules/import/no-relative-barrel-file-imports/index.js +7 -3
  17. package/dist/es2019/rules/import/shared/jest-utils.js +44 -0
  18. package/dist/es2019/rules/import/shared/package-resolution.js +97 -5
  19. package/dist/es2019/rules/visit-example-type-import-required/index.js +375 -0
  20. package/dist/esm/index.js +6 -1
  21. package/dist/esm/rules/ensure-use-sync-external-store-server-snapshot/index.js +35 -0
  22. package/dist/esm/rules/import/no-barrel-entry-imports/index.js +475 -67
  23. package/dist/esm/rules/import/no-barrel-entry-jest-mock/index.js +388 -113
  24. package/dist/esm/rules/import/no-jest-mock-barrel-files/index.js +3 -2
  25. package/dist/esm/rules/import/no-relative-barrel-file-imports/index.js +7 -3
  26. package/dist/esm/rules/import/shared/jest-utils.js +61 -9
  27. package/dist/esm/rules/import/shared/package-resolution.js +156 -25
  28. package/dist/esm/rules/visit-example-type-import-required/index.js +402 -0
  29. package/dist/types/index.d.ts +12 -0
  30. package/dist/types/rules/ensure-use-sync-external-store-server-snapshot/index.d.ts +3 -0
  31. package/dist/types/rules/import/shared/jest-utils.d.ts +8 -0
  32. package/dist/types/rules/import/shared/package-resolution.d.ts +22 -2
  33. package/dist/types/rules/visit-example-type-import-required/index.d.ts +4 -0
  34. package/dist/types-ts4.5/index.d.ts +12 -0
  35. package/dist/types-ts4.5/rules/ensure-use-sync-external-store-server-snapshot/index.d.ts +3 -0
  36. package/dist/types-ts4.5/rules/import/shared/jest-utils.d.ts +8 -0
  37. package/dist/types-ts4.5/rules/import/shared/package-resolution.d.ts +22 -2
  38. package/dist/types-ts4.5/rules/visit-example-type-import-required/index.d.ts +4 -0
  39. package/package.json +3 -1
@@ -6,14 +6,34 @@ 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
+ }
9
19
  /**
10
20
  * Find a matching export entry for a given source file path.
11
21
  * Returns the export path (e.g., "./controllers/analytics") or null if not found.
22
+ *
23
+ * When `fs` is provided, also checks entry-point wrapper files. If an export resolves
24
+ * to a file inside a recognized entry-points folder (entry-points, entrypoints, etc.),
25
+ * the wrapper is parsed to see if it re-exports from `sourceFilePath`.
26
+ *
27
+ * `sourceExportName` is the name under which the symbol is exported from the source file
28
+ * (e.g. `'default'`). Used to look up the corresponding entry-point export name so the
29
+ * caller can generate the correct import style.
12
30
  */
13
- export declare function findExportForSourceFile({ sourceFilePath, exportsMap, }: {
31
+ export declare function findExportForSourceFile({ sourceFilePath, exportsMap, fs, sourceExportName, }: {
14
32
  sourceFilePath: string;
15
33
  exportsMap: Map<string, string>;
16
- }): string | null;
34
+ fs?: FileSystem;
35
+ sourceExportName?: string;
36
+ }): ExportMatchResult | null;
17
37
  /**
18
38
  * Extract the package name and subpath from an import specifier.
19
39
  * Returns null if the import is not a scoped package import.
@@ -0,0 +1,4 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const RULE_NAME = "visit-example-type-import-required";
3
+ declare const rule: Rule.RuleModule;
4
+ export default rule;
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.8.0",
4
+ "version": "2.9.0",
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"