Skip to content

Commit

Permalink
Merge pull request palantir#380 from adidahiya/1.5-tsconfig
Browse files Browse the repository at this point in the history
Add tsconfig.json project files & remove reference paths
  • Loading branch information
ashwinr committed May 6, 2015
2 parents 568c452 + ca5bc53 commit 7016aef
Show file tree
Hide file tree
Showing 90 changed files with 407 additions and 352 deletions.
33 changes: 27 additions & 6 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = function(grunt) {
dest: 'lib/tslint.js'
},
test: {
src: ['<%= typescriptBin %>', 'build/tslint-tests.js'],
src: ['lib/tslint.js', 'build/tslint-tests.js'],
dest: 'build/tslint-tests.js'
}
},
Expand Down Expand Up @@ -51,13 +51,17 @@ module.exports = function(grunt) {
},

ts: {
options:{
options: {
sourceMap: false,
target: 'es5'
},

bin: {
src: ['src/tslint-cli.ts'],
src: [
'typings/*.d.ts',
'src/language/**/*.ts',
'src/*.ts',
],
out: 'bin/tslint-cli.js'
},

Expand All @@ -67,7 +71,13 @@ module.exports = function(grunt) {
declaration: true,
module: 'commonjs'
},
src: ['src/tslint.ts'],
src: [
'typings/*.d.ts',
'src/language/walker/syntaxWalker.ts',
'src/language/**/*.ts',
'src/*.ts',
'!src/tslint-cli.ts'
],
out: 'lib/tslint.js'
},

Expand All @@ -76,7 +86,11 @@ module.exports = function(grunt) {
base_path: 'src/rules',
module: 'commonjs'
},
src: ['lib/tslint.d.ts', 'src/rules/*.ts'],
src: [
'typings/*.d.ts',
'lib/tslint.d.ts',
'src/rules/*.ts'
],
outDir: 'build/rules/'
},

Expand All @@ -85,12 +99,19 @@ module.exports = function(grunt) {
base_path: 'src/formatters',
module: 'commonjs'
},
src: ['lib/tslint.d.ts', 'src/formatters/*.ts'],
src: [
'typings/*.d.ts',
'lib/tslint.d.ts',
'src/formatters/*.ts'
],
outDir: 'build/formatters/'
},

test: {
src: [
'typings/*.d.ts',
'lib/tslint.d.ts',
'test/typings/*.d.ts',
'test/**/*.ts',
'!test/files/**/*.ts'
],
Expand Down
190 changes: 94 additions & 96 deletions lib/tslint.d.ts
Original file line number Diff line number Diff line change
@@ -1,52 +1,3 @@
/// <reference path="../typings/typescriptServices.d.ts" />
/// <reference path="../typings/node.d.ts" />
declare module Lint {
interface IOptions {
ruleArguments?: any[];
ruleName: string;
disabledIntervals: Lint.IDisabledInterval[];
}
interface IDisabledInterval {
startPosition: number;
endPosition: number;
}
interface IRule {
getOptions(): IOptions;
isEnabled(): boolean;
apply(sourceFile: ts.SourceFile): RuleFailure[];
applyWithWalker(walker: Lint.RuleWalker): RuleFailure[];
}
class RuleFailurePosition {
private position;
private lineAndCharacter;
constructor(position: number, lineAndCharacter: ts.LineAndCharacter);
getPosition(): number;
getLineAndCharacter(): ts.LineAndCharacter;
toJson(): {
position: number;
line: number;
character: number;
};
equals(ruleFailurePosition: RuleFailurePosition): boolean;
}
class RuleFailure {
private sourceFile;
private fileName;
private startPosition;
private endPosition;
private failure;
private ruleName;
constructor(sourceFile: ts.SourceFile, start: number, end: number, failure: string, ruleName: string);
getFileName(): string;
getRuleName(): string;
getStartPosition(): Lint.RuleFailurePosition;
getEndPosition(): Lint.RuleFailurePosition;
getFailure(): string;
toJson(): any;
equals(ruleFailure: RuleFailure): boolean;
private createFailurePosition(position);
}
}
declare module Lint {
class SyntaxWalker {
walk(node: ts.Node): void;
Expand Down Expand Up @@ -112,6 +63,77 @@ declare module Lint {
private walkChildren(node);
}
}
declare module Lint.Formatters {
class AbstractFormatter implements Lint.IFormatter {
format(failures: Lint.RuleFailure[]): string;
}
}
declare module Lint {
interface IFormatter {
format(failures: Lint.RuleFailure[]): string;
}
}
declare module Lint {
function createLanguageServiceHost(fileName: string, source: string): ts.LanguageServiceHost;
}
declare module Lint.Rules {
class AbstractRule implements Lint.IRule {
private value;
private options;
constructor(ruleName: string, value: any, disabledIntervals: Lint.IDisabledInterval[]);
getOptions(): Lint.IOptions;
apply(sourceFile: ts.SourceFile): RuleFailure[];
applyWithWalker(walker: Lint.RuleWalker): RuleFailure[];
isEnabled(): boolean;
}
}
declare module Lint {
interface IOptions {
ruleArguments?: any[];
ruleName: string;
disabledIntervals: Lint.IDisabledInterval[];
}
interface IDisabledInterval {
startPosition: number;
endPosition: number;
}
interface IRule {
getOptions(): IOptions;
isEnabled(): boolean;
apply(sourceFile: ts.SourceFile): RuleFailure[];
applyWithWalker(walker: Lint.RuleWalker): RuleFailure[];
}
class RuleFailurePosition {
private position;
private lineAndCharacter;
constructor(position: number, lineAndCharacter: ts.LineAndCharacter);
getPosition(): number;
getLineAndCharacter(): ts.LineAndCharacter;
toJson(): {
position: number;
line: number;
character: number;
};
equals(ruleFailurePosition: RuleFailurePosition): boolean;
}
class RuleFailure {
private sourceFile;
private fileName;
private startPosition;
private endPosition;
private failure;
private ruleName;
constructor(sourceFile: ts.SourceFile, start: number, end: number, failure: string, ruleName: string);
getFileName(): string;
getRuleName(): string;
getStartPosition(): Lint.RuleFailurePosition;
getEndPosition(): Lint.RuleFailurePosition;
getFailure(): string;
toJson(): any;
equals(ruleFailure: RuleFailure): boolean;
private createFailurePosition(position);
}
}
declare module Lint {
function getSourceFile(fileName: string, source: string): ts.SourceFile;
function createCompilerOptions(): ts.CompilerOptions;
Expand Down Expand Up @@ -141,28 +163,18 @@ declare module Lint {
}
}
declare module Lint {
interface IEnableDisablePosition {
isEnabled: boolean;
position: number;
}
function loadRules(ruleConfiguration: {
[name: string]: any;
}, enableDisableRuleMap: {
[rulename: string]: Lint.IEnableDisablePosition[];
}, rulesDirectory?: string): IRule[];
function findRule(name: string, rulesDirectory?: string): any;
}
declare module Lint.Configuration {
function findConfiguration(configFile: string, inputFileLocation: string): any;
}
declare module Lint {
interface IFormatter {
format(failures: Lint.RuleFailure[]): string;
class ScopeAwareRuleWalker<T> extends RuleWalker {
private scopeStack;
constructor(sourceFile: ts.SourceFile, options?: any);
createScope(): T;
getCurrentScope(): T;
getCurrentDepth(): number;
onScopeStart(): void;
onScopeEnd(): void;
protected visitNode(node: ts.Node): void;
private isScopeBoundary(node);
}
}
declare module Lint {
function findFormatter(name: string, formattersDirectory?: string): any;
}
declare module Lint {
class SkippableTokenAwareRuleWalker extends RuleWalker {
protected tokensToSkipStartEndMap: {
Expand All @@ -175,6 +187,9 @@ declare module Lint {
private addTokenToSkipFromNode(node);
}
}
declare module Lint.Configuration {
function findConfiguration(configFile: string, inputFileLocation: string): any;
}
declare module Lint {
class EnableDisableRulesWalker extends Lint.SkippableTokenAwareRuleWalker {
enableDisableRuleMap: {
Expand All @@ -185,36 +200,19 @@ declare module Lint {
}
}
declare module Lint {
function createLanguageServiceHost(fileName: string, source: string): ts.LanguageServiceHost;
}
declare module Lint.Formatters {
class AbstractFormatter implements Lint.IFormatter {
format(failures: Lint.RuleFailure[]): string;
}
}
declare module Lint.Rules {
class AbstractRule implements Lint.IRule {
private value;
private options;
constructor(ruleName: string, value: any, disabledIntervals: Lint.IDisabledInterval[]);
getOptions(): Lint.IOptions;
apply(sourceFile: ts.SourceFile): RuleFailure[];
applyWithWalker(walker: Lint.RuleWalker): RuleFailure[];
isEnabled(): boolean;
}
function findFormatter(name: string, formattersDirectory?: string): any;
}
declare module Lint {
class ScopeAwareRuleWalker<T> extends RuleWalker {
private scopeStack;
constructor(sourceFile: ts.SourceFile, options?: any);
createScope(): T;
getCurrentScope(): T;
getCurrentDepth(): number;
onScopeStart(): void;
onScopeEnd(): void;
protected visitNode(node: ts.Node): void;
private isScopeBoundary(node);
interface IEnableDisablePosition {
isEnabled: boolean;
position: number;
}
function loadRules(ruleConfiguration: {
[name: string]: any;
}, enableDisableRuleMap: {
[rulename: string]: Lint.IEnableDisablePosition[];
}, rulesDirectory?: string): IRule[];
function findRule(name: string, rulesDirectory?: string): any;
}
declare module Lint {
interface LintResult {
Expand Down
3 changes: 0 additions & 3 deletions src/enableDisableRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

/// <reference path='language/walker/skippableTokenAwareRuleWalker.ts'/>

module Lint {
export class EnableDisableRulesWalker extends Lint.SkippableTokenAwareRuleWalker {
public enableDisableRuleMap: {[rulename: string]: Lint.IEnableDisablePosition[]} = {};
Expand Down Expand Up @@ -61,7 +59,6 @@ module Lint {
this.enableDisableRuleMap[ruleToAdd].push({position: position, isEnabled: isEnabled});
});
}

}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/formatterLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

/// <reference path='language/formatter/formatter.ts'/>

module Lint {
var fs = require("fs");
var path = require("path");
Expand Down
2 changes: 0 additions & 2 deletions src/formatters/jsonFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

/// <reference path='../../lib/tslint.d.ts' />

export class Formatter extends Lint.Formatters.AbstractFormatter {
public format(failures: Lint.RuleFailure[]): string {
var failuresJSON = failures.map((failure) => failure.toJson());
Expand Down
2 changes: 0 additions & 2 deletions src/formatters/pmdFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

/// <reference path='../../lib/tslint.d.ts' />

export class Formatter extends Lint.Formatters.AbstractFormatter {
public format(failures: Lint.RuleFailure[]): string {
var output = "<pmd version=\"tslint\">";
Expand Down
2 changes: 0 additions & 2 deletions src/formatters/proseFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

/// <reference path='../../lib/tslint.d.ts' />

export class Formatter extends Lint.Formatters.AbstractFormatter {
public format(failures: Lint.RuleFailure[]): string {

Expand Down
21 changes: 21 additions & 0 deletions src/formatters/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": "1.5.0-alpha",
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"sourceMap": false,
"target": "es5",
"outDir": "../../build/formatters/"
},
"filesGlob": [
"../../lib/tslint.d.ts",
"./*.ts"
],
"files": [
"../../lib/tslint.d.ts",
"./jsonFormatter.ts",
"./pmdFormatter.ts",
"./proseFormatter.ts",
"./verboseFormatter.ts"
]
}
2 changes: 0 additions & 2 deletions src/formatters/verboseFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

/// <reference path='../../lib/tslint.d.ts' />

export class Formatter extends Lint.Formatters.AbstractFormatter {
public format(failures: Lint.RuleFailure[]): string {

Expand Down
4 changes: 1 addition & 3 deletions src/language/formatter/abstractFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/// <reference path='formatter.ts' />
*/

module Lint.Formatters {
export class AbstractFormatter implements Lint.IFormatter {
Expand Down
Loading

0 comments on commit 7016aef

Please sign in to comment.