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

Commit

Permalink
Merge pull request #854 from palantir/update-next
Browse files Browse the repository at this point in the history
Prepare release 3.2.0-dev.1
  • Loading branch information
adidahiya committed Dec 7, 2015
2 parents 7de115d + 442bf06 commit 0730f45
Show file tree
Hide file tree
Showing 96 changed files with 622 additions and 216 deletions.
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
Change Log
===

v3.2.0-dev.1
---
* [bugfix] fixed bug in how custom rules directories are registered (#844)
* [enhancement] better support for globs in CLI (#827)
* [new-rule] `no-null-keyword` rule (#722)

v3.1.1
---
* Bump TypeScript peer dependency to `>= 1.7.3` due to `const enum` incompatibility (#832)

v3.1.0
---
* [bugfix] build with TS v1.7.3 to fix null pointer exception (#832)
* [bugfix] fixed false positive in `no-require-imports` rule (#816)

v3.1.0-dev.1
---
* [bugfix] fixed `no-shadowed-variable` false positives when handling destructuring in function params (#727)
- [enhancement] `rulesDirectory` in `tslint.json` now supports multiple file paths (#795)
* [enhancement] `rulesDirectory` in `tslint.json` now supports multiple file paths (#795)

v3.0.0
---
Expand All @@ -19,7 +34,7 @@ v3.0.0

v3.0.0-dev.3
---
* Typescript is now a peerDependency (#791)
* TypeScript is now a peerDependency (#791)
* [bugfix] `no-unused-variable` rule with `react` option works with self-closing JSX tags (#776)
* [bugfix] `use-strict` bugfix (#544)

Expand Down
13 changes: 11 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,17 @@ module.exports = function (grunt) {
grunt.loadNpmTasks("grunt-ts");

// register custom tasks
grunt.registerTask("core", ["clean:core", "ts:core", "tslint:src"]);
grunt.registerTask("test", ["clean:test", "ts:test", "tslint:test", "mochaTest"].concat(checkBinTest));
grunt.registerTask("core", [
"clean:core",
"ts:core",
"tslint:src"
]);
grunt.registerTask("test", [
"clean:test",
"ts:test",
"tslint:test",
"mochaTest"
].concat(checkBinTest));

// create default task
grunt.registerTask("default", ["jscs", "core", "test"]);
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ A sample configuration file with all options is available [here](https://github.
* `no-eval` disallows `eval` function invocations.
* `no-inferrable-types` disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean.
* `no-internal-module` disallows internal `module` (use `namespace` instead).
* `no-require-imports` disallows `require()` style imports (use ES6-style imports instead).
* `no-null-keyword` disallows use of the `null` keyword literal
* `no-require-imports` disallows invocation of `require()` (use ES6-style imports instead).
* `no-shadowed-variable` disallows shadowed variable declarations.
* `no-string-literal` disallows object access via string literals.
* `no-switch-case-fall-through` disallows falling through case statements.
Expand Down
1 change: 1 addition & 0 deletions docs/sample.tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"no-eval": true,
"no-inferrable-types": false,
"no-internal-module": true,
"no-null-keyword": true,
"no-require-imports": true,
"no-shadowed-variable": true,
"no-string-literal": true,
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tslint",
"version": "3.1.0-dev.1",
"version": "3.2.0-dev.1",
"description": "a static analysis linter for TypeScript",
"bin": {
"tslint": "./bin/tslint"
Expand All @@ -21,6 +21,7 @@
},
"dependencies": {
"findup-sync": "~0.2.1",
"glob": "^6.0.1",
"optimist": "~0.6.0",
"underscore.string": "~3.1.1"
},
Expand All @@ -39,7 +40,7 @@
"typescript": "next"
},
"peerDependencies": {
"typescript": ">=1.7.0 || >=1.7.0-dev.20151003 || >=1.8.0-dev"
"typescript": ">=1.7.3 || >=1.7.0-dev.20151003 || >=1.8.0-dev"
},
"license": "Apache-2.0"
}
24 changes: 23 additions & 1 deletion src/configuration.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -34,6 +35,7 @@ const DEFAULT_CONFIG = {
"semicolon": true
}
};
const moduleDirectory = path.dirname(module.filename);

export function findConfiguration(configFile: string, inputFileLocation: string): any {
if (configFile == null) {
Expand Down Expand Up @@ -84,3 +86,23 @@ function getHomeDir() {
}
}
}

export function getRelativePath(directory: string): string {
if (directory != null) {
return path.relative(moduleDirectory, directory);
}
}

export function getRulesDirectories(directories: string | string[]): string[] {
let rulesDirectories: string[] = [];

if (directories != null) {
if (typeof directories === "string") {
rulesDirectories = [getRelativePath(<string>directories)];
} else {
rulesDirectories = (<string[]>directories).map((dir) => getRelativePath(dir));
}
}

return rulesDirectories;
}
5 changes: 3 additions & 2 deletions src/enableDisableRules.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright 2014 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,9 +15,9 @@
* limitations under the License.
*/

import * as ts from "typescript";
import * as Lint from "./lint";
import {SkippableTokenAwareRuleWalker} from "./language/walker/skippableTokenAwareRuleWalker";
import * as ts from "typescript";

export class EnableDisableRulesWalker extends SkippableTokenAwareRuleWalker {
public enableDisableRuleMap: {[rulename: string]: Lint.IEnableDisablePosition[]} = {};
Expand Down
3 changes: 2 additions & 1 deletion src/formatterLoader.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
17 changes: 17 additions & 0 deletions src/formatters.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
/*
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/

export * from "./language/formatter/abstractFormatter";
export * from "./formatters/index";
17 changes: 17 additions & 0 deletions src/formatters/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/

export * from "./jsonFormatter";
export * from "./pmdFormatter";
export * from "./proseFormatter";
Expand Down
7 changes: 4 additions & 3 deletions src/formatters/jsonFormatter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,11 +15,11 @@
* limitations under the License.
*/

import * as Lint from "../lint";
import {AbstractFormatter} from "../language/formatter/abstractFormatter";
import {RuleFailure} from "../language/rule/rule";

export class Formatter extends AbstractFormatter {
public format(failures: Lint.RuleFailure[]): string {
public format(failures: RuleFailure[]): string {
const failuresJSON = failures.map((failure) => failure.toJson());
return JSON.stringify(failuresJSON);
}
Expand Down
7 changes: 4 additions & 3 deletions src/formatters/pmdFormatter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,11 +15,11 @@
* limitations under the License.
*/

import * as Lint from "../lint";
import {AbstractFormatter} from "../language/formatter/abstractFormatter";
import {RuleFailure} from "../language/rule/rule";

export class Formatter extends AbstractFormatter {
public format(failures: Lint.RuleFailure[]): string {
public format(failures: RuleFailure[]): string {
let output = "<pmd version=\"tslint\">";

for (let failure of failures) {
Expand Down
9 changes: 5 additions & 4 deletions src/formatters/proseFormatter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,12 +15,12 @@
* limitations under the License.
*/

import * as Lint from "../lint";
import {AbstractFormatter} from "../language/formatter/abstractFormatter";
import {RuleFailure} from "../language/rule/rule";

export class Formatter extends AbstractFormatter {
public format(failures: Lint.RuleFailure[]): string {
const outputLines = failures.map((failure: Lint.RuleFailure) => {
public format(failures: RuleFailure[]): string {
const outputLines = failures.map((failure: RuleFailure) => {
const fileName = failure.getFileName();
const failureString = failure.getFailure();

Expand Down
10 changes: 5 additions & 5 deletions src/formatters/verboseFormatter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,13 +15,12 @@
* limitations under the License.
*/

import * as Lint from "../lint";
import {AbstractFormatter} from "../language/formatter/abstractFormatter";
import {RuleFailure} from "../language/rule/rule";

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

const outputLines = failures.map((failure: Lint.RuleFailure) => {
public format(failures: RuleFailure[]): string {
const outputLines = failures.map((failure: RuleFailure) => {
const fileName = failure.getFileName();
const failureString = failure.getFailure();
const ruleName = failure.getRuleName();
Expand Down
10 changes: 6 additions & 4 deletions src/language/formatter/abstractFormatter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,8 +15,9 @@
* limitations under the License.
*/

import * as Lint from "../../lint";
import {RuleFailure} from "../rule/rule";
import {IFormatter} from "./formatter";

export abstract class AbstractFormatter implements Lint.IFormatter {
public abstract format(failures: Lint.RuleFailure[]): string;
export abstract class AbstractFormatter implements IFormatter {
public abstract format(failures: RuleFailure[]): string;
}
7 changes: 4 additions & 3 deletions src/language/formatter/formatter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,8 +15,8 @@
* limitations under the License.
*/

import * as Lint from "../../lint";
import {RuleFailure} from "../rule/rule";

export interface IFormatter {
format(failures: Lint.RuleFailure[]): string;
format(failures: RuleFailure[]): string;
}
9 changes: 5 additions & 4 deletions src/language/languageServiceHost.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
/**
* @license
* Copyright 2014 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,12 +15,12 @@
* limitations under the License.
*/

import * as Lint from "../lint";
import * as ts from "typescript";
import {createCompilerOptions} from "./utils";

export function createLanguageServiceHost(fileName: string, source: string): ts.LanguageServiceHost {
return {
getCompilationSettings: () => Lint.createCompilerOptions(),
getCompilationSettings: () => createCompilerOptions(),
getCurrentDirectory: () => "",
getDefaultLibFileName: () => "lib.d.ts",
getScriptFileNames: () => [fileName],
Expand All @@ -30,6 +31,6 @@ export function createLanguageServiceHost(fileName: string, source: string): ts.
}

export function createLanguageService(fileName: string, source: string) {
const languageServiceHost = Lint.createLanguageServiceHost(fileName, source);
const languageServiceHost = createLanguageServiceHost(fileName, source);
return ts.createLanguageService(languageServiceHost);
}
Loading

0 comments on commit 0730f45

Please sign in to comment.