ThisBuild / doc / scalacOptions += "-Xsomething"

ThisBuild / shellPrompt := { state => "sbt> " }

lazy val lintBuildTest = taskKey[Unit]("")

lazy val root = (project in file("."))
  .settings(
    lintBuildTest := {
      val state = Keys.state.value
      val includeKeys = (includeLintKeys in Global).value map { _.scopedKey.key.label }
      val excludeKeys = (excludeLintKeys in Global).value map { _.scopedKey.key.label }
      val result = sbt.internal.LintUnused.lintUnused(state, includeKeys, excludeKeys)
      result foreach {
        case (_, "ThisBuild / doc / scalacOptions", _) => ()
        case (_, "app / globalAutoPluginSetting", _)   => ()
        case (_, "root / globalAutoPluginSetting", _)  => ()
        case (_, str, _)                               => sys.error(str)
      }
    }
  )

lazy val app = project

ThisBuild / doc / scalacOptions += "-Xsomething"

ThisBuild / shellPrompt := { state => "sbt> " }

// watch related settings
ThisBuild / sbt.nio.Keys.watchTriggers := Seq()
ThisBuild / sbt.nio.Keys.watchPersistFileStamps := true

lazy val lintBuildTest = taskKey[Unit]("")

lazy val root = (project in file("."))
  .settings(
    lintBuildTest := {
      val state = Keys.state.value
      val includeKeys = (lintIncludeFilter in Global).value
      val excludeKeys = (lintExcludeFilter in Global).value
      val result = sbt.internal.LintUnused.lintUnused(state, includeKeys, excludeKeys)
      result foreach {
        case (_, "ThisBuild / doc / scalacOptions", _) => ()
        case (_, "app / globalAutoPluginSetting", _)   => ()
        case (_, "root / globalAutoPluginSetting", _)  => ()
        case (_, str, _)                               => sys.error(str)
      }
    }
  )

lazy val app = project

Use lint***Filter instead of ***LintKeys for more reliable test
Use lint***Filter instead of ***LintKeys  for more reliable test

Below functions pass lintIncludeFilter and lintExcludeFilter to lintUnusedinstead of includeLintKeys and excludeLintKeys respectively.
- sbt.internal.LintUnused#lintUnusedTask
- sbt.internal.LintUnused#lintUnusedFunc
Therefore, in the test, we had better to use lint***Filter instead of ***LintKeys.
