Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Drop support for configuration via package.json #1579

Merged
merged 1 commit into from
Sep 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/usage/tslint-json/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ An example `tslint.json` file might look like this:

```ts
{
"rulesDirectory": ["path/to/custom/rules/direcotry/", "another/path/"],
"rulesDirectory": ["path/to/custom/rules/directory/", "another/path/"],
"rules": {
"class-name": true,
"comment-format": [true, "check-space"],
Expand Down
14 changes: 1 addition & 13 deletions src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ export const DEFAULT_CONFIG = {
};
/* tslint:enable:object-literal-key-quotes */

const PACKAGE_DEPRECATION_MSG = "Configuration of TSLint via package.json has been deprecated, "
+ "please start using a tslint.json file instead (http://palantir.github.io/tslint/usage/tslint-json/).";

const BUILT_IN_CONFIG = /^tslint:(.*)$/;

/**
Expand All @@ -93,7 +90,7 @@ export function findConfiguration(configFile: string, inputFilePath: string): IC
* the location of the config file is not known and you want to search for one.
* @param inputFilePath A path to the current file being linted. This is the starting location
* of the search for a configuration.
* @returns An absolute path to a tslint.json file, a path to a package.json file with a tslintConfig field
* @returns An absolute path to a tslint.json file
* or undefined if neither can be found.
*/
export function findConfigurationPath(suppliedConfigFilePath: string, inputFilePath: string) {
Expand All @@ -110,12 +107,6 @@ export function findConfigurationPath(suppliedConfigFilePath: string, inputFileP
return path.resolve(configFilePath);
}

// search for package.json with tslintConfig property
configFilePath = findup("package.json", { cwd: inputFilePath, nocase: true });
if (configFilePath != null && require(configFilePath).tslintConfig != null) {
return path.resolve(configFilePath);
}

// search for tslint.json in home directory
const homeDir = getHomeDir();
if (homeDir != null) {
Expand All @@ -141,9 +132,6 @@ export function findConfigurationPath(suppliedConfigFilePath: string, inputFileP
export function loadConfigurationFromPath(configFilePath: string): IConfigurationFile {
if (configFilePath == null) {
return DEFAULT_CONFIG;
} else if (path.basename(configFilePath) === "package.json") {
console.warn(PACKAGE_DEPRECATION_MSG);
return require(configFilePath).tslintConfig;
} else {
const resolvedConfigFilePath = resolveConfigurationPath(configFilePath);
let configFile: IConfigurationFile;
Expand Down