UI for Zipcoin Blue

configuration.d.ts 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /**
  2. * @license
  3. * Copyright 2013 Palantir Technologies, Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. import { IOptions, RuleSeverity } from "./language/rule/rule";
  18. export interface IConfigurationFile {
  19. /**
  20. * @deprecated property is never set
  21. *
  22. * The severity that is applied to rules in this config file as well as rules
  23. * in any inherited config files which have their severity set to "default".
  24. * Not inherited.
  25. */
  26. defaultSeverity?: RuleSeverity;
  27. /**
  28. * An array of config files whose rules are inherited by this config file.
  29. */
  30. extends: string[];
  31. /**
  32. * Rules that are used to lint to JavaScript files.
  33. */
  34. jsRules: Map<string, Partial<IOptions>>;
  35. /**
  36. * A subset of the CLI options.
  37. */
  38. linterOptions?: Partial<{
  39. exclude: string[];
  40. }>;
  41. /**
  42. * Directories containing custom rules. Resolved using node module semantics.
  43. */
  44. rulesDirectory: string[];
  45. /**
  46. * Rules that are used to lint TypeScript files.
  47. */
  48. rules: Map<string, Partial<IOptions>>;
  49. }
  50. export interface IConfigurationLoadResult {
  51. path?: string;
  52. results?: IConfigurationFile;
  53. }
  54. export declare const JSON_CONFIG_FILENAME = "tslint.json";
  55. /** @deprecated use `JSON_CONFIG_FILENAME` or `CONFIG_FILENAMES` instead. */
  56. export declare const CONFIG_FILENAME = "tslint.json";
  57. export declare const CONFIG_FILENAMES: string[];
  58. export declare const DEFAULT_CONFIG: IConfigurationFile;
  59. export declare const EMPTY_CONFIG: IConfigurationFile;
  60. /**
  61. * Searches for a TSLint configuration and returns the data from the config.
  62. * @param configFile A path to a config file, this can be null if the location of a config is not known
  63. * @param inputFilePath A path containing the current file being linted. This is the starting location
  64. * of the search for a configuration.
  65. * @returns Load status for a TSLint configuration object
  66. */
  67. export declare function findConfiguration(configFile: string | null, inputFilePath: string): IConfigurationLoadResult;
  68. export declare function findConfiguration(configFile: string, inputFilePath?: string): IConfigurationLoadResult;
  69. /**
  70. * Searches for a TSLint configuration and returns the path to it.
  71. * Could return undefined if not configuration is found.
  72. * @param suppliedConfigFilePath A path to an known config file supplied by a user. Pass null here if
  73. * the location of the config file is not known and you want to search for one.
  74. * @param inputFilePath A path to the current file being linted. This is the starting location
  75. * of the search for a configuration.
  76. * @returns An absolute path to a tslint.json or tslint.yml or tslint.yaml file
  77. * or undefined if neither can be found.
  78. */
  79. export declare function findConfigurationPath(suppliedConfigFilePath: string | null, inputFilePath: string): string | undefined;
  80. export declare function findConfigurationPath(suppliedConfigFilePath: string, inputFilePath?: string): string | undefined;
  81. /**
  82. * Used Node semantics to load a configuration file given configFilePath.
  83. * For example:
  84. * '/path/to/config' will be treated as an absolute path
  85. * './path/to/config' will be treated as a relative path
  86. * 'path/to/config' will attempt to load a to/config file inside a node module named path
  87. * @param configFilePath The configuration to load
  88. * @param originalFilePath (deprecated) The entry point configuration file
  89. * @returns a configuration object for TSLint loaded from the file at configFilePath
  90. */
  91. export declare function loadConfigurationFromPath(configFilePath?: string, _originalFilePath?: string): IConfigurationFile;
  92. /** Reads the configuration file from disk and parses it as raw JSON, YAML or JS depending on the extension. */
  93. export declare function readConfigurationFile(filepath: string): RawConfigFile;
  94. export declare function extendConfigurationFile(targetConfig: IConfigurationFile, nextConfigSource: IConfigurationFile): IConfigurationFile;
  95. /**
  96. * returns the absolute path (contrary to what the name implies)
  97. *
  98. * @deprecated use `path.resolve` instead
  99. */
  100. export declare function getRelativePath(directory?: string | null, relativeTo?: string): string | undefined;
  101. export declare function useAsPath(directory: string): boolean;
  102. /**
  103. * @param directories A path(s) to a directory of custom rules
  104. * @param relativeTo A path that directories provided are relative to.
  105. * For example, if the directories come from a tslint.json file, this path
  106. * should be the path to the tslint.json file.
  107. * @return An array of absolute paths to directories potentially containing rules
  108. */
  109. export declare function getRulesDirectories(directories?: string | string[], relativeTo?: string): string[];
  110. export interface RawConfigFile {
  111. extends?: string | string[];
  112. linterOptions?: IConfigurationFile["linterOptions"];
  113. rulesDirectory?: string | string[];
  114. defaultSeverity?: string;
  115. rules?: RawRulesConfig;
  116. jsRules?: RawRulesConfig;
  117. }
  118. export interface RawRulesConfig {
  119. [key: string]: RawRuleConfig;
  120. }
  121. export declare type RawRuleConfig = null | undefined | boolean | any[] | {
  122. severity?: RuleSeverity | "warn" | "none" | "default";
  123. options?: any;
  124. };
  125. /**
  126. * Parses a config file and normalizes legacy config settings.
  127. * If `configFileDir` and `readConfig` are provided, this function will load all base configs and reduce them to the final configuration.
  128. *
  129. * @param configFile The raw object read from the JSON of a config file
  130. * @param configFileDir The directory of the config file
  131. * @param readConfig Will be used to load all base configurations while parsing. The function is called with the resolved path.
  132. */
  133. export declare function parseConfigFile(configFile: RawConfigFile, configFileDir?: string, readConfig?: (path: string) => RawConfigFile): IConfigurationFile;
  134. /**
  135. * Fills in default values for `IOption` properties and outputs an array of `IOption`
  136. */
  137. export declare function convertRuleOptions(ruleConfiguration: Map<string, Partial<IOptions>>): IOptions[];