What is the difference between `extends` and `rulesDirectory` in TSLint
What is the difference between
extends
andrulesDirectory
in TSLint
They are very different.
extends
allows you to apply an existing tslint config and then extend itrulesDirectory
simply allows you to add directories for custom rules.
?Answer taken from tslint configuration docs as of 6 April 2018:
extends?: string | string[]
: The name of a built-in configuration preset (see built-in presets below), or a path or array of paths to other configuration files which are extended by this configuration. This value is handled using node module resolution semantics. For example, a value of"tslint-config"
would tell TSLint to try and load the main file of a module named "tslint-config" as a configuration file. Specific files inside node modules can also be specified, eg."tslint-config/path/to/submodule"
. Relative paths to JSON files or JS modules are also supported, e.g."./tslint-config"
.rulesDirectory?: string | string[]
: A path to a directory or an array of paths to directories of [custom rules][2]. These values are handled using node module resolution semantics, if anindex.js
is placed in your rules directory. We fallback to use relative or absolute paths, if the module can't be resolved. If you want to avoid module resolution you can directly use a relative or absolute path (e.g. with./
).
Any rules specified in this rules
block will override those configured in any base configuration being extended.