Skip to content

please-style: Yarn Plug'n'Play gaps in editorconfig/check resolution and Kotlin Multiplatform source sets in jvmLayout #45

Closed

Description

@amondnet

Out-of-scope items from #37 (found while fixing it in #42)

PR #42 makes init skip sgconfig.yml under Yarn Plug'n'Play and makes kotlin-error-outside-errors-file ignore Kotlin Multiplatform test source sets. Three related places still have the same gaps.

1. .editorconfig applier assumes node_modules (packages/cli/src/appliers.ts)

applyEditorConfig copies the config from node_modules/@pleaseai/editorconfig/.editorconfig. Under Plug'n'Play that file does not exist, so the applier puts .editorconfig in skipped without saying why. The comment says this means "package not installed yet". The user never learns that the cause is the linker. It should either resolve the package another way or warn like the ast-grep applier does (astGrepPlugNPlay).

2. please-style check toolchain resolution under Plug'n'Play (packages/cli/src/check/ast-grep.ts)

resolveToolchain resolves @pleaseai/ast-grep-config and @ast-grep/cli with createRequire(anchor).resolve(...). It then passes extract/<lang>.yml and extract/sgconfig.yml to the native ast-grep binary as file paths. Under Plug'n'Play, a resolved path can point inside a zip archive in .yarn/cache. The binary cannot read such a path. When the process runs without the PnP runtime, resolution fails instead. Not verified yet. This needs a PnP fixture to confirm what happens and to decide the fix: a clear error, unplugging, or extracting the rules to a temp directory.

3. jvmLayout ignores Kotlin Multiplatform source sets (packages/cli/src/check/layouts.ts)

jvmLayout finds modules with src/(main|test|testFixtures)/<lang>/. It uses src/test/<lang> as the test root and src/main/<lang> as the source root. A KMP module (src/commonMain/kotlin, src/commonTest/kotlin, src/jvmTest/kotlin, src/iosTest/kotlin, …) is therefore not a unit at all. Its tests are not checked by test-path-derivable-from-source, and its helpers are not checked by test-helpers-in-dedicated-location. This under-reports; it does not produce wrong findings. Supporting KMP needs a decision on how a <target>Test set maps to its <target>Main (and commonMain) source set.

Acceptance criteria

  • Under Plug'n'Play, init either writes a working .editorconfig or warns with the reason.
  • please-style check in a Plug'n'Play project either works or fails with an actionable message. A test with a PnP fixture covers this.
  • A KMP module's *Test source sets are test roots for the matching *Main / commonMain source sets. Tests cover commonTest and one platform set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions