Akitainu Configuration

Akitainu supports JSON format (.akitaiunrc.json), YAML format (.akirainurc.yml) and JavaScript format (.akitainurc.js), backed by cosmiconfig. JavaScript is recommennded since it supports switching configurations based on ennvironment variables.

Akitaiun configuration is an object with following properties:

baseDirectory

baseDirectory?: string

Path that is basis of relative paths in configuration. Defaults to the directory where configuration file exists.

rules

rules?: ConfigRule[]

One rule roughly corresponds to configuration of one linting tool. Rule is a set of source, checker and filter.

rules.source

source?: PackageConfig

Source is a package that calculates the set of files to be linted. Specified in the form of PackageConfig. If omitted, falls back to checker's default.

Example:

{
  rules: [{
    source: ["akitainu:source-static", {
      files: ["./src/**/*.ts", "./src/**/*.tsx"]
    }],
    checker: "akitainu-checker-eslint"
  }]
}

rules.checker

checker: PackageConfig

Checker is a package that runs linting against files specified by the accompanying source. Specified in the form of PackageConfig. Checker cannot be omitted.

Example:

{
  rules: [{
    source: ["akitainu:source-static", {
      files: ["./src/**/*.ts", "./src/**/*.tsx"]
    }],
    checker: "akitainu-checker-eslint"
  }]
}

rules.filter

filter?: PackageConfig

Filter is a package that filters lint errors from the accompanying checker. Filters can be utilized when you want to ignore some sort of errors. Specified in the form of PackageConfig. If omitted, no filtering is done.

{
  rules: [{
    source: ["akitainu:source-static", {
      files: ["./src/**/*.ts", "./src/**/*.tsx"]
    }],
    checker: "akitainu-checker-eslint",
    filter: ["akitaiu:filter-by-code", {
      // do not report no-explicit-any errors
      exclude: ["@typescript-eslint/no-explicit-any"]
    }]
  }]
}

reporters

Reporter defines how to output lint errors. If omitted, reporters defaults to akitainu:reporter-pretty-console that prints the result to console.

{
  reporters: [
    "akitainu:reporter-pretty-console"
  ]
}

PackageConfig Type

type PackageConfig = string | [packageName: string, config: unknown];

The PackageConfig type is used in akitainu config to specify what package to use as source, checker, filter or reporter. The latter form allows passing options to the specified package.

PackageConfig is either a package name as a string or a pair of package name and config given to that package. "package-name" is equivalent to ["package-name", {}].

Package name is to be required/imported from the akitainu runtime. However, names that start with akitainu: are considered internal packages that come along with the akitainu package and do not require installation of additional packages.