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

Improve configuration handling #1035

Merged
merged 3 commits into from
Mar 30, 2016
Merged

Improve configuration handling #1035

merged 3 commits into from
Mar 30, 2016

Conversation

jkillian
Copy link
Contributor

This commit lets us simplify the codebase in a couple other ways:

  • helper arrayify and objectify functions make it easier to handle T
    | T[] types.
  • loadConfigurationFromPath now resolves rules directories to absolute paths. This means 3rd-party tools can do config: findConfiguration("possible/user/supplied/config/path", "file/ts/lint.ts") and everything should work correctly.

Closes #1019

This commit lets us simplify the codebase in a couple other ways:
- helper `arrayify` and `objectify` functions make it easier to handle T
  | T[] types.
- the CLI code can now use configurationPath to simplify its job
@@ -45,7 +45,8 @@ export interface LintResult {
}

export interface ILinterOptions {
configuration: any;
configuration?: any;
configurationPath?: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the changes in this PR are good, but I'm wondering if we actually need this configurationPath option. If 3rd-party tools use findConfiguration/loadConfigurationFromPath, those functions can resolve relative paths which the programatic API should then be able to handle.

…e findConfiguration to easily handle loading configs, as the CLI now does
@jkillian jkillian force-pushed the configPath branch 2 times, most recently from 93e46c5 to feef951 Compare March 24, 2016 15:56
@jkillian
Copy link
Contributor Author

@adidahiya This needs review, and after this merges we can add the extends feature. I removed the part from this that dealt with node_module: syntax.

@unional
Copy link
Contributor

unional commented Mar 24, 2016

Can't wait for this to go in so I can complete the extend feature.

@@ -19,6 +19,13 @@ import * as fs from "fs";
import * as path from "path";
import * as findup from "findup-sync";

import {arrayify, objectify} from "./utils";

export interface IConfigFile {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's be consistent about the abbreviation -- I think it should be "Configuration" everywhere, not "Config"

edit: let's just try to use "Configuration" in all names in public APIs. private variable names can use "config"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So just leave this as is, right? Exported things are a blurry line between private/public, but I assume we're only treating as public things in the top level package

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to chime in, but I think it should be renamed is IConfigurationFile as this interface is useful to extensions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anything exported is part of the public API; let's just assume people will use anything they can find in our generated typings

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, the tricky thing here is we already have public APIs like
'DEFAULT_CONFIG' before that don't obey this convention.

@adidahiya
Copy link
Contributor

overall lgtm 👍 only blocking issue is the naming convention in public API surface

@jkillian
Copy link
Contributor Author

[Updated]

@adidahiya
Copy link
Contributor

👍

@adidahiya adidahiya merged commit 7e6cc32 into master Mar 30, 2016
@adidahiya adidahiya deleted the configPath branch March 30, 2016 17:48
@jkillian jkillian changed the title Add configurationPath option Improve configuration handling Apr 1, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

configurationPath option for programmatic API.
3 participants