I don’t think it’s possible to access to org.sonar.api.batch.fs.FileSystem#baseDir() from the JavaFileScannerContext of a rule or to the sonar.projectBaseDir property.
But, it should be possible to inject FileSystem fs to any class added as an extension in your class that implements Plugin (like context.addExtension(MyJavaFileCheckRegistrar.class);).
To do so add a public constructor with a FileSystem fs argument, and the container will inject it.
@SonarLintSide
@ScannerSide
public class MyClass {
public MyClass(FileSystem fs) {
// find a hack to pass the fs argument to the rules...
}
}
For example, you could add a constructor to your class that implements CheckRegistrar.