Merge pull request #89 from github/update-v1-a08742f1
Merge main into v1
This commit is contained in:
commit
010117c1b7
195 changed files with 17426 additions and 1416 deletions
10
.editorconfig
Normal file
10
.editorconfig
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.ts]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
34
.github/update-release-branch.py
vendored
34
.github/update-release-branch.py
vendored
|
|
@ -7,7 +7,7 @@ import sys
|
|||
|
||||
# The branch being merged from.
|
||||
# This is the one that contains day-to-day development work.
|
||||
MASTER_BRANCH = 'master'
|
||||
MAIN_BRANCH = 'main'
|
||||
# The branch being merged into.
|
||||
# This is the release branch that users reference.
|
||||
LATEST_RELEASE_BRANCH = 'v1'
|
||||
|
|
@ -28,7 +28,7 @@ def branch_exists_on_remote(branch_name):
|
|||
return run_git('ls-remote', '--heads', ORIGIN, branch_name).strip() != ''
|
||||
|
||||
# Opens a PR from the given branch to the release branch
|
||||
def open_pr(repo, all_commits, short_master_sha, branch_name):
|
||||
def open_pr(repo, all_commits, short_main_sha, branch_name):
|
||||
# Sort the commits into the pull requests that introduced them,
|
||||
# and any commits that don't have a pull request
|
||||
pull_requests = []
|
||||
|
|
@ -45,11 +45,11 @@ def open_pr(repo, all_commits, short_master_sha, branch_name):
|
|||
print('Found ' + str(len(commits_without_pull_requests)) + ' commits not in a pull request')
|
||||
|
||||
# Sort PRs and commits by age
|
||||
sorted(pull_requests, key=lambda pr: pr.number)
|
||||
sorted(commits_without_pull_requests, key=lambda c: c.commit.author.date)
|
||||
pull_requests = sorted(pull_requests, key=lambda pr: pr.number)
|
||||
commits_without_pull_requests = sorted(commits_without_pull_requests, key=lambda c: c.commit.author.date)
|
||||
|
||||
# Start constructing the body text
|
||||
body = 'Merging ' + short_master_sha + ' into ' + LATEST_RELEASE_BRANCH
|
||||
body = 'Merging ' + short_main_sha + ' into ' + LATEST_RELEASE_BRANCH
|
||||
|
||||
conductor = get_conductor(repo, pull_requests, commits_without_pull_requests)
|
||||
body += '\n\nConductor for this PR is @' + conductor
|
||||
|
|
@ -71,7 +71,7 @@ def open_pr(repo, all_commits, short_master_sha, branch_name):
|
|||
body += ' - ' + get_truncated_commit_message(commit)
|
||||
body += ' (@' + commit.author.login + ')'
|
||||
|
||||
title = 'Merge ' + MASTER_BRANCH + ' into ' + LATEST_RELEASE_BRANCH
|
||||
title = 'Merge ' + MAIN_BRANCH + ' into ' + LATEST_RELEASE_BRANCH
|
||||
|
||||
# Create the pull request
|
||||
pr = repo.create_pull(title=title, body=body, head=branch_name, base=LATEST_RELEASE_BRANCH)
|
||||
|
|
@ -90,12 +90,12 @@ def get_conductor(repo, pull_requests, other_commits):
|
|||
# Otherwise take the author of the latest commit
|
||||
return other_commits[-1].author.login
|
||||
|
||||
# Gets a list of the SHAs of all commits that have happened on master
|
||||
# Gets a list of the SHAs of all commits that have happened on main
|
||||
# since the release branched off.
|
||||
# This will not include any commits that exist on the release branch
|
||||
# that aren't on master.
|
||||
# that aren't on main.
|
||||
def get_commit_difference(repo):
|
||||
commits = run_git('log', '--pretty=format:%H', ORIGIN + '/' + LATEST_RELEASE_BRANCH + '...' + MASTER_BRANCH).strip().split('\n')
|
||||
commits = run_git('log', '--pretty=format:%H', ORIGIN + '/' + LATEST_RELEASE_BRANCH + '...' + MAIN_BRANCH).strip().split('\n')
|
||||
|
||||
# Convert to full-fledged commit objects
|
||||
commits = [repo.get_commit(c) for c in commits]
|
||||
|
|
@ -115,7 +115,7 @@ def get_truncated_commit_message(commit):
|
|||
else:
|
||||
return message
|
||||
|
||||
# Converts a commit into the PR that introduced it to the master branch.
|
||||
# Converts a commit into the PR that introduced it to the main branch.
|
||||
# Returns the PR object, or None if no PR could be found.
|
||||
def get_pr_for_commit(repo, commit):
|
||||
prs = commit.get_pulls()
|
||||
|
|
@ -144,20 +144,20 @@ def main():
|
|||
repo = Github(github_token).get_repo(repository_nwo)
|
||||
|
||||
# Print what we intend to go
|
||||
print('Considering difference between ' + MASTER_BRANCH + ' and ' + LATEST_RELEASE_BRANCH)
|
||||
short_master_sha = run_git('rev-parse', '--short', MASTER_BRANCH).strip()
|
||||
print('Current head of ' + MASTER_BRANCH + ' is ' + short_master_sha)
|
||||
print('Considering difference between ' + MAIN_BRANCH + ' and ' + LATEST_RELEASE_BRANCH)
|
||||
short_main_sha = run_git('rev-parse', '--short', MAIN_BRANCH).strip()
|
||||
print('Current head of ' + MAIN_BRANCH + ' is ' + short_main_sha)
|
||||
|
||||
# See if there are any commits to merge in
|
||||
commits = get_commit_difference(repo)
|
||||
if len(commits) == 0:
|
||||
print('No commits to merge from ' + MASTER_BRANCH + ' to ' + LATEST_RELEASE_BRANCH)
|
||||
print('No commits to merge from ' + MAIN_BRANCH + ' to ' + LATEST_RELEASE_BRANCH)
|
||||
return
|
||||
|
||||
# The branch name is based off of the name of branch being merged into
|
||||
# and the SHA of the branch being merged from. Thus if the branch already
|
||||
# exists we can assume we don't need to recreate it.
|
||||
new_branch_name = 'update-' + LATEST_RELEASE_BRANCH + '-' + short_master_sha
|
||||
new_branch_name = 'update-' + LATEST_RELEASE_BRANCH + '-' + short_main_sha
|
||||
print('Branch name is ' + new_branch_name)
|
||||
|
||||
# Check if the branch already exists. If so we can abort as this script
|
||||
|
|
@ -168,11 +168,11 @@ def main():
|
|||
|
||||
# Create the new branch and push it to the remote
|
||||
print('Creating branch ' + new_branch_name)
|
||||
run_git('checkout', '-b', new_branch_name, MASTER_BRANCH)
|
||||
run_git('checkout', '-b', new_branch_name, MAIN_BRANCH)
|
||||
run_git('push', ORIGIN, new_branch_name)
|
||||
|
||||
# Open a PR to update the branch
|
||||
open_pr(repo, commits, short_master_sha, new_branch_name)
|
||||
open_pr(repo, commits, short_main_sha, new_branch_name)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ author: 'GitHub'
|
|||
inputs:
|
||||
check_name:
|
||||
description: The name of the check run to add text to.
|
||||
required: false
|
||||
output:
|
||||
description: The path of the directory in which to save the SARIF results
|
||||
required: false
|
||||
|
|
@ -11,10 +12,14 @@ inputs:
|
|||
upload:
|
||||
description: Upload the SARIF file
|
||||
required: false
|
||||
default: true
|
||||
default: "true"
|
||||
ram:
|
||||
description: Override the amount of memory in MB to be used by CodeQL. By default, almost all the memory of the machine is used.
|
||||
required: false
|
||||
threads:
|
||||
description: The number of threads to be used by CodeQL.
|
||||
required: false
|
||||
default: "1"
|
||||
token:
|
||||
default: ${{ github.token }}
|
||||
matrix:
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"analysis-paths.js","sourceRoot":"","sources":["../src/analysis-paths.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AAItC,SAAgB,8BAA8B,CAAC,MAA0B,EAAE,SAAmB;IAC1F,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QAC3B,IAAI,CAAC,cAAc,CAAC,oBAAoB,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;KACtE;IAED,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QACjC,IAAI,CAAC,cAAc,CAAC,oBAAoB,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;KAC5E;IAED,SAAS,qBAAqB,CAAC,QAAQ;QACnC,OAAO,QAAQ,KAAK,YAAY,IAAI,QAAQ,KAAK,QAAQ,CAAC;IAC9D,CAAC;IAED,2DAA2D;IAC3D,+DAA+D;IAC/D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE;QAC3G,IAAI,CAAC,OAAO,CAAC,4FAA4F,CAAC,CAAC;KAC9G;AACL,CAAC;AAlBD,wEAkBC"}
|
||||
{"version":3,"file":"analysis-paths.js","sourceRoot":"","sources":["../src/analysis-paths.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AAItC,SAAgB,8BAA8B,CAAC,MAA0B,EAAE,SAAmB;IAC5F,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,IAAI,CAAC,cAAc,CAAC,oBAAoB,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;KACpE;IAED,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QACnC,IAAI,CAAC,cAAc,CAAC,oBAAoB,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;KAC1E;IAED,SAAS,qBAAqB,CAAC,QAAQ;QACrC,OAAO,QAAQ,KAAK,YAAY,IAAI,QAAQ,KAAK,QAAQ,CAAC;IAC5D,CAAC;IAED,2DAA2D;IAC3D,+DAA+D;IAC/D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE;QAC7G,IAAI,CAAC,OAAO,CAAC,4FAA4F,CAAC,CAAC;KAC5G;AACH,CAAC;AAlBD,wEAkBC"}
|
||||
2
lib/analysis-paths.test.js
generated
2
lib/analysis-paths.test.js
generated
|
|
@ -13,6 +13,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const ava_1 = __importDefault(require("ava"));
|
||||
const analysisPaths = __importStar(require("./analysis-paths"));
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
const testing_utils_1 = require("./testing-utils");
|
||||
testing_utils_1.silenceDebugOutput(ava_1.default);
|
||||
ava_1.default("emptyPaths", async (t) => {
|
||||
let config = new configUtils.Config();
|
||||
analysisPaths.includeAndExcludeAnalysisPaths(config, []);
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"analysis-paths.test.js","sourceRoot":"","sources":["../src/analysis-paths.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAuB;AAEvB,gEAAkD;AAClD,4DAA8C;AAE9C,aAAI,CAAC,YAAY,EAAE,KAAK,EAAC,CAAC,EAAC,EAAE;IACzB,IAAI,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;IACtC,aAAa,CAAC,8BAA8B,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,SAAS,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,eAAe,EAAE,KAAK,EAAC,CAAC,EAAC,EAAE;IAC5B,IAAI,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1C,aAAa,CAAC,8BAA8B,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,cAAc,CAAC,CAAC;IACxD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,cAAc,CAAC,CAAC;AAC5D,CAAC,CAAC,CAAC"}
|
||||
{"version":3,"file":"analysis-paths.test.js","sourceRoot":"","sources":["../src/analysis-paths.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAuB;AAEvB,gEAAkD;AAClD,4DAA8C;AAC9C,mDAAmD;AAEnD,kCAAkB,CAAC,aAAI,CAAC,CAAC;AAEzB,aAAI,CAAC,YAAY,EAAE,KAAK,EAAC,CAAC,EAAC,EAAE;IAC3B,IAAI,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;IACtC,aAAa,CAAC,8BAA8B,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,SAAS,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,eAAe,EAAE,KAAK,EAAC,CAAC,EAAC,EAAE;IAC9B,IAAI,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1C,aAAa,CAAC,8BAA8B,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,cAAc,CAAC,CAAC;IACxD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,cAAc,CAAC,CAAC;AAC1D,CAAC,CAAC,CAAC"}
|
||||
23
lib/api-client.js
generated
Normal file
23
lib/api-client.js
generated
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const octokit = __importStar(require("@octokit/rest"));
|
||||
const console_log_level_1 = __importDefault(require("console-log-level"));
|
||||
const githubAPIURL = process.env["GITHUB_API_URL"] || "https://api.github.com";
|
||||
exports.client = new octokit.Octokit({
|
||||
auth: core.getInput("token"),
|
||||
baseUrl: githubAPIURL,
|
||||
userAgent: "CodeQL Action",
|
||||
log: console_log_level_1.default({ level: "debug" })
|
||||
});
|
||||
//# sourceMappingURL=api-client.js.map
|
||||
1
lib/api-client.js.map
Normal file
1
lib/api-client.js.map
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsC;AACtC,uDAAyC;AACzC,0EAAgD;AAEhD,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,wBAAwB,CAAC;AAClE,QAAA,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;IACxC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;IAC5B,OAAO,EAAE,YAAY;IACrB,SAAS,EAAE,eAAe;IAC1B,GAAG,EAAE,2BAAe,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;CACzC,CAAC,CAAC"}
|
||||
File diff suppressed because one or more lines are too long
2
lib/config-utils.test.js
generated
2
lib/config-utils.test.js
generated
|
|
@ -14,7 +14,9 @@ const ava_1 = __importDefault(require("ava"));
|
|||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
const testing_utils_1 = require("./testing-utils");
|
||||
const util = __importStar(require("./util"));
|
||||
testing_utils_1.silenceDebugOutput(ava_1.default);
|
||||
function setInput(name, value) {
|
||||
// Transformation copied from
|
||||
// https://github.com/actions/toolkit/blob/05e39f551d33e1688f61b209ab5cdd335198f1b8/packages/core/src/core.ts#L69
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
2
lib/external-queries.test.js
generated
2
lib/external-queries.test.js
generated
|
|
@ -15,7 +15,9 @@ const fs = __importStar(require("fs"));
|
|||
const path = __importStar(require("path"));
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
const externalQueries = __importStar(require("./external-queries"));
|
||||
const testing_utils_1 = require("./testing-utils");
|
||||
const util = __importStar(require("./util"));
|
||||
testing_utils_1.silenceDebugOutput(ava_1.default);
|
||||
ava_1.default("checkoutExternalQueries", async (t) => {
|
||||
let config = new configUtils.Config();
|
||||
config.externalQueries = [
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"external-queries.test.js","sourceRoot":"","sources":["../src/external-queries.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAuB;AACvB,uCAAyB;AACzB,2CAA6B;AAE7B,4DAA8C;AAC9C,oEAAsD;AACtD,6CAA+B;AAE/B,aAAI,CAAC,yBAAyB,EAAE,KAAK,EAAC,CAAC,EAAC,EAAE;IACtC,IAAI,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,CAAC,eAAe,GAAG;QACrB,IAAI,WAAW,CAAC,aAAa,CAAC,kBAAkB,EAAE,0CAA0C,CAAC;KAChG,CAAC;IAEF,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAC,MAAM,EAAC,EAAE;QACjC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC;QACpC,MAAM,eAAe,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;QAEtD,uFAAuF;QACvF,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
||||
{"version":3,"file":"external-queries.test.js","sourceRoot":"","sources":["../src/external-queries.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAuB;AACvB,uCAAyB;AACzB,2CAA6B;AAE7B,4DAA8C;AAC9C,oEAAsD;AACtD,mDAAmD;AACnD,6CAA+B;AAE/B,kCAAkB,CAAC,aAAI,CAAC,CAAC;AAEzB,aAAI,CAAC,yBAAyB,EAAE,KAAK,EAAC,CAAC,EAAC,EAAE;IACxC,IAAI,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,CAAC,eAAe,GAAG;QACvB,IAAI,WAAW,CAAC,aAAa,CAAC,kBAAkB,EAAE,0CAA0C,CAAC;KAC9F,CAAC;IAEF,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAC,MAAM,EAAC,EAAE;QACnC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC;QACpC,MAAM,eAAe,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;QAEtD,uFAAuF;QACvF,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||
21
lib/finalize-db.js
generated
21
lib/finalize-db.js
generated
|
|
@ -11,7 +11,6 @@ const core = __importStar(require("@actions/core"));
|
|||
const exec = __importStar(require("@actions/exec"));
|
||||
const io = __importStar(require("@actions/io"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
const externalQueries = __importStar(require("./external-queries"));
|
||||
|
|
@ -37,23 +36,6 @@ function queryIsDisabled(language, query) {
|
|||
return (DISABLED_BUILTIN_QUERIES[language] || [])
|
||||
.some(disabledQuery => query.endsWith(disabledQuery));
|
||||
}
|
||||
function getMemoryFlag() {
|
||||
let memoryToUseMegaBytes;
|
||||
const memoryToUseString = core.getInput("ram");
|
||||
if (memoryToUseString) {
|
||||
memoryToUseMegaBytes = Number(memoryToUseString);
|
||||
if (Number.isNaN(memoryToUseMegaBytes) || memoryToUseMegaBytes <= 0) {
|
||||
throw new Error("Invalid RAM setting \"" + memoryToUseString + "\", specified.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
const totalMemoryBytes = os.totalmem();
|
||||
const totalMemoryMegaBytes = totalMemoryBytes / (1024 * 1024);
|
||||
const systemReservedMemoryMegaBytes = 256;
|
||||
memoryToUseMegaBytes = totalMemoryMegaBytes - systemReservedMemoryMegaBytes;
|
||||
}
|
||||
return "--ram=" + Math.floor(memoryToUseMegaBytes);
|
||||
}
|
||||
async function createdDBForScannedLanguages(codeqlCmd, databaseFolder) {
|
||||
const scannedLanguages = process.env[sharedEnv.CODEQL_ACTION_SCANNED_LANGUAGES];
|
||||
if (scannedLanguages) {
|
||||
|
|
@ -163,7 +145,8 @@ async function runQueries(codeqlCmd, databaseFolder, sarifFolder, config) {
|
|||
await exec.exec(codeqlCmd, [
|
||||
'database',
|
||||
'analyze',
|
||||
getMemoryFlag(),
|
||||
util.getMemoryFlag(),
|
||||
util.getThreadsFlag(),
|
||||
path.join(databaseFolder, database),
|
||||
'--format=sarif-latest',
|
||||
'--output=' + sarifFile,
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
2
lib/finalize-db.test.js
generated
Normal file
2
lib/finalize-db.test.js
generated
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
//# sourceMappingURL=finalize-db.test.js.map
|
||||
1
lib/finalize-db.test.js.map
Normal file
1
lib/finalize-db.test.js.map
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"finalize-db.test.js","sourceRoot":"","sources":["../src/finalize-db.test.ts"],"names":[],"mappings":""}
|
||||
File diff suppressed because one or more lines are too long
2
lib/fingerprints.test.js
generated
2
lib/fingerprints.test.js
generated
|
|
@ -14,6 +14,8 @@ const ava_1 = __importDefault(require("ava"));
|
|||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const fingerprints = __importStar(require("./fingerprints"));
|
||||
const testing_utils_1 = require("./testing-utils");
|
||||
testing_utils_1.silenceDebugOutput(ava_1.default);
|
||||
function testHash(t, input, expectedHashes) {
|
||||
let index = 0;
|
||||
let callback = function (lineNumber, hash) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
2
lib/setup-tools.js
generated
2
lib/setup-tools.js
generated
|
|
@ -20,7 +20,7 @@ class CodeQLSetup {
|
|||
if (process.platform === 'win32') {
|
||||
this.platform = 'win64';
|
||||
if (this.cmd.endsWith('codeql')) {
|
||||
this.cmd += ".cmd";
|
||||
this.cmd += ".exe";
|
||||
}
|
||||
}
|
||||
else if (process.platform === 'linux') {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"setup-tools.js","sourceRoot":"","sources":["../src/setup-tools.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AACtC,+DAAiD;AACjD,2CAA6B;AAC7B,+CAAiC;AAEjC,MAAa,WAAW;IAMpB,YAAY,UAAkB;QAC1B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC3C,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,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S,CAAC,QAAQ,CAAC,eAAe,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC;SACtF;QACD,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;KAE3D;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC9D;AACH,CAAC;AAnBD,kCAmBC;AAED,SAAgB,mBAAmB,CAAC,GAAW;IAE7C,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAClD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QACtC,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,iCAAiC,CAAC,CAAC;KAC/E;IAED,IAAI,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAEvB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;QAC1B,IAAI,CAAC,KAAK,CAAC,kBAAkB,OAAO,gEAAgE,OAAO,GAAG,CAAC,CAAC;QAChH,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;KAC9B;IAED,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAChC,IAAI,CAAC,CAAC,EAAE;QACN,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,iDAAiD,OAAO,UAAU,CAAC,CAAC;KAC/G;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AApBD,kDAoBC"}
|
||||
2
lib/setup-tools.test.js
generated
2
lib/setup-tools.test.js
generated
|
|
@ -15,7 +15,9 @@ const ava_1 = __importDefault(require("ava"));
|
|||
const nock_1 = __importDefault(require("nock"));
|
||||
const path = __importStar(require("path"));
|
||||
const setupTools = __importStar(require("./setup-tools"));
|
||||
const testing_utils_1 = require("./testing-utils");
|
||||
const util = __importStar(require("./util"));
|
||||
testing_utils_1.silenceDebugOutput(ava_1.default);
|
||||
ava_1.default('download codeql bundle cache', async (t) => {
|
||||
await util.withTmpDir(async (tmpDir) => {
|
||||
process.env['GITHUB_WORKSPACE'] = tmpDir;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"setup-tools.test.js","sourceRoot":"","sources":["../src/setup-tools.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAAiD;AACjD,8CAAuB;AACvB,gDAAwB;AACxB,2CAA6B;AAE7B,0DAA4C;AAC5C,6CAA+B;AAE/B,aAAI,CAAC,8BAA8B,EAAE,KAAK,EAAC,CAAC,EAAC,EAAE;IAE3C,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAC,MAAM,EAAC,EAAE;QAEjC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,GAAG,MAAM,CAAC;QAEzC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE9D,MAAM,QAAQ,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAE1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YAE5B,cAAI,CAAC,qBAAqB,CAAC;iBACtB,GAAG,CAAC,2BAA2B,OAAO,uBAAuB,CAAC;iBAC9D,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uCAAuC,CAAC,CAAC,CAAC;YAGvF,OAAO,CAAC,GAAG,CAAC,a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AC;AACL,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,iCAAiC,EAAE,CAAC,CAAC,EAAE;IAE1C,MAAM,KAAK,GAAG;QACZ,UAAU,EAAE,gBAAgB;QAC5B,YAAY,EAAE,kBAAkB;QAChC,cAAc,EAAE,cAAc;QAC9B,OAAO,EAAE,OAAO;QAChB,aAAa,EAAE,aAAa;QAC5B,cAAc,EAAE,cAAc;KAC/B,CAAC;IAEF,KAAK,MAAM,CAAC,OAAO,EAAE,eAAe,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QAC9D,MAAM,GAAG,GAAG,wCAAwC,OAAO,MAAM,CAAC;QAElE,IAAI;YACF,MAAM,aAAa,GAAG,UAAU,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;YAC1D,CAAC,CAAC,SAAS,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;SAC7C;QAAC,OAAO,CAAC,EAAE;YACV,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;SACnB;KACF;AACH,CAAC,CAAC,CAAC"}
|
||||
32
lib/setup-tracer.js
generated
32
lib/setup-tracer.js
generated
|
|
@ -127,22 +127,28 @@ function concatTracerConfigs(configs) {
|
|||
return { env, spec };
|
||||
}
|
||||
async function run() {
|
||||
let languages;
|
||||
try {
|
||||
if (util.should_abort('init', false) || !await util.reportActionStarting('init')) {
|
||||
return;
|
||||
}
|
||||
// The config file MUST be parsed in the init action
|
||||
const config = await configUtils.loadConfig();
|
||||
core.startGroup('Load language configuration');
|
||||
const languages = await util.getLanguages();
|
||||
const config = await configUtils.loadConfig();
|
||||
languages = await util.getLanguages();
|
||||
// If the languages parameter was not given and no languages were
|
||||
// detected then fail here as this is a workflow configuration error.
|
||||
if (languages.length === 0) {
|
||||
core.setFailed("Did not detect any languages to analyze. Please update input in workflow.");
|
||||
return;
|
||||
throw new Error("Did not detect any languages to analyze. Please update input in workflow.");
|
||||
}
|
||||
core.endGroup();
|
||||
analysisPaths.includeAndExcludeAnalysisPaths(config, languages);
|
||||
core.endGroup();
|
||||
}
|
||||
catch (e) {
|
||||
core.setFailed(e.message);
|
||||
await util.reportActionAborted('init', e.message);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const sourceRoot = path.resolve();
|
||||
core.startGroup('Setup CodeQL tools');
|
||||
const codeqlSetup = await setuptools.setupCodeQL();
|
||||
|
|
@ -165,7 +171,13 @@ async function run() {
|
|||
for (let language of languages) {
|
||||
const languageDatabase = path.join(databaseFolder, language);
|
||||
// Init language database
|
||||
await exec.exec(codeqlSetup.cmd, ['database', 'init', languageDatabase, '--language=' + language, '--source-root=' + sourceRoot]);
|
||||
await exec.exec(codeqlSetup.cmd, [
|
||||
'database',
|
||||
'init',
|
||||
languageDatabase,
|
||||
'--language=' + language,
|
||||
'--source-root=' + sourceRoot,
|
||||
]);
|
||||
// TODO: add better detection of 'traced languages' instead of using a hard coded list
|
||||
if (['cpp', 'java', 'csharp'].includes(language)) {
|
||||
const config = await tracerConfig(codeqlSetup, languageDatabase);
|
||||
|
|
@ -187,8 +199,10 @@ async function run() {
|
|||
core.exportVariable('DYLD_INSERT_LIBRARIES', path.join(codeqlSetup.tools, 'osx64', 'libtrace.dylib'));
|
||||
}
|
||||
else if (process.platform === 'win32') {
|
||||
await exec.exec('powershell', [path.resolve(__dirname, '..', 'src', 'inject-tracer.ps1'),
|
||||
path.resolve(codeqlSetup.tools, 'win64', 'tracer.exe')], { env: { 'ODASA_TRACER_CONFIGURATION': mainTracerConfig.spec } });
|
||||
await exec.exec('powershell', [
|
||||
path.resolve(__dirname, '..', 'src', 'inject-tracer.ps1'),
|
||||
path.resolve(codeqlSetup.tools, 'win64', 'tracer.exe'),
|
||||
], { env: { 'ODASA_TRACER_CONFIGURATION': mainTracerConfig.spec } });
|
||||
}
|
||||
else {
|
||||
core.exportVariable('LD_PRELOAD', path.join(codeqlSetup.tools, 'linux64', '${LIB}trace.so'));
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
22
lib/test-utils.js
generated
Normal file
22
lib/test-utils.js
generated
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function silenceDebugOutput(test) {
|
||||
const typedTest = test;
|
||||
typedTest.beforeEach(t => {
|
||||
const processStdoutWrite = process.stdout.write.bind(process.stdout);
|
||||
t.context.write = processStdoutWrite;
|
||||
process.stdout.write = (str, encoding, cb) => {
|
||||
// Core library will directly call process.stdout.write for commands
|
||||
// We don't want :: commands to be executed by the runner during tests
|
||||
if (!str.match(/^::/)) {
|
||||
processStdoutWrite(str, encoding, cb);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
});
|
||||
typedTest.afterEach(t => {
|
||||
process.stdout.write = t.context.write;
|
||||
});
|
||||
}
|
||||
exports.silenceDebugOutput = silenceDebugOutput;
|
||||
//# sourceMappingURL=test-utils.js.map
|
||||
1
lib/test-utils.js.map
Normal file
1
lib/test-utils.js.map
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../src/test-utils.ts"],"names":[],"mappings":";;AAEA,SAAgB,kBAAkB,CAAC,IAAwB;IACzD,MAAM,SAAS,GAAG,IAAmC,CAAC;IAEtD,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;QACrB,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACrE,CAAC,CAAC,OAAO,CAAC,KAAK,GAAG,kBAAkB,CAAC;QACrC,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,GAAQ,EAAE,QAAc,EAAE,EAA0B,EAAE,EAAE;YAC5E,oEAAoE;YACpE,sEAAsE;YACtE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACnB,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;aACzC;YACD,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC;IACN,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;QACpB,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC;AAnBD,gDAmBC"}
|
||||
48
lib/testing-utils.js
generated
Normal file
48
lib/testing-utils.js
generated
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function wrapOutput(context) {
|
||||
// Function signature taken from Socket.write.
|
||||
// Note there are two overloads:
|
||||
// write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean;
|
||||
// write(str: Uint8Array | string, encoding?: string, cb?: (err?: Error) => void): boolean;
|
||||
return (chunk, encoding, cb) => {
|
||||
// Work out which method overload we are in
|
||||
if (cb === undefined && typeof encoding === 'function') {
|
||||
cb = encoding;
|
||||
encoding = undefined;
|
||||
}
|
||||
// Record the output
|
||||
if (typeof chunk === 'string') {
|
||||
context.testOutput += chunk;
|
||||
}
|
||||
else {
|
||||
context.testOutput += new TextDecoder(encoding || 'utf-8').decode(chunk);
|
||||
}
|
||||
// Satisfy contract by calling callback when done
|
||||
if (cb !== undefined && typeof cb === 'function') {
|
||||
cb();
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
function silenceDebugOutput(test) {
|
||||
const typedTest = test;
|
||||
typedTest.beforeEach(t => {
|
||||
t.context.testOutput = "";
|
||||
const processStdoutWrite = process.stdout.write.bind(process.stdout);
|
||||
t.context.stdoutWrite = processStdoutWrite;
|
||||
process.stdout.write = wrapOutput(t.context);
|
||||
const processStderrWrite = process.stderr.write.bind(process.stderr);
|
||||
t.context.stderrWrite = processStderrWrite;
|
||||
process.stderr.write = wrapOutput(t.context);
|
||||
});
|
||||
typedTest.afterEach.always(t => {
|
||||
process.stdout.write = t.context.stdoutWrite;
|
||||
process.stderr.write = t.context.stderrWrite;
|
||||
if (!t.passed) {
|
||||
process.stdout.write(t.context.testOutput);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.silenceDebugOutput = silenceDebugOutput;
|
||||
//# sourceMappingURL=testing-utils.js.map
|
||||
1
lib/testing-utils.js.map
Normal file
1
lib/testing-utils.js.map
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"testing-utils.js","sourceRoot":"","sources":["../src/testing-utils.ts"],"names":[],"mappings":";;AAIA,SAAS,UAAU,CAAC,OAAoB;IACtC,8CAA8C;IAC9C,gCAAgC;IAChC,2EAA2E;IAC3E,2FAA2F;IAC3F,OAAO,CAAC,KAA0B,EAAE,QAAiB,EAAE,EAA0B,EAAW,EAAE;QAC5F,2CAA2C;QAC3C,IAAI,EAAE,KAAK,SAAS,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YACtD,EAAE,GAAG,QAAQ,CAAC;YACd,QAAQ,GAAG,SAAS,CAAC;SACtB;QAED,oBAAoB;QACpB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC;SAC7B;aAAM;YACL,OAAO,CAAC,UAAU,IAAI,IAAI,WAAW,CAAC,QAAQ,IAAI,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SAC1E;QAED,iDAAiD;QACjD,IAAI,EAAE,KAAK,SAAS,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE;YAChD,EAAE,EAAE,CAAC;SACN;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED,SAAgB,kBAAkB,CAAC,IAAwB;IACzD,MAAM,SAAS,GAAG,IAAkC,CAAC;IAErD,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;QACvB,CAAC,CAAC,OAAO,CAAC,UAAU,GAAG,EAAE,CAAC;QAE1B,MAAM,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,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,OAAO,KAAK,KAAK,WAAW,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE;QACpF,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;KACpB;CACJ;AACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACtC,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC"}
|
||||
{"version":3,"file":"tracer-env.js","sourceRoot":"","sources":["../src/tracer-env.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyB;AAEzB,MAAM,GAAG,GAAG,EAAE,CAAC;AACf,KAAK,IAAI,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;IAC7C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACrB,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,OAAO,KAAK,KAAK,WAAW,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE;QACtF,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;KAClB;CACF;AACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACtC,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC"}
|
||||
26
lib/upload-lib.js
generated
26
lib/upload-lib.js
generated
|
|
@ -11,13 +11,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const http = __importStar(require("@actions/http-client"));
|
||||
const auth = __importStar(require("@actions/http-client/auth"));
|
||||
const file_url_1 = __importDefault(require("file-url"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const jsonschema = __importStar(require("jsonschema"));
|
||||
const path = __importStar(require("path"));
|
||||
const zlib_1 = __importDefault(require("zlib"));
|
||||
const api = __importStar(require("./api-client"));
|
||||
const fingerprints = __importStar(require("./fingerprints"));
|
||||
const sharedEnv = __importStar(require("./shared-environment"));
|
||||
const util = __importStar(require("./util"));
|
||||
|
|
@ -51,27 +50,28 @@ async function uploadPayload(payload) {
|
|||
if (testMode) {
|
||||
return true;
|
||||
}
|
||||
const githubToken = core.getInput('token');
|
||||
const ph = new auth.BearerCredentialHandler(githubToken);
|
||||
const client = new http.HttpClient('Code Scanning : Upload SARIF', [ph]);
|
||||
const url = 'https://api.github.com/repos/' + process.env['GITHUB_REPOSITORY'] + '/code-scanning/analysis';
|
||||
const [owner, repo] = util.getRequiredEnvParam("GITHUB_REPOSITORY").split("/");
|
||||
// Make up to 4 attempts to upload, and sleep for these
|
||||
// number of seconds between each attempt.
|
||||
// We don't want to backoff too much to avoid wasting action
|
||||
// minutes, but just waiting a little bit could maybe help.
|
||||
const backoffPeriods = [1, 5, 15];
|
||||
for (let attempt = 0; attempt <= backoffPeriods.length; attempt++) {
|
||||
const res = await client.put(url, payload);
|
||||
core.debug('response status: ' + res.message.statusCode);
|
||||
const statusCode = res.message.statusCode;
|
||||
const response = await api.client.request("PUT /repos/:owner/:repo/code-scanning/analysis", ({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
data: payload,
|
||||
}));
|
||||
core.debug('response status: ' + response.status);
|
||||
const statusCode = response.status;
|
||||
if (statusCode === 202) {
|
||||
core.info("Successfully uploaded results");
|
||||
return true;
|
||||
}
|
||||
const requestID = res.message.headers["x-github-request-id"];
|
||||
const requestID = response.headers["x-github-request-id"];
|
||||
// On any other status code that's not 5xx mark the upload as failed
|
||||
if (!statusCode || statusCode < 500 || statusCode >= 600) {
|
||||
core.setFailed('Upload failed (' + requestID + '): (' + statusCode + ') ' + await res.readBody());
|
||||
core.setFailed('Upload failed (' + requestID + '): (' + statusCode + ') ' + JSON.stringify(response.data));
|
||||
return false;
|
||||
}
|
||||
// On a 5xx status code we may retry the request
|
||||
|
|
@ -79,7 +79,7 @@ async function uploadPayload(payload) {
|
|||
// Log the failure as a warning but don't mark the action as failed yet
|
||||
core.warning('Upload attempt (' + (attempt + 1) + ' of ' + (backoffPeriods.length + 1) +
|
||||
') failed (' + requestID + '). Retrying in ' + backoffPeriods[attempt] +
|
||||
' seconds: (' + statusCode + ') ' + await res.readBody());
|
||||
' seconds: (' + statusCode + ') ' + JSON.stringify(response.data));
|
||||
// Sleep for the backoff period
|
||||
await new Promise(r => setTimeout(r, backoffPeriods[attempt] * 1000));
|
||||
continue;
|
||||
|
|
@ -88,7 +88,7 @@ async function uploadPayload(payload) {
|
|||
// If the upload fails with 5xx then we assume it is a temporary problem
|
||||
// and not an error that the user has caused or can fix.
|
||||
// We avoid marking the job as failed to avoid breaking CI workflows.
|
||||
core.error('Upload failed (' + requestID + '): (' + statusCode + ') ' + await res.readBody());
|
||||
core.error('Upload failed (' + requestID + '): (' + statusCode + ') ' + JSON.stringify(response.data));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
2
lib/upload-lib.test.js
generated
2
lib/upload-lib.test.js
generated
|
|
@ -11,7 +11,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const ava_1 = __importDefault(require("ava"));
|
||||
const testing_utils_1 = require("./testing-utils");
|
||||
const uploadLib = __importStar(require("./upload-lib"));
|
||||
testing_utils_1.silenceDebugOutput(ava_1.default);
|
||||
ava_1.default('validateSarifFileSchema - valid', t => {
|
||||
const inputFile = __dirname + '/../src/testdata/valid-sarif.sarif';
|
||||
t.true(uploadLib.validateSarifFileSchema(inputFile));
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"upload-lib.test.js","sourceRoot":"","sources":["../src/upload-lib.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAuB;AAEvB,wDAA0C;AAE1C,aAAI,CAAC,iCAAiC,EAAE,CAAC,CAAC,EAAE;IAC1C,MAAM,SAAS,GAAG,SAAS,GAAG,oCAAoC,CAAC;IACnE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,mCAAmC,EAAE,CAAC,CAAC,EAAE;IAC5C,MAAM,SAAS,GAAG,SAAS,GAAG,sCAAsC,CAAC;IACrE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,CAAC;IACtD,iFAAiF;IACjF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
|
||||
{"version":3,"file":"upload-lib.test.js","sourceRoot":"","sources":["../src/upload-lib.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAuB;AAEvB,mDAAmD;AACnD,wDAA0C;AAE1C,kCAAkB,CAAC,aAAI,CAAC,CAAC;AAEzB,aAAI,CAAC,iCAAiC,EAAE,CAAC,CAAC,EAAE;IAC1C,MAAM,SAAS,GAAG,SAAS,GAAG,oCAAoC,CAAC;IACnE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,mCAAmC,EAAE,CAAC,CAAC,EAAE;IAC5C,MAAM,SAAS,GAAG,SAAS,GAAG,sCAAsC,CAAC;IACrE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,CAAC;IACtD,iFAAiF;IACjF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
|
||||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"upload-sarif.js","sourceRoot":"","sources":["../src/upload-sarif.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AAEtC,yDAA2C;AAC3C,6CAA+B;AAE/B,KAAK,UAAU,GAAG;IACd,IAAI,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,EAAE;QAC9F,OAAO;KACV;IAED,IAAI;QACA,IAAI,MAAM,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,EAAE;YACtD,MAAM,IAAI,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC;SACpD;aAAM;YACH,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;SAC3D;KACJ;IAAC,OAAO,KAAK,EAAE;QACZ,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9B,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1E,OAAO;KACV;AACL,CAAC;AAED,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACZ,IAAI,CAAC,SAAS,CAAC,qCAAqC,GAAG,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC"}
|
||||
{"version":3,"file":"upload-sarif.js","sourceRoot":"","sources":["../src/upload-sarif.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AAEtC,yDAA2C;AAC3C,6CAA+B;AAE/B,KAAK,UAAU,GAAG;IAChB,IAAI,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,EAAE;QAChG,OAAO;KACR;IAED,IAAI;QACF,IAAI,MAAM,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,EAAE;YACxD,MAAM,IAAI,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC;SAClD;aAAM;YACL,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;SACzD;KACF;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9B,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1E,OAAO;KACR;AACH,CAAC;AAED,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACd,IAAI,CAAC,SAAS,CAAC,qCAAqC,GAAG,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}
|
||||
147
lib/util.js
generated
147
lib/util.js
generated
|
|
@ -6,19 +6,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const exec = __importStar(require("@actions/exec"));
|
||||
const http = __importStar(require("@actions/http-client"));
|
||||
const auth = __importStar(require("@actions/http-client/auth"));
|
||||
const octokit = __importStar(require("@octokit/rest"));
|
||||
const console_log_level_1 = __importDefault(require("console-log-level"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
const api = __importStar(require("./api-client"));
|
||||
const sharedEnv = __importStar(require("./shared-environment"));
|
||||
/**
|
||||
* Should the current action be aborted?
|
||||
|
|
@ -47,7 +41,7 @@ exports.should_abort = should_abort;
|
|||
*/
|
||||
function getRequiredEnvParam(paramName) {
|
||||
const value = process.env[paramName];
|
||||
if (value === undefined) {
|
||||
if (value === undefined || value.length === 0) {
|
||||
throw new Error(paramName + ' environment variable must be set');
|
||||
}
|
||||
core.debug(paramName + '=' + value);
|
||||
|
|
@ -75,12 +69,7 @@ async function getLanguagesInRepo() {
|
|||
let owner = repo_nwo[0];
|
||||
let repo = repo_nwo[1];
|
||||
core.debug(`GitHub repo ${owner} ${repo}`);
|
||||
let ok = new octokit.Octokit({
|
||||
auth: core.getInput('token'),
|
||||
userAgent: "CodeQL Action",
|
||||
log: console_log_level_1.default({ level: "debug" })
|
||||
});
|
||||
const response = await ok.request("GET /repos/:owner/:repo/languages", ({
|
||||
const response = await api.client.request("GET /repos/:owner/:repo/languages", ({
|
||||
owner,
|
||||
repo
|
||||
}));
|
||||
|
|
@ -140,15 +129,28 @@ exports.getLanguages = getLanguages;
|
|||
* Gets the SHA of the commit that is currently checked out.
|
||||
*/
|
||||
async function getCommitOid() {
|
||||
let commitOid = '';
|
||||
await exec.exec('git', ['rev-parse', 'HEAD'], {
|
||||
silent: true,
|
||||
listeners: {
|
||||
stdout: (data) => { commitOid += data.toString(); },
|
||||
stderr: (data) => { process.stderr.write(data); }
|
||||
}
|
||||
});
|
||||
return commitOid.trim();
|
||||
// Try to use git to get the current commit SHA. If that fails then
|
||||
// log but otherwise silently fall back to using the SHA from the environment.
|
||||
// The only time these two values will differ is during analysis of a PR when
|
||||
// the workflow has changed the current commit to the head commit instead of
|
||||
// the merge commit, which must mean that git is available.
|
||||
// Even if this does go wrong, it's not a huge problem for the alerts to
|
||||
// reported on the merge commit.
|
||||
try {
|
||||
let commitOid = '';
|
||||
await exec.exec('git', ['rev-parse', 'HEAD'], {
|
||||
silent: true,
|
||||
listeners: {
|
||||
stdout: (data) => { commitOid += data.toString(); },
|
||||
stderr: (data) => { process.stderr.write(data); }
|
||||
}
|
||||
});
|
||||
return commitOid.trim();
|
||||
}
|
||||
catch (e) {
|
||||
core.info("Failed to call git to get current commit. Continuing with data from environment: " + e);
|
||||
return getRequiredEnvParam('GITHUB_SHA');
|
||||
}
|
||||
}
|
||||
exports.getCommitOid = getCommitOid;
|
||||
/**
|
||||
|
|
@ -158,19 +160,14 @@ async function getWorkflowPath() {
|
|||
const repo_nwo = getRequiredEnvParam('GITHUB_REPOSITORY').split("/");
|
||||
const owner = repo_nwo[0];
|
||||
const repo = repo_nwo[1];
|
||||
const run_id = getRequiredEnvParam('GITHUB_RUN_ID');
|
||||
const ok = new octokit.Octokit({
|
||||
auth: core.getInput('token'),
|
||||
userAgent: "CodeQL Action",
|
||||
log: console_log_level_1.default({ level: 'debug' })
|
||||
});
|
||||
const runsResponse = await ok.request('GET /repos/:owner/:repo/actions/runs/:run_id', {
|
||||
const run_id = Number(getRequiredEnvParam('GITHUB_RUN_ID'));
|
||||
const runsResponse = await api.client.request('GET /repos/:owner/:repo/actions/runs/:run_id', {
|
||||
owner,
|
||||
repo,
|
||||
run_id
|
||||
});
|
||||
const workflowUrl = runsResponse.data.workflow_url;
|
||||
const workflowResponse = await ok.request('GET ' + workflowUrl);
|
||||
const workflowResponse = await api.client.request('GET ' + workflowUrl);
|
||||
return workflowResponse.data.path;
|
||||
}
|
||||
/**
|
||||
|
|
@ -252,7 +249,7 @@ async function createStatusReport(actionName, status, cause, exception) {
|
|||
if (exception) {
|
||||
statusReport.exception = exception;
|
||||
}
|
||||
if (status === 'success' || status === 'failure') {
|
||||
if (status === 'success' || status === 'failure' || status === 'aborted') {
|
||||
statusReport.completed_at = new Date().toISOString();
|
||||
}
|
||||
let matrix = core.getInput('matrix');
|
||||
|
|
@ -264,21 +261,19 @@ async function createStatusReport(actionName, status, cause, exception) {
|
|||
/**
|
||||
* Send a status report to the code_scanning/analysis/status endpoint.
|
||||
*
|
||||
* Returns the status code of the response to the status request, or
|
||||
* undefined if the given statusReport is undefined or no response was
|
||||
* received.
|
||||
* Returns the status code of the response to the status request.
|
||||
*/
|
||||
async function sendStatusReport(statusReport) {
|
||||
var _a;
|
||||
const statusReportJSON = JSON.stringify(statusReport);
|
||||
core.debug('Sending status report: ' + statusReportJSON);
|
||||
const githubToken = core.getInput('token');
|
||||
const ph = new auth.BearerCredentialHandler(githubToken);
|
||||
const client = new http.HttpClient('Code Scanning : Status Report', [ph]);
|
||||
const url = 'https://api.github.com/repos/' + process.env['GITHUB_REPOSITORY']
|
||||
+ '/code-scanning/analysis/status';
|
||||
const res = await client.put(url, statusReportJSON);
|
||||
return (_a = res.message) === null || _a === void 0 ? void 0 : _a.statusCode;
|
||||
const nwo = getRequiredEnvParam("GITHUB_REPOSITORY");
|
||||
const [owner, repo] = nwo.split("/");
|
||||
const statusResponse = await api.client.request('PUT /repos/:owner/:repo/code-scanning/analysis/status', {
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
data: statusReportJSON,
|
||||
});
|
||||
return statusResponse.status;
|
||||
}
|
||||
/**
|
||||
* Send a status report that an action is starting.
|
||||
|
|
@ -327,6 +322,16 @@ async function reportActionSucceeded(action) {
|
|||
await sendStatusReport(await createStatusReport(action, 'success'));
|
||||
}
|
||||
exports.reportActionSucceeded = reportActionSucceeded;
|
||||
/**
|
||||
* Report that an action has been aborted.
|
||||
*
|
||||
* Note that the started_at date is always that of the `init` action, since
|
||||
* this is likely to give a more useful duration when inspecting events.
|
||||
*/
|
||||
async function reportActionAborted(action, cause) {
|
||||
await sendStatusReport(await createStatusReport(action, 'aborted', cause));
|
||||
}
|
||||
exports.reportActionAborted = reportActionAborted;
|
||||
/**
|
||||
* Get the array of all the tool names contained in the given sarif contents.
|
||||
*
|
||||
|
|
@ -349,9 +354,63 @@ exports.getToolNames = getToolNames;
|
|||
// Mostly intended for use within tests.
|
||||
async function withTmpDir(body) {
|
||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'codeql-action-'));
|
||||
const result = await body(tmpDir);
|
||||
const realSubdir = path.join(tmpDir, 'real');
|
||||
fs.mkdirSync(realSubdir);
|
||||
const symlinkSubdir = path.join(tmpDir, 'symlink');
|
||||
fs.symlinkSync(realSubdir, symlinkSubdir, 'dir');
|
||||
const result = await body(symlinkSubdir);
|
||||
fs.rmdirSync(tmpDir, { recursive: true });
|
||||
return result;
|
||||
}
|
||||
exports.withTmpDir = withTmpDir;
|
||||
/**
|
||||
* Get the codeql `--ram` flag as configured by the `ram` input. If no value was
|
||||
* specified, the total available memory will be used minus 256 MB.
|
||||
*
|
||||
* @returns string
|
||||
*/
|
||||
function getMemoryFlag() {
|
||||
let memoryToUseMegaBytes;
|
||||
const memoryToUseString = core.getInput("ram");
|
||||
if (memoryToUseString) {
|
||||
memoryToUseMegaBytes = Number(memoryToUseString);
|
||||
if (Number.isNaN(memoryToUseMegaBytes) || memoryToUseMegaBytes <= 0) {
|
||||
throw new Error("Invalid RAM setting \"" + memoryToUseString + "\", specified.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
const totalMemoryBytes = os.totalmem();
|
||||
const totalMemoryMegaBytes = totalMemoryBytes / (1024 * 1024);
|
||||
const systemReservedMemoryMegaBytes = 256;
|
||||
memoryToUseMegaBytes = totalMemoryMegaBytes - systemReservedMemoryMegaBytes;
|
||||
}
|
||||
return "--ram=" + Math.floor(memoryToUseMegaBytes);
|
||||
}
|
||||
exports.getMemoryFlag = getMemoryFlag;
|
||||
/**
|
||||
* Get the codeql `--threads` value specified for the `threads` input. The value
|
||||
* defaults to 1. The value will be capped to the number of available CPUs.
|
||||
*
|
||||
* @returns string
|
||||
*/
|
||||
function getThreadsFlag() {
|
||||
let numThreads = 1;
|
||||
const numThreadsString = core.getInput("threads");
|
||||
if (numThreadsString) {
|
||||
numThreads = Number(numThreadsString);
|
||||
if (Number.isNaN(numThreads)) {
|
||||
throw new Error(`Invalid threads setting "${numThreadsString}", specified.`);
|
||||
}
|
||||
const maxThreads = os.cpus().length;
|
||||
if (numThreads > maxThreads) {
|
||||
numThreads = maxThreads;
|
||||
}
|
||||
const minThreads = -maxThreads;
|
||||
if (numThreads < minThreads) {
|
||||
numThreads = minThreads;
|
||||
}
|
||||
}
|
||||
return `--threads=${numThreads}`;
|
||||
}
|
||||
exports.getThreadsFlag = getThreadsFlag;
|
||||
//# sourceMappingURL=util.js.map
|
||||
File diff suppressed because one or more lines are too long
43
lib/util.test.js
generated
43
lib/util.test.js
generated
|
|
@ -12,10 +12,53 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const ava_1 = __importDefault(require("ava"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const os = __importStar(require("os"));
|
||||
const testing_utils_1 = require("./testing-utils");
|
||||
const util = __importStar(require("./util"));
|
||||
testing_utils_1.silenceDebugOutput(ava_1.default);
|
||||
ava_1.default('getToolNames', t => {
|
||||
const input = fs.readFileSync(__dirname + '/../src/testdata/tool-names.sarif', 'utf8');
|
||||
const toolNames = util.getToolNames(input);
|
||||
t.deepEqual(toolNames, ["CodeQL command-line toolchain", "ESLint"]);
|
||||
});
|
||||
ava_1.default('getMemoryFlag() should return the correct --ram flag', t => {
|
||||
const totalMem = Math.floor(os.totalmem() / (1024 * 1024));
|
||||
const tests = {
|
||||
"": `--ram=${totalMem - 256}`,
|
||||
"512": "--ram=512",
|
||||
};
|
||||
for (const [input, expectedFlag] of Object.entries(tests)) {
|
||||
process.env['INPUT_RAM'] = input;
|
||||
const flag = util.getMemoryFlag();
|
||||
t.deepEqual(flag, expectedFlag);
|
||||
}
|
||||
});
|
||||
ava_1.default('getMemoryFlag() throws if the ram input is < 0 or NaN', t => {
|
||||
for (const input of ["-1", "hello!"]) {
|
||||
process.env['INPUT_RAM'] = input;
|
||||
t.throws(util.getMemoryFlag);
|
||||
}
|
||||
});
|
||||
ava_1.default('getThreadsFlag() should return the correct --threads flag', t => {
|
||||
const numCpus = os.cpus().length;
|
||||
const tests = {
|
||||
"0": "--threads=0",
|
||||
"1": "--threads=1",
|
||||
[`${numCpus + 1}`]: `--threads=${numCpus}`,
|
||||
[`${-numCpus - 1}`]: `--threads=${-numCpus}`
|
||||
};
|
||||
for (const [input, expectedFlag] of Object.entries(tests)) {
|
||||
process.env['INPUT_THREADS'] = input;
|
||||
const flag = util.getThreadsFlag();
|
||||
t.deepEqual(flag, expectedFlag);
|
||||
}
|
||||
});
|
||||
ava_1.default('getThreadsFlag() throws if the threads input is not an integer', t => {
|
||||
process.env['INPUT_THREADS'] = "hello!";
|
||||
t.throws(util.getThreadsFlag);
|
||||
});
|
||||
ava_1.default('getRef() throws on the empty string', t => {
|
||||
process.env["GITHUB_REF"] = "";
|
||||
t.throws(util.getRef);
|
||||
});
|
||||
//# sourceMappingURL=util.test.js.map
|
||||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"util.test.js","sourceRoot":"","sources":["../src/util.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAuB;AACvB,uCAAyB;AAEzB,6CAA+B;AAE/B,aAAI,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE;IACvB,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,GAAG,mCAAmC,EAAE,MAAM,CAAC,CAAC;IACvF,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,+BAA+B,EAAE,QAAQ,CAAC,CAAC,CAAC;AACtE,CAAC,CAAC,CAAC"}
|
||||
{"version":3,"file":"util.test.js","sourceRoot":"","sources":["../src/util.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAu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source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
202
node_modules/doctrine/LICENSE.closure-compiler
generated
vendored
Normal file
202
node_modules/doctrine/LICENSE.closure-compiler
generated
vendored
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
19
node_modules/doctrine/LICENSE.esprima
generated
vendored
Normal file
19
node_modules/doctrine/LICENSE.esprima
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
174
node_modules/doctrine/README.md
generated
vendored
Normal file
174
node_modules/doctrine/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
[![NPM version][npm-image]][npm-url]
|
||||
[![build status][travis-image]][travis-url]
|
||||
[![Test coverage][coveralls-image]][coveralls-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
[](https://gitter.im/eslint/doctrine?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
# Doctrine
|
||||
|
||||
Doctrine is a [JSDoc](http://usejsdoc.org) parser that parses documentation comments from JavaScript (you need to pass in the comment, not a whole JavaScript file).
|
||||
|
||||
## Installation
|
||||
|
||||
You can install Doctrine using [npm](https://npmjs.com):
|
||||
|
||||
```
|
||||
$ npm install doctrine --save-dev
|
||||
```
|
||||
|
||||
Doctrine can also be used in web browsers using [Browserify](http://browserify.org).
|
||||
|
||||
## Usage
|
||||
|
||||
Require doctrine inside of your JavaScript:
|
||||
|
||||
```js
|
||||
var doctrine = require("doctrine");
|
||||
```
|
||||
|
||||
### parse()
|
||||
|
||||
The primary method is `parse()`, which accepts two arguments: the JSDoc comment to parse and an optional options object. The available options are:
|
||||
|
||||
* `unwrap` - set to `true` to delete the leading `/**`, any `*` that begins a line, and the trailing `*/` from the source text. Default: `false`.
|
||||
* `tags` - an array of tags to return. When specified, Doctrine returns only tags in this array. For example, if `tags` is `["param"]`, then only `@param` tags will be returned. Default: `null`.
|
||||
* `recoverable` - set to `true` to keep parsing even when syntax errors occur. Default: `false`.
|
||||
* `sloppy` - set to `true` to allow optional parameters to be specified in brackets (`@param {string} [foo]`). Default: `false`.
|
||||
* `lineNumberes` - set to `true` to add `lineNumber` to each node, specifying the line on which the node is found in the source. Default: `false`.
|
||||
|
||||
Here's a simple example:
|
||||
|
||||
```js
|
||||
var ast = doctrine.parse(
|
||||
[
|
||||
"/**",
|
||||
" * This function comment is parsed by doctrine",
|
||||
" * @param {{ok:String}} userName",
|
||||
"*/"
|
||||
].join('\n'), { unwrap: true });
|
||||
```
|
||||
|
||||
This example returns the following AST:
|
||||
|
||||
{
|
||||
"description": "This function comment is parsed by doctrine",
|
||||
"tags": [
|
||||
{
|
||||
"title": "param",
|
||||
"description": null,
|
||||
"type": {
|
||||
"type": "RecordType",
|
||||
"fields": [
|
||||
{
|
||||
"type": "FieldType",
|
||||
"key": "ok",
|
||||
"value": {
|
||||
"type": "NameExpression",
|
||||
"name": "String"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"name": "userName"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
See the [demo page](http://eslint.org/doctrine/demo/) more detail.
|
||||
|
||||
## Team
|
||||
|
||||
These folks keep the project moving and are resources for help:
|
||||
|
||||
* Nicholas C. Zakas ([@nzakas](https://github.com/nzakas)) - project lead
|
||||
* Yusuke Suzuki ([@constellation](https://github.com/constellation)) - reviewer
|
||||
|
||||
## Contributing
|
||||
|
||||
Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/doctrine/issues).
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
### Can I pass a whole JavaScript file to Doctrine?
|
||||
|
||||
No. Doctrine can only parse JSDoc comments, so you'll need to pass just the JSDoc comment to Doctrine in order to work.
|
||||
|
||||
|
||||
### License
|
||||
|
||||
#### doctrine
|
||||
|
||||
Copyright (C) 2012 [Yusuke Suzuki](http://github.com/Constellation)
|
||||
(twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#### esprima
|
||||
|
||||
some of functions is derived from esprima
|
||||
|
||||
Copyright (C) 2012, 2011 [Ariya Hidayat](http://ariya.ofilabs.com/about)
|
||||
(twitter: [@ariyahidayat](http://twitter.com/ariyahidayat)) and other contributors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
#### closure-compiler
|
||||
|
||||
some of extensions is derived from closure-compiler
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
|
||||
### Where to ask for help?
|
||||
|
||||
Join our [Chatroom](https://gitter.im/eslint/doctrine)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/doctrine.svg?style=flat-square
|
||||
[npm-url]: https://www.npmjs.com/package/doctrine
|
||||
[travis-image]: https://img.shields.io/travis/eslint/doctrine/master.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/eslint/doctrine
|
||||
[coveralls-image]: https://img.shields.io/coveralls/eslint/doctrine/master.svg?style=flat-square
|
||||
[coveralls-url]: https://coveralls.io/r/eslint/doctrine?branch=master
|
||||
[downloads-image]: http://img.shields.io/npm/dm/doctrine.svg?style=flat-square
|
||||
[downloads-url]: https://www.npmjs.com/package/doctrine
|
||||
833
node_modules/doctrine/lib/doctrine.js
generated
vendored
Normal file
833
node_modules/doctrine/lib/doctrine.js
generated
vendored
Normal file
|
|
@ -0,0 +1,833 @@
|
|||
/*
|
||||
Copyright (C) 2012-2014 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
Copyright (C) 2014 Dan Tao <daniel.tao@gmail.com>
|
||||
Copyright (C) 2013 Andrew Eisenberg <andrew@eisenberg.as>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var typed,
|
||||
utility,
|
||||
isArray,
|
||||
jsdoc,
|
||||
esutils,
|
||||
hasOwnProperty;
|
||||
|
||||
esutils = require('esutils');
|
||||
isArray = require('isarray');
|
||||
typed = require('./typed');
|
||||
utility = require('./utility');
|
||||
|
||||
function sliceSource(source, index, last) {
|
||||
return source.slice(index, last);
|
||||
}
|
||||
|
||||
hasOwnProperty = (function () {
|
||||
var func = Object.prototype.hasOwnProperty;
|
||||
return function hasOwnProperty(obj, name) {
|
||||
return func.call(obj, name);
|
||||
};
|
||||
}());
|
||||
|
||||
function shallowCopy(obj) {
|
||||
var ret = {}, key;
|
||||
for (key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
ret[key] = obj[key];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function isASCIIAlphanumeric(ch) {
|
||||
return (ch >= 0x61 /* 'a' */ && ch <= 0x7A /* 'z' */) ||
|
||||
(ch >= 0x41 /* 'A' */ && ch <= 0x5A /* 'Z' */) ||
|
||||
(ch >= 0x30 /* '0' */ && ch <= 0x39 /* '9' */);
|
||||
}
|
||||
|
||||
function isParamTitle(title) {
|
||||
return title === 'param' || title === 'argument' || title === 'arg';
|
||||
}
|
||||
|
||||
function isReturnTitle(title) {
|
||||
return title === 'return' || title === 'returns';
|
||||
}
|
||||
|
||||
function isProperty(title) {
|
||||
return title === 'property' || title === 'prop';
|
||||
}
|
||||
|
||||
function isNameParameterRequired(title) {
|
||||
return isParamTitle(title) || isProperty(title) ||
|
||||
title === 'alias' || title === 'this' || title === 'mixes' || title === 'requires';
|
||||
}
|
||||
|
||||
function isAllowedName(title) {
|
||||
return isNameParameterRequired(title) || title === 'const' || title === 'constant';
|
||||
}
|
||||
|
||||
function isAllowedNested(title) {
|
||||
return isProperty(title) || isParamTitle(title);
|
||||
}
|
||||
|
||||
function isTypeParameterRequired(title) {
|
||||
return isParamTitle(title) || isReturnTitle(title) ||
|
||||
title === 'define' || title === 'enum' ||
|
||||
title === 'implements' || title === 'this' ||
|
||||
title === 'type' || title === 'typedef' || isProperty(title);
|
||||
}
|
||||
|
||||
// Consider deprecation instead using 'isTypeParameterRequired' and 'Rules' declaration to pick when a type is optional/required
|
||||
// This would require changes to 'parseType'
|
||||
function isAllowedType(title) {
|
||||
return isTypeParameterRequired(title) || title === 'throws' || title === 'const' || title === 'constant' ||
|
||||
title === 'namespace' || title === 'member' || title === 'var' || title === 'module' ||
|
||||
title === 'constructor' || title === 'class' || title === 'extends' || title === 'augments' ||
|
||||
title === 'public' || title === 'private' || title === 'protected';
|
||||
}
|
||||
|
||||
function trim(str) {
|
||||
return str.replace(/^\s+/, '').replace(/\s+$/, '');
|
||||
}
|
||||
|
||||
function unwrapComment(doc) {
|
||||
// JSDoc comment is following form
|
||||
// /**
|
||||
// * .......
|
||||
// */
|
||||
// remove /**, */ and *
|
||||
var BEFORE_STAR = 0,
|
||||
STAR = 1,
|
||||
AFTER_STAR = 2,
|
||||
index,
|
||||
len,
|
||||
mode,
|
||||
result,
|
||||
ch;
|
||||
|
||||
doc = doc.replace(/^\/\*\*?/, '').replace(/\*\/$/, '');
|
||||
index = 0;
|
||||
len = doc.length;
|
||||
mode = BEFORE_STAR;
|
||||
result = '';
|
||||
|
||||
while (index < len) {
|
||||
ch = doc.charCodeAt(index);
|
||||
switch (mode) {
|
||||
case BEFORE_STAR:
|
||||
if (esutils.code.isLineTerminator(ch)) {
|
||||
result += String.fromCharCode(ch);
|
||||
} else if (ch === 0x2A /* '*' */) {
|
||||
mode = STAR;
|
||||
} else if (!esutils.code.isWhiteSpace(ch)) {
|
||||
result += String.fromCharCode(ch);
|
||||
mode = AFTER_STAR;
|
||||
}
|
||||
break;
|
||||
|
||||
case STAR:
|
||||
if (!esutils.code.isWhiteSpace(ch)) {
|
||||
result += String.fromCharCode(ch);
|
||||
}
|
||||
mode = esutils.code.isLineTerminator(ch) ? BEFORE_STAR : AFTER_STAR;
|
||||
break;
|
||||
|
||||
case AFTER_STAR:
|
||||
result += String.fromCharCode(ch);
|
||||
if (esutils.code.isLineTerminator(ch)) {
|
||||
mode = BEFORE_STAR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
|
||||
return result.replace(/\s+$/, '');
|
||||
}
|
||||
|
||||
// JSDoc Tag Parser
|
||||
|
||||
(function (exports) {
|
||||
var Rules,
|
||||
index,
|
||||
lineNumber,
|
||||
length,
|
||||
source,
|
||||
recoverable,
|
||||
sloppy,
|
||||
strict;
|
||||
|
||||
function advance() {
|
||||
var ch = source.charCodeAt(index);
|
||||
index += 1;
|
||||
if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(index) === 0x0A /* '\n' */)) {
|
||||
lineNumber += 1;
|
||||
}
|
||||
return String.fromCharCode(ch);
|
||||
}
|
||||
|
||||
function scanTitle() {
|
||||
var title = '';
|
||||
// waste '@'
|
||||
advance();
|
||||
|
||||
while (index < length && isASCIIAlphanumeric(source.charCodeAt(index))) {
|
||||
title += advance();
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
function seekContent() {
|
||||
var ch, waiting, last = index;
|
||||
|
||||
waiting = false;
|
||||
while (last < length) {
|
||||
ch = source.charCodeAt(last);
|
||||
if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(last + 1) === 0x0A /* '\n' */)) {
|
||||
waiting = true;
|
||||
} else if (waiting) {
|
||||
if (ch === 0x40 /* '@' */) {
|
||||
break;
|
||||
}
|
||||
if (!esutils.code.isWhiteSpace(ch)) {
|
||||
waiting = false;
|
||||
}
|
||||
}
|
||||
last += 1;
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
||||
// type expression may have nest brace, such as,
|
||||
// { { ok: string } }
|
||||
//
|
||||
// therefore, scanning type expression with balancing braces.
|
||||
function parseType(title, last) {
|
||||
var ch, brace, type, direct = false;
|
||||
|
||||
|
||||
// search '{'
|
||||
while (index < last) {
|
||||
ch = source.charCodeAt(index);
|
||||
if (esutils.code.isWhiteSpace(ch)) {
|
||||
advance();
|
||||
} else if (ch === 0x7B /* '{' */) {
|
||||
advance();
|
||||
break;
|
||||
} else {
|
||||
// this is direct pattern
|
||||
direct = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (direct) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// type expression { is found
|
||||
brace = 1;
|
||||
type = '';
|
||||
while (index < last) {
|
||||
ch = source.charCodeAt(index);
|
||||
if (esutils.code.isLineTerminator(ch)) {
|
||||
advance();
|
||||
} else {
|
||||
if (ch === 0x7D /* '}' */) {
|
||||
brace -= 1;
|
||||
if (brace === 0) {
|
||||
advance();
|
||||
break;
|
||||
}
|
||||
} else if (ch === 0x7B /* '{' */) {
|
||||
brace += 1;
|
||||
}
|
||||
type += advance();
|
||||
}
|
||||
}
|
||||
|
||||
if (brace !== 0) {
|
||||
// braces is not balanced
|
||||
return utility.throwError('Braces are not balanced');
|
||||
}
|
||||
|
||||
if (isParamTitle(title)) {
|
||||
return typed.parseParamType(type);
|
||||
}
|
||||
return typed.parseType(type);
|
||||
}
|
||||
|
||||
function scanIdentifier(last) {
|
||||
var identifier;
|
||||
if (!esutils.code.isIdentifierStart(source.charCodeAt(index))) {
|
||||
return null;
|
||||
}
|
||||
identifier = advance();
|
||||
while (index < last && esutils.code.isIdentifierPart(source.charCodeAt(index))) {
|
||||
identifier += advance();
|
||||
}
|
||||
return identifier;
|
||||
}
|
||||
|
||||
function skipWhiteSpace(last) {
|
||||
while (index < last && (esutils.code.isWhiteSpace(source.charCodeAt(index)) || esutils.code.isLineTerminator(source.charCodeAt(index)))) {
|
||||
advance();
|
||||
}
|
||||
}
|
||||
|
||||
function parseName(last, allowBrackets, allowNestedParams) {
|
||||
var name = '', useBrackets;
|
||||
|
||||
skipWhiteSpace(last);
|
||||
|
||||
if (index >= last) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (allowBrackets && source.charCodeAt(index) === 0x5B /* '[' */) {
|
||||
useBrackets = true;
|
||||
name = advance();
|
||||
}
|
||||
|
||||
if (!esutils.code.isIdentifierStart(source.charCodeAt(index))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
name += scanIdentifier(last);
|
||||
|
||||
if (allowNestedParams) {
|
||||
if (source.charCodeAt(index) === 0x3A /* ':' */ && (
|
||||
name === 'module' ||
|
||||
name === 'external' ||
|
||||
name === 'event')) {
|
||||
name += advance();
|
||||
name += scanIdentifier(last);
|
||||
|
||||
}
|
||||
if(source.charCodeAt(index) === 0x5B /* '[' */ && source.charCodeAt(index + 1) === 0x5D /* ']' */){
|
||||
name += advance();
|
||||
name += advance();
|
||||
}
|
||||
while (source.charCodeAt(index) === 0x2E /* '.' */ ||
|
||||
source.charCodeAt(index) === 0x23 /* '#' */ ||
|
||||
source.charCodeAt(index) === 0x7E /* '~' */) {
|
||||
name += advance();
|
||||
name += scanIdentifier(last);
|
||||
}
|
||||
}
|
||||
|
||||
if (useBrackets) {
|
||||
|
||||
|
||||
// do we have a default value for this?
|
||||
if (source.charCodeAt(index) === 0x3D /* '=' */) {
|
||||
// consume the '='' symbol
|
||||
name += advance();
|
||||
var bracketDepth = 1;
|
||||
// scan in the default value
|
||||
while (index < last) {
|
||||
if (source.charCodeAt(index) === 0x5B /* '[' */) {
|
||||
bracketDepth++;
|
||||
} else if (source.charCodeAt(index) === 0x5D /* ']' */ &&
|
||||
--bracketDepth === 0) {
|
||||
break;
|
||||
}
|
||||
name += advance();
|
||||
}
|
||||
}
|
||||
|
||||
if (index >= last || source.charCodeAt(index) !== 0x5D /* ']' */) {
|
||||
// we never found a closing ']'
|
||||
return null;
|
||||
}
|
||||
|
||||
// collect the last ']'
|
||||
name += advance();
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
function skipToTag() {
|
||||
while (index < length && source.charCodeAt(index) !== 0x40 /* '@' */) {
|
||||
advance();
|
||||
}
|
||||
if (index >= length) {
|
||||
return false;
|
||||
}
|
||||
utility.assert(source.charCodeAt(index) === 0x40 /* '@' */);
|
||||
return true;
|
||||
}
|
||||
|
||||
function TagParser(options, title) {
|
||||
this._options = options;
|
||||
this._title = title;
|
||||
this._tag = {
|
||||
title: title,
|
||||
description: null
|
||||
};
|
||||
if (this._options.lineNumbers) {
|
||||
this._tag.lineNumber = lineNumber;
|
||||
}
|
||||
this._last = 0;
|
||||
// space to save special information for title parsers.
|
||||
this._extra = { };
|
||||
}
|
||||
|
||||
// addError(err, ...)
|
||||
TagParser.prototype.addError = function addError(errorText) {
|
||||
var args = Array.prototype.slice.call(arguments, 1),
|
||||
msg = errorText.replace(
|
||||
/%(\d)/g,
|
||||
function (whole, index) {
|
||||
utility.assert(index < args.length, 'Message reference must be in range');
|
||||
return args[index];
|
||||
}
|
||||
);
|
||||
|
||||
if (!this._tag.errors) {
|
||||
this._tag.errors = [];
|
||||
}
|
||||
if (strict) {
|
||||
utility.throwError(msg);
|
||||
}
|
||||
this._tag.errors.push(msg);
|
||||
return recoverable;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseType = function () {
|
||||
// type required titles
|
||||
if (isTypeParameterRequired(this._title)) {
|
||||
try {
|
||||
this._tag.type = parseType(this._title, this._last);
|
||||
if (!this._tag.type) {
|
||||
if (!isParamTitle(this._title) && !isReturnTitle(this._title)) {
|
||||
if (!this.addError('Missing or invalid tag type')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this._tag.type = null;
|
||||
if (!this.addError(error.message)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (isAllowedType(this._title)) {
|
||||
// optional types
|
||||
try {
|
||||
this._tag.type = parseType(this._title, this._last);
|
||||
} catch (e) {
|
||||
//For optional types, lets drop the thrown error when we hit the end of the file
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype._parseNamePath = function (optional) {
|
||||
var name;
|
||||
name = parseName(this._last, sloppy && isParamTitle(this._title), true);
|
||||
if (!name) {
|
||||
if (!optional) {
|
||||
if (!this.addError('Missing or invalid tag name')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
this._tag.name = name;
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseNamePath = function () {
|
||||
return this._parseNamePath(false);
|
||||
};
|
||||
|
||||
TagParser.prototype.parseNamePathOptional = function () {
|
||||
return this._parseNamePath(true);
|
||||
};
|
||||
|
||||
|
||||
TagParser.prototype.parseName = function () {
|
||||
var assign, name;
|
||||
|
||||
// param, property requires name
|
||||
if (isAllowedName(this._title)) {
|
||||
this._tag.name = parseName(this._last, sloppy && isParamTitle(this._title), isAllowedNested(this._title));
|
||||
if (!this._tag.name) {
|
||||
if (!isNameParameterRequired(this._title)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// it's possible the name has already been parsed but interpreted as a type
|
||||
// it's also possible this is a sloppy declaration, in which case it will be
|
||||
// fixed at the end
|
||||
if (isParamTitle(this._title) && this._tag.type && this._tag.type.name) {
|
||||
this._extra.name = this._tag.type;
|
||||
this._tag.name = this._tag.type.name;
|
||||
this._tag.type = null;
|
||||
} else {
|
||||
if (!this.addError('Missing or invalid tag name')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
name = this._tag.name;
|
||||
if (name.charAt(0) === '[' && name.charAt(name.length - 1) === ']') {
|
||||
// extract the default value if there is one
|
||||
// example: @param {string} [somebody=John Doe] description
|
||||
assign = name.substring(1, name.length - 1).split('=');
|
||||
if (assign[1]) {
|
||||
this._tag['default'] = assign[1];
|
||||
}
|
||||
this._tag.name = assign[0];
|
||||
|
||||
// convert to an optional type
|
||||
if (this._tag.type && this._tag.type.type !== 'OptionalType') {
|
||||
this._tag.type = {
|
||||
type: 'OptionalType',
|
||||
expression: this._tag.type
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseDescription = function parseDescription() {
|
||||
var description = trim(sliceSource(source, index, this._last));
|
||||
if (description) {
|
||||
if ((/^-\s+/).test(description)) {
|
||||
description = description.substring(2);
|
||||
}
|
||||
this._tag.description = description;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseKind = function parseKind() {
|
||||
var kind, kinds;
|
||||
kinds = {
|
||||
'class': true,
|
||||
'constant': true,
|
||||
'event': true,
|
||||
'external': true,
|
||||
'file': true,
|
||||
'function': true,
|
||||
'member': true,
|
||||
'mixin': true,
|
||||
'module': true,
|
||||
'namespace': true,
|
||||
'typedef': true
|
||||
};
|
||||
kind = trim(sliceSource(source, index, this._last));
|
||||
this._tag.kind = kind;
|
||||
if (!hasOwnProperty(kinds, kind)) {
|
||||
if (!this.addError('Invalid kind name \'%0\'', kind)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseAccess = function parseAccess() {
|
||||
var access;
|
||||
access = trim(sliceSource(source, index, this._last));
|
||||
this._tag.access = access;
|
||||
if (access !== 'private' && access !== 'protected' && access !== 'public') {
|
||||
if (!this.addError('Invalid access name \'%0\'', access)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseVariation = function parseVariation() {
|
||||
var variation, text;
|
||||
text = trim(sliceSource(source, index, this._last));
|
||||
variation = parseFloat(text, 10);
|
||||
this._tag.variation = variation;
|
||||
if (isNaN(variation)) {
|
||||
if (!this.addError('Invalid variation \'%0\'', text)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.ensureEnd = function () {
|
||||
var shouldBeEmpty = trim(sliceSource(source, index, this._last));
|
||||
if (shouldBeEmpty) {
|
||||
if (!this.addError('Unknown content \'%0\'', shouldBeEmpty)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.epilogue = function epilogue() {
|
||||
var description;
|
||||
|
||||
description = this._tag.description;
|
||||
// un-fix potentially sloppy declaration
|
||||
if (isParamTitle(this._title) && !this._tag.type && description && description.charAt(0) === '[') {
|
||||
this._tag.type = this._extra.name;
|
||||
if (!this._tag.name) {
|
||||
this._tag.name = undefined;
|
||||
}
|
||||
|
||||
if (!sloppy) {
|
||||
if (!this.addError('Missing or invalid tag name')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
Rules = {
|
||||
// http://usejsdoc.org/tags-access.html
|
||||
'access': ['parseAccess'],
|
||||
// http://usejsdoc.org/tags-alias.html
|
||||
'alias': ['parseNamePath', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-augments.html
|
||||
'augments': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-constructor.html
|
||||
'constructor': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// Synonym: http://usejsdoc.org/tags-constructor.html
|
||||
'class': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// Synonym: http://usejsdoc.org/tags-extends.html
|
||||
'extends': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-deprecated.html
|
||||
'deprecated': ['parseDescription'],
|
||||
// http://usejsdoc.org/tags-global.html
|
||||
'global': ['ensureEnd'],
|
||||
// http://usejsdoc.org/tags-inner.html
|
||||
'inner': ['ensureEnd'],
|
||||
// http://usejsdoc.org/tags-instance.html
|
||||
'instance': ['ensureEnd'],
|
||||
// http://usejsdoc.org/tags-kind.html
|
||||
'kind': ['parseKind'],
|
||||
// http://usejsdoc.org/tags-mixes.html
|
||||
'mixes': ['parseNamePath', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-mixin.html
|
||||
'mixin': ['parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-member.html
|
||||
'member': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-method.html
|
||||
'method': ['parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-module.html
|
||||
'module': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// Synonym: http://usejsdoc.org/tags-method.html
|
||||
'func': ['parseNamePathOptional', 'ensureEnd'],
|
||||
// Synonym: http://usejsdoc.org/tags-method.html
|
||||
'function': ['parseNamePathOptional', 'ensureEnd'],
|
||||
// Synonym: http://usejsdoc.org/tags-member.html
|
||||
'var': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-name.html
|
||||
'name': ['parseNamePath', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-namespace.html
|
||||
'namespace': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-private.html
|
||||
'private': ['parseType', 'parseDescription'],
|
||||
// http://usejsdoc.org/tags-protected.html
|
||||
'protected': ['parseType', 'parseDescription'],
|
||||
// http://usejsdoc.org/tags-public.html
|
||||
'public': ['parseType', 'parseDescription'],
|
||||
// http://usejsdoc.org/tags-readonly.html
|
||||
'readonly': ['ensureEnd'],
|
||||
// http://usejsdoc.org/tags-requires.html
|
||||
'requires': ['parseNamePath', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-since.html
|
||||
'since': ['parseDescription'],
|
||||
// http://usejsdoc.org/tags-static.html
|
||||
'static': ['ensureEnd'],
|
||||
// http://usejsdoc.org/tags-summary.html
|
||||
'summary': ['parseDescription'],
|
||||
// http://usejsdoc.org/tags-this.html
|
||||
'this': ['parseNamePath', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-todo.html
|
||||
'todo': ['parseDescription'],
|
||||
// http://usejsdoc.org/tags-typedef.html
|
||||
'typedef': ['parseType', 'parseNamePathOptional'],
|
||||
// http://usejsdoc.org/tags-variation.html
|
||||
'variation': ['parseVariation'],
|
||||
// http://usejsdoc.org/tags-version.html
|
||||
'version': ['parseDescription']
|
||||
};
|
||||
|
||||
TagParser.prototype.parse = function parse() {
|
||||
var i, iz, sequences, method;
|
||||
|
||||
// empty title
|
||||
if (!this._title) {
|
||||
if (!this.addError('Missing or invalid title')) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Seek to content last index.
|
||||
this._last = seekContent(this._title);
|
||||
|
||||
if (hasOwnProperty(Rules, this._title)) {
|
||||
sequences = Rules[this._title];
|
||||
} else {
|
||||
// default sequences
|
||||
sequences = ['parseType', 'parseName', 'parseDescription', 'epilogue'];
|
||||
}
|
||||
|
||||
for (i = 0, iz = sequences.length; i < iz; ++i) {
|
||||
method = sequences[i];
|
||||
if (!this[method]()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return this._tag;
|
||||
};
|
||||
|
||||
function parseTag(options) {
|
||||
var title, parser, tag;
|
||||
|
||||
// skip to tag
|
||||
if (!skipToTag()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// scan title
|
||||
title = scanTitle();
|
||||
|
||||
// construct tag parser
|
||||
parser = new TagParser(options, title);
|
||||
tag = parser.parse();
|
||||
|
||||
// Seek global index to end of this tag.
|
||||
while (index < parser._last) {
|
||||
advance();
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
//
|
||||
// Parse JSDoc
|
||||
//
|
||||
|
||||
function scanJSDocDescription(preserveWhitespace) {
|
||||
var description = '', ch, atAllowed;
|
||||
|
||||
atAllowed = true;
|
||||
while (index < length) {
|
||||
ch = source.charCodeAt(index);
|
||||
|
||||
if (atAllowed && ch === 0x40 /* '@' */) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (esutils.code.isLineTerminator(ch)) {
|
||||
atAllowed = true;
|
||||
} else if (atAllowed && !esutils.code.isWhiteSpace(ch)) {
|
||||
atAllowed = false;
|
||||
}
|
||||
|
||||
description += advance();
|
||||
}
|
||||
|
||||
return preserveWhitespace ? description : trim(description);
|
||||
}
|
||||
|
||||
function parse(comment, options) {
|
||||
var tags = [], tag, description, interestingTags, i, iz;
|
||||
|
||||
if (options === undefined) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (typeof options.unwrap === 'boolean' && options.unwrap) {
|
||||
source = unwrapComment(comment);
|
||||
} else {
|
||||
source = comment;
|
||||
}
|
||||
|
||||
// array of relevant tags
|
||||
if (options.tags) {
|
||||
if (isArray(options.tags)) {
|
||||
interestingTags = { };
|
||||
for (i = 0, iz = options.tags.length; i < iz; i++) {
|
||||
if (typeof options.tags[i] === 'string') {
|
||||
interestingTags[options.tags[i]] = true;
|
||||
} else {
|
||||
utility.throwError('Invalid "tags" parameter: ' + options.tags);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
utility.throwError('Invalid "tags" parameter: ' + options.tags);
|
||||
}
|
||||
}
|
||||
|
||||
length = source.length;
|
||||
index = 0;
|
||||
lineNumber = 0;
|
||||
recoverable = options.recoverable;
|
||||
sloppy = options.sloppy;
|
||||
strict = options.strict;
|
||||
|
||||
description = scanJSDocDescription(options.preserveWhitespace);
|
||||
|
||||
while (true) {
|
||||
tag = parseTag(options);
|
||||
if (!tag) {
|
||||
break;
|
||||
}
|
||||
if (!interestingTags || interestingTags.hasOwnProperty(tag.title)) {
|
||||
tags.push(tag);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
description: description,
|
||||
tags: tags
|
||||
};
|
||||
}
|
||||
exports.parse = parse;
|
||||
}(jsdoc = {}));
|
||||
|
||||
exports.version = utility.VERSION;
|
||||
exports.parse = jsdoc.parse;
|
||||
exports.parseType = typed.parseType;
|
||||
exports.parseParamType = typed.parseParamType;
|
||||
exports.unwrapComment = unwrapComment;
|
||||
exports.Syntax = shallowCopy(typed.Syntax);
|
||||
exports.Error = utility.DoctrineError;
|
||||
exports.type = {
|
||||
Syntax: exports.Syntax,
|
||||
parseType: typed.parseType,
|
||||
parseParamType: typed.parseParamType,
|
||||
stringify: typed.stringify
|
||||
};
|
||||
}());
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
1261
node_modules/doctrine/lib/typed.js
generated
vendored
Normal file
1261
node_modules/doctrine/lib/typed.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
54
node_modules/doctrine/lib/utility.js
generated
vendored
Normal file
54
node_modules/doctrine/lib/utility.js
generated
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
Copyright (C) 2014 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var VERSION;
|
||||
|
||||
VERSION = require('../package.json').version;
|
||||
exports.VERSION = VERSION;
|
||||
|
||||
function DoctrineError(message) {
|
||||
this.name = 'DoctrineError';
|
||||
this.message = message;
|
||||
}
|
||||
DoctrineError.prototype = (function () {
|
||||
var Middle = function () { };
|
||||
Middle.prototype = Error.prototype;
|
||||
return new Middle();
|
||||
}());
|
||||
DoctrineError.prototype.constructor = DoctrineError;
|
||||
exports.DoctrineError = DoctrineError;
|
||||
|
||||
function throwError(message) {
|
||||
throw new DoctrineError(message);
|
||||
}
|
||||
exports.throwError = throwError;
|
||||
|
||||
exports.assert = require('assert');
|
||||
}());
|
||||
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
19
node_modules/doctrine/node_modules/esutils/LICENSE.BSD
generated
vendored
Normal file
19
node_modules/doctrine/node_modules/esutils/LICENSE.BSD
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
169
node_modules/doctrine/node_modules/esutils/README.md
generated
vendored
Normal file
169
node_modules/doctrine/node_modules/esutils/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
### esutils [](http://travis-ci.org/Constellation/esutils)
|
||||
esutils ([esutils](http://github.com/Constellation/esutils)) is
|
||||
utility box for ECMAScript language tools.
|
||||
|
||||
### API
|
||||
|
||||
### ast
|
||||
|
||||
#### ast.isExpression(node)
|
||||
|
||||
Returns true if `node` is an Expression as defined in ECMA262 edition 5.1 section
|
||||
[11](https://es5.github.io/#x11).
|
||||
|
||||
#### ast.isStatement(node)
|
||||
|
||||
Returns true if `node` is a Statement as defined in ECMA262 edition 5.1 section
|
||||
[12](https://es5.github.io/#x12).
|
||||
|
||||
#### ast.isIterationStatement(node)
|
||||
|
||||
Returns true if `node` is an IterationStatement as defined in ECMA262 edition
|
||||
5.1 section [12.6](https://es5.github.io/#x12.6).
|
||||
|
||||
#### ast.isSourceElement(node)
|
||||
|
||||
Returns true if `node` is a SourceElement as defined in ECMA262 edition 5.1
|
||||
section [14](https://es5.github.io/#x14).
|
||||
|
||||
#### ast.trailingStatement(node)
|
||||
|
||||
Returns `Statement?` if `node` has trailing `Statement`.
|
||||
```js
|
||||
if (cond)
|
||||
consequent;
|
||||
```
|
||||
When taking this `IfStatement`, returns `consequent;` statement.
|
||||
|
||||
#### ast.isProblematicIfStatement(node)
|
||||
|
||||
Returns true if `node` is a problematic IfStatement. If `node` is a problematic `IfStatement`, `node` cannot be represented as an one on one JavaScript code.
|
||||
```js
|
||||
{
|
||||
type: 'IfStatement',
|
||||
consequent: {
|
||||
type: 'WithStatement',
|
||||
body: {
|
||||
type: 'IfStatement',
|
||||
consequent: {type: 'EmptyStatement'}
|
||||
}
|
||||
},
|
||||
alternate: {type: 'EmptyStatement'}
|
||||
}
|
||||
```
|
||||
The above node cannot be represented as a JavaScript code, since the top level `else` alternate belongs to an inner `IfStatement`.
|
||||
|
||||
|
||||
### code
|
||||
|
||||
#### code.isDecimalDigit(code)
|
||||
|
||||
Return true if provided code is decimal digit.
|
||||
|
||||
#### code.isHexDigit(code)
|
||||
|
||||
Return true if provided code is hexadecimal digit.
|
||||
|
||||
#### code.isOctalDigit(code)
|
||||
|
||||
Return true if provided code is octal digit.
|
||||
|
||||
#### code.isWhiteSpace(code)
|
||||
|
||||
Return true if provided code is white space. White space characters are formally defined in ECMA262.
|
||||
|
||||
#### code.isLineTerminator(code)
|
||||
|
||||
Return true if provided code is line terminator. Line terminator characters are formally defined in ECMA262.
|
||||
|
||||
#### code.isIdentifierStart(code)
|
||||
|
||||
Return true if provided code can be the first character of ECMA262 Identifier. They are formally defined in ECMA262.
|
||||
|
||||
#### code.isIdentifierPart(code)
|
||||
|
||||
Return true if provided code can be the trailing character of ECMA262 Identifier. They are formally defined in ECMA262.
|
||||
|
||||
### keyword
|
||||
|
||||
#### keyword.isKeywordES5(id, strict)
|
||||
|
||||
Returns `true` if provided identifier string is a Keyword or Future Reserved Word
|
||||
in ECMA262 edition 5.1. They are formally defined in ECMA262 sections
|
||||
[7.6.1.1](http://es5.github.io/#x7.6.1.1) and [7.6.1.2](http://es5.github.io/#x7.6.1.2),
|
||||
respectively. If the `strict` flag is truthy, this function additionally checks whether
|
||||
`id` is a Keyword or Future Reserved Word under strict mode.
|
||||
|
||||
#### keyword.isKeywordES6(id, strict)
|
||||
|
||||
Returns `true` if provided identifier string is a Keyword or Future Reserved Word
|
||||
in ECMA262 edition 6. They are formally defined in ECMA262 sections
|
||||
[11.6.2.1](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-keywords) and
|
||||
[11.6.2.2](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-future-reserved-words),
|
||||
respectively. If the `strict` flag is truthy, this function additionally checks whether
|
||||
`id` is a Keyword or Future Reserved Word under strict mode.
|
||||
|
||||
#### keyword.isReservedWordES5(id, strict)
|
||||
|
||||
Returns `true` if provided identifier string is a Reserved Word in ECMA262 edition 5.1.
|
||||
They are formally defined in ECMA262 section [7.6.1](http://es5.github.io/#x7.6.1).
|
||||
If the `strict` flag is truthy, this function additionally checks whether `id`
|
||||
is a Reserved Word under strict mode.
|
||||
|
||||
#### keyword.isReservedWordES6(id, strict)
|
||||
|
||||
Returns `true` if provided identifier string is a Reserved Word in ECMA262 edition 6.
|
||||
They are formally defined in ECMA262 section [11.6.2](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reserved-words).
|
||||
If the `strict` flag is truthy, this function additionally checks whether `id`
|
||||
is a Reserved Word under strict mode.
|
||||
|
||||
#### keyword.isRestrictedWord(id)
|
||||
|
||||
Returns `true` if provided identifier string is one of `eval` or `arguments`.
|
||||
They are restricted in strict mode code throughout ECMA262 edition 5.1 and
|
||||
in ECMA262 edition 6 section [12.1.1](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-early-errors).
|
||||
|
||||
#### keyword.isIdentifierName(id)
|
||||
|
||||
Return true if provided identifier string is an IdentifierName as specified in
|
||||
ECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6).
|
||||
|
||||
#### keyword.isIdentifierES5(id, strict)
|
||||
|
||||
Return true if provided identifier string is an Identifier as specified in
|
||||
ECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6). If the `strict`
|
||||
flag is truthy, this function additionally checks whether `id` is an Identifier
|
||||
under strict mode.
|
||||
|
||||
#### keyword.isIdentifierES6(id, strict)
|
||||
|
||||
Return true if provided identifier string is an Identifier as specified in
|
||||
ECMA262 edition 6 section [12.1](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers).
|
||||
If the `strict` flag is truthy, this function additionally checks whether `id`
|
||||
is an Identifier under strict mode.
|
||||
|
||||
### License
|
||||
|
||||
Copyright (C) 2013 [Yusuke Suzuki](http://github.com/Constellation)
|
||||
(twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
144
node_modules/doctrine/node_modules/esutils/lib/ast.js
generated
vendored
Normal file
144
node_modules/doctrine/node_modules/esutils/lib/ast.js
generated
vendored
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function isExpression(node) {
|
||||
if (node == null) { return false; }
|
||||
switch (node.type) {
|
||||
case 'ArrayExpression':
|
||||
case 'AssignmentExpression':
|
||||
case 'BinaryExpression':
|
||||
case 'CallExpression':
|
||||
case 'ConditionalExpression':
|
||||
case 'FunctionExpression':
|
||||
case 'Identifier':
|
||||
case 'Literal':
|
||||
case 'LogicalExpression':
|
||||
case 'MemberExpression':
|
||||
case 'NewExpression':
|
||||
case 'ObjectExpression':
|
||||
case 'SequenceExpression':
|
||||
case 'ThisExpression':
|
||||
case 'UnaryExpression':
|
||||
case 'UpdateExpression':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isIterationStatement(node) {
|
||||
if (node == null) { return false; }
|
||||
switch (node.type) {
|
||||
case 'DoWhileStatement':
|
||||
case 'ForInStatement':
|
||||
case 'ForStatement':
|
||||
case 'WhileStatement':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isStatement(node) {
|
||||
if (node == null) { return false; }
|
||||
switch (node.type) {
|
||||
case 'BlockStatement':
|
||||
case 'BreakStatement':
|
||||
case 'ContinueStatement':
|
||||
case 'DebuggerStatement':
|
||||
case 'DoWhileStatement':
|
||||
case 'EmptyStatement':
|
||||
case 'ExpressionStatement':
|
||||
case 'ForInStatement':
|
||||
case 'ForStatement':
|
||||
case 'IfStatement':
|
||||
case 'LabeledStatement':
|
||||
case 'ReturnStatement':
|
||||
case 'SwitchStatement':
|
||||
case 'ThrowStatement':
|
||||
case 'TryStatement':
|
||||
case 'VariableDeclaration':
|
||||
case 'WhileStatement':
|
||||
case 'WithStatement':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isSourceElement(node) {
|
||||
return isStatement(node) || node != null && node.type === 'FunctionDeclaration';
|
||||
}
|
||||
|
||||
function trailingStatement(node) {
|
||||
switch (node.type) {
|
||||
case 'IfStatement':
|
||||
if (node.alternate != null) {
|
||||
return node.alternate;
|
||||
}
|
||||
return node.consequent;
|
||||
|
||||
case 'LabeledStatement':
|
||||
case 'ForStatement':
|
||||
case 'ForInStatement':
|
||||
case 'WhileStatement':
|
||||
case 'WithStatement':
|
||||
return node.body;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function isProblematicIfStatement(node) {
|
||||
var current;
|
||||
|
||||
if (node.type !== 'IfStatement') {
|
||||
return false;
|
||||
}
|
||||
if (node.alternate == null) {
|
||||
return false;
|
||||
}
|
||||
current = node.consequent;
|
||||
do {
|
||||
if (current.type === 'IfStatement') {
|
||||
if (current.alternate == null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
current = trailingStatement(current);
|
||||
} while (current);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isExpression: isExpression,
|
||||
isStatement: isStatement,
|
||||
isIterationStatement: isIterationStatement,
|
||||
isSourceElement: isSourceElement,
|
||||
isProblematicIfStatement: isProblematicIfStatement,
|
||||
|
||||
trailingStatement: trailingStatement
|
||||
};
|
||||
}());
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
101
node_modules/doctrine/node_modules/esutils/lib/code.js
generated
vendored
Normal file
101
node_modules/doctrine/node_modules/esutils/lib/code.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
137
node_modules/doctrine/node_modules/esutils/lib/keyword.js
generated
vendored
Normal file
137
node_modules/doctrine/node_modules/esutils/lib/keyword.js
generated
vendored
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
/*
|
||||
Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var code = require('./code');
|
||||
|
||||
function isStrictModeReservedWordES6(id) {
|
||||
switch (id) {
|
||||
case 'implements':
|
||||
case 'interface':
|
||||
case 'package':
|
||||
case 'private':
|
||||
case 'protected':
|
||||
case 'public':
|
||||
case 'static':
|
||||
case 'let':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isKeywordES5(id, strict) {
|
||||
// yield should not be treated as keyword under non-strict mode.
|
||||
if (!strict && id === 'yield') {
|
||||
return false;
|
||||
}
|
||||
return isKeywordES6(id, strict);
|
||||
}
|
||||
|
||||
function isKeywordES6(id, strict) {
|
||||
if (strict && isStrictModeReservedWordES6(id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (id.length) {
|
||||
case 2:
|
||||
return (id === 'if') || (id === 'in') || (id === 'do');
|
||||
case 3:
|
||||
return (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try');
|
||||
case 4:
|
||||
return (id === 'this') || (id === 'else') || (id === 'case') ||
|
||||
(id === 'void') || (id === 'with') || (id === 'enum');
|
||||
case 5:
|
||||
return (id === 'while') || (id === 'break') || (id === 'catch') ||
|
||||
(id === 'throw') || (id === 'const') || (id === 'yield') ||
|
||||
(id === 'class') || (id === 'super');
|
||||
case 6:
|
||||
return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
|
||||
(id === 'switch') || (id === 'export') || (id === 'import');
|
||||
case 7:
|
||||
return (id === 'default') || (id === 'finally') || (id === 'extends');
|
||||
case 8:
|
||||
return (id === 'function') || (id === 'continue') || (id === 'debugger');
|
||||
case 10:
|
||||
return (id === 'instanceof');
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isReservedWordES5(id, strict) {
|
||||
return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
|
||||
}
|
||||
|
||||
function isReservedWordES6(id, strict) {
|
||||
return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict);
|
||||
}
|
||||
|
||||
function isRestrictedWord(id) {
|
||||
return id === 'eval' || id === 'arguments';
|
||||
}
|
||||
|
||||
function isIdentifierName(id) {
|
||||
var i, iz, ch;
|
||||
|
||||
if (id.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ch = id.charCodeAt(0);
|
||||
if (!code.isIdentifierStart(ch) || ch === 92) { // \ (backslash)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 1, iz = id.length; i < iz; ++i) {
|
||||
ch = id.charCodeAt(i);
|
||||
if (!code.isIdentifierPart(ch) || ch === 92) { // \ (backslash)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function isIdentifierES5(id, strict) {
|
||||
return isIdentifierName(id) && !isReservedWordES5(id, strict);
|
||||
}
|
||||
|
||||
function isIdentifierES6(id, strict) {
|
||||
return isIdentifierName(id) && !isReservedWordES6(id, strict);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isKeywordES5: isKeywordES5,
|
||||
isKeywordES6: isKeywordES6,
|
||||
isReservedWordES5: isReservedWordES5,
|
||||
isReservedWordES6: isReservedWordES6,
|
||||
isRestrictedWord: isRestrictedWord,
|
||||
isIdentifierName: isIdentifierName,
|
||||
isIdentifierES5: isIdentifierES5,
|
||||
isIdentifierES6: isIdentifierES6
|
||||
};
|
||||
}());
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
33
node_modules/doctrine/node_modules/esutils/lib/utils.js
generated
vendored
Normal file
33
node_modules/doctrine/node_modules/esutils/lib/utils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
exports.ast = require('./ast');
|
||||
exports.code = require('./code');
|
||||
exports.keyword = require('./keyword');
|
||||
}());
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
49
node_modules/doctrine/node_modules/esutils/package.json
generated
vendored
Normal file
49
node_modules/doctrine/node_modules/esutils/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"name": "esutils",
|
||||
"description": "utility box for ECMAScript language tools",
|
||||
"homepage": "https://github.com/Constellation/esutils",
|
||||
"main": "lib/utils.js",
|
||||
"version": "1.1.6",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "./lib"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE.BSD",
|
||||
"README.md",
|
||||
"lib"
|
||||
],
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Yusuke Suzuki",
|
||||
"email": "utatane.tea@gmail.com",
|
||||
"web": "http://github.com/Constellation"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/Constellation/esutils.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "~1.12.0",
|
||||
"chai": "~1.7.2",
|
||||
"jshint": "2.1.5",
|
||||
"coffee-script": "~1.6.3",
|
||||
"unicode-6.3.0": "~0.1.1",
|
||||
"regenerate": "~0.5.4"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "BSD",
|
||||
"url": "http://github.com/Constellation/esutils/raw/master/LICENSE.BSD"
|
||||
}
|
||||
],
|
||||
"scripts": {
|
||||
"test": "npm run-script lint && npm run-script unit-test",
|
||||
"lint": "jshint lib/*.js",
|
||||
"unit-test": "mocha --compilers coffee:coffee-script -R spec",
|
||||
"generate-regex": "node tools/generate-identifier-regex.js"
|
||||
}
|
||||
}
|
||||
69
node_modules/doctrine/package.json
generated
vendored
Normal file
69
node_modules/doctrine/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"name": "doctrine",
|
||||
"description": "JSDoc parser",
|
||||
"homepage": "https://github.com/eslint/doctrine",
|
||||
"main": "lib/doctrine.js",
|
||||
"version": "0.7.2",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "./lib"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"LICENSE.BSD",
|
||||
"LICENSE.closure-compiler",
|
||||
"LICENSE.esprima",
|
||||
"README.md"
|
||||
],
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Yusuke Suzuki",
|
||||
"email": "utatane.tea@gmail.com",
|
||||
"web": "http://github.com/Constellation"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/eslint/doctrine.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.2",
|
||||
"dateformat": "^1.0.11",
|
||||
"eslint": "^1.9.0",
|
||||
"gulp": "^3.8.10",
|
||||
"gulp-bump": "^0.1.13",
|
||||
"gulp-eslint": "^0.5.0",
|
||||
"gulp-filter": "^2.0.2",
|
||||
"gulp-git": "^1.0.0",
|
||||
"gulp-istanbul": "^0.6.0",
|
||||
"gulp-jshint": "^1.9.0",
|
||||
"gulp-mocha": "^2.0.0",
|
||||
"gulp-tag-version": "^1.2.1",
|
||||
"jshint-stylish": "^1.0.0",
|
||||
"linefix": "^0.1.1",
|
||||
"mocha": "^2.3.3",
|
||||
"npm-license": "^0.3.1",
|
||||
"semver": "^5.0.3",
|
||||
"shelljs": "^0.5.3",
|
||||
"shelljs-nodecli": "^0.1.1",
|
||||
"should": "^5.0.1"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "BSD",
|
||||
"url": "http://github.com/eslint/doctrine/raw/master/LICENSE.BSD"
|
||||
}
|
||||
],
|
||||
"scripts": {
|
||||
"test": "gulp",
|
||||
"unit-test": "gulp test",
|
||||
"lint": "gulp lint",
|
||||
"coveralls": "cat ./coverage/lcov.info | coveralls && rm -rf ./coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"esutils": "^1.1.6",
|
||||
"isarray": "0.0.1"
|
||||
}
|
||||
}
|
||||
54
node_modules/isarray/README.md
generated
vendored
Normal file
54
node_modules/isarray/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
# isarray
|
||||
|
||||
`Array#isArray` for older browsers.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isArray = require('isarray');
|
||||
|
||||
console.log(isArray([])); // => true
|
||||
console.log(isArray({})); // => false
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](http://npmjs.org) do
|
||||
|
||||
```bash
|
||||
$ npm install isarray
|
||||
```
|
||||
|
||||
Then bundle for the browser with
|
||||
[browserify](https://github.com/substack/browserify).
|
||||
|
||||
With [component](http://component.io) do
|
||||
|
||||
```bash
|
||||
$ component install juliangruber/isarray
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
209
node_modules/isarray/build/build.js
generated
vendored
Normal file
209
node_modules/isarray/build/build.js
generated
vendored
Normal file
|
|
@ -0,0 +1,209 @@
|
|||
|
||||
/**
|
||||
* Require the given path.
|
||||
*
|
||||
* @param {String} path
|
||||
* @return {Object} exports
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function require(path, parent, orig) {
|
||||
var resolved = require.resolve(path);
|
||||
|
||||
// lookup failed
|
||||
if (null == resolved) {
|
||||
orig = orig || path;
|
||||
parent = parent || 'root';
|
||||
var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
|
||||
err.path = orig;
|
||||
err.parent = parent;
|
||||
err.require = true;
|
||||
throw err;
|
||||
}
|
||||
|
||||
var module = require.modules[resolved];
|
||||
|
||||
// perform real require()
|
||||
// by invoking the module's
|
||||
// registered function
|
||||
if (!module.exports) {
|
||||
module.exports = {};
|
||||
module.client = module.component = true;
|
||||
module.call(this, module.exports, require.relative(resolved), module);
|
||||
}
|
||||
|
||||
return module.exports;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registered modules.
|
||||
*/
|
||||
|
||||
require.modules = {};
|
||||
|
||||
/**
|
||||
* Registered aliases.
|
||||
*/
|
||||
|
||||
require.aliases = {};
|
||||
|
||||
/**
|
||||
* Resolve `path`.
|
||||
*
|
||||
* Lookup:
|
||||
*
|
||||
* - PATH/index.js
|
||||
* - PATH.js
|
||||
* - PATH
|
||||
*
|
||||
* @param {String} path
|
||||
* @return {String} path or null
|
||||
* @api private
|
||||
*/
|
||||
|
||||
require.resolve = function(path) {
|
||||
if (path.charAt(0) === '/') path = path.slice(1);
|
||||
var index = path + '/index.js';
|
||||
|
||||
var paths = [
|
||||
path,
|
||||
path + '.js',
|
||||
path + '.json',
|
||||
path + '/index.js',
|
||||
path + '/index.json'
|
||||
];
|
||||
|
||||
for (var i = 0; i < paths.length; i++) {
|
||||
var path = paths[i];
|
||||
if (require.modules.hasOwnProperty(path)) return path;
|
||||
}
|
||||
|
||||
if (require.aliases.hasOwnProperty(index)) {
|
||||
return require.aliases[index];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Normalize `path` relative to the current path.
|
||||
*
|
||||
* @param {String} curr
|
||||
* @param {String} path
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
require.normalize = function(curr, path) {
|
||||
var segs = [];
|
||||
|
||||
if ('.' != path.charAt(0)) return path;
|
||||
|
||||
curr = curr.split('/');
|
||||
path = path.split('/');
|
||||
|
||||
for (var i = 0; i < path.length; ++i) {
|
||||
if ('..' == path[i]) {
|
||||
curr.pop();
|
||||
} else if ('.' != path[i] && '' != path[i]) {
|
||||
segs.push(path[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return curr.concat(segs).join('/');
|
||||
};
|
||||
|
||||
/**
|
||||
* Register module at `path` with callback `definition`.
|
||||
*
|
||||
* @param {String} path
|
||||
* @param {Function} definition
|
||||
* @api private
|
||||
*/
|
||||
|
||||
require.register = function(path, definition) {
|
||||
require.modules[path] = definition;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias a module definition.
|
||||
*
|
||||
* @param {String} from
|
||||
* @param {String} to
|
||||
* @api private
|
||||
*/
|
||||
|
||||
require.alias = function(from, to) {
|
||||
if (!require.modules.hasOwnProperty(from)) {
|
||||
throw new Error('Failed to alias "' + from + '", it does not exist');
|
||||
}
|
||||
require.aliases[to] = from;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a require function relative to the `parent` path.
|
||||
*
|
||||
* @param {String} parent
|
||||
* @return {Function}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
require.relative = function(parent) {
|
||||
var p = require.normalize(parent, '..');
|
||||
|
||||
/**
|
||||
* lastIndexOf helper.
|
||||
*/
|
||||
|
||||
function lastIndexOf(arr, obj) {
|
||||
var i = arr.length;
|
||||
while (i--) {
|
||||
if (arr[i] === obj) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* The relative require() itself.
|
||||
*/
|
||||
|
||||
function localRequire(path) {
|
||||
var resolved = localRequire.resolve(path);
|
||||
return require(resolved, parent, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve relative to the parent.
|
||||
*/
|
||||
|
||||
localRequire.resolve = function(path) {
|
||||
var c = path.charAt(0);
|
||||
if ('/' == c) return path.slice(1);
|
||||
if ('.' == c) return require.normalize(p, path);
|
||||
|
||||
// resolve deps by returning
|
||||
// the dep in the nearest "deps"
|
||||
// directory
|
||||
var segs = parent.split('/');
|
||||
var i = lastIndexOf(segs, 'deps') + 1;
|
||||
if (!i) i = 0;
|
||||
path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
|
||||
return path;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if module is defined at `path`.
|
||||
*/
|
||||
|
||||
localRequire.exists = function(path) {
|
||||
return require.modules.hasOwnProperty(localRequire.resolve(path));
|
||||
};
|
||||
|
||||
return localRequire;
|
||||
};
|
||||
require.register("isarray/index.js", function(exports, require, module){
|
||||
module.exports = Array.isArray || function (arr) {
|
||||
return Object.prototype.toString.call(arr) == '[object Array]';
|
||||
};
|
||||
|
||||
});
|
||||
require.alias("isarray/index.js", "isarray/index.js");
|
||||
|
||||
19
node_modules/isarray/component.json
generated
vendored
Normal file
19
node_modules/isarray/component.json
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name" : "isarray",
|
||||
"description" : "Array#isArray for older browsers",
|
||||
"version" : "0.0.1",
|
||||
"repository" : "juliangruber/isarray",
|
||||
"homepage": "https://github.com/juliangruber/isarray",
|
||||
"main" : "index.js",
|
||||
"scripts" : [
|
||||
"index.js"
|
||||
],
|
||||
"dependencies" : {},
|
||||
"keywords": ["browser","isarray","array"],
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
3
node_modules/isarray/index.js
generated
vendored
Normal file
3
node_modules/isarray/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = Array.isArray || function (arr) {
|
||||
return Object.prototype.toString.call(arr) == '[object Array]';
|
||||
};
|
||||
29
node_modules/isarray/package.json
generated
vendored
Normal file
29
node_modules/isarray/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "isarray",
|
||||
"description": "Array#isArray for older browsers",
|
||||
"version": "0.0.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/isarray.git"
|
||||
},
|
||||
"homepage": "https://github.com/juliangruber/isarray",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"tap": "*"
|
||||
},
|
||||
"keywords": [
|
||||
"browser",
|
||||
"isarray",
|
||||
"array"
|
||||
],
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
398
node_modules/tslint-eslint-rules/CHANGELOG.md
generated
vendored
Normal file
398
node_modules/tslint-eslint-rules/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,398 @@
|
|||
# Change Log
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [v5.4.0] - August 14, 2018
|
||||
*Rules*
|
||||
- `ter-padded-blocks`
|
||||
|
||||
*Updates*
|
||||
- `object-curly-spacing`: supports `arraysInObjects/objectsInObjects` options.
|
||||
- Support for typescript 3.0
|
||||
|
||||
|
||||
## [v5.3.1] - May 15, 2018
|
||||
#### Features
|
||||
- `valid-jsdoc` recognizes `@inheritDoc` tag
|
||||
|
||||
#### Bug fixes
|
||||
- `sort-imports` rule reads imports correctly (Issue #319)
|
||||
- `space-in-parens` bugfix when using default options (Issue #305)
|
||||
- `no-multi-spaces` bugfix in string literals.
|
||||
|
||||
NOTE: The Github tag v5.3.0 was deleted since it the NPM package
|
||||
missed a bugfix due to not syncing the branches locally.
|
||||
|
||||
|
||||
## [v5.2.0] - May 08, 2018
|
||||
### Rules
|
||||
- `ter-no-proto`
|
||||
- `ter-no-script-url`
|
||||
- `ter-no-self-compare`
|
||||
|
||||
### Fixes
|
||||
- `ter-newline-after-var` - issue 302
|
||||
|
||||
|
||||
## [v5.1.0] - Feb 24, 2018
|
||||
### Rules
|
||||
- `ter-padded-blocks`
|
||||
|
||||
### Fixes
|
||||
- `ter-indent`: failed when missing `VariableDeclarator` options ([bfff0e6])
|
||||
- `ter-newline-after-var`: incorrectly fixing code and within try catch block ([d930c6c])
|
||||
|
||||
[bfff0e6]: https://github.com/buzinas/tslint-eslint-rules/commit/bfff0e60263ff4fa38280739566e99c523d9fd4d
|
||||
[d930c6c]: https://github.com/buzinas/tslint-eslint-rules/commit/d930c6c76de65f9f94d95624a65f5cfd537fe571
|
||||
|
||||
## [v5.0.0] - Feb 14, 2018
|
||||
### Upgraded to TSLint 5.9 and Typescript 2.6
|
||||
- NOTE: Another release will come soon that uses 2.7
|
||||
|
||||
#### Rules Added
|
||||
- `ter-no-tabs`
|
||||
|
||||
See the differences in [v5.0.0] for more information on the changes.
|
||||
|
||||
|
||||
## [v4.1.1] - May 26, 2017
|
||||
#### Fixes
|
||||
- valid-jsdoc reported missing return with abstract methods ([3bd2dafb])
|
||||
|
||||
[3bd2dafb]: https://github.com/buzinas/tslint-eslint-rules/commit/3bd2dafb22174d2912f1a9b73ca917abe52107fc
|
||||
|
||||
|
||||
## [v4.1.0] - May 21, 2017
|
||||
#### Fixes
|
||||
- valid-jsdoc reported at wrong location ([82a3ca75])
|
||||
|
||||
#### Rules Added
|
||||
- [ter-func-call-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terFuncCallSpacingRule.md)
|
||||
|
||||
#### Name Change
|
||||
The following rule names have been renamed since they are no longer accessible with TSLint 5.0.
|
||||
|
||||
- `no-irregular-whitespace` changed to `ter-no-irregular-whitespace`
|
||||
- `no-sparse-arrays` changed to `ter-no-sparse-arrays`
|
||||
|
||||
#### Removed
|
||||
- `use-isnan`: This rule is now provided by TSLint.
|
||||
|
||||
[82a3ca75]: https://github.com/buzinas/tslint-eslint-rules/commit/82a3ca75678240976d868498407b3763ff57419c
|
||||
|
||||
|
||||
## [v4.0.0] - April 4, 2017
|
||||
### Upgraded to [TSLint 5.0](https://github.com/palantir/tslint/releases/tag/5.0.0)
|
||||
|
||||
|
||||
## [v3.5.1] - 2017/03/17 23:00 GMT-0600
|
||||
#### Fixes
|
||||
- sort-imports bug in simple type imports ([3d57149])
|
||||
|
||||
[3d57149]: https://github.com/buzinas/tslint-eslint-rules/commit/3d571494aa5642f19f856fc361d5723a1b792e4a
|
||||
|
||||
|
||||
## [v3.5.0] - 2017/03/16 15:20 GMT-0600
|
||||
#### Fixes
|
||||
- valid-jsdoc crashed with missing return type ([de16445])
|
||||
|
||||
#### Features
|
||||
- valid-jsdoc added option to omitt return and parameters type ([b81e671])
|
||||
|
||||
#### Rules Added
|
||||
- [sort-imports](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/sortImportsRule.md)
|
||||
|
||||
#### Fixers Added
|
||||
- ter-indent ([b76ee05])
|
||||
|
||||
#### Other Changes
|
||||
|
||||
`tslint` peer dependency updated to 4.5.0
|
||||
|
||||
[de16445]: https://github.com/buzinas/tslint-eslint-rules/commit/de164458164116b1743d0cdc57fcfbcd6a4109c4
|
||||
[b76ee05]: https://github.com/buzinas/tslint-eslint-rules/commit/b76ee05033a273bdf61b6ee7465290ad8c4a73f1
|
||||
[b81e671]: https://github.com/buzinas/tslint-eslint-rules/commit/b81e67141abf76f976ab399a0f16f50e971891b8
|
||||
|
||||
|
||||
## [v3.4.0] - 2017/02/16 15:40 GMT-0600
|
||||
#### Fixes
|
||||
- array-bracket-spacing handles comments ([9c551d7])
|
||||
|
||||
#### Rules Added
|
||||
- [space-in-parens](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/spaceInParensRule.md)
|
||||
|
||||
#### Fixers Added
|
||||
- object-curly-spacing ([ec81eb4])
|
||||
- array-bracket-spacing ([3c689ff])
|
||||
- space-in-parens ([cd50170])
|
||||
|
||||
#### Other Changes
|
||||
|
||||
`tslint` is no longer a `dependency`. Instead it is a `peerDependency` and `devDependency`.
|
||||
|
||||
[ec81eb4]: https://github.com/buzinas/tslint-eslint-rules/commit/ec81eb457aa1758dbc35fd4ea01519fc934e1259
|
||||
[3c689ff]: https://github.com/buzinas/tslint-eslint-rules/commit/3c689ffa23b36870e9fae8bb04ccdbe51cbf04c7
|
||||
[cd50170]: https://github.com/buzinas/tslint-eslint-rules/commit/cd50170f658c62062dff3fa60d501cebccd98d9e
|
||||
[9c551d7]: https://github.com/buzinas/tslint-eslint-rules/commit/9c551d7eaaa55289cc326e16e804d702c36cc3a1
|
||||
|
||||
|
||||
## [v3.3.0] - 2017/02/04 04:45 GMT-0600
|
||||
#### Changes
|
||||
- Build errors fixed ([d163eb5])
|
||||
- TSLint extends support ([18902f1])
|
||||
|
||||
[d163eb5]: https://github.com/buzinas/tslint-eslint-rules/commit/d163eb5aa438cce25da2624cf43c478544e7889b
|
||||
[18902f1]: https://github.com/buzinas/tslint-eslint-rules/commit/18902f10939aeb4dedbcb7334be42d462846457c
|
||||
|
||||
|
||||
## [v3.2.3] - 2016/12/24 22:52 GMT-0600
|
||||
#### Fixes
|
||||
- handle-callback-err ([0a9a882])
|
||||
|
||||
[0a9a882]: https://github.com/buzinas/tslint-eslint-rules/commit/0a9a88284f199ec292bcea0534b4323f10a5bc50
|
||||
|
||||
|
||||
## [v3.2.2] - 2016/12/24 12:10 GMT-0600
|
||||
#### Fixes
|
||||
- ter-indent
|
||||
- JSDocs no longer break variable declarations [cb01358]
|
||||
- Interfaces are also checked for indentation [5be6774]
|
||||
- handle-callback-err: [Issue 153](https://github.com/buzinas/tslint-eslint-rules/issues/153)
|
||||
- Added `allowProperties` option to make the rule more strict.
|
||||
|
||||
Note that the npm release `v3.2.1` only contains this hotfix [cb01358].
|
||||
|
||||
[5be6774]: https://github.com/buzinas/tslint-eslint-rules/commit/5be67747d4a74e216be14fc332e3871546609cdd
|
||||
[cb01358]: https://github.com/buzinas/tslint-eslint-rules/commit/cb013580a74a2eb6781a6a0701a7bfafc0818c75
|
||||
|
||||
|
||||
## [v3.2.0] - 2016/12/14 00:50 GMT-0600
|
||||
#### Rules Added
|
||||
- [ter-arrow-body-style](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terArrowBodyStyleRule.md)
|
||||
- [ter-arrow-parens](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terArrowParensRule.md)
|
||||
- [ter-arrow-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terArrowSpacingRule.md)
|
||||
|
||||
#### Fixes
|
||||
- handle-callback-err: [Issue 146](https://github.com/buzinas/tslint-eslint-rules/issues/146)
|
||||
|
||||
#### Changes
|
||||
- Added contributing file detailing how to use the current gulp tasks
|
||||
- Added links to the rule and test source in each of the rule documentation
|
||||
|
||||
## [v3.1.0] - 2016/11/29 23:20 GTM-0600
|
||||
#### Rules Added
|
||||
- ter-prefer-arrow-callback
|
||||
|
||||
#### Fixes
|
||||
- ter-indent:
|
||||
- issues with try/catch statements
|
||||
- issues with return statements
|
||||
- issues with method declarations
|
||||
- A `CallExpression` option has been added.
|
||||
|
||||
|
||||
## [v3.0.0] - 2016/11/21 12:36 GTM-0600
|
||||
### Upgraded to [TSLint 4.0](https://palantir.github.io/tslint/2016/11/17/new-for-4.0.html)
|
||||
- Several rules are no longer applicable
|
||||
- no-duplicate-key
|
||||
- no-unreachable
|
||||
- no-unused-variable
|
||||
- use-strict
|
||||
|
||||
#### Developer Tools
|
||||
- Added RuleTester to help writing tests, see [max-len-rule](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/test/rules/terMaxLenRuleTests.ts) and [no-multi-spaces](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/test/rules/noMultiSpacesRuleTests.ts) for usage examples.
|
||||
|
||||
|
||||
## [v2.2.1] - 2016/11/17 21:50 GMT-0600
|
||||
#### Fixes
|
||||
- ter-max-len ([539b3c2](https://github.com/buzinas/tslint-eslint-rules/commit/539b3c210d1fd157d27a9fb61e123c28249e7690))
|
||||
|
||||
|
||||
## [v2.2.0] - 2016/11/17 02:30 GMT-0600
|
||||
#### Rules Added
|
||||
- ter-indent ([b0334d4](https://github.com/buzinas/tslint-eslint-rules/commit/b0334d4fbf7286e07521cbffc5fa90f96e536224))
|
||||
- ter-max-len ([5938feb](https://github.com/buzinas/tslint-eslint-rules/commit/5938feb4c290de54e80ddd4bfdd3259441124279))
|
||||
|
||||
#### Fixes
|
||||
- no-constant-condition ([b0456a4](https://github.com/buzinas/tslint-eslint-rules/commit/b0456a45b25dd7df488880a61027cf485329fe91))
|
||||
|
||||
#### Changes
|
||||
- Rule documentation can be generated from its metadata ([d6ea71e](https://github.com/buzinas/tslint-eslint-rules/commit/d6ea71ee398c26e55d9bc86f01bbe2beca08b350))
|
||||
|
||||
|
||||
## [v2.1.0] - 2016/10/03 19:29 +00:00
|
||||
#### Fixes
|
||||
- handle-callback-err ([caf6ec6](https://github.com/buzinas/tslint-eslint-rules/commit/caf6ec62be772297c18a9dd56d280d9b2dac076a))
|
||||
|
||||
#### Changes
|
||||
- Added support for node 4 ([4785e36](https://github.com/buzinas/tslint-eslint-rules/commit/4785e3637166072d10fec61c9bf8a3350aa05733))
|
||||
- Added support for node 0.10 ([adc290c](https://github.com/buzinas/tslint-eslint-rules/commit/adc290c02f1299251637ce5d448a3c152b58dc56))
|
||||
- Using `es5` as the TypeScript target ([83ad6e3](https://github.com/buzinas/tslint-eslint-rules/commit/83ad6e3c89eb88a55707502c1251255771805e4a))
|
||||
|
||||
|
||||
## [v2.0.0] - 2016/10/01 06:12 +00:00
|
||||
### Upgraded to [TypeScript 2.0](https://www.typescriptlang.org/docs/release-notes/typescript-2.0.html)
|
||||
- Using `es6` as the TypeScript target.
|
||||
- Dropped support for node 4
|
||||
|
||||
|
||||
## [v1.6.1] - 2016/10/01 05:41 +00:00
|
||||
#### Fixes
|
||||
- no-ex-assign ([31afa69](https://github.com/buzinas/tslint-eslint-rules/commit/31afa69d1718bda1b6d7b9f16c77ef1eb157bb37))
|
||||
|
||||
|
||||
## [v1.6.0] - 2016/09/27 05:56 +00:00
|
||||
#### Rules Added
|
||||
- no-multi-spaces ([7972712](https://github.com/buzinas/tslint-eslint-rules/commit/79727121b64c383bc3c66f8bf2d5feaab3f2ad02))
|
||||
|
||||
#### Fixes
|
||||
- no-constant-condition ([3f8dcc5](https://github.com/buzinas/tslint-eslint-rules/commit/3f8dcc5a2f5804243c86a47ba6dbfb4a2241d771))
|
||||
- no-ex-assign ([93de74b](https://github.com/buzinas/tslint-eslint-rules/commit/93de74b4d33bb4d6c32c047ac995dd57eb92648d))
|
||||
- no-extra-boolean-cast ([8a98530](https://github.com/buzinas/tslint-eslint-rules/commit/8a985309a3c2c645fdd143ae893b026710fa8c01))
|
||||
|
||||
#### Changes
|
||||
- README rules documentation replaced for a table ([1c86880](https://github.com/buzinas/tslint-eslint-rules/commit/1c868803f270ec664a1199dc6df2844bae097ea8))
|
||||
- Added markdown files for each of the existing rules ([9617910](https://github.com/buzinas/tslint-eslint-rules/commit/961791020bb7947c1c4e942b5f7875165a693b2a))
|
||||
|
||||
## [v1.5.0] - 2016/09/05 15:10 +00:00
|
||||
#### Rules Added
|
||||
- object-curly-spacing ([28c5727](https://github.com/buzinas/tslint-eslint-rules/commit/28c57275aeb62d83e5df7d6f75dfd9c52b05d2bc))
|
||||
|
||||
#### Changes
|
||||
- Updated Contribution section in README to mention new gulp options
|
||||
|
||||
|
||||
## [v1.4.0] - 2016/09/05 13:47 +00:00
|
||||
#### Fixes
|
||||
- block-spacing ([3ad19dd](https://github.com/buzinas/tslint-eslint-rules/commit/3ad19dd4f6aab0cf744880998db3066f2ad99a11))
|
||||
- brace-style ([874440f](https://github.com/buzinas/tslint-eslint-rules/commit/874440f99f2a37a3acf42939bdcd0212ec0dd148))
|
||||
- handle-callback-err ([c6b2b40](https://github.com/buzinas/tslint-eslint-rules/commit/c6b2b4088023381895f94abf53037c89c75bdace))
|
||||
- no-inner-declarations ([debb0f7](https://github.com/buzinas/tslint-eslint-rules/commit/debb0f7d3fb4939242f5f0207d9ab31a30c6087a))
|
||||
- valid-js-doc ([951a64c](https://github.com/buzinas/tslint-eslint-rules/commit/951a64cbb0c11070ab0fa26c2672cc0bed08e0e3))
|
||||
|
||||
|
||||
## [v1.3.0] - 2016/04/28 22:05 +00:00
|
||||
#### Rules Added
|
||||
- handle-callback-err ([8f6f4c3](https://github.com/buzinas/tslint-eslint-rules/commit/8f6f4c3bf147647ed66de5bf5baf37e96e7886f7))
|
||||
- brace-style ([34b97dc](https://github.com/buzinas/tslint-eslint-rules/commit/34b97dc92f6fa9ff0d5115b8493322e0c90811ab))
|
||||
- block-spacing ([d0de347](https://github.com/buzinas/tslint-eslint-rules/commit/d0de34796ac0953113f52eee32c74101efb2fb12))
|
||||
|
||||
#### Fixes
|
||||
- no-inner-declarations ([49f410c](https://github.com/buzinas/tslint-eslint-rules/commit/49f410caefe92a34c81aba425712758a4ac723af))
|
||||
|
||||
|
||||
## [v1.2.0] - 2016/04/04 17:28 +00:00
|
||||
#### Rules Added
|
||||
- array-bracket-spacing ([2ed91e2](https://github.com/buzinas/tslint-eslint-rules/commit/2ed91e2d6c3691ada63ae855bdfb73d4315174de))
|
||||
|
||||
#### Changes
|
||||
- Updated README to fit current ESLint rules ([aa5c342](https://github.com/buzinas/tslint-eslint-rules/commit/aa5c342))
|
||||
|
||||
#### Fixes
|
||||
- no-unexpected-multiline issue ([bdca78a](https://github.com/buzinas/tslint-eslint-rules/commit/bdca78ae91cca963e9b93c3bdcb18e661378f55a))
|
||||
- no-constant-condition issue ([4904bec](https://github.com/buzinas/tslint-eslint-rules/commit/4904bec6846d96275901d2570a314f4441f937fe))
|
||||
|
||||
|
||||
## [v1.1.1] - 2016/03/21 18:29 +00:00
|
||||
#### Added
|
||||
- index.js ([cd376d0](https://github.com/buzinas/tslint-eslint-rules/commit/cd376d0877aaec62acc7a4dd4d17e66d0807c3a4))
|
||||
|
||||
|
||||
## [v1.1.0] - 2016/03/18 17:05 +00:00
|
||||
#### Changes
|
||||
- Updated npm dependencies
|
||||
|
||||
#### Fixes
|
||||
- no-ex-assign: updated failure string and added test for false positive ([9da7ba8](https://github.com/buzinas/tslint-eslint-rules/commit/9da7ba8a45d172c5f5c04733da210a2b0a59d272))
|
||||
|
||||
|
||||
## [v1.0.0] - 2015/12/14 17:14 +00:00
|
||||
### First stable version
|
||||
- Improved documentation
|
||||
- Updated dependencies
|
||||
|
||||
## [v0.3.0] - 2015/11/19 14:47 +00:00
|
||||
#### Rules Added
|
||||
- valid-jsdoc ([3deb2a3](https://github.com/buzinas/tslint-eslint-rules/commit/3deb2a35789142ca58741c134b158d7ff66b4a20))
|
||||
|
||||
|
||||
## [v0.2.7] - 2015/11/17 14:00 +00:00
|
||||
#### Rules Added
|
||||
- no-irregular-whitespace ([15056f0](https://github.com/buzinas/tslint-eslint-rules/commit/15056f0722bee86c4fad44156622af4473261c47))
|
||||
|
||||
|
||||
## [v0.2.6] - 2015/11/17 12:07 +00:00
|
||||
#### Rules Added
|
||||
- no-regex-spaces ([c92f89e](https://github.com/buzinas/tslint-eslint-rules/commit/c92f89e31a10eb97660fd2310ec6718fcab3b3b4))
|
||||
- no-empty-character ([1eb3425](https://github.com/buzinas/tslint-eslint-rules/commit/1eb34253bc16ceb05c061fa5de0dd5d2d8f9054b))
|
||||
- no-control-regex ([17c66cf](https://github.com/buzinas/tslint-eslint-rules/commit/17c66cf8bf0590d1a138326ef54c0c10a8cbd71d))
|
||||
|
||||
|
||||
## [v0.2.5] - 2015/11/17 11:11 +00:00
|
||||
#### Rules Added
|
||||
- no-inner-declarations ([97a0e63](https://github.com/buzinas/tslint-eslint-rules/commit/97a0e637e919d741df56f9872057b9d902f4d4f2))
|
||||
|
||||
|
||||
## [v0.2.4] - 2015/11/17 01:01 +00:00
|
||||
#### Rules Added
|
||||
- no-invalid-regexp ([7c2f010](https://github.com/buzinas/tslint-eslint-rules/commit/7c2f0104696f85b03ead14f771406c4845cec819))
|
||||
|
||||
#### Changes
|
||||
- Improved README with commit conventions ([63b0536](https://github.com/buzinas/tslint-eslint-rules/commit/63b053653c2234b531ee233185fdb07d3bd04545))
|
||||
|
||||
|
||||
## [v0.2.3] - 2015/11/14 15:02 +00:00
|
||||
#### Rules Added
|
||||
- no-constant-condition ([d5b7f38](https://github.com/buzinas/tslint-eslint-rules/commit/d5b7f38a82abb86bd7503b20dc47b06b07c59211))
|
||||
- no-duplicate-case ([ac1bb70](https://github.com/buzinas/tslint-eslint-rules/commit/ac1bb700f4f04639cdef40996b2c0c6d42231a23))
|
||||
- no-sparse-arrays ([55f8481](https://github.com/buzinas/tslint-eslint-rules/commit/55f84818d7c2d031699fbd1f98ee97e33a755cb7))
|
||||
- no-extra-semi ([4b886d3](https://github.com/buzinas/tslint-eslint-rules/commit/4b886d340890f5aaf035cee18b8993de67a234ee))
|
||||
- no-extra-boolean-cast ([a5882da](https://github.com/buzinas/tslint-eslint-rules/commit/a5882daf7221aa7c0b6032ed67830f2762704c86))
|
||||
- no-ex-assign ([9292423](https://github.com/buzinas/tslint-eslint-rules/commit/9292423a033abb75ddcd5ade48f5026861273e05))
|
||||
- no-unexpected-multiline ([2ad0d8b](https://github.com/buzinas/tslint-eslint-rules/commit/2ad0d8b0c464d23ed4d2a0735368341df0def496))
|
||||
- valid-typeof ([c2f242e](https://github.com/buzinas/tslint-eslint-rules/commit/c2f242ead01b7467a239398964d7f7543f395200))
|
||||
- use-isnan ([b07e3d7](https://github.com/buzinas/tslint-eslint-rules/commit/b07e3d757b6c15058e5110a39229fd617440064d))
|
||||
|
||||
#### Enhancements
|
||||
- Added tslint as a dependency ([0fb030a](https://github.com/buzinas/tslint-eslint-rules/commit/0fb030a98fc47af7cb51843336c5c27e9c661ec5))
|
||||
- Added Travis CI integration ([2a4f9a2](https://github.com/buzinas/tslint-eslint-rules/commit/2a4f9a2c8c1cc024be51775d9be20444f947edb5))
|
||||
- Added and made lots of improvements in README.md
|
||||
|
||||
|
||||
[Unreleased]: https://github.com/buzinas/tslint-eslint-rules/compare/v5.4.0...HEAD
|
||||
[v5.4.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v5.3.1...v5.4.0
|
||||
[v5.3.1]: https://github.com/buzinas/tslint-eslint-rules/compare/v5.2.0...v5.3.1
|
||||
[v5.2.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v5.1.0...v5.2.0
|
||||
[v5.1.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v5.0.0...v5.1.0
|
||||
[v5.0.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v4.1.1...v5.0.0
|
||||
[v4.1.1]: https://github.com/buzinas/tslint-eslint-rules/compare/v4.1.0...v4.1.1
|
||||
[v4.1.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v4.0.0...v4.1.0
|
||||
[v4.0.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.5.1...v4.0.0
|
||||
[v3.5.1]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.5.0...v3.5.1
|
||||
[v3.5.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.4.0...v3.5.0
|
||||
[v3.4.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.3.0...v3.4.0
|
||||
[v3.3.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.2.3...v3.3.0
|
||||
[v3.2.3]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.2.2...v3.2.3
|
||||
[v3.2.2]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.2.0...v3.2.2
|
||||
[v3.2.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.1.0...v3.2.0
|
||||
[v3.1.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.0.0...v3.1.0
|
||||
[v3.0.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v2.2.1...v3.0.0
|
||||
[v2.2.1]: https://github.com/buzinas/tslint-eslint-rules/compare/v2.2.0...v2.2.1
|
||||
[v2.2.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v2.1.0...v2.2.0
|
||||
[v2.1.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v2.0.0...v2.1.0
|
||||
[v2.0.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.6.1...v2.0.0
|
||||
[v1.6.1]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.6.0...v1.6.1
|
||||
[v1.6.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.5.0...v1.6.0
|
||||
[v1.5.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.4.0...v1.5.0
|
||||
[v1.4.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.3.0...v1.4.0
|
||||
[v1.3.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.2.0...v1.3.0
|
||||
[v1.2.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.1.1...v1.2.0
|
||||
[v1.1.1]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.1.0...v1.1.1
|
||||
[v1.1.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.0.0...v1.1.0
|
||||
[v1.0.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v0.3.0...v1.0.0
|
||||
[v0.3.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v0.2.7...v0.3.0
|
||||
[v0.2.7]: https://github.com/buzinas/tslint-eslint-rules/compare/v0.2.6...v0.2.7
|
||||
[v0.2.6]: https://github.com/buzinas/tslint-eslint-rules/compare/v0.2.5...v0.2.6
|
||||
[v0.2.5]: https://github.com/buzinas/tslint-eslint-rules/compare/v0.2.4...v0.2.5
|
||||
[v0.2.4]: https://github.com/buzinas/tslint-eslint-rules/compare/v0.2.3...v0.2.4
|
||||
[v0.2.3]: https://github.com/buzinas/tslint-eslint-rules/compare/2601ba448c8e8d639539dc461d8b2dc43bb908fa...v0.2.3
|
||||
22
node_modules/tslint-eslint-rules/LICENSE
generated
vendored
Normal file
22
node_modules/tslint-eslint-rules/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2015 Vitor Buzinaro, Victor Schiavi
|
||||
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
345
node_modules/tslint-eslint-rules/README.md
generated
vendored
Normal file
345
node_modules/tslint-eslint-rules/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,345 @@
|
|||
[](https://travis-ci.org/buzinas/tslint-eslint-rules)
|
||||
[](https://www.npmjs.com/package/tslint-eslint-rules)
|
||||
[](https://www.npmjs.com/package/tslint-eslint-rules)
|
||||
[](https://zenhub.io/)
|
||||
[](https://shields.io/)
|
||||
[](LICENSE)
|
||||
|
||||
|
||||
# ESLint rules for TSLint
|
||||
|
||||
## Improve your TSLint with the missing ESLint Rules
|
||||
|
||||
You want to code in TypeScript but miss all the rules available in ESLint?
|
||||
|
||||
Now you can combine both worlds by using this TSLint plugin!
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Install from NPM to your Dev Dependencies
|
||||
|
||||
```console
|
||||
npm install --save-dev tslint-eslint-rules
|
||||
```
|
||||
|
||||
### Or install from Yarn to your Dev Dependencies
|
||||
|
||||
```console
|
||||
yarn add tslint-eslint-rules --dev
|
||||
```
|
||||
|
||||
### Configure TSLint to use `tslint-eslint-rules`:
|
||||
|
||||
In your `tslint.json` file, extend this package, e.g:
|
||||
|
||||
```json
|
||||
{
|
||||
"extends": [
|
||||
"tslint-eslint-rules"
|
||||
],
|
||||
"rules": {
|
||||
"no-constant-condition": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can also extend other tslint config packages to combine this plugin with other community custom rules.
|
||||
|
||||
|
||||
### Configure your rules
|
||||
|
||||
In your `tslint.json` file, insert the rules as described below.
|
||||
|
||||
|
||||
## Rules (copied from the [ESLint website](http://eslint.org/docs/rules/))
|
||||
|
||||
The following tables shows all the existing ESLint rules and the similar rules available in TSLint.
|
||||
Please refer to the following icons as they provide the status of the rule.
|
||||
|
||||
| Icon | Description |
|
||||
| :--- | :-- |
|
||||
| :no_entry_sign: | The rule is not applicable to Typescript. |
|
||||
| :ballot_box_with_check: | The rule is provided natively by [TSLint](http://palantir.github.io/tslint/rules/). |
|
||||
| :white_check_mark: | The rule is available via tslint-eslint-rules. |
|
||||
| :x: | The rule is currently unavailable. |
|
||||
|
||||
<!-- WARNING!
|
||||
Do **not** edit this table directly. It is automatically generated.
|
||||
-->
|
||||
<!-- Start:AutoTable:: Modify `src/readme/rules.ts` and run `gulp readme` to update block -->
|
||||
|
||||
### Possible Errors
|
||||
|
||||
The following rules point out areas where you might have made mistakes.
|
||||
|
||||
| :grey_question: | ESLint | TSLint | Description |
|
||||
| :--- | :---: | :---: | :--- |
|
||||
|:ballot_box_with_check:|[comma-dangle](http://eslint.org/docs/rules/comma-dangle)|[trailing-comma](http://palantir.github.io/tslint/rules/trailing-comma)|disallow or enforce trailing commas (recommended)|
|
||||
|:ballot_box_with_check:|[no-cond-assign](http://eslint.org/docs/rules/no-cond-assign)|[no-conditional-assignment](http://palantir.github.io/tslint/rules/no-conditional-assignment)|disallow assignment in conditional expressions (recommended)|
|
||||
|:ballot_box_with_check:|[no-console](http:/eslint.org/docs/rules/no-console)|[no-console](http://palantir.github.io/tslint/rules/no-console)|disallow use of `console` in the node environment (recommended)|
|
||||
|:white_check_mark:|[no-constant-condition](http://eslint.org/docs/rules/no-constant-condition)|[no-constant-condition](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noConstantConditionRule.md)|disallow use of constant expressions in conditions (recommended)|
|
||||
|:white_check_mark:|[no-control-regex](http://eslint.org/docs/rules/no-control-regex)|[no-control-regex](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noControlRegexRule.md)|disallow control characters in regular expressions (recommended)|
|
||||
|:ballot_box_with_check:|[no-debugger](http://eslint.org/docs/rules/no-debugger)|[no-debugger](http://palantir.github.io/tslint/rules/no-debugger)|disallow use of `debugger` (recommended)|
|
||||
|:no_entry_sign:|[no-dupe-args](http://eslint.org/docs/rules/no-dupe-args)|Not applicable|disallow duplicate arguments in functions (recommended)|
|
||||
|:no_entry_sign:|[no-dupe-keys](http://eslint.org/docs/rules/no-dupe-keys)|Not applicable|disallow duplicate keys when creating object literals (recommended)|
|
||||
|:white_check_mark:|[no-duplicate-case](http://eslint.org/docs/rules/no-duplicate-case)|[no-duplicate-case](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noDuplicateCaseRule.md)|disallow a duplicate case label. (recommended)|
|
||||
|:ballot_box_with_check:|[no-empty](http://eslint.org/docs/rules/no-empty)|[no-empty](http://palantir.github.io/tslint/rules/no-empty)|disallow empty statements (recommended)|
|
||||
|:white_check_mark:|[no-empty-character-class](http://eslint.org/docs/rules/no-empty-character-class)|[no-empty-character-class](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noEmptyCharacterClassRule.md)|disallow the use of empty character classes in regular expressions (recommended)|
|
||||
|:white_check_mark:|[no-ex-assign](http://eslint.org/docs/rules/no-ex-assign)|[no-ex-assign](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noExAssignRule.md)|disallow assigning to the exception in a `catch` block (recommended)|
|
||||
|:white_check_mark:|[no-extra-boolean-cast](http://eslint.org/docs/rules/no-extra-boolean-cast)|[no-extra-boolean-cast](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noExtraBooleanCastRule.md)|disallow double-negation boolean casts in a boolean context (recommended)|
|
||||
|:x:|[no-extra-parens](http://eslint.org/docs/rules/no-extra-parens)|no-extra-parens|disallow unnecessary parentheses|
|
||||
|:white_check_mark:|[no-extra-semi](http://eslint.org/docs/rules/no-extra-semi)|[no-extra-semi](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noExtraSemiRule.md)|disallow unnecessary semicolons (recommended)|
|
||||
|:no_entry_sign:|[no-func-assign](http://eslint.org/docs/rules/no-func-assign)|Not applicable|disallow overwriting functions written as function declarations (recommended)|
|
||||
|:white_check_mark:|[no-inner-declarations](http://eslint.org/docs/rules/no-inner-declarations)|[no-inner-declarations](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noInnerDeclarationsRule.md)|disallow function or variable declarations in nested blocks (recommended)|
|
||||
|:white_check_mark:|[no-invalid-regexp](http://eslint.org/docs/rules/no-invalid-regexp)|[no-invalid-regexp](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noInvalidRegexpRule.md)|disallow invalid regular expression strings in the `RegExp` constructor (recommended)|
|
||||
|:white_check_mark:|[no-irregular-whitespace](http://eslint.org/docs/rules/no-irregular-whitespace)|[ter-no-irregular-whitespace](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNoIrregularWhitespaceRule.md)|disallow irregular whitespace (recommended)|
|
||||
|:no_entry_sign:|[no-negated-in-lhs](http://eslint.org/docs/rules/no-negated-in-lhs)|Not applicable|disallow negation of the left operand of an `in` expression (recommended)|
|
||||
|:no_entry_sign:|[no-obj-calls](http://eslint.org/docs/rules/no-obj-calls)|Not applicable|disallow the use of object properties of the global object (`Math` and `JSON`) as functions (recommended)|
|
||||
|:white_check_mark:|[no-regex-spaces](http://eslint.org/docs/rules/no-regex-spaces)|[no-regex-spaces](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noRegexSpacesRule.md)|disallow multiple spaces in a regular expression literal (recommended)|
|
||||
|:white_check_mark:|[no-sparse-arrays](http://eslint.org/docs/rules/no-sparse-arrays)|[ter-no-sparse-arrays](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNoSparseArraysRule.md)|disallow sparse arrays (recommended)|
|
||||
|:white_check_mark:|[no-unexpected-multiline](http://eslint.org/docs/rules/no-unexpected-multiline)|[no-unexpected-multiline](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noUnexpectedMultilineRule.md)|Avoid code that looks like two expressions but is actually one|
|
||||
|:no_entry_sign:|[no-unreachable](http://eslint.org/docs/rules/no-unreachable)|Not applicable|disallow unreachable statements after a return, throw, continue, or break statement (recommended)|
|
||||
|:ballot_box_with_check:|[no-unsafe-finally](http://eslint.org/docs/rules/no-unsafe-finally)|[no-unsafe-finally](https://palantir.github.io/tslint/rules/no-unsafe-finally)|disallow control flow statements in finally blocks (recommended)|
|
||||
|:ballot_box_with_check:|[use-isnan](http://eslint.org/docs/rules/use-isnan)|[use-isnan](https://palantir.github.io/tslint/rules/use-isnan)|disallow comparisons with the value `NaN` (recommended)|
|
||||
|:white_check_mark:|[valid-jsdoc](http://eslint.org/docs/rules/valid-jsdoc)|[valid-jsdoc](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/validJsdocRule.md)|enforce valid JSDoc comments|
|
||||
|:white_check_mark:|[valid-typeof](http://eslint.org/docs/rules/valid-typeof)|[valid-typeof](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/validTypeofRule.md)|Ensure that the results of typeof are compared against a valid string (recommended)|
|
||||
|
||||
### Best Practices
|
||||
|
||||
These are rules designed to prevent you from making mistakes. They either
|
||||
prescribe a better way of doing something or help you avoid footguns.
|
||||
|
||||
| :grey_question: | ESLint | TSLint | Description |
|
||||
| :--- | :---: | :---: | :--- |
|
||||
|:x:|[accessor-pairs](http://eslint.org/docs/rules/accessor-pairs)|accessor-pairs|Enforces getter/setter pairs in objects|
|
||||
|:x:|[array-callback-return](http://eslint.org/docs/rules/array-callback-return)|array-callback-return|Enforce return statements in callbacks of array’s methods|
|
||||
|:x:|[block-scoped-var](http://eslint.org/docs/rules/block-scoped-var)|accessor-pairs|treat `var` statements as if they were block scoped|
|
||||
|:ballot_box_with_check:|[complexity](http://eslint.org/docs/rules/complexity)|[cyclomatic-complexity](https://palantir.github.io/tslint/rules/cyclomatic-complexity)|specify the maximum cyclomatic complexity allowed in a program|
|
||||
|:x:|[consistent-return](http://eslint.org/docs/rules/consistent-return)|consistent-return|require `return` statements to either always or never specify values|
|
||||
|:ballot_box_with_check:|[curly](http://eslint.org/docs/rules/curly)|[curly](http://palantir.github.io/tslint/rules/curly)|specify curly brace conventions for all control statements|
|
||||
|:ballot_box_with_check:|[default-case](http://eslint.org/docs/rules/default-case)|[switch-default](http://palantir.github.io/tslint/rules/switch-default)|require `default` case in `switch` statements|
|
||||
|:x:|[dot-location](http://eslint.org/docs/rules/dot-location)|dot-location|enforces consistent newlines before or after dots|
|
||||
|:x:|[dot-notation](http://eslint.org/docs/rules/dot-notation)|dot-notation|encourages use of dot notation whenever possible|
|
||||
|:ballot_box_with_check:|[eqeqeq](http://eslint.org/docs/rules/eqeqeq)|[triple-equals](http://palantir.github.io/tslint/rules/triple-equals)|require the use of `===` and `!==`|
|
||||
|:ballot_box_with_check:|[guard-for-in](http://eslint.org/docs/rules/guard-for-in)|[forin](http://palantir.github.io/tslint/rules/forin)|make sure `for-in` loops have an `if` statement|
|
||||
|:ballot_box_with_check:|[no-alert](http://eslint.org/docs/rules/no-alert)|[ban](https://palantir.github.io/tslint/rules/ban)|disallow the use of `alert`, `confirm`, and `prompt`<br>can be achieved using the `"ban": [true, ["alert"]]` tslint rule|
|
||||
|:ballot_box_with_check:|[no-caller](http://eslint.org/docs/rules/no-caller)|[no-arg](http://palantir.github.io/tslint/rules/no-arg)|disallow use of `arguments.caller` or `arguments.callee`|
|
||||
|:x:|[no-case-declarations](http://eslint.org/docs/rules/no-case-declarations)|no-case-declarations|disallow lexical declarations in case clauses|
|
||||
|:x:|[no-div-regex](http://eslint.org/docs/rules/no-div-regex)|no-div-regex|disallow division operators explicitly at beginning of regular expression|
|
||||
|:x:|[no-else-return](http://eslint.org/docs/rules/no-else-return)|no-else-return|disallow `else` after a `return` in an `if`|
|
||||
|:ballot_box_with_check:|[no-empty-function](http://eslint.org/docs/rules/no-empty-function)|[no-empty](http://palantir.github.io/tslint/rules/no-empty)|disallow use of empty functions|
|
||||
|:x:|[no-empty-pattern](http://eslint.org/docs/rules/no-empty-pattern)|no-empty-pattern|disallow use of empty destructuring patterns|
|
||||
|:x:|[no-eq-null](http://eslint.org/docs/rules/no-eq-null)|no-eq-null|disallow comparisons to null without a type-checking operator|
|
||||
|:ballot_box_with_check:|[no-eval](http://eslint.org/docs/rules/no-eval)|[no-eval](http://palantir.github.io/tslint/rules/no-eval)|disallow use of `eval()`|
|
||||
|:x:|[no-extend-native](http://eslint.org/docs/rules/no-extend-native)|no-extend-native|disallow adding to native types|
|
||||
|:x:|[no-extra-bind](http://eslint.org/docs/rules/no-extra-bind)|no-extra-bind|disallow unnecessary function binding|
|
||||
|:x:|[no-extra-label](http://eslint.org/docs/rules/no-extra-label)|no-extra-label|disallow unnecessary labels|
|
||||
|:ballot_box_with_check:|[no-fallthrough](http://eslint.org/docs/rules/no-fallthrough)|[no-switch-case-fall-through](http://palantir.github.io/tslint/rules/no-switch-case-fall-through)|disallow fallthrough of `case` statements (recommended)|
|
||||
|:x:|[no-floating-decimal](http://eslint.org/docs/rules/no-floating-decimal)|no-floating-decimal|disallow the use of leading or trailing decimal points in numeric literals|
|
||||
|:x:|[no-implicit-coercion](http://eslint.org/docs/rules/no-implicit-coercion)|no-implicit-coercion|disallow the type conversions with shorter notations|
|
||||
|:x:|[no-implicit-globals](http://eslint.org/docs/rules/no-implicit-globals)|no-implicit-globals|disallow var and named functions in global scope|
|
||||
|:x:|[no-implied-eval](http://eslint.org/docs/rules/no-implied-eval)|no-implied-eval|disallow use of `eval()`-like methods|
|
||||
|:ballot_box_with_check:|[no-invalid-this](http://eslint.org/docs/rules/no-invalid-this)|[no-invalid-this](https://palantir.github.io/tslint/rules/no-invalid-this)|disallow `this` keywords outside of classes or class-like objects|
|
||||
|:x:|[no-iterator](http://eslint.org/docs/rules/no-iterator)|no-iterator|disallow Usage of `__iterator__` property|
|
||||
|:ballot_box_with_check:|[no-labels](http://eslint.org/docs/rules/no-labels)|[label-position](https://palantir.github.io/tslint/rules/label-position)|disallow use of labeled statements|
|
||||
|:x:|[no-lone-blocks](http://eslint.org/docs/rules/no-lone-blocks)|no-lone-blocks|disallow unnecessary nested blocks|
|
||||
|:x:|[no-loop-func](http://eslint.org/docs/rules/no-loop-func)|no-loop-func|disallow creation of functions within loops|
|
||||
|:ballot_box_with_check:|[no-magic-numbers](http://eslint.org/docs/rules/no-magic-numbers)|[no-magic-numbers](https://palantir.github.io/tslint/rules/no-magic-numbers)|disallow the use of magic numbers|
|
||||
|:white_check_mark:|[no-multi-spaces](http://eslint.org/docs/rules/no-multi-spaces)|[no-multi-spaces](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noMultiSpacesRule.md)|disallow use of multiple spaces|
|
||||
|:x:|[no-multi-str](http://eslint.org/docs/rules/no-multi-str)|no-multi-str|disallow use of multiline strings|
|
||||
|:no_entry_sign:|[no-native-reassign](http://eslint.org/docs/rules/no-native-reassign)|Not applicable|disallow reassignments of native objects|
|
||||
|:ballot_box_with_check:|[no-new](http://eslint.org/docs/rules/no-new)|[no-unused-expression](https://palantir.github.io/tslint/rules/no-unused-expression)|disallow use of the `new` operator when not part of an assignment or comparison|
|
||||
|:x:|[no-new-func](http://eslint.org/docs/rules/no-new-func)|no-new-func|disallow use of new operator for `Function` object|
|
||||
|:ballot_box_with_check:|[no-new-wrappers](http://eslint.org/docs/rules/no-new-wrappers)|[no-construct](https://palantir.github.io/tslint/rules/no-construct)|disallows creating new instances of `String`,`Number`, and `Boolean`|
|
||||
|:no_entry_sign:|[no-octal](http://eslint.org/docs/rules/no-octal)|Not applicable|disallow use of octal literals (recommended)|
|
||||
|:x:|[no-octal-escape](http://eslint.org/docs/rules/no-octal-escape)|no-octal-escape|disallow use of octal escape sequences in string literals, such as `var foo = "Copyright \251";`|
|
||||
|:x:|[no-param-reassign](http://eslint.org/docs/rules/no-param-reassign)|no-param-reassign|disallow reassignment of function parameters|
|
||||
|:white_check_mark:|[no-proto](http://eslint.org/docs/rules/no-proto)|[ter-no-proto](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNoProtoRule.md)|disallow the use of `__proto__` property|
|
||||
|:ballot_box_with_check:|[no-redeclare](http://eslint.org/docs/rules/no-redeclare)|[no-duplicate-variable](http://palantir.github.io/tslint/rules/no-duplicate-variable)|disallow declaring the same variable more than once (http://eslint.org/docs/rules/recommended)|
|
||||
|:x:|[no-return-assign](http://eslint.org/docs/rules/no-return-assign)|no-return-assign|disallow use of assignment in `return` statement|
|
||||
|:white_check_mark:|[no-script-url](http://eslint.org/docs/rules/no-script-url)|[ter-no-script-url](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNoScriptUrlRule.md)|disallow use of `javascript:` urls.|
|
||||
|:x:|[no-self-assign](http://eslint.org/docs/rules/no-self-assign)|no-self-assign|disallow assignments where both sides are exactly the same|
|
||||
|:white_check_mark:|[no-self-compare](http://eslint.org/docs/rules/no-self-compare)|[ter-no-self-compare](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNoSelfCompareRule.md)|disallow comparisons where both sides are exactly the same|
|
||||
|:x:|[no-sequences](http://eslint.org/docs/rules/no-sequences)|no-sequences|disallow use of the comma operator|
|
||||
|:ballot_box_with_check:|[no-throw-literal](http://eslint.org/docs/rules/no-throw-literal)|[no-string-throw](https://palantir.github.io/tslint/rules/no-string-throw)|restrict what can be thrown as an exception|
|
||||
|:x:|[no-unmodified-loop-condition](http://eslint.org/docs/rules/no-unmodified-loop-condition)|no-unmodified-loop-condition|disallow unmodified conditions of loops|
|
||||
|:ballot_box_with_check:|[no-unused-expressions](http://eslint.org/docs/rules/no-unused-expressions)|[no-unused-expression](http://palantir.github.io/tslint/rules/no-unused-expression)|disallow Usage of expressions in statement position|
|
||||
|:x:|[no-unused-labels](http://eslint.org/docs/rules/no-unused-labels)|no-unused-labels|disallow unused labels|
|
||||
|:x:|[no-useless-call](http://eslint.org/docs/rules/no-useless-call)|no-useless-call|disallow unnecessary `.call()` and `.apply()`|
|
||||
|:x:|[no-useless-concat](http://eslint.org/docs/rules/no-useless-concat)|no-useless-concat|disallow unnecessary concatenation of literals or template literals|
|
||||
|:x:|[no-useless-escape](http://eslint.org/docs/rules/no-useless-escape)|no-useless-escape|disallow unnecessary usage of escape character|
|
||||
|:x:|[no-void](http://eslint.org/docs/rules/no-void)|no-void|disallow use of the `void` operator|
|
||||
|:x:|[no-warning-comments](http://eslint.org/docs/rules/no-warning-comments)|no-warning-comments|disallow Usage of configurable warning terms in comments e.g. `TODO` or `FIXME`|
|
||||
|:x:|[no-with](http://eslint.org/docs/rules/no-with)|no-with|disallow use of the `with` statement|
|
||||
|:ballot_box_with_check:|[radix](http://eslint.org/docs/rules/radix)|[radix](http://palantir.github.io/tslint/rules/radix)|require use of the second argument for `parseInt()`|
|
||||
|:x:|[vars-on-top](http://eslint.org/docs/rules/vars-on-top)|vars-on-top|require declaration of all vars at the top of their containing scope|
|
||||
|:x:|[wrap-iife](http://eslint.org/docs/rules/wrap-iife)|wrap-iife|require immediate function invocation to be wrapped in parentheses|
|
||||
|:x:|[yoda](http://eslint.org/docs/rules/yoda)|yoda|require or disallow Yoda conditions|
|
||||
|
||||
### Strict Mode
|
||||
|
||||
These rules relate to using strict mode.
|
||||
|
||||
| :grey_question: | ESLint | TSLint | Description |
|
||||
| :--- | :---: | :---: | :--- |
|
||||
|:no_entry_sign:|[strict](http://eslint.org/docs/rules/strict)|Not applicable|require effective use of strict mode directives|
|
||||
|
||||
### Variables
|
||||
|
||||
These rules have to do with variable declarations.
|
||||
|
||||
| :grey_question: | ESLint | TSLint | Description |
|
||||
| :--- | :---: | :---: | :--- |
|
||||
|:x:|[init-declarations](http://eslint.org/docs/rules/init-declarations)|init-declarations|enforce or disallow variable initializations at definition|
|
||||
|:x:|[no-catch-shadow](http://eslint.org/docs/rules/no-catch-shadow)|no-catch-shadow|disallow the catch clause parameter name being the same as a variable in the outer scope|
|
||||
|:no_entry_sign:|[no-delete-var](http://eslint.org/docs/rules/no-delete-var)|Not applicable|disallow deletion of variables (recommended)|
|
||||
|:x:|[no-label-var](http://eslint.org/docs/rules/no-label-var)|no-label-var|disallow labels that share a name with a variable|
|
||||
|:ballot_box_with_check:|[no-shadow](http://eslint.org/docs/rules/no-shadow)|[no-shadowed-variable](http://palantir.github.io/tslint/rules/no-shadowed-variable)|disallow declaration of variables already declared in the outer scope|
|
||||
|:x:|[no-shadow-restricted-names](http://eslint.org/docs/rules/no-shadow-restricted-names)|no-shadow-restricted-names|disallow shadowing of names such as `arguments`|
|
||||
|:no_entry_sign:|[no-undef](http://eslint.org/docs/rules/no-undef)|Not applicable|disallow use of undeclared variables unless mentioned in a `/*global */` block (recommended)|
|
||||
|:x:|[no-undef-init](http://eslint.org/docs/rules/no-undef-init)|no-undef-init|disallow use of undefined when initializing variables|
|
||||
|:x:|[no-undefined](http://eslint.org/docs/rules/no-undefined)|no-undefined|disallow use of `undefined` variable|
|
||||
|:ballot_box_with_check:|[no-unused-vars](http://eslint.org/docs/rules/no-unused-vars)|[no-unused-variable](https://palantir.github.io/tslint/rules/no-unused-variable/)|disallow unused variables (recommended).|
|
||||
|:ballot_box_with_check:|[no-use-before-define](http://eslint.org/docs/rules/no-use-before-define)|[no-use-before-declare](http://palantir.github.io/tslint/rules/no-use-before-declare)|disallow use of variables before they are defined|
|
||||
|
||||
### Node.js and CommonJS
|
||||
|
||||
These rules are specific to JavaScript running on Node.js or using CommonJS in the browser.
|
||||
|
||||
| :grey_question: | ESLint | TSLint | Description |
|
||||
| :--- | :---: | :---: | :--- |
|
||||
|:x:|[callback-return](http://eslint.org/docs/rules/callback-return)|callback-return|enforce `return` after a callback|
|
||||
|:x:|[global-require](http://eslint.org/docs/rules/global-require)|global-require|enforce `require()` on top-level module scope|
|
||||
|:white_check_mark:|[handle-callback-err](http://eslint.org/docs/rules/handle-callback-err)|[handle-callback-err](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/handleCallbackErrRule.md)|enforce error handling in callbacks|
|
||||
|:x:|[no-mixed-requires](http://eslint.org/docs/rules/no-mixed-requires)|no-mixed-requires|disallow mixing regular variable and require declarations|
|
||||
|:x:|[no-new-require](http://eslint.org/docs/rules/no-new-require)|no-new-require|disallow use of `new` operator with the `require` function|
|
||||
|:x:|[no-path-concat](http://eslint.org/docs/rules/no-path-concat)|no-path-concat|disallow string concatenation with `__dirname` and `__filename`|
|
||||
|:x:|[no-process-env](http://eslint.org/docs/rules/no-process-env)|no-process-env|disallow use of `process.env`|
|
||||
|:x:|[no-process-exit](http://eslint.org/docs/rules/no-process-exit)|no-process-exit|disallow `process.exit()`|
|
||||
|:x:|[no-restricted-modules](http://eslint.org/docs/rules/no-restricted-modules)|no-restricted-modules|restrict Usage of specified node modules|
|
||||
|:x:|[no-sync](http://eslint.org/docs/rules/no-sync)|no-sync|disallow use of synchronous methods|
|
||||
|
||||
### Stylistic Issues
|
||||
|
||||
These rules are purely matters of style and are quite subjective.
|
||||
|
||||
| :grey_question: | ESLint | TSLint | Description |
|
||||
| :--- | :---: | :---: | :--- |
|
||||
|:white_check_mark:|[array-bracket-spacing](http://eslint.org/docs/rules/array-bracket-spacing)|[array-bracket-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/arrayBracketSpacingRule.md)|enforce consistent spacing inside array brackets|
|
||||
|:white_check_mark:|[block-spacing](http://eslint.org/docs/rules/block-spacing)|[block-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/blockSpacingRule.md)|disallow or enforce spaces inside of single line blocks|
|
||||
|:white_check_mark:|[brace-style](http://eslint.org/docs/rules/brace-style)|[brace-style](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/braceStyleRule.md)|enforce one true brace style|
|
||||
|:ballot_box_with_check:|[camelcase](http://eslint.org/docs/rules/camelcase)|[variable-name](http://palantir.github.io/tslint/rules/variable-name)|require camel case names|
|
||||
|:x:|[comma-spacing](http://eslint.org/docs/rules/comma-spacing)|comma-spacing|enforce spacing before and after comma|
|
||||
|:x:|[comma-style](http://eslint.org/docs/rules/comma-style)|comma-style|enforce one true comma style|
|
||||
|:white_check_mark:|[computed-property-spacing](http://eslint.org/docs/rules/computed-property-spacing)|[ter-computed-property-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terComputedPropertySpacingRule.md)|require or disallow padding inside computed properties|
|
||||
|:x:|[consistent-this](http://eslint.org/docs/rules/consistent-this)|consistent-this|enforce consistent naming when capturing the current execution context|
|
||||
|:ballot_box_with_check:|[eol-last](http://eslint.org/docs/rules/eol-last)|[eofline](https://palantir.github.io/tslint/rules/eofline)|enforce newline at the end of file, with no multiple empty lines|
|
||||
|:white_check_mark:|[func-call-spacing](http://eslint.org/docs/rules/func-call-spacing)|[ter-func-call-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terFuncCallSpacingRule.md)|require or disallow spacing between function identifiers and their invocations|
|
||||
|:x:|[func-names](http://eslint.org/docs/rules/func-names)|func-names|require function expressions to have a name|
|
||||
|:x:|[func-style](http://eslint.org/docs/rules/func-style)|func-style|enforce use of function declarations or expressions|
|
||||
|:x:|[id-blacklist](http://eslint.org/docs/rules/id-blacklist)|id-blacklist|disallow certain identifiers to prevent them being used|
|
||||
|:x:|[id-length](http://eslint.org/docs/rules/id-length)|id-length|this option enforces minimum and maximum identifier lengths (variable names, property names etc.)|
|
||||
|:x:|[id-match](http://eslint.org/docs/rules/id-match)|id-match|require identifiers to match the provided regular expression|
|
||||
|:white_check_mark:|[indent](http://eslint.org/docs/rules/indent)|[ter-indent](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terIndentRule.md)|enforce consistent indentation|
|
||||
|:x:|[jsx-quotes](http://eslint.org/docs/rules/jsx-quotes)|jsx-quotes|specify whether double or single quotes should be used in JSX attributes|
|
||||
|:x:|[key-spacing](http://eslint.org/docs/rules/key-spacing)|key-spacing|enforce spacing between keys and values in object literal properties<br>Tslint's [whitespace](https://palantir.github.io/tslint/rules/whitespace/) can partially be used|
|
||||
|:x:|[keyword-spacing](http://eslint.org/docs/rules/keyword-spacing)|keyword-spacing|enforce spacing before and after keywords<br>Tslint's [whitespace](https://palantir.github.io/tslint/rules/whitespace/) can partially be used|
|
||||
|:ballot_box_with_check:|[linebreak-style](http://eslint.org/docs/rules/linebreak-style)|[linebreak-style](https://palantir.github.io/tslint/rules/linebreak-style)|disallow mixed 'LF' and 'CRLF' as linebreaks|
|
||||
|:x:|[lines-around-comment](http://eslint.org/docs/rules/lines-around-comment)|lines-around-comment|enforce empty lines around comments|
|
||||
|:x:|[max-depth](http://eslint.org/docs/rules/max-depth)|max-depth|specify the maximum depth that blocks can be nested|
|
||||
|:white_check_mark:|[max-len](http://eslint.org/docs/rules/max-len)|[ter-max-len](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terMaxLenRule.md)|enforce a maximum line length|
|
||||
|:ballot_box_with_check:|[max-lines](http://eslint.org/docs/rules/max-lines)|[max-file-line-count](http://palantir.github.io/tslint/rules/max-file-line-count)|enforce a maximum number of lines per file|
|
||||
|:x:|[max-nested-callbacks](http://eslint.org/docs/rules/max-nested-callbacks)|max-nested-callbacks|specify the maximum depth callbacks can be nested|
|
||||
|:x:|[max-params](http://eslint.org/docs/rules/max-params)|max-params|specify the number of parameters that can be used in the function declaration|
|
||||
|:x:|[max-statements](http://eslint.org/docs/rulesmax-statements)|max-statements|specify the maximum number of statement allowed in a function|
|
||||
|:x:|[max-statements-per-line](http://eslint.org/docs/max-statements-per-line)|max-statements-per-line|specify the maximum number of statements allowed per line|
|
||||
|:no_entry_sign:|[new-cap](http://eslint.org/docs/rules/new-cap)|Not applicable|require a capital letter for constructors|
|
||||
|:ballot_box_with_check:|[new-parens](http://eslint.org/docs/rules/new-parens)|[new-parens](https://palantir.github.io/tslint/rules/new-parens)|disallow the omission of parentheses when invoking a constructor with no arguments|
|
||||
|:white_check_mark:|[newline-after-var](http://eslint.org/docs/rules/newline-after-var)|[ter-newline-after-var](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNewlineAfterVarRule.md)|require or disallow an empty newline after variable declarations|
|
||||
|:x:|[newline-before-return](http://eslint.org/docs/rules/newline-before-return)|newline-before-return|require newline before return statement|
|
||||
|:x:|[newline-per-chained-call](http://eslint.org/docs/rules/newline-per-chained-call)|newline-per-chained-call|enforce newline after each call when chaining the calls|
|
||||
|:x:|[no-array-constructor](http://eslint.org/docs/rules/no-array-constructor)|no-array-constructor|disallow use of the `Array` constructor|
|
||||
|:ballot_box_with_check:|[no-bitwise](http://eslint.org/docs/rules/no-bitwise)|[no-bitwise](https://palantir.github.io/tslint/rules/no-bitwise)|disallows bitwise operators|
|
||||
|:x:|[no-continue](http://eslint.org/docs/rules/no-continue)|no-continue|disallow use of the `continue` statement|
|
||||
|:x:|[no-inline-comments](http://eslint.org/docs/rules/no-inline-comments)|no-inline-comments|disallow comments inline after code|
|
||||
|:x:|[no-lonely-if](http://eslint.org/docs/rules/no-lonely-if)|no-lonely-if|disallow `if` as the only statement in an `else` block|
|
||||
|:white_check_mark:|[no-mixed-spaces-and-tabs](http://eslint.org/docs/rules/no-mixed-spaces-and-tabs)|[ter-no-mixed-spaces-and-tabs](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNoMixedSpacesAndTabsRule.md)|disallow mixed spaces and tabs for indentation (recommended)|
|
||||
|:ballot_box_with_check:|[no-multiple-empty-lines](http://eslint.org/docs/rules/no-multiple-empty-lines)|[no-consecutive-blank-lines](http://palantir.github.io/tslint/rules/no-consecutive-blank-lines)|disallow multiple empty lines|
|
||||
|:x:|[no-negated-condition](http://eslint.org/docs/rules/no-negated-condition)|no-negated-condition|disallow negated conditions|
|
||||
|:x:|[no-nested-ternary](http://eslint.org/docs/rules/no-nested-ternary)|no-nested-ternary|disallow nested ternary expressions|
|
||||
|:x:|[no-new-object](http://eslint.org/docs/rules/no-new-object)|no-new-object|disallow the use of the `Object` constructor|
|
||||
|:x:|[no-restricted-syntax](http://eslint.org/docs/rules/no-restricted-syntax)|no-restricted-syntax|disallow use of certain syntax in code|
|
||||
|:x:|[no-spaced-func](http://eslint.org/docs/rules/no-spaced-func)|no-spaced-func|disallow space between function identifier and application|
|
||||
|:x:|[no-ternary](http://eslint.org/docs/rules/no-ternary)|no-ternary|disallow the use of ternary operators|
|
||||
|:ballot_box_with_check:|[no-trailing-spaces](http://eslint.org/docs/rules/no-trailing-spaces)|[no-trailing-whitespace](http://palantir.github.io/tslint/rules/no-trailing-whitespace)|disallow trailing whitespace at the end of lines|
|
||||
|:x:|[no-underscore-dangle](http://eslint.org/docs/rules/no-underscore-dangle)|no-underscore-dangle|disallow dangling underscores in identifiers|
|
||||
|:x:|[no-unneeded-ternary](http://eslint.org/docs/rules/no-unneeded-ternary)|no-unneeded-ternary|disallow the use of ternary operators when a simpler alternative exists|
|
||||
|:x:|[no-whitespace-before-property](http://eslint.org/docs/rules/no-whitespace-before-property)|no-whitespace-before-property|disallow whitespace before properties|
|
||||
|:white_check_mark:|[object-curly-spacing](http://eslint.org/docs/rules/object-curly-spacing)|[object-curly-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/objectCurlySpacingRule.md)|require or disallow padding inside curly braces|
|
||||
|:ballot_box_with_check:|[one-var](http://eslint.org/docs/rules/one-var)|[one-variable-per-declaration](http://palantir.github.io/tslint/rules/one-variable-per-declaration/)|require or disallow one variable declaration per function|
|
||||
|:x:|[one-var-declaration-per-line](http://eslint.org/docs/rules/one-var-declaration-per-line)|one-var-declaration-per-line|require or disallow a newline around variable declarations|
|
||||
|:x:|[operator-assignment](http://eslint.org/docs/rules/operator-assignment)|operator-assignment|require assignment operator shorthand where possible or prohibit it entirely|
|
||||
|:x:|[operator-linebreak](http://eslint.org/docs/rules/operator-linebreak)|operator-linebreak|enforce operators to be placed before or after line breaks|
|
||||
|:white_check_mark:|[padded-blocks](http://eslint.org/docs/rules/padded-blocks)|ter-padded-blocks|enforce padding within blocks|
|
||||
|:ballot_box_with_check:|[quote-props](http://eslint.org/docs/rules/quote-props)|[object-literal-key-quotes](https://palantir.github.io/tslint/rules/object-literal-key-quotes)|require quotes around object literal property names|
|
||||
|:ballot_box_with_check:|[quotes](http://eslint.org/docs/rules/quotes)|[quotemark](http://palantir.github.io/tslint/rules/quotemark/)|specify whether backticks, double or single quotes should be used|
|
||||
|:x:|[require-jsdoc](http://eslint.org/docs/rules/require-jsdoc)|require-jsdoc|Require JSDoc comment|
|
||||
|:ballot_box_with_check:|[semi](http://eslint.org/docs/rules/semi)|[semicolon](http://palantir.github.io/tslint/rules/semicolon)|require or disallow use of semicolons instead of ASI|
|
||||
|:x:|[semi-spacing](http://eslint.org/docs/rules/semi-spacing)|semi-spacing|enforce spacing before and after semicolons|
|
||||
|:white_check_mark:|[sort-imports](http://eslint.org/docs/rules/sort-imports)|[sort-imports](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/sortImportsRule.md)|enforce sorting import declarations within module|
|
||||
|:x:|[sort-vars](http://eslint.org/docs/rules/sort-vars)|sort-vars|sort variables within the same declaration block|
|
||||
|:x:|[space-before-blocks](http://eslint.org/docs/rules/space-before-blocks)|space-before-blocks|require or disallow a space before blocks|
|
||||
|:x:|[space-before-function-paren](http://eslint.org/docs/rules/space-before-function-paren)|space-before-function-paren|require or disallow a space before function opening parenthesis|
|
||||
|:white_check_mark:|[space-in-parens](http://eslint.org/docs/rules/space-in-parens)|[space-in-parens](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/spaceInParensRule.md)|require or disallow spaces inside parentheses|
|
||||
|:x:|[space-infix-ops](http://eslint.org/docs/rules/space-infix-ops)|space-infix-ops|require spaces around operators<br>Tslint's [whitespace](https://palantir.github.io/tslint/rules/whitespace/) can partially be used|
|
||||
|:x:|[space-unary-ops](http://eslint.org/docs/rules/space-unary-ops)|space-unary-ops|require or disallow spaces before/after unary operators|
|
||||
|:ballot_box_with_check:|[spaced-comment](http://eslint.org/docs/rules/spaced-comment)|[comment-format](https://palantir.github.io/tslint/rules/comment-format)|require or disallow a space immediately following the `//` or `/*` in a comment|
|
||||
|:x:|[wrap-regex](http://eslint.org/docs/rules/wrap-regex)|wrap-regex|require regex literals to be wrapped in parentheses|
|
||||
|:white_check_mark:|[no-tabs](https://eslint.org/docs/rules/no-tabs)|[ter-no-tabs](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNoTabsRule.md)|disallow all tabs|
|
||||
|
||||
### ECMAScript 6
|
||||
|
||||
These rules are only relevant to ES6 environments.
|
||||
|
||||
| :grey_question: | ESLint | TSLint | Description |
|
||||
| :--- | :---: | :---: | :--- |
|
||||
|:white_check_mark:|[arrow-body-style](http://eslint.org/docs/rules/arrow-body-style)|[ter-arrow-body-style](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terArrowBodyStyleRule.md)|require braces in arrow function body|
|
||||
|:white_check_mark:|[arrow-parens](http://eslint.org/docs/rules/arrow-parens)|[ter-arrow-parens](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terArrowParensRule.md)|require parens in arrow function arguments|
|
||||
|:white_check_mark:|[arrow-spacing](http://eslint.org/docs/rules/arrow-spacing)|[ter-arrow-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terArrowSpacingRule.md)|require space before/after arrow function's arrow|
|
||||
|:no_entry_sign:|[constructor-super](http://eslint.org/docs/rules/constructor-super)|Not applicable|verify calls of `super()` in constructors|
|
||||
|:x:|[generator-star-spacing](http://eslint.org/docs/rules/generator-star-spacing)|generator-star-spacing|enforce spacing around the `*` in generator functions|
|
||||
|:x:|[no-class-assign](http://eslint.org/docs/rules/no-class-assign)|no-class-assign|disallow modifying variables of class declarations|
|
||||
|:x:|[no-confusing-arrow](http://eslint.org/docs/rules/no-confusing-arrow)|no-confusing-arrow|disallow arrow functions where they could be confused with comparisons|
|
||||
|:no_entry_sign:|[no-const-assign](http://eslint.org/docs/rules/no-const-assign)|Not applicable|disallow modifying variables that are declared using `const`|
|
||||
|:no_entry_sign:|[no-dupe-class-members](http://eslint.org/docs/rules/no-dupe-class-members)|Not applicable|disallow duplicate name in class members|
|
||||
|:x:|[no-duplicate-imports](http://eslint.org/docs/rules/no-duplicate-imports)|no-duplicate-imports|disallow duplicate module imports|
|
||||
|:x:|[no-new-symbol](http://eslint.org/docs/rules/no-new-symbol)|no-new-symbol|disallow use of the `new` operator with the `Symbol` object|
|
||||
|:x:|[no-restricted-imports](http://eslint.org/docs/rules/no-restricted-imports)|no-restricted-imports|restrict usage of specified modules when loaded by `import` declaration|
|
||||
|:no_entry_sign:|[no-this-before-super](http://eslint.org/docs/rules/no-this-before-super)|Not applicable|disallow use of `this`/`super` before calling `super()` in constructors.|
|
||||
|:x:|[no-useless-constructor](http://eslint.org/docs/rules/no-useless-constructor)|no-useless-constructor|disallow unnecessary constructor|
|
||||
|:ballot_box_with_check:|[no-var](http://eslint.org/docs/rules/no-var)|[no-var-keyword](http://palantir.github.io/tslint/rules/no-var-keyword)|require `let` or `const` instead of `var`|
|
||||
|:ballot_box_with_check:|[object-shorthand](http://eslint.org/docs/rules/object-shorthand)|[object-literal-shorthand](https://palantir.github.io/tslint/rules/object-literal-shorthand)|require method and property shorthand syntax for object literals|
|
||||
|:white_check_mark:|[prefer-arrow-callback](http://eslint.org/docs/rules/prefer-arrow-callback)|[ter-prefer-arrow-callback](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terPreferArrowCallbackRule.md)|require arrow functions as callbacks|
|
||||
|:ballot_box_with_check:|[prefer-const](http://eslint.org/docs/rules/prefer-const)|[prefer-const](https://palantir.github.io/tslint/rules/prefer-const)|suggest using `const` declaration for variables that are never modified after declared|
|
||||
|:x:|[prefer-destructuring](http://eslint.org/docs/rules/prefer-destructuring)|prefer-destructuring|require using destructuring when assigning to variables from arrays and objects|
|
||||
|:x:|[prefer-reflect](http://eslint.org/docs/rules/prefer-reflect)|prefer-reflect|suggest using Reflect methods where applicable|
|
||||
|:x:|[prefer-rest-params](http://eslint.org/docs/rules/prefer-rest-params)|prefer-rest-params|suggest using the rest parameters instead of `arguments`|
|
||||
|:x:|[prefer-spread](http://eslint.org/docs/rules/prefer-spread)|prefer-spread|suggest using the spread operator instead of `.apply()`.|
|
||||
|:x:|[prefer-template](http://eslint.org/docs/rules/prefer-template)|prefer-template|suggest using template literals instead of strings concatenation|
|
||||
|:x:|[require-yield](http://eslint.org/docs/rules/require-yield)|require-yield|disallow generator functions that do not have `yield`|
|
||||
|:x:|[template-curly-spacing](http://eslint.org/docs/rules/template-curly-spacing)|template-curly-spacing|enforce spacing around embedded expressions of template strings|
|
||||
|:x:|[yield-star-spacing](http://eslint.org/docs/rules/yield-star-spacing)|yield-star-spacing|enforce spacing around the `*` in `yield*` expressions|
|
||||
<!-- End:AutoTable -->
|
||||
|
||||
## Contributing
|
||||
|
||||
Bugs, rules requests, doubts etc., open a Github [Issue]. If you want to create one of the missing
|
||||
rules or fix/improve some existing rule please check out the [contribution guide].
|
||||
|
||||
## LICENSE
|
||||
|
||||
MIT
|
||||
|
||||
[Issue]: https://github.com/buzinas/tslint-eslint-rules/issues/new
|
||||
[contribution guide]: https://github.com/buzinas/tslint-eslint-rules/blob/master/CONTRIBUTING.md
|
||||
196
node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js
generated
vendored
Normal file
196
node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
58
node_modules/tslint-eslint-rules/dist/rules/blockSpacingRule.js
generated
vendored
Normal file
58
node_modules/tslint-eslint-rules/dist/rules/blockSpacingRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var OPTION_ALWAYS = 'always';
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new BlockSpacingWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
Rule.FAILURE_STRING = {
|
||||
always: 'Requires a space',
|
||||
never: 'Unexpected space(s)'
|
||||
};
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var BlockSpacingWalker = (function (_super) {
|
||||
tslib_1.__extends(BlockSpacingWalker, _super);
|
||||
function BlockSpacingWalker(sourceFile, options) {
|
||||
var _this = _super.call(this, sourceFile, options) || this;
|
||||
_this.always = _this.hasOption(OPTION_ALWAYS) || (_this.getOptions() && _this.getOptions().length === 0);
|
||||
return _this;
|
||||
}
|
||||
BlockSpacingWalker.prototype.visitNode = function (node) {
|
||||
if (node.kind === ts.SyntaxKind.Block || node.kind === ts.SyntaxKind.CaseBlock) {
|
||||
this.checkSpacingInsideBraces(node);
|
||||
}
|
||||
_super.prototype.visitNode.call(this, node);
|
||||
};
|
||||
BlockSpacingWalker.prototype.checkSpacingInsideBraces = function (node) {
|
||||
var blockChildren = node.getChildren();
|
||||
var syntaxList = blockChildren[1];
|
||||
var openBraceLocation = this.getStartPosition(blockChildren[0]);
|
||||
var closeBraceLocation = this.getStartPosition(blockChildren[blockChildren.length - 1]);
|
||||
if (syntaxList && syntaxList.getChildCount() > 0 && openBraceLocation.line === closeBraceLocation.line) {
|
||||
if (this.isSpaceBetween(blockChildren[0], blockChildren[1]) !== this.always
|
||||
|| this.isSpaceBetween(blockChildren[blockChildren.length - 2], blockChildren[blockChildren.length - 1]) !== this.always) {
|
||||
var failureString = this.always ? Rule.FAILURE_STRING.always : Rule.FAILURE_STRING.never;
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), failureString));
|
||||
}
|
||||
}
|
||||
};
|
||||
BlockSpacingWalker.prototype.isSpaceBetween = function (node, nextNode) {
|
||||
return nextNode.getStart() - node.getEnd() > 0;
|
||||
};
|
||||
BlockSpacingWalker.prototype.getStartPosition = function (node) {
|
||||
return node.getSourceFile().getLineAndCharacterOfPosition(node.getStart());
|
||||
};
|
||||
return BlockSpacingWalker;
|
||||
}(Lint.RuleWalker));
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL2Jsb2NrU3BhY2luZ1J1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQixJQUFNLGFBQWEsR0FBRyxRQUFRLENBQUM7QUFFL0I7SUFBMEIsZ0NBQXVCO0lBQWpEOztJQVVBLENBQUM7SUFKUSxvQkFBSyxHQUFaLFVBQWEsVUFBeUI7UUFDcEMsSUFBTSxNQUFNLEdBQUcsSUFBSSxrQkFBa0IsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFDLENBQU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JQUNILENBQUM7SUFFTywyQ0FBYyxHQUF0QixVQUF1QixJQUFhLEVBQUUsUUFBaUI7UUFDckQsT0FBTyxRQUFRLENBQUMsUUFBUSxFQUFFLEdBQUcsSUFBSSxDQUFDLE1BQU0sRUFBRSxHQUFHLENBQUMsQ0FBQztJQUNqRCxDQUFDO0lBRU8sNkNBQWdCLEdBQXhCLFVBQXlCLElBQWE7UUFDcEMsT0FBTyxJQUFJLENBQUMsYUFBYSxFQUFFLENBQUMsNkJBQTZCLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7SUFDN0UsQ0FBQztJQUNILHlCQUFDO0FBQUQsQ0F2Q0EsQUF1Q0MsQ0F2Q2dDLElBQUksQ0FBQyxVQUFVLEdBdUMvQyIsImZpbGUiOiJydWxlcy9ibG9ja1NwYWNpbmdSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0=
|
||||
149
node_modules/tslint-eslint-rules/dist/rules/braceStyleRule.js
generated
vendored
Normal file
149
node_modules/tslint-eslint-rules/dist/rules/braceStyleRule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
155
node_modules/tslint-eslint-rules/dist/rules/handleCallbackErrRule.js
generated
vendored
Normal file
155
node_modules/tslint-eslint-rules/dist/rules/handleCallbackErrRule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
116
node_modules/tslint-eslint-rules/dist/rules/noConstantConditionRule.js
generated
vendored
Normal file
116
node_modules/tslint-eslint-rules/dist/rules/noConstantConditionRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var token_1 = require("../support/token");
|
||||
var RULE_NAME = 'no-constant-condition';
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new NoConstantConditionWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
Rule.FAILURE_STRING = 'unexpected constant condition';
|
||||
Rule.metadata = {
|
||||
ruleName: RULE_NAME,
|
||||
description: 'disallow use of constant expressions in conditions (recommended)',
|
||||
rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n A constant expression (for example, a literal) as a test condition might be a typo or\n development trigger for a specific behavior. For example, the following code looks as if it is\n not ready for production.\n "], ["\n A constant expression (for example, a literal) as a test condition might be a typo or\n development trigger for a specific behavior. For example, the following code looks as if it is\n not ready for production.\n "]))),
|
||||
optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n - `\"checkLoops\"` Setting this option to `false` allows constant expressions in loops (default: `true`).\n "], ["\n - \\`\"checkLoops\"\\` Setting this option to \\`false\\` allows constant expressions in loops (default: \\`true\\`).\n "]))),
|
||||
options: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
checkLoops: {
|
||||
type: 'boolean'
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
},
|
||||
optionExamples: [
|
||||
Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": true\n "], ["\n \"", "\": true\n "])), RULE_NAME),
|
||||
Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, { \"checkLoops\": false }]\n "], ["\n \"", "\": [true, { \"checkLoops\": false }]\n "])), RULE_NAME)
|
||||
],
|
||||
typescriptOnly: false,
|
||||
type: 'functionality'
|
||||
};
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var NoConstantConditionWalker = (function (_super) {
|
||||
tslib_1.__extends(NoConstantConditionWalker, _super);
|
||||
function NoConstantConditionWalker(sourceFile, options) {
|
||||
var _this = _super.call(this, sourceFile, options) || this;
|
||||
_this.checkLoops = true;
|
||||
var opts = _this.getOptions();
|
||||
if (opts.length && opts[0].checkLoops === false) {
|
||||
_this.checkLoops = false;
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
NoConstantConditionWalker.prototype.visitIfStatement = function (node) {
|
||||
this.validateCondition(node.expression);
|
||||
_super.prototype.visitIfStatement.call(this, node);
|
||||
};
|
||||
NoConstantConditionWalker.prototype.visitWhileStatement = function (node) {
|
||||
if (this.checkLoops) {
|
||||
this.validateCondition(node.expression);
|
||||
}
|
||||
_super.prototype.visitWhileStatement.call(this, node);
|
||||
};
|
||||
NoConstantConditionWalker.prototype.visitDoStatement = function (node) {
|
||||
if (this.checkLoops) {
|
||||
this.validateCondition(node.expression);
|
||||
}
|
||||
_super.prototype.visitDoStatement.call(this, node);
|
||||
};
|
||||
NoConstantConditionWalker.prototype.visitForStatement = function (node) {
|
||||
if (this.checkLoops && node.condition) {
|
||||
this.validateCondition(node.condition);
|
||||
}
|
||||
_super.prototype.visitForStatement.call(this, node);
|
||||
};
|
||||
NoConstantConditionWalker.prototype.visitConditionalExpression = function (node) {
|
||||
this.validateCondition(node.condition);
|
||||
_super.prototype.visitConditionalExpression.call(this, node);
|
||||
};
|
||||
NoConstantConditionWalker.prototype.validateCondition = function (expression) {
|
||||
if (this.isConstant(expression)) {
|
||||
this.addFailure(this.createFailure(expression.getStart(), expression.getWidth(), Rule.FAILURE_STRING));
|
||||
}
|
||||
this.walkChildren(expression);
|
||||
};
|
||||
NoConstantConditionWalker.prototype.isConstant = function (node) {
|
||||
switch (node.kind) {
|
||||
case ts.SyntaxKind.StringLiteral:
|
||||
case ts.SyntaxKind.NumericLiteral:
|
||||
case ts.SyntaxKind.TrueKeyword:
|
||||
case ts.SyntaxKind.FalseKeyword:
|
||||
case ts.SyntaxKind.ArrowFunction:
|
||||
case ts.SyntaxKind.FunctionExpression:
|
||||
case ts.SyntaxKind.ObjectLiteralExpression:
|
||||
case ts.SyntaxKind.ArrayLiteralExpression:
|
||||
return true;
|
||||
case ts.SyntaxKind.PostfixUnaryExpression:
|
||||
return this.isConstant(node.operand);
|
||||
case ts.SyntaxKind.BinaryExpression:
|
||||
if (token_1.isAssignmentToken(node.operatorToken)) {
|
||||
return this.isConstant(node.right);
|
||||
}
|
||||
return this.isConstant(node.left) && this.isConstant(node.right);
|
||||
case ts.SyntaxKind.ConditionalExpression:
|
||||
return this.isConstant(node.condition);
|
||||
case ts.SyntaxKind.PrefixUnaryExpression:
|
||||
return this.isConstant(node.operand);
|
||||
case ts.SyntaxKind.ParenthesizedExpression:
|
||||
return this.isConstant(node.expression);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
return NoConstantConditionWalker;
|
||||
}(Lint.RuleWalker));
|
||||
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vQ29uc3RhbnRDb25kaXRpb25SdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUFpQztBQUNqQyw2QkFBK0I7QUFDL0IsMENBQXFEO0FBRXJELElBQU0sU0FBUyxHQUFHLHVCQUF1QixDQUFDO0FBRTFDO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUF1Q0EsQ0FBQztJQUpRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxJQUFNLE1BQU0sR0FBRyxJQUFJLHlCQUF5QixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQztRQUM1RSxPQUFPLElBQUksQ0FBQyxlQUFlLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdEMsQ0FBQztJQXJDYSxtQkFBYyxHQUFHLCtCQ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aW50LWVzbGludC1ydWxlcy9zcmMifQ==
|
||||
53
node_modules/tslint-eslint-rules/dist/rules/noControlRegexRule.js
generated
vendored
Normal file
53
node_modules/tslint-eslint-rules/dist/rules/noControlRegexRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new NoControlRegexWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
Rule.FAILURE_STRING = 'unexpected control character in regular expression';
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var NoControlRegexWalker = (function (_super) {
|
||||
tslib_1.__extends(NoControlRegexWalker, _super);
|
||||
function NoControlRegexWalker() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
NoControlRegexWalker.prototype.visitRegularExpressionLiteral = function (node) {
|
||||
this.validateControlRegex(node);
|
||||
_super.prototype.visitRegularExpressionLiteral.call(this, node);
|
||||
};
|
||||
NoControlRegexWalker.prototype.visitNewExpression = function (node) {
|
||||
if (node.expression.getText() === 'RegExp') {
|
||||
this.visitRegularExpressionFunction(node);
|
||||
}
|
||||
_super.prototype.visitNewExpression.call(this, node);
|
||||
};
|
||||
NoControlRegexWalker.prototype.visitCallExpression = function (node) {
|
||||
if (node.expression.getText() === 'RegExp') {
|
||||
this.visitRegularExpressionFunction(node);
|
||||
}
|
||||
_super.prototype.visitCallExpression.call(this, node);
|
||||
};
|
||||
NoControlRegexWalker.prototype.visitRegularExpressionFunction = function (node) {
|
||||
if (node.arguments && node.arguments.length > 0 && node.arguments[0].kind === ts.SyntaxKind.StringLiteral) {
|
||||
this.validateControlRegex(node.arguments[0]);
|
||||
}
|
||||
};
|
||||
NoControlRegexWalker.prototype.validateControlRegex = function (node) {
|
||||
if (/[\x00-\x1f]/.test(node.text)) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
|
||||
}
|
||||
};
|
||||
return NoControlRegexWalker;
|
||||
}(Lint.RuleWalker));
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vQ29udHJvbFJlZ2V4UnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBaUM7QUFDakMsNkJBQStCO0FBRS9CO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUFPQSxDQUFDO0lBSlEsb0JBQUssR0FBWixVQUFhLFVBQXlCO1FBQ3BDLElBQU0sTUFBTSxHQUFHLElBQUksb0JBQW9CLENBQUMsVUFBVSxFQUFFLElBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDO1FBQ3ZFLE9BQU8sSUFBSSxDQUFDLGVBQWUsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUN0QyxDQUFDO0lBTGEsbUJBQWMsR0FBRyxvREFBb0QsQ0FBQztJQU10RixXQUFDO0NBUEQsQUFPQyxDQVB5QixJQUFJLENBQUMsS0FBSyxDQUFDLFlBQVksR0FPaEQ7QUFQWSxvQkFBSTtBQVNqQjtJQUFtQyxnREFBZTtJQUFsRDs7SUErQkEsQ0FBQztJQTlCVyw0REFBNkIsR0FBdkMsVUFBd0MsSUFBMEI7UUFDaEUsSUFBSSxDQUFDLG9CQUFvQixDQUFDLElBQUksQ0FBQyxDQUFDO1FBQ2hDLGlCQUFNLDZCQUE2QixZQUFDLElBQUksQ0FBQyxDQUFDO0lBQzVDLENBQUM7SUFFUyxpREFBa0IsR0FBNUIsVUFBNkIs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FQUFFLElBQUksQ0FBQyxjQUFjLENBQUMsQ0FBQyxDQUFDO1NBQzVGO0lBQ0gsQ0FBQztJQUNILDJCQUFDO0FBQUQsQ0EvQkEsQUErQkMsQ0EvQmtDLElBQUksQ0FBQyxVQUFVLEdBK0JqRCIsImZpbGUiOiJydWxlcy9ub0NvbnRyb2xSZWdleFJ1bGUuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2ptbG9wZXovdHNsaW50LWVzbGludC1ydWxlcy9zcmMifQ==
|
||||
46
node_modules/tslint-eslint-rules/dist/rules/noDuplicateCaseRule.js
generated
vendored
Normal file
46
node_modules/tslint-eslint-rules/dist/rules/noDuplicateCaseRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new NoDuplicateCaseWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
Rule.FAILURE_STRING = 'duplicate case label';
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var NoDuplicateCaseWalker = (function (_super) {
|
||||
tslib_1.__extends(NoDuplicateCaseWalker, _super);
|
||||
function NoDuplicateCaseWalker() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
NoDuplicateCaseWalker.prototype.visitSwitchStatement = function (node) {
|
||||
this.validateNoDupeCase(node);
|
||||
_super.prototype.visitSwitchStatement.call(this, node);
|
||||
};
|
||||
NoDuplicateCaseWalker.prototype.validateNoDupeCase = function (node) {
|
||||
var _this = this;
|
||||
var cases = Object.create(null);
|
||||
node.caseBlock.clauses.forEach(function (clause) {
|
||||
if (clause.kind === ts.SyntaxKind.CaseClause) {
|
||||
var key = clause.getText();
|
||||
if (cases[key]) {
|
||||
_this.addFailure(_this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
|
||||
}
|
||||
else {
|
||||
cases[key] = clause;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
return NoDuplicateCaseWalker;
|
||||
}(Lint.RuleWalker));
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vRHVwbGljYXRlQ2FzZVJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQjtJQUEwQixnQ0FBdUI7SUFBakQ7O0lBT0EsQ0FBQztJQUpRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxJQUFNLE1BQU0sR0FBRyxJQUFJLHFCQUFxQixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQztRQUN4RSxPQUFPLElBQUksQ0FBQyxlQUFlLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdEMsQ0FBQztJQUxhLG1CQUFjLEdBQUcsc0JBQXNCLENBQUM7SUFNeEQsV0FBQztDQVBELEFBT0MsQ0FQeUIsSUFBSSxDQUFDLEtBQUssQ0FBQyxZQUFZLEdBT2hEO0FBUFksb0JBQUk7QUFTakI7SUFBb0MsaURBQWU7SUFBbkQ7O0lBcUJBLENBQUM7SUFwQlcsb0RBQW9CLEdBQTlCLFVBQStCLElBQXdCO1FBQ3JELElBQUksQ0FBQyxrQkFBa0IsQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUM5QixpQkFBTSxvQkFBb0IsWUFBQyxJQUFJLENBQUMsQ0FBQztJQUNuQyxDQUFDO0lBRU8sa0RBQWtCLEdBQTFCLFVBQTJCLElBQXdCO1FBQW5ELGlCQWNDO1FBYkMsSUFBTSxLQUFLLEdBQUcsTUFBTSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUVsQyxJQUFJLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsVUFBQyxNQUFNO1lBQ3BDLElBQUksTUFBTSxDQUFDLElBQUksS0FBSyxFQUFFLENBQUMsVUFBVSxDQUFDLFVBQVUsRUFBRTtnQkFDNUMsSUFBTSxHQUFHLEdBQUcsTUFBTSxDQUFDLE9BQU8sRUFBRSxDQUFDO2dCQUM3QixJQUFJLEtBQUssQ0FBQyxHQUFHLENBQUMsRUFBRTtvQkFDZCxLQUFJLENBQUMsVUFBVSxDQUFDLEtBQUksQ0FBQyxhQUFhLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxFQUFFLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsY0FBYyxDQUFDLENBQUMsQ0FBQztpQkFDNUY7cUJBQ0k7b0JBQ0gsS0FBSyxDQUFDLEdBQUcsQ0FBQyxHQUFHLE1BQXVCLENBQUM7aUJBQ3RDO2FBQ0Y7UUFDSCxDQUFDLENBQUMsQ0FBQztJQUNMLENBQUM7SUFDSCw0QkFBQztBQUFELENBckJBLEFBcUJDLENBckJtQyxJQUFJLENBQUMsVUFBVSxHQXFCbEQiLCJmaWxlIjoicnVsZXMvbm9EdXBsaWNhdGVDYXNlUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9
|
||||
35
node_modules/tslint-eslint-rules/dist/rules/noEmptyCharacterClassRule.js
generated
vendored
Normal file
35
node_modules/tslint-eslint-rules/dist/rules/noEmptyCharacterClassRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var Lint = require("tslint");
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new NoEmptyCharacterClassWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
Rule.FAILURE_STRING = "don't use empty classes in regular expressions";
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var NoEmptyCharacterClassWalker = (function (_super) {
|
||||
tslib_1.__extends(NoEmptyCharacterClassWalker, _super);
|
||||
function NoEmptyCharacterClassWalker() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
NoEmptyCharacterClassWalker.prototype.visitRegularExpressionLiteral = function (node) {
|
||||
this.validateEmptyCharacterClass(node);
|
||||
_super.prototype.visitRegularExpressionLiteral.call(this, node);
|
||||
};
|
||||
NoEmptyCharacterClassWalker.prototype.validateEmptyCharacterClass = function (node) {
|
||||
if (!(/^\/([^\\[]|\\.|\[([^\\\]]|\\.)+\])*\/[gim]*$/.test(node.text))) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
|
||||
}
|
||||
};
|
||||
return NoEmptyCharacterClassWalker;
|
||||
}(Lint.RuleWalker));
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vRW1wdHlDaGFyYWN0ZXJDbGFzc1J1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EsNkJBQStCO0FBRS9CO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUFPQSxDQUFDO0lBSlEsb0JBQUssR0FBWixVQUFhLFVBQXlCO1FBQ3BDLElBQU0sTUFBTSxHQUFHLElBQUks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.js
generated
vendored
Normal file
57
node_modules/tslint-eslint-rules/dist/rules/noExAssignRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var token_1 = require("../support/token");
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new NoExAssignWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
Rule.FAILURE_STRING = 'do not assign to the exception parameter';
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var NoExAssignWalker = (function (_super) {
|
||||
tslib_1.__extends(NoExAssignWalker, _super);
|
||||
function NoExAssignWalker() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.isInCatchClause = false;
|
||||
return _this;
|
||||
}
|
||||
NoExAssignWalker.prototype.visitCatchClause = function (node) {
|
||||
this.variableNode = node.variableDeclaration;
|
||||
this.isInCatchClause = true;
|
||||
_super.prototype.visitCatchClause.call(this, node);
|
||||
this.isInCatchClause = false;
|
||||
delete this.variableNode;
|
||||
};
|
||||
NoExAssignWalker.prototype.visitBinaryExpression = function (node) {
|
||||
var _this = this;
|
||||
if (this.isInCatchClause) {
|
||||
if (!token_1.isAssignmentToken(node.operatorToken)) {
|
||||
return;
|
||||
}
|
||||
if (this.variableNode &&
|
||||
this.variableNode.name.getText() === node.left.getText() &&
|
||||
node.left.kind === ts.SyntaxKind.Identifier) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
|
||||
}
|
||||
else if (node.left.kind === ts.SyntaxKind.ArrayLiteralExpression) {
|
||||
var els = node.left.elements;
|
||||
if (els.some(function (el) { return !!_this.variableNode && el.getText() === _this.variableNode.getText(); })) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
|
||||
}
|
||||
}
|
||||
}
|
||||
_super.prototype.visitBinaryExpression.call(this, node);
|
||||
};
|
||||
return NoExAssignWalker;
|
||||
}(Lint.RuleWalker));
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vRXhBc3NpZ25SdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUFpQztBQUNqQyw2QkFBK0I7QUFDL0IsMENBQXFEO0FBRXJEO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUFPQSxDQUFDO0lBSlEsb0JBQUssR0FBWixVQUFhLFVBQXlCO1FBQ3BDLElBQU0sTUFBTSxHQUFHLElBQUksZ0JBQWdCLENBQUMsVUFBVSxFQUFFLElBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDO1FBQ25FLE9BQU8sSUFBSSxDQUFDLGVBQWUsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUN0QyxDQUFDO0lBTGEsbUJBQWMsR0FBRywwQ0FBMEMsQ0FBQztJQU01RSxXQUFDO0NBUEQsQUFPQyxDQVB5QixJQUFJLENBQUMsS0FBSyxDQUFDLFlBQVksR0FPaEQ7QUFQWSxvQkFBSTtBQVNqQjtJQUErQiw0Q0FBZTtJQUE5QztRQUFBLHFFQWlDQztRQWhDUyxxQkFBZSxHQUFHLEtBQUssQ0FBQzs7SUFnQ2xDLENBQUM7SUE3QlcsMkNBQWdCLEdBQTFCLFVBQTJCLElBQW9CO1FBQzdDLElBQUksQ0FBQyxZQUFZLEdBQUcsSUFBSSxDQUFDLG1CQUFtQixDQUFDO1FBQzdDLElBQUksQ0FBQyxlQUFlLEdBQUcsSUFBSSxDQUFDO1FBQzV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RSxLQUFLLEtBQUksQ0FBQyxZQUFZLENBQUMsT0FBTyxFQUFFLEVBQW5FLENBQW1FLENBQUMsRUFBRTtvQkFDdkYsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUM7aUJBQzVGO2FBQ0Y7U0FDRjtRQUNELGlCQUFNLHFCQUFxQixZQUFDLElBQUksQ0FBQyxDQUFDO0lBQ3BDLENBQUM7SUFDSCx1QkFBQztBQUFELENBakNBLEFBaUNDLENBakM4QixJQUFJLENBQUMsVUFBVSxHQWlDN0MiLCJmaWxlIjoicnVsZXMvbm9FeEFzc2lnblJ1bGUuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2ptbG9wZXovdHNsaW50LWVzbGludC1ydWxlcy9zcmMifQ==
|
||||
83
node_modules/tslint-eslint-rules/dist/rules/noExtraBooleanCastRule.js
generated
vendored
Normal file
83
node_modules/tslint-eslint-rules/dist/rules/noExtraBooleanCastRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new NoExtraBooleanCastWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
Rule.FAILURE_STRING = {
|
||||
if: 'redundant double negation in an if statement condition',
|
||||
do: 'redundant double negation in a do while loop condition',
|
||||
while: 'redundant double negation in a while loop condition',
|
||||
ternaryif: 'redundant double negation in a ternary condition',
|
||||
for: 'redundant double negation in a for loop condition',
|
||||
unaryCast: 'redundant multiple negation',
|
||||
objectCast: 'redundant double negation in call to Boolean()',
|
||||
newCast: 'redundant double negation in Boolean constructor call'
|
||||
};
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var NoExtraBooleanCastWalker = (function (_super) {
|
||||
tslib_1.__extends(NoExtraBooleanCastWalker, _super);
|
||||
function NoExtraBooleanCastWalker() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
NoExtraBooleanCastWalker.prototype.visitPrefixUnaryExpression = function (node) {
|
||||
this.validateNoExtraBoolean(node);
|
||||
_super.prototype.visitPrefixUnaryExpression.call(this, node);
|
||||
};
|
||||
NoExtraBooleanCastWalker.prototype.validateNoExtraBoolean = function (node) {
|
||||
if (!node.parent || !node.parent.parent) {
|
||||
return;
|
||||
}
|
||||
var parent = node.parent;
|
||||
var grandparent = parent.parent;
|
||||
if (node.operator !== ts.SyntaxKind.ExclamationToken ||
|
||||
parent.kind !== ts.SyntaxKind.PrefixUnaryExpression ||
|
||||
parent.operator !== ts.SyntaxKind.ExclamationToken ||
|
||||
!grandparent) {
|
||||
return;
|
||||
}
|
||||
if (grandparent.kind === ts.SyntaxKind.BinaryExpression) {
|
||||
grandparent = grandparent.parent;
|
||||
}
|
||||
if (!grandparent) {
|
||||
return;
|
||||
}
|
||||
if (grandparent.kind === ts.SyntaxKind.IfStatement) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.if));
|
||||
}
|
||||
else if (grandparent.kind === ts.SyntaxKind.DoStatement) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.do));
|
||||
}
|
||||
else if (grandparent.kind === ts.SyntaxKind.WhileStatement) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.while));
|
||||
}
|
||||
else if (grandparent.kind === ts.SyntaxKind.ConditionalExpression && parent === grandparent.condition) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.ternaryif));
|
||||
}
|
||||
else if (grandparent.kind === ts.SyntaxKind.ForStatement && parent === grandparent.condition) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.for));
|
||||
}
|
||||
else if (grandparent.kind === ts.SyntaxKind.PrefixUnaryExpression && grandparent.operator === ts.SyntaxKind.ExclamationToken) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.unaryCast));
|
||||
}
|
||||
else if (grandparent.kind === ts.SyntaxKind.CallExpression && /^Boolean/.test(grandparent.getText())) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.objectCast));
|
||||
}
|
||||
else if (grandparent.kind === ts.SyntaxKind.NewExpression && /^new Boolean/.test(grandparent.getText())) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.newCast));
|
||||
}
|
||||
};
|
||||
return NoExtraBooleanCastWalker;
|
||||
}(Lint.RuleWalker));
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vRXh0cmFCb29sZWFuQ2FzdFJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQjtJQUEwQixnQ0FBdUI7SUFBakQ7O0lBZ0JBLENBQUM7SUFKUSxvQkFBSyxHQUFaLFVBQWEsVUFBeUI7UUFDcEMsSUFBTSxNQUFNLEdBQUcsSUFBSSx3QkFBd0IsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFDLENBQUM7UUFDM0UsT0FBTyxJQUFJLENBQUMsZUFBZSxDQUFDLE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SxXQUFXLENBQUMsSUFBSSxLQUFLLEVBQUUsQ0FBQyxVQUFVLENBQUMsY0FBYyxJQUFJLFVBQVUsQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLE9BQU8sRUFBRSxDQUFDLEVBQUU7WUFDdEcsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxDQUFDLGNBQWMsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFDO1NBQ3ZHO2FBQU0sSUFBSSxXQUFXLENBQUMsSUFBSSxLQUFLLEVBQUUsQ0FBQyxVQUFVLENBQUMsYUFBYSxJQUFJLGNBQWMsQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLE9BQU8sRUFBRSxDQUFDLEVBQUU7WUFDekcsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxDQUFDLGNBQWMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDO1NBQ3BHO0lBQ0gsQ0FBQztJQUNILCtCQUFDO0FBQUQsQ0FwREEsQUFvREMsQ0FwRHNDLElBQUksQ0FBQyxVQUFVLEdBb0RyRCIsImZpbGUiOiJydWxlcy9ub0V4dHJhQm9vbGVhbkNhc3RSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0=
|
||||
69
node_modules/tslint-eslint-rules/dist/rules/noExtraSemiRule.js
generated
vendored
Normal file
69
node_modules/tslint-eslint-rules/dist/rules/noExtraSemiRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new NoExtraSemiWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
Rule.FAILURE_STRING = 'unnecessary semicolon';
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var NoExtraSemiWalker = (function (_super) {
|
||||
tslib_1.__extends(NoExtraSemiWalker, _super);
|
||||
function NoExtraSemiWalker() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.ALLOWED_PARENT_TYPES = [
|
||||
ts.SyntaxKind.ForStatement,
|
||||
ts.SyntaxKind.ForInStatement,
|
||||
ts.SyntaxKind.ForOfStatement,
|
||||
ts.SyntaxKind.WhileStatement,
|
||||
ts.SyntaxKind.DoStatement
|
||||
];
|
||||
return _this;
|
||||
}
|
||||
NoExtraSemiWalker.prototype.visitNode = function (node) {
|
||||
if (node.kind === ts.SyntaxKind.EmptyStatement) {
|
||||
this.visitEmptyStatement(node);
|
||||
}
|
||||
_super.prototype.visitNode.call(this, node);
|
||||
};
|
||||
NoExtraSemiWalker.prototype.visitClassDeclaration = function (node) {
|
||||
this.checkClass(node);
|
||||
_super.prototype.visitClassDeclaration.call(this, node);
|
||||
};
|
||||
NoExtraSemiWalker.prototype.visitEmptyStatement = function (node) {
|
||||
if (node.parent && this.ALLOWED_PARENT_TYPES.indexOf(node.parent.kind) === -1) {
|
||||
this.validateNoExtraSemi(node);
|
||||
}
|
||||
};
|
||||
NoExtraSemiWalker.prototype.checkClass = function (node) {
|
||||
var indexOf = node.getChildren().map(function (child) { return child.kind; }).indexOf(ts.SyntaxKind.FirstPunctuation);
|
||||
var children = node.getChildren().slice(indexOf);
|
||||
this.checkClassChildren(children);
|
||||
};
|
||||
NoExtraSemiWalker.prototype.checkClassChildren = function (children) {
|
||||
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
|
||||
var child = children_1[_i];
|
||||
if ((child.kind === ts.SyntaxKind.SyntaxList || child.kind === ts.SyntaxKind.SemicolonClassElement) && child.getText() === ';') {
|
||||
this.validateNoExtraSemi(child);
|
||||
}
|
||||
else if (child.kind === ts.SyntaxKind.SyntaxList && child.getText().indexOf(';') !== -1) {
|
||||
this.checkClassChildren(child.getChildren());
|
||||
}
|
||||
}
|
||||
};
|
||||
NoExtraSemiWalker.prototype.validateNoExtraSemi = function (node) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
|
||||
};
|
||||
return NoExtraSemiWalker;
|
||||
}(Lint.RuleWalker));
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vRXh0cmFTZW1pUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBaUM7QUFDakMsNkJBQStCO0FBRS9CO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUFPQSxDQUFDO0lBSlEsb0JBQUssR0FBWixVQUFhLFVBQXlCO1FBQ3BDLElBQU0sTUFBTSxHQUFHLElBQUksaUJBQWlCLENBQUMsVUFBVSxFQUFFLElBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDO1FBQ3BFLE9BQU8sSUFBSSxDQUFDLGVBQWUsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUN0QyxDQUFDO0lBTGEsbUJBQWMsR0FBRyx1QkFBdUIsQ0FBQztJQU16RCxXQUFDO0NBUEQsQUFPQyxDQVB5QixJQUFJLENBQUMsS0FBSyxDQUFDLFlBQVksR0FPaEQ7QUFQWSxvQkFBSTtBQVNqQjtJQ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IsVUFBNEIsSUFBYTtRQUN2QyxJQUFJLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxFQUFFLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsY0FBYyxDQUFDLENBQUMsQ0FBQztJQUM3RixDQUFDO0lBQ0gsd0JBQUM7QUFBRCxDQWhEQSxBQWdEQyxDQWhEK0IsSUFBSSxDQUFDLFVBQVUsR0FnRDlDIiwiZmlsZSI6InJ1bGVzL25vRXh0cmFTZW1pUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9
|
||||
67
node_modules/tslint-eslint-rules/dist/rules/noInnerDeclarationsRule.js
generated
vendored
Normal file
67
node_modules/tslint-eslint-rules/dist/rules/noInnerDeclarationsRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new NoInnerDeclarationsWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var NoInnerDeclarationsWalker = (function (_super) {
|
||||
tslib_1.__extends(NoInnerDeclarationsWalker, _super);
|
||||
function NoInnerDeclarationsWalker() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.VALID_PARENT_TYPES = [
|
||||
ts.SyntaxKind.SourceFile,
|
||||
ts.SyntaxKind.FunctionDeclaration,
|
||||
ts.SyntaxKind.FunctionExpression,
|
||||
ts.SyntaxKind.ArrowFunction,
|
||||
ts.SyntaxKind.MethodDeclaration,
|
||||
ts.SyntaxKind.ModuleDeclaration,
|
||||
ts.SyntaxKind.Constructor
|
||||
];
|
||||
return _this;
|
||||
}
|
||||
NoInnerDeclarationsWalker.prototype.visitFunctionDeclaration = function (node) {
|
||||
this.validateInnerDeclaration(node);
|
||||
_super.prototype.visitFunctionDeclaration.call(this, node);
|
||||
};
|
||||
NoInnerDeclarationsWalker.prototype.visitVariableStatement = function (node) {
|
||||
if (this.hasOption('both') && node.declarationList.getFirstToken().kind === ts.SyntaxKind.VarKeyword) {
|
||||
this.validateInnerDeclaration(node);
|
||||
}
|
||||
_super.prototype.visitVariableStatement.call(this, node);
|
||||
};
|
||||
NoInnerDeclarationsWalker.prototype.validateInnerDeclaration = function (node) {
|
||||
var body = this.nearestBody(node);
|
||||
var isValid = (body.isSourceFile && body.distance === 1) || body.distance === 2;
|
||||
if (!isValid) {
|
||||
var decl = node.kind === ts.SyntaxKind.FunctionDeclaration ? 'function' : 'variable';
|
||||
var root = body.isSourceFile ? 'program' : 'function body';
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), "move " + decl + " declaration to " + root + " root"));
|
||||
}
|
||||
};
|
||||
NoInnerDeclarationsWalker.prototype.nearestBody = function (node) {
|
||||
var ancestor = node.parent;
|
||||
var generation = 1;
|
||||
while (ancestor && this.VALID_PARENT_TYPES.indexOf(ancestor.kind) === -1) {
|
||||
generation++;
|
||||
ancestor = ancestor.parent;
|
||||
}
|
||||
return {
|
||||
isSourceFile: (ancestor && ancestor.kind === ts.SyntaxKind.SourceFile) || !ancestor,
|
||||
distance: generation
|
||||
};
|
||||
};
|
||||
return NoInnerDeclarationsWalker;
|
||||
}(Lint.RuleWalker));
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vSW5uZ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UNILENBQUM7SUFFTywrQ0FBVyxHQUFuQixVQUFvQixJQUFhO1FBQy9CLElBQUksUUFBUSxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUM7UUFDM0IsSUFBSSxVQUFVLEdBQUcsQ0FBQyxDQUFDO1FBRW5CLE9BQU8sUUFBUSxJQUFJLElBQUksQ0FBQyxrQkFBa0IsQ0FBQyxPQUFPLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsQ0FBQyxFQUFFO1lBQ3hFLFVBQVUsRUFBRSxDQUFDO1lBQ2IsUUFBUSxHQUFHLFFBQVEsQ0FBQyxNQUFNLENBQUM7U0FDNUI7UUFFRCxPQUFPO1lBQ0wsWUFBWSxFQUFFLENBQUMsUUFBUSxJQUFJLFFBQVEsQ0FBQyxJQUFJLEtBQUssRUFBRSxDQUFDLFVBQVUsQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLFFBQVE7WUFDbkYsUUFBUSxFQUFFLFVBQVU7U0FDckIsQ0FBQztJQUNKLENBQUM7SUFDSCxnQ0FBQztBQUFELENBbkRBLEFBbURDLENBbkR1QyxJQUFJLENBQUMsVUFBVSxHQW1EdEQiLCJmaWxlIjoicnVsZXMvbm9Jbm5lckRlY2xhcmF0aW9uc1J1bGUuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2ptbG9wZXovdHNsaW50LWVzbGludC1ydWxlcy9zcmMifQ==
|
||||
49
node_modules/tslint-eslint-rules/dist/rules/noInvalidRegexpRule.js
generated
vendored
Normal file
49
node_modules/tslint-eslint-rules/dist/rules/noInvalidRegexpRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new NoInvalidRegexpWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var NoInvalidRegexpWalker = (function (_super) {
|
||||
tslib_1.__extends(NoInvalidRegexpWalker, _super);
|
||||
function NoInvalidRegexpWalker() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
NoInvalidRegexpWalker.prototype.visitNewExpression = function (node) {
|
||||
this.validateInvalidRegExp(node);
|
||||
_super.prototype.visitNewExpression.call(this, node);
|
||||
};
|
||||
NoInvalidRegexpWalker.prototype.visitCallExpression = function (node) {
|
||||
this.validateInvalidRegExp(node);
|
||||
_super.prototype.visitCallExpression.call(this, node);
|
||||
};
|
||||
NoInvalidRegexpWalker.prototype.validateInvalidRegExp = function (node) {
|
||||
if (node.expression.getText() === 'RegExp') {
|
||||
var args = node.arguments;
|
||||
if (args && args.length > 0 && args[0].kind === ts.SyntaxKind.StringLiteral) {
|
||||
var expr = args[0].text;
|
||||
var flags = args.length > 1 && args[1].kind === ts.SyntaxKind.StringLiteral ? args[1].text : undefined;
|
||||
try {
|
||||
new RegExp(expr, flags);
|
||||
}
|
||||
catch (e) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), e.message));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
return NoInvalidRegexpWalker;
|
||||
}(Lint.RuleWalker));
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vSW52YWxpZFJlZ2V4cFJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQjtJQUEwQixnQ0FBdUI7SUFBakQ7O0lBS0Es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FJLENBQUMsQ0FBQyxDQUFzQixDQUFDLElBQUksQ0FBQztnQkFDaEQsSUFBTSxLQUFLLEdBQUcsSUFBSSxDQUFDLE1BQU0sR0FBRyxDQUFDLElBQUksSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDLElBQUksS0FBSyxFQUFFLENBQUMsVUFBVSxDQUFDLGFBQWEsQ0FBQyxDQUFDLENBQUUsSUFBSSxDQUFDLENBQUMsQ0FBc0IsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLFNBQVMsQ0FBQztnQkFFL0gsSUFBSTtvQkFFRixJQUFJLE1BQU0sQ0FBQyxJQUFJLEVBQUUsS0FBSyxDQUFDLENBQUM7aUJBQ3pCO2dCQUNELE9BQU8sQ0FBQyxFQUFFO29CQUNSLElBQUksQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLGFBQWEsQ0FBQyxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxDQUFDLFFBQVEsRUFBRSxFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDO2lCQUNsRjthQUNGO1NBQ0Y7SUFDSCxDQUFDO0lBQ0gsNEJBQUM7QUFBRCxDQTVCQSxBQTRCQyxDQTVCbUMsSUFBSSxDQUFDLFVBQVUsR0E0QmxEIiwiZmlsZSI6InJ1bGVzL25vSW52YWxpZFJlZ2V4cFJ1bGUuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2ptbG9wZXovdHNsaW50LWVzbGludC1ydWxlcy9zcmMifQ==
|
||||
119
node_modules/tslint-eslint-rules/dist/rules/noMultiSpacesRule.js
generated
vendored
Normal file
119
node_modules/tslint-eslint-rules/dist/rules/noMultiSpacesRule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
35
node_modules/tslint-eslint-rules/dist/rules/noRegexSpacesRule.js
generated
vendored
Normal file
35
node_modules/tslint-eslint-rules/dist/rules/noRegexSpacesRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var Lint = require("tslint");
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new NoRegexSpacesWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var NoRegexSpacesWalker = (function (_super) {
|
||||
tslib_1.__extends(NoRegexSpacesWalker, _super);
|
||||
function NoRegexSpacesWalker() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
NoRegexSpacesWalker.prototype.visitRegularExpressionLiteral = function (node) {
|
||||
this.validateMultipleSpaces(node);
|
||||
_super.prototype.visitRegularExpressionLiteral.call(this, node);
|
||||
};
|
||||
NoRegexSpacesWalker.prototype.validateMultipleSpaces = function (node) {
|
||||
var res = /( {2,})+?/.exec(node.text);
|
||||
if (res) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), "spaces are hard to count - use {" + res[0].length + "}"));
|
||||
}
|
||||
};
|
||||
return NoRegexSpacesWalker;
|
||||
}(Lint.RuleWalker));
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vUmVnZXhTcGFjZXNSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLDZCQUErQjtBQUUvQjtJQUEwQixnQ0FBdUI7SUFBakQ7O0lBS0EsQ0FBQztJQUpRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxJQUFNLE1BQU0sR0FBRyxJQUFJLG1CQUFtQixDQUFDLFVBQVUsRUFBRSxJ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al file
91
node_modules/tslint-eslint-rules/dist/rules/noUnexpectedMultilineRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new NoUnexpectedMultilineWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
Rule.FAILURE_STRING = {
|
||||
func: 'unexpected newline between function and ( of function call',
|
||||
prop: 'unexpected newline between object and [ of property access',
|
||||
template: 'unexpected newline between template tag and template literal'
|
||||
};
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var NoUnexpectedMultilineWalker = (function (_super) {
|
||||
tslib_1.__extends(NoUnexpectedMultilineWalker, _super);
|
||||
function NoUnexpectedMultilineWalker() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
NoUnexpectedMultilineWalker.prototype.visitCallExpression = function (node) {
|
||||
var firstLeftParen = node.getChildren().filter(function (ch) { return ch.kind === ts.SyntaxKind.OpenParenToken; })[0];
|
||||
if (this.isBreakBefore(firstLeftParen)) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), this.getMessage(node)));
|
||||
}
|
||||
_super.prototype.visitCallExpression.call(this, node);
|
||||
};
|
||||
NoUnexpectedMultilineWalker.prototype.visitElementAccessExpression = function (node) {
|
||||
var firstLeftSquareBracket = node.getChildren().filter(function (ch) { return ch.kind === ts.SyntaxKind.OpenBracketToken; })[0];
|
||||
if (this.isBreakBefore(firstLeftSquareBracket)) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), this.getMessage(node)));
|
||||
}
|
||||
_super.prototype.visitElementAccessExpression.call(this, node);
|
||||
};
|
||||
NoUnexpectedMultilineWalker.prototype.visitNode = function (node) {
|
||||
if (node.kind === ts.SyntaxKind.TaggedTemplateExpression) {
|
||||
var children = node.getChildren();
|
||||
var tag = children.filter(function (ch) { return ch.kind === ts.SyntaxKind.Identifier; })[0];
|
||||
var tagIndex = children.indexOf(tag);
|
||||
if (tag && children[tagIndex + 1]) {
|
||||
var template = children[tagIndex + 1];
|
||||
if (this.isBreakBefore(template)) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), this.getMessage(node)));
|
||||
}
|
||||
}
|
||||
}
|
||||
_super.prototype.visitNode.call(this, node);
|
||||
};
|
||||
NoUnexpectedMultilineWalker.prototype.isBreakBefore = function (node) {
|
||||
if (node.parent) {
|
||||
var children = node.parent.getChildren();
|
||||
var nodeIndex = children.indexOf(node);
|
||||
if (nodeIndex > 0) {
|
||||
var nodeLine = this.getStartPosition(node).line;
|
||||
var previousNodeLine = this.getEndPosition(children[nodeIndex - 1]).line;
|
||||
if (nodeLine !== previousNodeLine) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
NoUnexpectedMultilineWalker.prototype.getMessage = function (node) {
|
||||
switch (node.kind) {
|
||||
case ts.SyntaxKind.CallExpression:
|
||||
return Rule.FAILURE_STRING.func;
|
||||
case ts.SyntaxKind.ElementAccessExpression:
|
||||
return Rule.FAILURE_STRING.prop;
|
||||
case ts.SyntaxKind.TaggedTemplateExpression:
|
||||
return Rule.FAILURE_STRING.template;
|
||||
default:
|
||||
throw 'Unexpected node type: ' + ts.SyntaxKind[node.kind];
|
||||
}
|
||||
};
|
||||
NoUnexpectedMultilineWalker.prototype.getStartPosition = function (node) {
|
||||
return node.getSourceFile().getLineAndCharacterOfPosition(node.getStart());
|
||||
};
|
||||
NoUnexpectedMultilineWalker.prototype.getEndPosition = function (node) {
|
||||
return node.getSourceFile().getLineAndCharacterOfPosition(node.getEnd());
|
||||
};
|
||||
return NoUnexpectedMultilineWalker;
|
||||
}(Lint.RuleWalker));
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vVW5leHBlY3RlZE11bHRpbGluZVJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQjtJQUEwQixnQ0FBdUI7SUFBakQ7O0lBV0EsQ0FBQztJQUpRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxJQUFNLE1BQU0sR0FBRyxJQUFJLDJCQUEyQixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQztRQUM5RSxPQUFPLElBQUksQ0FBQyxlQUFlLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdEMsQ0FBQztJQVRhLG1CQUFjLEdBQUc7UUFDN0IsSUFBSSxFQUFFLDREQUE0RDtRQUNsRSxJQUFJLEVBQUUsNERBQTREO1FBQ2xFLFFBQVEsRUFBRSw4REFBOEQ7S0FDekUsQ0FBQztJQU1KLFdBQUM7Q0FYRCxBQVdDLENBWHlCLElBQUksQ0FBQyxLQUFLLENBQUMsWUFBWSxHQVdoRDtBQVhZLG9CQUFJO0FBYWpCO0lBQTBDLHVEQUFlO0lBQXpEOztJQTZFQSxDQUFDO0lBNUVXLHlEQUFtQixHQUE3QixVQUE4QixJQUF1QjtRQUNuRCxJQUFNLGNBQWMsR0FBRyxJQUFJLENBQUMsV0FBVyxFQUFFLENBQUMsTUFBTSxDQUFDLFVBQUEsRUFBRSxJQUFJLE9BQUEsRUFBRSxDQUFDLElBQUksS0FBSyxFQUFFLENBQUMsVUFBVSxDQUFDLGNBQWMsRUFBeEMsQ0FBd0MsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQ3BHLElBQUks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FTyxvREFBYyxHQUF0QixVQUF1QixJQUFhO1FBQ2xDLE9BQU8sSUFBSSxDQUFDLGFBQWEsRUFBRSxDQUFDLDZCQUE2QixDQUFDLElBQUksQ0FBQyxNQUFNLEVBQUUsQ0FBQyxDQUFDO0lBQzNFLENBQUM7SUFDSCxrQ0FBQztBQUFELENBN0VBLEFBNkVDLENBN0V5QyxJQUFJLENBQUMsVUFBVSxHQTZFeEQiLCJmaWxlIjoicnVsZXMvbm9VbmV4cGVjdGVkTXVsdGlsaW5lUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9
|
||||
109
node_modules/tslint-eslint-rules/dist/rules/objectCurlySpacingRule.js
generated
vendored
Normal file
109
node_modules/tslint-eslint-rules/dist/rules/objectCurlySpacingRule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
215
node_modules/tslint-eslint-rules/dist/rules/sortImportsRule.js
generated
vendored
Normal file
215
node_modules/tslint-eslint-rules/dist/rules/sortImportsRule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
215
node_modules/tslint-eslint-rules/dist/rules/spaceInParensRule.js
generated
vendored
Normal file
215
node_modules/tslint-eslint-rules/dist/rules/spaceInParensRule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
117
node_modules/tslint-eslint-rules/dist/rules/terArrowBodyStyleRule.js
generated
vendored
Normal file
117
node_modules/tslint-eslint-rules/dist/rules/terArrowBodyStyleRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var RULE_NAME = 'ter-arrow-body-style';
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new RuleWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
Rule.metadata = {
|
||||
ruleName: RULE_NAME,
|
||||
description: 'require braces in arrow function body',
|
||||
rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Arrow functions have two syntactic forms for their function bodies. They may be defined with\n a block body (denoted by curly braces) `() => { ... }` or with a single expression\n `() => ...`, whose value is implicitly returned.\n "], ["\n Arrow functions have two syntactic forms for their function bodies. They may be defined with\n a block body (denoted by curly braces) \\`() => { ... }\\` or with a single expression\n \\`() => ...\\`, whose value is implicitly returned.\n "]))),
|
||||
optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n The rule takes one or two options. The first is a string, which can be:\n\n - `\"always\"` enforces braces around the function body\n - `\"as-needed\"` enforces no braces where they can be omitted (default)\n - `\"never\"` enforces no braces around the function body (constrains arrow functions to the\n role of returning an expression)\n\n The second one is an object for more fine-grained configuration when the first option is\n `\"as-needed\"`. Currently, the only available option is `requireReturnForObjectLiteral`, a\n boolean property. It\u2019s false by default. If set to true, it requires braces and an explicit\n return for object literals.\n "], ["\n The rule takes one or two options. The first is a string, which can be:\n\n - \\`\"always\"\\` enforces braces around the function body\n - \\`\"as-needed\"\\` enforces no braces where they can be omitted (default)\n - \\`\"never\"\\` enforces no braces around the function body (constrains arrow functions to the\n role of returning an expression)\n\n The second one is an object for more fine-grained configuration when the first option is\n \\`\"as-needed\"\\`. Currently, the only available option is \\`requireReturnForObjectLiteral\\`, a\n boolean property. It\u2019s false by default. If set to true, it requires braces and an explicit\n return for object literals.\n "]))),
|
||||
options: {
|
||||
anyOf: [
|
||||
{
|
||||
type: 'array',
|
||||
items: [
|
||||
{
|
||||
enum: ['always', 'never']
|
||||
}
|
||||
],
|
||||
minItems: 0,
|
||||
maxItems: 1
|
||||
},
|
||||
{
|
||||
type: 'array',
|
||||
items: [
|
||||
{
|
||||
enum: ['as-needed']
|
||||
},
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
requireReturnForObjectLiteral: { type: 'boolean' }
|
||||
},
|
||||
additionalProperties: false
|
||||
}
|
||||
],
|
||||
minItems: 0,
|
||||
maxItems: 2
|
||||
}
|
||||
]
|
||||
},
|
||||
optionExamples: [
|
||||
Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"always\"]\n "], ["\n \"", "\": [true, \"always\"]\n "])), RULE_NAME),
|
||||
Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"never\"]\n "], ["\n \"", "\": [true, \"never\"]\n "])), RULE_NAME),
|
||||
Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"as-needed\", {\n \"requireReturnForObjectLiteral\": true\n }]\n "], ["\n \"", "\": [true, \"as-needed\", {\n \"requireReturnForObjectLiteral\": true\n }]\n "])), RULE_NAME)
|
||||
],
|
||||
typescriptOnly: false,
|
||||
type: 'style'
|
||||
};
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var RuleWalker = (function (_super) {
|
||||
tslib_1.__extends(RuleWalker, _super);
|
||||
function RuleWalker(sourceFile, options) {
|
||||
var _this = _super.call(this, sourceFile, options) || this;
|
||||
var opt = _this.getOptions();
|
||||
_this.always = opt[0] === 'always';
|
||||
_this.asNeeded = !opt[0] || opt[0] === 'as-needed';
|
||||
_this.never = opt[0] === 'never';
|
||||
_this.requireReturnForObjectLiteral = opt[1] && opt[1].requireReturnForObjectLiteral;
|
||||
return _this;
|
||||
}
|
||||
RuleWalker.prototype.visitArrowFunction = function (node) {
|
||||
var arrowBody = node.body;
|
||||
if (arrowBody.kind === ts.SyntaxKind.Block) {
|
||||
var blockBody = arrowBody.statements;
|
||||
if (blockBody.length !== 1 && !this.never) {
|
||||
return;
|
||||
}
|
||||
var returnExpression = blockBody[0].expression;
|
||||
if (this.asNeeded &&
|
||||
this.requireReturnForObjectLiteral &&
|
||||
blockBody[0].kind === ts.SyntaxKind.ReturnStatement &&
|
||||
(returnExpression && this.isObjectLiteral(returnExpression))) {
|
||||
return;
|
||||
}
|
||||
if (this.never || this.asNeeded && blockBody[0].kind === ts.SyntaxKind.ReturnStatement) {
|
||||
this.report(arrowBody, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.always || (this.asNeeded &&
|
||||
this.requireReturnForObjectLiteral &&
|
||||
this.isObjectLiteral(arrowBody))) {
|
||||
this.report(arrowBody, true);
|
||||
}
|
||||
}
|
||||
_super.prototype.visitArrowFunction.call(this, node);
|
||||
};
|
||||
RuleWalker.prototype.isObjectLiteral = function (node) {
|
||||
var obj = node;
|
||||
while (obj.kind === ts.SyntaxKind.ParenthesizedExpression) {
|
||||
obj = node.expression;
|
||||
}
|
||||
return obj.kind === ts.SyntaxKind.ObjectLiteralExpression;
|
||||
};
|
||||
RuleWalker.prototype.report = function (arrowBody, expected) {
|
||||
var val = expected ? 'Expected' : 'Unexpected';
|
||||
var failure = this.createFailure(arrowBody.getStart(), arrowBody.getWidth(), val + " block statement surrounding arrow body.");
|
||||
this.addFailure(failure);
|
||||
};
|
||||
return RuleWalker;
|
||||
}(Lint.RuleWalker));
|
||||
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3RlckFycm93Qm9keVN0eWxlUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFJQSwrQkFBaUM7QUFDakMsNkJBQStCO0FBRS9CLElBQU0sU0FBUyxHQUFHLHNCQUFzQixDQUFDO0FBRXpDO0lBQTBCLGdDQUF1QjtJQUFqRDs7SU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R5U3R5bGVSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0=
|
||||
115
node_modules/tslint-eslint-rules/dist/rules/terArrowParensRule.js
generated
vendored
Normal file
115
node_modules/tslint-eslint-rules/dist/rules/terArrowParensRule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
104
node_modules/tslint-eslint-rules/dist/rules/terArrowSpacingRule.js
generated
vendored
Normal file
104
node_modules/tslint-eslint-rules/dist/rules/terArrowSpacingRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var Lint = require("tslint");
|
||||
var RULE_NAME = 'ter-arrow-spacing';
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new RuleWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
Rule.metadata = {
|
||||
ruleName: RULE_NAME,
|
||||
description: 'require space before/after arrow function\'s arrow',
|
||||
rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n This rule normalizes the style of spacing before/after an arrow function\u2019s arrow(`=>`).\n "], ["\n This rule normalizes the style of spacing before/after an arrow function\u2019s arrow(\\`=>\\`).\n "]))),
|
||||
optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n This rule takes an object argument with `before` and `after` properties, each with a\n Boolean value.\n\n The default configuration is `{ \"before\": true, \"after\": true }`.\n\n `true` means there should be one or more spaces and `false` means no spaces.\n "], ["\n This rule takes an object argument with \\`before\\` and \\`after\\` properties, each with a\n Boolean value.\n\n The default configuration is \\`{ \"before\": true, \"after\": true }\\`.\n\n \\`true\\` means there should be one or more spaces and \\`false\\` means no spaces.\n "]))),
|
||||
options: {
|
||||
type: 'array',
|
||||
items: [{
|
||||
type: 'object',
|
||||
properties: {
|
||||
before: {
|
||||
type: 'boolean'
|
||||
},
|
||||
after: {
|
||||
type: 'boolean'
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
}],
|
||||
maxLength: 1
|
||||
},
|
||||
optionExamples: [
|
||||
Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true]\n "], ["\n \"", "\": [true]\n "])), RULE_NAME),
|
||||
Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, {\n \"before\": false,\n \"after\": false\n }]\n "], ["\n \"", "\": [true, {\n \"before\": false,\n \"after\": false\n }]\n "])), RULE_NAME)
|
||||
],
|
||||
typescriptOnly: false,
|
||||
type: 'style'
|
||||
};
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var RuleWalker = (function (_super) {
|
||||
tslib_1.__extends(RuleWalker, _super);
|
||||
function RuleWalker(sourceFile, options) {
|
||||
var _this = _super.call(this, sourceFile, options) || this;
|
||||
_this.before = true;
|
||||
_this.after = true;
|
||||
var opt = _this.getOptions();
|
||||
if (opt[0]) {
|
||||
_this.before = opt[0].before !== false;
|
||||
_this.after = opt[0].after !== false;
|
||||
}
|
||||
_this.srcFile = sourceFile;
|
||||
_this.srcText = sourceFile.getFullText();
|
||||
return _this;
|
||||
}
|
||||
RuleWalker.prototype.visitArrowFunction = function (node) {
|
||||
var arrow = node.equalsGreaterThanToken;
|
||||
var arrowStart = arrow.getStart(this.srcFile);
|
||||
var bodyStart = node.body.getStart(this.srcFile);
|
||||
var space = {
|
||||
before: /\s/.test(this.srcText[arrowStart - 1]),
|
||||
after: /\s/.test(this.srcText[arrow.end])
|
||||
};
|
||||
if (this.before) {
|
||||
if (!space.before) {
|
||||
var fix = Lint.Replacement.appendText(arrowStart, ' ');
|
||||
this.report(arrow, 'Missing', 'before', fix);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (space.before) {
|
||||
var spaces = arrowStart - arrow.getFullStart();
|
||||
var fix = Lint.Replacement.deleteText(arrowStart - spaces, spaces);
|
||||
this.report(arrow, 'Unexpected', 'before', fix);
|
||||
}
|
||||
}
|
||||
if (this.after) {
|
||||
if (!space.after) {
|
||||
var fix = Lint.Replacement.appendText(arrow.end, ' ');
|
||||
this.report(arrow, 'Missing', 'after', fix);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (space.after) {
|
||||
var fix = Lint.Replacement.deleteText(arrow.end, bodyStart - arrow.end);
|
||||
this.report(arrow, 'Unexpected', 'after', fix);
|
||||
}
|
||||
}
|
||||
_super.prototype.visitArrowFunction.call(this, node);
|
||||
};
|
||||
RuleWalker.prototype.report = function (arrowToken, status, place, fix) {
|
||||
var failure = this.createFailure(arrowToken.getStart(this.srcFile), arrowToken.getWidth(this.srcFile), status + " space " + place + " =>.", fix);
|
||||
this.addFailure(failure);
|
||||
};
|
||||
return RuleWalker;
|
||||
}(Lint.RuleWalker));
|
||||
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3RlckFycm93U3BhY2luZ1J1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBUUEsNkJBQStCO0FBRS9CLElBQU0sU0FBUyxHQUFHLG1CQUFtQixDQUFDO0FBRXRDO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUFrREEsQ0FBQztJQUpRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxJQUFNLE1BQU0sR0FBRyxJQUFJLFVBQVUsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFD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FBQU07WUFDTCxJQUFJLEtBQUssQ0FBQyxLQUFLLEVBQUU7Z0JBQ2YsSUFBTSxHQUFHLEdBQUcsSUFBSSxDQUFDLFdBQVcsQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxTQUFTLEdBQUcsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDO2dCQUMxRSxJQUFJLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxZQUFZLEVBQUUsT0FBTyxFQUFFLEdBQUcsQ0FBQyxDQUFDO2FBQ2hEO1NBQ0Y7UUFDRCxpQkFBTSxrQkFBa0IsWUFBQyxJQUFJLENBQUMsQ0FBQztJQUNqQyxDQUFDO0lBRU8sMkJBQU0sR0FBZCxVQUFlLFVBQW1CLEVBQUUsTUFBYyxFQUFFLEtBQWEsRUFBRSxHQUFhO1FBQzlFLElBQU0sT0FBTyxHQUFHLElBQUksQ0FBQyxhQUFhLENBQ2hDLFVBQVUsQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxFQUNqQyxVQUFVLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsRUFDOUIsTUFBTSxlQUFVLEtBQUssU0FBTSxFQUM5QixHQUFHLENBQ0osQ0FBQztRQUNGLElBQUksQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDM0IsQ0FBQztJQUNILGlCQUFDO0FBQUQsQ0E1REEsQUE0REMsQ0E1RHdCLElBQUksQ0FBQyxVQUFVLEdBNER2QyIsImZpbGUiOiJydWxlcy90ZXJBcnJvd1NwYWNpbmdSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0=
|
||||
123
node_modules/tslint-eslint-rules/dist/rules/terComputedPropertySpacingRule.js
generated
vendored
Normal file
123
node_modules/tslint-eslint-rules/dist/rules/terComputedPropertySpacingRule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
137
node_modules/tslint-eslint-rules/dist/rules/terFuncCallSpacingRule.js
generated
vendored
Normal file
137
node_modules/tslint-eslint-rules/dist/rules/terFuncCallSpacingRule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
915
node_modules/tslint-eslint-rules/dist/rules/terIndentRule.js
generated
vendored
Normal file
915
node_modules/tslint-eslint-rules/dist/rules/terIndentRule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
306
node_modules/tslint-eslint-rules/dist/rules/terMaxLenRule.js
generated
vendored
Normal file
306
node_modules/tslint-eslint-rules/dist/rules/terMaxLenRule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
113
node_modules/tslint-eslint-rules/dist/rules/terNewlineAfterVarRule.js
generated
vendored
Normal file
113
node_modules/tslint-eslint-rules/dist/rules/terNewlineAfterVarRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var RULE_NAME = 'ter-newline-after-var';
|
||||
var EXPECTED_BLANK_LINE_MESSAGE = 'Expected blank line after variable declarations.';
|
||||
var UNEXPECTED_BLANK_LINE_MESSAGE = 'Unexpected blank line after variable declarations.';
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.formatOptions = function (_a) {
|
||||
var alwaysOrNever = _a[0];
|
||||
return {
|
||||
always: alwaysOrNever !== 'never'
|
||||
};
|
||||
};
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var opt = this.formatOptions(this.ruleArguments);
|
||||
var walker = new RuleWalker(sourceFile, this.ruleName, opt);
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
Rule.metadata = {
|
||||
ruleName: RULE_NAME,
|
||||
hasFix: true,
|
||||
description: 'require or disallow an empty line after variable declarations',
|
||||
rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n This rule enforces a coding style where empty lines are required or disallowed after `var`, `let`, or `const`\n statements to achieve a consistent coding style across the project.\n "], ["\n This rule enforces a coding style where empty lines are required or disallowed after \\`var\\`, \\`let\\`, or \\`const\\`\n statements to achieve a consistent coding style across the project.\n "]))),
|
||||
optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n This rule has a string option:\n\n * `\"always\"` (default) requires an empty line after `var`, `let`, or `const`.\n Comments on a line directly after var statements are treated like additional var statements.\n * `\"never\"` disallows empty lines after `var`, `let`, or `const`.\n "], ["\n This rule has a string option:\n\n * \\`\"always\"\\` (default) requires an empty line after \\`var\\`, \\`let\\`, or \\`const\\`.\n Comments on a line directly after var statements are treated like additional var statements.\n * \\`\"never\"\\` disallows empty lines after \\`var\\`, \\`let\\`, or \\`const\\`.\n "]))),
|
||||
options: {
|
||||
type: 'array',
|
||||
items: [{
|
||||
enum: ['always', 'never']
|
||||
}],
|
||||
maxLength: 1
|
||||
},
|
||||
optionExamples: [
|
||||
Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true]\n "], ["\n \"", "\": [true]\n "])), RULE_NAME),
|
||||
Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"always\"]\n "], ["\n \"", "\": [true, \"always\"]\n "])), RULE_NAME),
|
||||
Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"never\"]\n "], ["\n \"", "\": [true, \"never\"]\n "])), RULE_NAME)
|
||||
],
|
||||
typescriptOnly: false,
|
||||
type: 'style'
|
||||
};
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var RuleWalker = (function (_super) {
|
||||
tslib_1.__extends(RuleWalker, _super);
|
||||
function RuleWalker() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
RuleWalker.prototype.walk = function (sourceFile) {
|
||||
var _this = this;
|
||||
this.sourceFileText = sourceFile.getFullText();
|
||||
var onNode = function (node) {
|
||||
var _a = _this, lastVariableStatementNode = _a.lastVariableStatementNode, sourceFileText = _a.sourceFileText;
|
||||
if (node.kind === ts.SyntaxKind.VariableStatement) {
|
||||
_this.lastVariableStatementNode = node;
|
||||
return;
|
||||
}
|
||||
if (node.kind === ts.SyntaxKind.EndOfFileToken) {
|
||||
_this.lastVariableStatementNode = undefined;
|
||||
return;
|
||||
}
|
||||
if (lastVariableStatementNode) {
|
||||
var unexpectedLineFixes = [];
|
||||
var expectedLineFixes = [];
|
||||
var isNewLineRequired = _this.options.always;
|
||||
var expectedLinePos = lastVariableStatementNode.end;
|
||||
var newLinesCount = 0;
|
||||
for (var i = lastVariableStatementNode.end; i < node.end; i++) {
|
||||
var code = sourceFileText.charCodeAt(i);
|
||||
if (code === 10) {
|
||||
newLinesCount++;
|
||||
if (!isNewLineRequired && newLinesCount > 1) {
|
||||
unexpectedLineFixes.push(Lint.Replacement.deleteText(i, 1));
|
||||
}
|
||||
}
|
||||
else if (code !== 9 && code !== 13 && code !== 32) {
|
||||
var leadingComments = ts.getLeadingCommentRanges("\n" + sourceFileText.slice(i), 0);
|
||||
var lastLeadingComment = leadingComments && leadingComments.pop();
|
||||
if (lastLeadingComment && (!isNewLineRequired || (isNewLineRequired && newLinesCount < 2))) {
|
||||
newLinesCount = 0;
|
||||
expectedLinePos = i - 1 + lastLeadingComment.end;
|
||||
i = expectedLinePos - 1;
|
||||
}
|
||||
else {
|
||||
if (isNewLineRequired && newLinesCount < 2) {
|
||||
expectedLineFixes.push(Lint.Replacement.appendText(expectedLinePos, '\n'));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isNewLineRequired && expectedLineFixes[0]) {
|
||||
_this.addFailureAt(lastVariableStatementNode.getStart(), 1, EXPECTED_BLANK_LINE_MESSAGE, expectedLineFixes);
|
||||
}
|
||||
else if (unexpectedLineFixes[0]) {
|
||||
_this.addFailureAt(lastVariableStatementNode.getStart(), 1, UNEXPECTED_BLANK_LINE_MESSAGE, unexpectedLineFixes);
|
||||
}
|
||||
_this.lastVariableStatementNode = undefined;
|
||||
}
|
||||
return ts.forEachChild(node, onNode);
|
||||
};
|
||||
return ts.forEachChild(sourceFile, onNode);
|
||||
};
|
||||
return RuleWalker;
|
||||
}(Lint.AbstractWalker));
|
||||
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5ld2xpbmVBZnRlclZhclJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQixJQUFNLFNBQVMsR0FBVyx1QkFBdUIsQ0FBQztBQU1sRCxJQUFNLDJCQUEyQixHQUFXLGtEQUFrRCxDQUFDO0FBQy9GLElBQU0sNkJBQTZCLEdBQVcsb0RBQW9ELENBQUM7QUFFbkc7SUFBMEIsZ0NBQXVCO0lBQWpEOztJQWlEQSxDQUFDO0lBWFMsNEJBQWEsR0FBckIsVUFBdUIsRUFBeUI7WUFBeEIscUJBQWE7UUFDbkMsT0FBTztZQUNMLE1BQU0sRUFBRSxhQUFhLEtBQUssT0FBTztTQUNsQyxDQUFDO0lBQ0osQ0FBQztJQUVNLG9CQUFLLEdBQVosVUFBYyxVQUF5QjtRQUNyQyxJQUFNLEdBQUcsR0FBRyxJQUFJLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsQ0FBQztRQUNuRCxJQUFNLE1BQU0sR0FBRyxJQUFJLFVB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UMsZUFBZSxFQUFFLElBQUksQ0FBQyxDQUFDLENBQUM7NkJBQzVFOzRCQUVELE1BQU07eUJBQ1A7cUJBQ0Y7aUJBQ0Y7Z0JBRUQsSUFBSSxpQkFBaUIsSUFBSSxpQkFBaUIsQ0FBQyxDQUFDLENBQUMsRUFBRTtvQkFFN0MsS0FBSSxDQUFDLFlBQVksQ0FDZix5QkFBeUIsQ0FBQyxRQUFRLEVBQUUsRUFDcEMsQ0FBQyxFQUNELDJCQUEyQixFQUMzQixpQkFBaUIsQ0FDbEIsQ0FBQztpQkFDSDtxQkFBTSxJQUFJLG1CQUFtQixDQUFDLENBQUMsQ0FBQyxFQUFFO29CQUNqQyxLQUFJLENBQUMsWUFBWSxDQUNmLHlCQUF5QixDQUFDLFFBQVEsRUFBRSxFQUNwQyxDQUFDLEVBQ0QsNkJBQTZCLEVBQzdCLG1CQUFtQixDQUNwQixDQUFDO2lCQUNIO2dCQUVELEtBQUksQ0FBQyx5QkFBeUIsR0FBRyxTQUFTLENBQUM7YUFDNUM7WUFFRCxPQUFPLEVBQUUsQ0FBQyxZQUFZLENBQUMsSUFBSSxFQUFFLE1BQU0sQ0FBQyxDQUFDO1FBQ3ZDLENBQUMsQ0FBQztRQUVGLE9BQU8sRUFBRSxDQUFDLFlBQVksQ0FBQyxVQUFVLEVBQUUsTUFBTSxDQUFDLENBQUM7SUFDN0MsQ0FBQztJQUNILGlCQUFDO0FBQUQsQ0FwRkEsQUFvRkMsQ0FwRndCLElBQUksQ0FBQyxjQUFjLEdBb0YzQyIsImZpbGUiOiJydWxlcy90ZXJOZXdsaW5lQWZ0ZXJWYXJSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0=
|
||||
84
node_modules/tslint-eslint-rules/dist/rules/terNoIrregularWhitespaceRule.js
generated
vendored
Normal file
84
node_modules/tslint-eslint-rules/dist/rules/terNoIrregularWhitespaceRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var RULE_NAME = 'ter-no-irregular-whitespace';
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new NoIrregularWhitespaceWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
Rule.metadata = {
|
||||
ruleName: RULE_NAME,
|
||||
description: 'disallow irregular whitespace (recommended)',
|
||||
rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Invalid or irregular whitespace causes issues with ECMAScript 5 parsers and also makes code\n harder to debug in a similar nature to mixed tabs and spaces.\n "], ["\n Invalid or irregular whitespace causes issues with ECMAScript 5 parsers and also makes code\n harder to debug in a similar nature to mixed tabs and spaces.\n "]))),
|
||||
optionsDescription: '',
|
||||
options: {},
|
||||
optionExamples: [
|
||||
Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n \"", "\": [true]\n "], ["\n \"", "\": [true]\n "])), RULE_NAME)
|
||||
],
|
||||
typescriptOnly: false,
|
||||
type: 'typescript'
|
||||
};
|
||||
Rule.RULE_NAME = 'ter-no-irregular-whitespace';
|
||||
Rule.FAILURE_STRING = 'irregular whitespace not allowed';
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var NoIrregularWhitespaceWalker = (function (_super) {
|
||||
tslib_1.__extends(NoIrregularWhitespaceWalker, _super);
|
||||
function NoIrregularWhitespaceWalker() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.IRREGULAR_WHITESPACE = /[\u0085\u00A0\ufeff\f\v\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000]+/mg;
|
||||
_this.IRREGULAR_LINE_TERMINATORS = /[\u2028\u2029]/mg;
|
||||
return _this;
|
||||
}
|
||||
NoIrregularWhitespaceWalker.prototype.visitSourceFile = function (node) {
|
||||
this.validateIrregularWhitespace(node);
|
||||
_super.prototype.visitSourceFile.call(this, node);
|
||||
};
|
||||
NoIrregularWhitespaceWalker.prototype.visitNode = function (node) {
|
||||
if (node.kind === ts.SyntaxKind.StringLiteral) {
|
||||
this.removeStringError(node);
|
||||
}
|
||||
_super.prototype.visitNode.call(this, node);
|
||||
};
|
||||
NoIrregularWhitespaceWalker.prototype.removeStringError = function (node) {
|
||||
var start = node.getStart();
|
||||
var end = node.getEnd();
|
||||
var failures = this.getFailures();
|
||||
for (var i = failures.length - 1; i >= 0; i--) {
|
||||
var failure = failures[i];
|
||||
if (failure.getRuleName() === Rule.RULE_NAME) {
|
||||
if (failure.getStartPosition().getPosition() >= start && failure.getEndPosition().getPosition() <= end) {
|
||||
failures.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
NoIrregularWhitespaceWalker.prototype.validateIrregularWhitespace = function (node) {
|
||||
var _this = this;
|
||||
var lines = node.text.split(/\n/g);
|
||||
lines.forEach(function (line, i) {
|
||||
var match = _this.IRREGULAR_WHITESPACE.exec(line);
|
||||
while (match) {
|
||||
_this.addFailure(_this.createFailure(node.getPositionOfLineAndCharacter(i, match.index), 1, Rule.FAILURE_STRING));
|
||||
match = _this.IRREGULAR_WHITESPACE.exec(line);
|
||||
}
|
||||
match = _this.IRREGULAR_LINE_TERMINATORS.exec(line);
|
||||
while (match) {
|
||||
_this.addFailure(_this.createFailure(node.getPositionOfLineAndCharacter(i, match.index), 1, Rule.FAILURE_STRING));
|
||||
match = _this.IRREGULAR_LINE_TERMINATORS.exec(line);
|
||||
}
|
||||
});
|
||||
};
|
||||
return NoIrregularWhitespaceWalker;
|
||||
}(Lint.RuleWalker));
|
||||
var templateObject_1, templateObject_2;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5vSXJyZWd1bGFyV2hpdGVzcGFjZVJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQixJQUFNLFNBQVMsR0FBRyw2QkFBNkIsQ0FBQztBQUVoRDtJQUEwQixnQ0FBdUI7SUFBakQ7O0lBeUJBLENBQUM7SUFKUSxvQkFBSyxHQUFaLFVBQWEsVUFBeUI7UUFDcEMsSUFBTSxNQUFNLEdBQUcsSUFBSSwyQkFBMkIsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFDLENBQUM7UUFDOUUsT0FBTyxJQUFJLENBQUMsZUFBZSxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBQ3RDLENBQUM7SUF2QmEsYUFBUSxHQUF1QjtRQUMzQyxRQUFRLEVBQUUsU0FBUztRQUNuQixXQUFXLEVBQUUsNkNBQTZDO1FBQzFELFNBQVMsRUFBRSxJQUFJLENBQUMsS0FBSyxDQUFDLE1BQU0sNlBBQUEsa0xBR3pCLElBQUE7UUFDSCxrQkFBa0IsRUFBRSxFQUFFO1FBQ3RCLE9BQU8sRUFBRSxFQUFFO1FBQ1gsY0FBYyxFQUFFO1lBQ2QsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLGlIQUFBLGNBQ1osRUFBUyxzQkFDWCxLQURFLFNBQVM7U0FFZjtRQUNELGNBQWMsRUFBRSxLQUFLO1FBQ3JCLElBQUksRUFBRSxZQUFZO0tBQ25CLENBQUM7SUFDWSxjQUFTLEdBQUcsNkJBQTZCLENBQUM7SUFDMUMsbUJBQWMsR0FBRyxrQ0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BQztZQUNuRCxPQUFPLEtBQUssRUFBRTtnQkFDWixLQUFJLENBQUMsVUFBVSxDQUFDLEtBQUksQ0FBQyxhQUFhLENBQUMsSUFBSSxDQUFDLDZCQUE2QixDQUFDLENBQUMsRUFBRSxLQUFLLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxFQUFFLElBQUksQ0FBQyxjQUFjLENBQUMsQ0FBQyxDQUFDO2dCQUNoSCxLQUFLLEdBQUcsS0FBSSxDQUFDLDBCQUEwQixDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQzthQUNwRDtRQUNILENBQUMsQ0FBQyxDQUFDO0lBQ0wsQ0FBQztJQUNILGtDQUFDO0FBQUQsQ0FwREEsQUFvREMsQ0FwRHlDLElBQUksQ0FBQyxVQUFVLEdBb0R4RCIsImZpbGUiOiJydWxlcy90ZXJOb0lycmVndWxhcldoaXRlc3BhY2VSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0=
|
||||
115
node_modules/tslint-eslint-rules/dist/rules/terNoMixedSpacesAndTabsRule.js
generated
vendored
Normal file
115
node_modules/tslint-eslint-rules/dist/rules/terNoMixedSpacesAndTabsRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var tsutils_1 = require("tsutils");
|
||||
var RULE_NAME = 'ter-no-mixed-spaces-and-tabs';
|
||||
var OPTION_USE_TABS = 'tabs';
|
||||
var OPTION_USE_SPACES = 'spaces';
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.FAILURE_STRING = function (expected, mixed) {
|
||||
if (!mixed) {
|
||||
return expected + " indentation expected";
|
||||
}
|
||||
return "indentation has mixed tabs and spaces";
|
||||
};
|
||||
Rule.prototype.formatOptions = function (ruleArguments) {
|
||||
var tabs = undefined;
|
||||
var smartTabs = false;
|
||||
var options = ruleArguments[0];
|
||||
if (options !== undefined) {
|
||||
tabs = options.type === OPTION_USE_TABS ? true : options.type === OPTION_USE_SPACES ? false : undefined;
|
||||
smartTabs = options.smartTabs;
|
||||
}
|
||||
return {
|
||||
tabs: tabs,
|
||||
smartTabs: smartTabs
|
||||
};
|
||||
};
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var options = this.formatOptions(this.ruleArguments);
|
||||
return this.applyWithFunction(sourceFile, walk, options);
|
||||
};
|
||||
Rule.metadata = {
|
||||
ruleName: RULE_NAME,
|
||||
description: 'Enforces indentation with unmixed tabs or spaces.',
|
||||
rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using only one of tabs or spaces for indentation leads to more consistent editor behavior,\n cleaner diffs in version control, and easier programmatic manipulation."], ["\n Using only one of tabs or spaces for indentation leads to more consistent editor behavior,\n cleaner diffs in version control, and easier programmatic manipulation."]))),
|
||||
optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n This rule takes an object argument with an optional `type` property which can be set to:\n\n * `", "` enforces consistent spaces for indentation.\n * `", "` enforces consistent tabs for indentation.\n\n If the above is not provided, the rule will enforce either all tabs or all spaces on each\n line, although different lines may differ between tabs and spaces.\n\n Optionally, a `smartTabs` boolean property can be specified. If set to true, smart tabs\n allow mixing tabs and spaces if tabs are used for indentation and spaces for alignment, eg.\n\n function main() {\n // --->const a = 1,\n // --->......b = 2;\n\n const a = 1,\n b = 2;\n }\n "], ["\n This rule takes an object argument with an optional \\`type\\` property which can be set to:\n\n * \\`", "\\` enforces consistent spaces for indentation.\n * \\`", "\\` enforces consistent tabs for indentation.\n\n If the above is not provided, the rule will enforce either all tabs or all spaces on each\n line, although different lines may differ between tabs and spaces.\n\n Optionally, a \\`smartTabs\\` boolean property can be specified. If set to true, smart tabs\n allow mixing tabs and spaces if tabs are used for indentation and spaces for alignment, eg.\n\n function main() {\n // --->const a = 1,\n // --->......b = 2;\n\n const a = 1,\n b = 2;\n }\n "])), OPTION_USE_SPACES, OPTION_USE_TABS),
|
||||
options: {
|
||||
type: 'array',
|
||||
items: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: {
|
||||
type: 'string',
|
||||
enum: [OPTION_USE_TABS, OPTION_USE_SPACES]
|
||||
},
|
||||
smartTabs: {
|
||||
type: 'boolean'
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
}
|
||||
],
|
||||
minLength: 0,
|
||||
maxLength: 1
|
||||
},
|
||||
optionExamples: [
|
||||
Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": { \"type\": \"", "\" } ]\n "], ["\n \"", "\": { \"type\": \"", "\" } ]\n "])), RULE_NAME, OPTION_USE_TABS),
|
||||
Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": { \"type\": \"", "\" } ]\n "], ["\n \"", "\": { \"type\": \"", "\" } ]\n "])), RULE_NAME, OPTION_USE_SPACES),
|
||||
Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": { \"smartTabs\": true } ]\n "], ["\n \"", "\": { \"smartTabs\": true } ]\n "])), RULE_NAME),
|
||||
Lint.Utils.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n \"", "\": { \"type\": \"", "\", \"smartTabs\": true } ]\n "], ["\n \"", "\": { \"type\": \"", "\", \"smartTabs\": true } ]\n "])), RULE_NAME, OPTION_USE_TABS)
|
||||
],
|
||||
type: 'maintainability',
|
||||
typescriptOnly: false
|
||||
};
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
function walk(ctx) {
|
||||
var sourceFile = ctx.sourceFile, _a = ctx.options, tabs = _a.tabs, smartTabs = _a.smartTabs;
|
||||
var regExp;
|
||||
if (tabs === true) {
|
||||
regExp = new RegExp(" " + (smartTabs ? '\\t' : ''));
|
||||
}
|
||||
else if (tabs === false) {
|
||||
regExp = new RegExp("\\t");
|
||||
}
|
||||
else {
|
||||
regExp = new RegExp((smartTabs ? '' : '\\t |') + " \\t");
|
||||
}
|
||||
var failure = Rule.FAILURE_STRING(tabs ? 'tab' : 'space', typeof tabs === 'undefined');
|
||||
for (var _i = 0, _b = tsutils_1.getLineRanges(sourceFile); _i < _b.length; _i++) {
|
||||
var _c = _b[_i], pos = _c.pos, contentLength = _c.contentLength;
|
||||
if (contentLength === 0) {
|
||||
continue;
|
||||
}
|
||||
var line = sourceFile.text.substr(pos, contentLength);
|
||||
var indentEnd = line.search(/\S/);
|
||||
if (indentEnd === 0) {
|
||||
continue;
|
||||
}
|
||||
if (indentEnd === -1) {
|
||||
indentEnd = contentLength;
|
||||
}
|
||||
var indentSpace = line.slice(0, indentEnd);
|
||||
if (!regExp.test(indentSpace)) {
|
||||
continue;
|
||||
}
|
||||
var token = tsutils_1.getTokenAtPosition(sourceFile, pos);
|
||||
if (token.kind !== ts.SyntaxKind.JsxText &&
|
||||
(pos >= token.getStart(sourceFile) || tsutils_1.isPositionInComment(sourceFile, pos, token))) {
|
||||
continue;
|
||||
}
|
||||
ctx.addFailureAt(pos, indentEnd, failure);
|
||||
}
|
||||
}
|
||||
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5vTWl4ZWRTcGFjZXNBbmRUYWJzUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBaUM7QUFDakMsNkJBQStCO0FB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ENBQUMsVUFBVSxDQUFDLElBQUksNkJBQW1CLENBQUMsVUFBVSxFQUFFLEdBQUcsRUFBRSxLQUFLLENBQUMsQ0FBQyxFQUFFO1lBQ3BGLFNBQVM7U0FDVjtRQUNELEdBQUcsQ0FBQyxZQUFZLENBQUMsR0FBRyxFQUFFLFNBQVMsRUFBRSxPQUFPLENBQUMsQ0FBQztLQUMzQztBQUNILENBQUMiLCJmaWxlIjoicnVsZXMvdGVyTm9NaXhlZFNwYWNlc0FuZFRhYnNSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0=
|
||||
46
node_modules/tslint-eslint-rules/dist/rules/terNoProtoRule.js
generated
vendored
Normal file
46
node_modules/tslint-eslint-rules/dist/rules/terNoProtoRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var RULE_NAME = 'ter-no-proto';
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
return this.applyWithFunction(sourceFile, walk);
|
||||
};
|
||||
Rule.FAILURE_STRING = 'The `__proto__` property is deprecated.';
|
||||
Rule.metadata = {
|
||||
ruleName: RULE_NAME,
|
||||
hasFix: false,
|
||||
description: 'disallow the use of `__proto__` property',
|
||||
rationale: '`__proto__` property has been deprecated as of ECMAScript 3.1 and shouldn’t be used in the code. Use getPrototypeOf method instead.',
|
||||
optionsDescription: '',
|
||||
options: {},
|
||||
optionExamples: [Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"", "\": true\n "], ["\n \"", "\": true\n "])), RULE_NAME)],
|
||||
typescriptOnly: false,
|
||||
type: 'functionality'
|
||||
};
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
function walk(ctx) {
|
||||
return ts.forEachChild(ctx.sourceFile, cb);
|
||||
function cb(node) {
|
||||
if ((node.kind === ts.SyntaxKind.Identifier &&
|
||||
node.text === '__proto__' &&
|
||||
node.parent &&
|
||||
node.parent.kind === ts.SyntaxKind.PropertyAccessExpression) ||
|
||||
(node.kind === ts.SyntaxKind.StringLiteral &&
|
||||
node.text === '__proto__')) {
|
||||
return ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
|
||||
}
|
||||
return ts.forEachChild(node, cb);
|
||||
}
|
||||
}
|
||||
var templateObject_1;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5vUHJvdG9SdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQU1BLCtCQUFpQztBQUNqQyw2QkFBK0I7QUFFL0IsSUFBTSxTQUFTLEdBQUcsY0FBYyxDQUFDO0FBRWpDO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUFxQkEsQ0FBQztJQUhRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxPQUFPLElBQUksQ0FBQyxpQkFBaUIsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLENBQUM7SUFDbEQsQ0FBQztJQW5CYSxtQkFBYyxHQUFHLHlDQUF5QyxDQUFDO0lBRTNELGFBQVEsR0FBdUI7UUFDM0MsUUFBUSxFQUFFLFNBQVM7UUFDbkIsTUFBTSxFQUFFLEtBQUs7UUFDYixXQUFXLEVBQUUsMENBQTBDO1FBQ3ZELFNBQVMsRUFDUCxxSUFBcUk7UUFDdkksa0JBQWtCLEVBQUUsRUFBRTtRQUN0QixPQUFPLEVBQUUsRUFBRTtRQUNYLGNBQWMsRUFBRSxD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9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0=
|
||||
48
node_modules/tslint-eslint-rules/dist/rules/terNoScriptUrlRule.js
generated
vendored
Normal file
48
node_modules/tslint-eslint-rules/dist/rules/terNoScriptUrlRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var RULE_NAME = 'ter-no-script-url';
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
return this.applyWithFunction(sourceFile, walk);
|
||||
};
|
||||
Rule.FAILURE_STRING = 'Script URL is a form of eval.';
|
||||
Rule.metadata = {
|
||||
ruleName: RULE_NAME,
|
||||
hasFix: false,
|
||||
description: 'disallow use of `javascript:` urls.',
|
||||
rationale: 'Using `javascript:` URLs is considered by some as a form of `eval`. ' +
|
||||
'Code passed in `javascript:` URLs has to be parsed and evaluated by the browser ' +
|
||||
'in the same way that eval is processed.',
|
||||
optionsDescription: '',
|
||||
options: {},
|
||||
optionExamples: [
|
||||
Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"", "\": true\n "], ["\n \"", "\": true\n "])), RULE_NAME)
|
||||
],
|
||||
typescriptOnly: false,
|
||||
type: 'functionality'
|
||||
};
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
function walk(ctx) {
|
||||
return ts.forEachChild(ctx.sourceFile, cb);
|
||||
function cb(node) {
|
||||
if (node.kind === ts.SyntaxKind.StringLiteral) {
|
||||
var value = node.text.toLowerCase();
|
||||
if (value.indexOf('javascript:') === 0) {
|
||||
return ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
|
||||
}
|
||||
}
|
||||
return ts.forEachChild(node, cb);
|
||||
}
|
||||
}
|
||||
var templateObject_1;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5vU2NyaXB0VXJsUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFJQSwrQkFBaUM7QUFDakMsNkJBQStCO0FBRS9CLElBQU0sU0FBUyxHQUFHLG1CQUFtQixDQUFDO0FBRXRDO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUF5QkEsQ0FBQztJQUhRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxPQUFPLElBQUksQ0FBQyxpQkFBaUIsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLENBQUM7SUFDbEQsQ0FBQztJQXZCYSxtQkFBYyxHQUFHLCtCQUErQixDQUFDO0lBRWpELGFBQVEsR0FBdUI7UUFDM0MsUUFBUSxFQUFFLFNBQVM7UUFDbkIsTUFBTSxFQUFFLEtBQUs7UUFDYixXQUFXLEVBQUUscUNBQXFDO1FBQ2xELFNBQVMsRUFDUCxzRUFBc0U7WUFDdEUsa0ZBQWtGO1lBQ2xGLHlDQUF5QztRQUMzQyxrQkFBa0IsRUFBRSxFQUFFO1FBQ3RCLE9BQU8sRUFBRSxFQUFFO1FBQ1gsY0FBYyxFQUFFO1lBQ2QsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLCtHQUFBLGNBQ1osRUFBUyxvQkFDWCxLQURFLFNBQVM7U0FFZjtRQUNELGNBQWMsRUFBRSxLQUFLO1FBQ3JCLElBQUksRUFBRSxlQUFlO0tBQ3RCLENBQUM7SUFLSixXQUFDO0NBekJELEFBeUJDLENBekJ5QixJQUFJLENBQUMsS0FBSyxDQUFDLFlBQVksR0F5QmhEO0FBekJZLG9CQUFJO0FBMkJqQixTQUFTLElBQUksQ0FBQyxHQUEyQjtJQUN2QyxPQUFPLEVBQUUsQ0FBQyxZQUFZLENBQUMsR0FBRyxDQUFDLFVBQVUsRUFBRSxFQUFFLENBQUMsQ0FBQztJQUUzQyxTQUFTLEVBQUUsQ0FBQyxJQUFhO1FBQ3ZCLElBQUksSUFBSSxDQUFDLElBQUksS0FBSyxFQUFFLENBQUMsVUFBVSxDQUFDLGFBQWEsRUFBRTtZQUM3QyxJQUFNLEtBQUssR0FBSSxJQUF5QixDQUFDLElBQUksQ0FBQyxXQUFXLEVBQUUsQ0FBQztZQUM1RCxJQUFJLEtBQUssQ0FBQyxPQUFPLENBQUMsYUFBYSxDQUFDLEtBQUssQ0FBQyxFQUFFO2dCQUN0QyxPQUFPLEdBQUcsQ0FBQyxnQkFBZ0IsQ0FBQyxJQUFJLEVBQUUsSUFBSSxDQUFDLGNBQWMsQ0FBQyxDQUFDO2FBQ3hEO1NBQ0Y7UUFDRCxPQUFPLEVBQUUsQ0FBQyxZQUFZLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxDQUFDO0lBQ25DLENBQUM7QUFDSCxDQUFDIiwiZmlsZSI6InJ1bGVzL3Rlck5vU2NyaXB0VXJsUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9
|
||||
75
node_modules/tslint-eslint-rules/dist/rules/terNoSelfCompareRule.js
generated
vendored
Normal file
75
node_modules/tslint-eslint-rules/dist/rules/terNoSelfCompareRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var RULE_NAME = 'ter-no-self-compare';
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
return this.applyWithWalker(new NoSelfCompareWalker(sourceFile, this.ruleName, new Set(this.ruleArguments.map(String))));
|
||||
};
|
||||
Rule.FAILURE_STRING = 'Comparing to itself is potentially pointless.';
|
||||
Rule.metadata = {
|
||||
ruleName: RULE_NAME,
|
||||
hasFix: false,
|
||||
description: 'disallow comparisons where both sides are exactly the same',
|
||||
rationale: 'Comparing a variable against itself is usually an error, ' +
|
||||
'either a typo or refactoring error. It is confusing to the reader ' +
|
||||
'and may potentially introduce a runtime error.',
|
||||
optionsDescription: '',
|
||||
options: {},
|
||||
optionExamples: [
|
||||
Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"", "\": true\n "], ["\n \"", "\": true\n "])), RULE_NAME)
|
||||
],
|
||||
typescriptOnly: false,
|
||||
type: 'maintainability'
|
||||
};
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var NoSelfCompareWalker = (function (_super) {
|
||||
tslib_1.__extends(NoSelfCompareWalker, _super);
|
||||
function NoSelfCompareWalker() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
NoSelfCompareWalker.prototype.isComparisonOperator = function (node) {
|
||||
var operators = new Set([
|
||||
ts.SyntaxKind.EqualsEqualsEqualsToken,
|
||||
ts.SyntaxKind.EqualsEqualsToken,
|
||||
ts.SyntaxKind.ExclamationEqualsEqualsToken,
|
||||
ts.SyntaxKind.ExclamationEqualsToken,
|
||||
ts.SyntaxKind.GreaterThanToken,
|
||||
ts.SyntaxKind.LessThanToken,
|
||||
ts.SyntaxKind.GreaterThanEqualsToken,
|
||||
ts.SyntaxKind.LessThanEqualsToken
|
||||
]);
|
||||
return operators.has(node.operatorToken.kind);
|
||||
};
|
||||
NoSelfCompareWalker.prototype.hasSameToken = function (left, right) {
|
||||
return left.kind === right.kind && left.getText() === right.getText();
|
||||
};
|
||||
NoSelfCompareWalker.prototype.walk = function (sourceFile) {
|
||||
var _this = this;
|
||||
var cb = function (node) {
|
||||
if (ts.isBinaryExpression(node)) {
|
||||
var nodeExpr = node;
|
||||
if (_this.isComparisonOperator(nodeExpr) &&
|
||||
_this.hasSameToken(nodeExpr.left, nodeExpr.right)) {
|
||||
_this.addFailureAt(nodeExpr.operatorToken.getStart(), nodeExpr.operatorToken.getWidth(), Rule.FAILURE_STRING);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return ts.forEachChild(node, cb);
|
||||
}
|
||||
};
|
||||
return ts.forEachChild(sourceFile, cb);
|
||||
};
|
||||
return NoSelfCompareWalker;
|
||||
}(Lint.AbstractWalker));
|
||||
var templateObject_1;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5vU2VsZkNvbXBhcmVSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUFpQztBQUNqQyw2QkFBK0I7QUFFL0IsSUFBTSxTQUFTLEdBQUcscUJBQXFCLENBQUM7QUFFeEM7SUFBMEIsZ0NBQXVCO0lBQWpEOztJQStCQSxDQUFDO0lBVFEsb0JBQUssR0FBWixVQUFhLFVBQXlCO1FBQ3BDLE9BQU8sSUFBSSxDQUFDLGVBQWUsQ0FDekIsSUFBSSxtQkFBbUIsQ0FDckIsVUFBVSxFQUNWLElBQUksQ0FBQyxRQUFRLEVBQ2IsSUFBSSxHQUFHLENBQUMsSUFBSSxDQUFDLGFBQWEsQ0FBQyxHQUFHLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FDeEMsQ0FDRixDQUFDO0lBQ0osQ0FBQztJQTdCYSxtQkFBYyxHQUFHLCtDQUErQyxDQUFDO0lBRWpFLGFBQVEsR0FBdUI7UUFDM0MsUUFBUSxFQUFFLFNBQVM7UUFDbkIsTUFBTSxFQUFFLEtBQUs7U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wiZmlsZSI6InJ1bGVzL3Rlck5vU2VsZkNvbXBhcmVSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0=
|
||||
51
node_modules/tslint-eslint-rules/dist/rules/terNoSparseArraysRule.js
generated
vendored
Normal file
51
node_modules/tslint-eslint-rules/dist/rules/terNoSparseArraysRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var RULE_NAME = 'ter-no-sparse-arrays';
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
var walker = new NoSparseArraysWalker(sourceFile, this.getOptions());
|
||||
return this.applyWithWalker(walker);
|
||||
};
|
||||
Rule.metadata = {
|
||||
ruleName: RULE_NAME,
|
||||
description: 'disallow sparse arrays (recommended)',
|
||||
rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Invalid or irregular whitespace causes issues with ECMAScript 5 parsers and also makes code\n harder to debug in a similar nature to mixed tabs and spaces.\n "], ["\n Invalid or irregular whitespace causes issues with ECMAScript 5 parsers and also makes code\n harder to debug in a similar nature to mixed tabs and spaces.\n "]))),
|
||||
optionsDescription: '',
|
||||
options: {},
|
||||
optionExamples: [
|
||||
Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n \"", "\": [true]\n "], ["\n \"", "\": [true]\n "])), RULE_NAME)
|
||||
],
|
||||
typescriptOnly: false,
|
||||
type: 'typescript'
|
||||
};
|
||||
Rule.FAILURE_STRING = 'unexpected comma in middle of array';
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var NoSparseArraysWalker = (function (_super) {
|
||||
tslib_1.__extends(NoSparseArraysWalker, _super);
|
||||
function NoSparseArraysWalker() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
NoSparseArraysWalker.prototype.visitArrayLiteralExpression = function (node) {
|
||||
this.validateNoSparseArray(node);
|
||||
_super.prototype.visitArrayLiteralExpression.call(this, node);
|
||||
};
|
||||
NoSparseArraysWalker.prototype.validateNoSparseArray = function (node) {
|
||||
var hasEmptySlot = node.elements.some(function (el) { return el.kind === ts.SyntaxKind.OmittedExpression; });
|
||||
if (hasEmptySlot) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
|
||||
}
|
||||
};
|
||||
return NoSparseArraysWalker;
|
||||
}(Lint.RuleWalker));
|
||||
var templateObject_1, templateObject_2;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5vU3BhcnNlQXJyYXlzUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBaUM7QUFDakMsNkJBQStCO0FBRS9CLElBQU0sU0FBUyxHQUFHLHNCQUFzQixDQUFDO0FBRXpDO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUF3QkEsQ0FBQztJQUpRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxJQUFNLE1BQU0sR0FBRyxJQUFJLG9CQUFvQixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQztRQUN2RSxPQUFPLElBQUksQ0FBQyxlQUFlLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdEMsQ0FBQztJQXRCYSxhQUFRLEdBQXVCO1FBQzNDLFFBQVEsRUFBRSxTQUFTO1FBQ25CLFdBQVcsRUFB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xFQUFFLElBQUksQ0FBQyxjQUFjLENBQUMsQ0FBQyxDQUFDO1NBQzVGO0lBQ0gsQ0FBQztJQUNILDJCQUFDO0FBQUQsQ0FiQSxBQWFDLENBYmtDLElBQUksQ0FBQyxVQUFVLEdBYWpEIiwiZmlsZSI6InJ1bGVzL3Rlck5vU3BhcnNlQXJyYXlzUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9
|
||||
43
node_modules/tslint-eslint-rules/dist/rules/terNoTabsRule.js
generated
vendored
Normal file
43
node_modules/tslint-eslint-rules/dist/rules/terNoTabsRule.js
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var Lint = require("tslint");
|
||||
var RULE_NAME = 'ter-no-tabs';
|
||||
var Rule = (function (_super) {
|
||||
tslib_1.__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
return this.applyWithFunction(sourceFile, walk);
|
||||
};
|
||||
Rule.FAILURE_STRING = 'Unexpected tab character.';
|
||||
Rule.metadata = {
|
||||
ruleName: RULE_NAME,
|
||||
hasFix: false,
|
||||
description: 'disallow all tabs',
|
||||
rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n This rule looks for tabs anywhere inside a file: code, comments or anything else, and disallows their usage.\n "], ["\n This rule looks for tabs anywhere inside a file: code, comments or anything else, and disallows their usage.\n "]))),
|
||||
optionsDescription: '',
|
||||
options: {},
|
||||
optionExamples: [
|
||||
Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n \"", "\": true\n "], ["\n \"", "\": true\n "])), RULE_NAME)
|
||||
],
|
||||
typescriptOnly: false,
|
||||
type: 'style'
|
||||
};
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
function walk(ctx) {
|
||||
var TAB_REGEX = /\t/;
|
||||
var lines = ctx.sourceFile.text.split(/\n/g);
|
||||
lines.forEach(function (line, i) {
|
||||
var match = TAB_REGEX.exec(line);
|
||||
if (match) {
|
||||
ctx.addFailureAt(ctx.sourceFile.getPositionOfLineAndCharacter(i, match.index), 1, Rule.FAILURE_STRING);
|
||||
}
|
||||
});
|
||||
}
|
||||
var templateObject_1, templateObject_2;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5vVGFic1J1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBUUEsNkJBQStCO0FBRS9CLElBQU0sU0FBUyxHQUFHLGFBQWEsQ0FBQztBQUVoQztJQUEwQixnQ0FBdUI7SUFBakQ7O0lBdUJBLENBQUM7SUFIUSxvQkFBSyxHQUFaLFVBQWEsVUFBeUI7UUFDcEMsT0FBTyxJQUFJLENBQUMsaUJBQWlCLENBQUMsVUFBVSxFQUFFLElBQUksQ0FBQyxDQUFDO0lBQ2xELENBQUM7SUFyQmEsbUJBQWMsR0FBRywyQkFBMkIsQ0FBQztJQUM3QyxhQUFRLEdBQXVCO1FBQzNDLFFBQVEsRUFBRSxTQUFTO1FBQ25CLE1BQU0sRUFBRSxLQUFLO1FBQ2IsV0FBVyxFQUFFLG1CQUFtQjtRQUNoQyxTQUFTLEVBQUUsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLHlNQUFBLDhIQUV6QixJQUFBO1FBQ0gsa0JBQWtCLEVBQUUsRUFBRTtRQUN0QixPQUFPLEVBQUUsRUFBRTtRQUNYLGNBQWMsRUFBRTtZQUNkLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSwrR0FBQSxjQUNaLEVBQVMsb0JBQ1gsS0FERSxTQUFTO1NBRWY7UUFDRCxjQUFjLEVBQUUsS0FBSztRQUNyQixJQUFJLEVBQUUsT0FBTztLQUNkLENBQUM7SUFLSixXQUFDO0NBdkJELEFBdUJDLENBdkJ5QixJQUFJLENBQUMsS0FBSyxDQUFDLFlBQVksR0F1QmhEO0FBdkJZLG9CQUFJO0FBeUJqQixTQUFTLElBQUksQ0FBQyxHQUEyQjtJQUN2QyxJQUFNLFNBQVMsR0FBRyxJQUFJLENBQUM7SUFDdkIsSUFBTSxLQUFLLEdBQUcsR0FBRyxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLEtBQUssQ0FBQyxDQUFDO0lBRS9DLEtBQUssQ0FBQyxPQUFPLENBQUMsVUFBQyxJQUFJLEVBQUUsQ0FBQztRQUNwQixJQUFNLEtBQUssR0FBRyxTQUFTLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDO1FBQ25DLElBQUksS0FBSyxFQUFFO1lBQ1QsR0FBRyxDQUFDLFlBQVksQ0FDZCxHQUFHLENBQUMsVUFBVSxDQUFDLDZCQUE2QixDQUFDLENBQUMsRUFBRSxLQUFLLENBQUMsS0FBSyxDQUFDLEVBQzVELENBQUMsRUFDRCxJQUFJLENBQUMsY0FBYyxDQUNwQixDQUFDO1NBQ0g7SUFDSCxDQUFDLENBQUMsQ0FBQztBQUNMLENBQUMiLCJmaWxlIjoicnVsZXMvdGVyTm9UYWJzUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9
|
||||
229
node_modules/tslint-eslint-rules/dist/rules/terPaddedBlocksRule.js
generated
vendored
Normal file
229
node_modules/tslint-eslint-rules/dist/rules/terPaddedBlocksRule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
188
node_modules/tslint-eslint-rules/dist/rules/terPreferArrowCallbackRule.js
generated
vendored
Normal file
188
node_modules/tslint-eslint-rules/dist/rules/terPreferArrowCallbackRule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
336
node_modules/tslint-eslint-rules/dist/rules/validJsdocRule.js
generated
vendored
Normal file
336
node_modules/tslint-eslint-rules/dist/rules/validJsdocRule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue