tslint-eslint-rules
Advanced tools
Comparing version 2.0.1 to 2.1.0
## Change Log | ||
### v2.1.0 (2016/10/03 19:29 +00:00) | ||
- [a3cca1b](https://github.com/buzinas/tslint-eslint-rules/commit/a3cca1b07641a58d4d6e69cc992270ae4e35b5e2) [docs] v2.1.0 - support for Node v4 and v0.10 (@buzinas) | ||
- [#128](https://github.com/buzinas/tslint-eslint-rules/pull/128) Merge pull request #128 from blakeembrey/0.10-support (@blakeembrey) | ||
- [adc290c](https://github.com/buzinas/tslint-eslint-rules/commit/adc290c02f1299251637ce5d448a3c152b58dc56) Support node 0.10 (@blakeembrey) | ||
- [4785e36](https://github.com/buzinas/tslint-eslint-rules/commit/4785e3637166072d10fec61c9bf8a3350aa05733) [feat] added support for Node v4.x (@buzinas) | ||
- [83ad6e3](https://github.com/buzinas/tslint-eslint-rules/commit/83ad6e3c89eb88a55707502c1251255771805e4a) Use `es5` as the TypeScript target (@blakeembrey) | ||
- [521ab3b](https://github.com/buzinas/tslint-eslint-rules/commit/521ab3b7714e01f64b76563d82f56de3863ae7e8) [docs] improved readme (@buzinas) | ||
- [b74c5cc](https://github.com/buzinas/tslint-eslint-rules/commit/b74c5ccbb00673b293120cf9e24f3e9f73698bc2) Merge remote-tracking branch 'upstream/master' into rulesMatching (@jcristovao) | ||
- [4826f33](https://github.com/buzinas/tslint-eslint-rules/commit/4826f33799780e911c2a0124ea7068ff52e64c3d) more wrong or missing links in README.md (@jcristovao) | ||
- [#123](https://github.com/buzinas/tslint-eslint-rules/pull/123) Merge pull request #123 from blakeembrey/handle-callback-err-patch (@blakeembrey) | ||
- [3e4a5c3](https://github.com/buzinas/tslint-eslint-rules/commit/3e4a5c3c0be0c0c3e69491fffb9cb3e5e4425d65) Refactor the `handle-callback-err` rule (@blakeembrey) | ||
- [#122](https://github.com/buzinas/tslint-eslint-rules/pull/122) Merge pull request #122 from blakeembrey/patch-handle-callback-err-rule (@blakeembrey) | ||
- [a9db8df](https://github.com/buzinas/tslint-eslint-rules/commit/a9db8dfe12f25586fb181a78aea36e0eb01b8eab) Tidy up error arg check for `handle-callback-err` (@blakeembrey) | ||
- [0555fe1](https://github.com/buzinas/tslint-eslint-rules/commit/0555fe129c7f6c08dbdf6407abdfbfcb00e6955c) [docs] v2.0.1 (@buzinas) | ||
- [#121](https://github.com/buzinas/tslint-eslint-rules/pull/121) Merge pull request #121 from blakeembrey/patch-handle-callback-err-rule (@blakeembrey) | ||
- [caf6ec6](https://github.com/buzinas/tslint-eslint-rules/commit/caf6ec62be772297c18a9dd56d280d9b2dac076a) Patch `handle-callback-err` (@blakeembrey) | ||
- [7f8ec85](https://github.com/buzinas/tslint-eslint-rules/commit/7f8ec857bed0d1088ed2232c80944d8475ffdfeb) [docs] v2.0.0 (closes #116) (@buzinas) | ||
### v2.0.0 (2016/10/01 06:12 +00:00) | ||
@@ -10,2 +28,3 @@ - [a8f558f](https://github.com/buzinas/tslint-eslint-rules/commit/a8f558f8b25ec0965c1d31bac5ed603713f569f6) [feat] updated TypeScript dependency to v2.0 (@buzinas) | ||
- [31afa69](https://github.com/buzinas/tslint-eslint-rules/commit/31afa69d1718bda1b6d7b9f16c77ef1eb157bb37) Fix `no-ex-assign` rule on non-assignment ops (@blakeembrey) | ||
- [279c1bb](https://github.com/buzinas/tslint-eslint-rules/commit/279c1bbd14408d42bb2f662aa01ad7f57a110559) README: fix ident error, only-arrow-function (@jcristovao) | ||
- [36eb552](https://github.com/buzinas/tslint-eslint-rules/commit/36eb5529a1cfba10c79ecf8eede72403cc197e07) [docs] v1.6.0 (@buzinas) | ||
@@ -12,0 +31,0 @@ |
"use strict"; | ||
const https = require('https'); | ||
const rules_1 = require('./rules'); | ||
var es6_promise_1 = require('es6-promise'); | ||
var https = require('https'); | ||
var rules_1 = require('./rules'); | ||
function camelCaseToDash(str) { | ||
@@ -8,7 +9,7 @@ return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); | ||
function arrayDiff(source, target) { | ||
return source.filter(item => target.indexOf(item) === -1); | ||
return source.filter(function (item) { return target.indexOf(item) === -1; }); | ||
} | ||
function requestFromGithub(path, callback) { | ||
const options = { | ||
path, | ||
var options = { | ||
path: path, | ||
host: 'api.github.com', | ||
@@ -19,13 +20,13 @@ headers: { | ||
}; | ||
https.get(options, (resp) => { | ||
https.get(options, function (resp) { | ||
resp.setEncoding('utf8'); | ||
const buffer = []; | ||
resp.on('data', (chunk) => { | ||
var buffer = []; | ||
resp.on('data', function (chunk) { | ||
buffer.push(chunk); | ||
}); | ||
resp.on('end', () => { | ||
const data = JSON.parse(buffer.join('')); | ||
resp.on('end', function () { | ||
var data = JSON.parse(buffer.join('')); | ||
callback(data); | ||
}); | ||
}).on('error', (e) => { | ||
}).on('error', function (e) { | ||
console.error(e); | ||
@@ -35,16 +36,16 @@ }); | ||
function compareToESLint() { | ||
return new Promise((fulfill, reject) => { | ||
requestFromGithub('/repos/eslint/eslint/contents/lib/rules', (data) => { | ||
const rules = data | ||
.filter(obj => obj.name.endsWith('.js')) | ||
.map(obj => obj.name.substring(0, obj.name.length - 3)); | ||
const esRules = Object.keys(rules_1.ruleESMap); | ||
const missing = arrayDiff(rules.map(x => rules_1.toCamelCase(x)), esRules); | ||
const deprecated = arrayDiff(esRules, rules.map(x => rules_1.toCamelCase(x))); | ||
const buffer = []; | ||
return new es6_promise_1.Promise(function (fulfill, reject) { | ||
requestFromGithub('/repos/eslint/eslint/contents/lib/rules', function (data) { | ||
var rules = data | ||
.filter(function (obj) { return obj.name.endsWith('.js'); }) | ||
.map(function (obj) { return obj.name.substring(0, obj.name.length - 3); }); | ||
var esRules = Object.keys(rules_1.ruleESMap); | ||
var missing = arrayDiff(rules.map(function (x) { return rules_1.toCamelCase(x); }), esRules); | ||
var deprecated = arrayDiff(esRules, rules.map(function (x) { return rules_1.toCamelCase(x); })); | ||
var buffer = []; | ||
if (missing.length) { | ||
buffer.push('Missing ESLint rules (http://eslint.org/docs/rules):'); | ||
missing.forEach((rule) => { | ||
const name = camelCaseToDash(rule); | ||
buffer.push(`- ${name}`); | ||
missing.forEach(function (rule) { | ||
var name = camelCaseToDash(rule); | ||
buffer.push("- " + name); | ||
}); | ||
@@ -54,5 +55,5 @@ } | ||
buffer.push('Deprecated ESLint rules:'); | ||
deprecated.forEach((rule) => { | ||
const name = camelCaseToDash(rule); | ||
buffer.push(`- ${name}`); | ||
deprecated.forEach(function (rule) { | ||
var name = camelCaseToDash(rule); | ||
buffer.push("- " + name); | ||
}); | ||
@@ -70,11 +71,11 @@ } | ||
function compareToTSLint() { | ||
return new Promise((fulfill, reject) => { | ||
requestFromGithub('/repos/palantir/tslint/contents/src/rules', (data) => { | ||
const rules = data | ||
.filter(obj => obj.name.endsWith('.ts')) | ||
.map(obj => obj.name.substring(0, obj.name.length - 7)); | ||
const notInUse = require('../../src/readme/unusedTSLintRules.json'); | ||
notInUse.forEach((name) => { | ||
const camel = rules_1.toCamelCase(name); | ||
const index = rules.indexOf(camel); | ||
return new es6_promise_1.Promise(function (fulfill, reject) { | ||
requestFromGithub('/repos/palantir/tslint/contents/src/rules', function (data) { | ||
var rules = data | ||
.filter(function (obj) { return obj.name.endsWith('.ts'); }) | ||
.map(function (obj) { return obj.name.substring(0, obj.name.length - 7); }); | ||
var notInUse = require('../../src/readme/unusedTSLintRules.json'); | ||
notInUse.forEach(function (name) { | ||
var camel = rules_1.toCamelCase(name); | ||
var index = rules.indexOf(camel); | ||
if (index > -1) { | ||
@@ -84,10 +85,10 @@ rules.splice(index, 1); | ||
}); | ||
const tsRules = Object.keys(rules_1.ruleTSMap); | ||
const missing = arrayDiff(rules, tsRules); | ||
const buffer = []; | ||
var tsRules = Object.keys(rules_1.ruleTSMap); | ||
var missing = arrayDiff(rules, tsRules); | ||
var buffer = []; | ||
if (missing.length) { | ||
buffer.push('Missing TSLint rules (http://palantir.github.io/tslint/rules):'); | ||
missing.forEach((rule) => { | ||
const name = camelCaseToDash(rule); | ||
buffer.push(`- ${name}`); | ||
missing.forEach(function (rule) { | ||
var name = camelCaseToDash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QWUsbUJBSmhCO0FBS0MiLCJmaWxlIjoicmVhZG1lL2ZldGNoLmpzIiwic291cmNlUm9vdCI6ImQ6XFxwcm9qZWN0c1xcdHNsaW50LWVzbGludC1ydWxlc1xcc3JjIn0= |
"use strict"; | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const rules_1 = require('./rules'); | ||
var es6_promise_1 = require('es6-promise'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var rules_1 = require('./rules'); | ||
function formatUsage(usage) { | ||
@@ -10,13 +11,13 @@ return usage.replace(/~~~/g, '```').replace(/(^[ \t]*\n)/gm, '\n').replace(/^ /mg, ''); | ||
function createRuleTable() { | ||
const buffer = []; | ||
let category = null; | ||
rules_1.rules.forEach((rule) => { | ||
var buffer = []; | ||
var category = null; | ||
rules_1.rules.forEach(function (rule) { | ||
if (category !== rule.category) { | ||
category = rule.category; | ||
buffer.push(`\n### ${category}\n\n`); | ||
buffer.push(`${rules_1.categories[category]}\n\n`); | ||
buffer.push("\n### " + category + "\n\n"); | ||
buffer.push(rules_1.categories[category] + "\n\n"); | ||
buffer.push('| :grey_question: | ESLint | TSLint | Description |\n'); | ||
buffer.push('| :--- | :---: | :---: | :--- |\n'); | ||
} | ||
let available; | ||
var available; | ||
if (rule.available) { | ||
@@ -28,9 +29,9 @@ available = rule.provider === 'native' ? ':ballot_box_with_check:' : ':white_check_mark:'; | ||
} | ||
const tsRuleName = rule.tslintUrl ? `[${rule.tslintRule}](${rule.tslintUrl})` : rule.tslintRule; | ||
const tsRule = rule.tslintRule === 'Not applicable' ? 'Not applicable' : tsRuleName; | ||
var tsRuleName = rule.tslintUrl ? "[" + rule.tslintRule + "](" + rule.tslintUrl + ")" : rule.tslintRule; | ||
var tsRule = rule.tslintRule === 'Not applicable' ? 'Not applicable' : tsRuleName; | ||
buffer.push('|'); | ||
buffer.push(`${available}|`); | ||
buffer.push(`[${rule.eslintRule}](${rule.eslintUrl})|`); | ||
buffer.push(`${tsRule}|`); | ||
buffer.push(`${rule.description}|`); | ||
buffer.push(available + "|"); | ||
buffer.push("[" + rule.eslintRule + "](" + rule.eslintUrl + ")|"); | ||
buffer.push(tsRule + "|"); | ||
buffer.push(rule.description + "|"); | ||
buffer.push('\n'); | ||
@@ -41,10 +42,10 @@ }); | ||
function updateReadme(cb) { | ||
fs.readFile('README.md', 'utf8', (readErr, data) => { | ||
fs.readFile('README.md', 'utf8', function (readErr, data) { | ||
if (readErr) { | ||
return console.error(readErr); | ||
} | ||
let content = data.replace(/^<!-- Start:AutoTable((.*?(\n))+.*?)End:AutoTable -->$/gm, '<!-- Start:AutoTable:: Modify `src/readme/rules.ts` and run `gulp readme` to update block -->\n' + | ||
var content = data.replace(/^<!-- Start:AutoTable((.*?(\n))+.*?)End:AutoTable -->$/gm, '<!-- Start:AutoTable:: Modify `src/readme/rules.ts` and run `gulp readme` to update block -->\n' + | ||
createRuleTable() + | ||
'<!-- End:AutoTable -->'); | ||
fs.writeFile('README.md', content, 'utf8', (writeErr) => { | ||
fs.writeFile('README.md', content, 'utf8', function (writeErr) { | ||
if (writeErr) { | ||
@@ -60,16 +61,13 @@ return console.error(writeErr); | ||
function createRuleContent(rule) { | ||
const usage = rule.usage ? `\n\n### Usage\n\n${formatUsage(rule.usage)}` : ''; | ||
const note = rule.note ? `\n\n### Note\n\n${rule.note}\n` : ''; | ||
return `## ${rule.tslintRule} (ESLint: [${rule.eslintRule}](${rule.eslintUrl})) | ||
${rule.description}${usage}${note} | ||
`; | ||
var usage = rule.usage ? "\n\n### Usage\n\n" + formatUsage(rule.usage) : ''; | ||
var note = rule.note ? "\n\n### Note\n\n" + rule.note + "\n" : ''; | ||
return "## " + rule.tslintRule + " (ESLint: [" + rule.eslintRule + "](" + rule.eslintUrl + "))\n\n" + rule.description + usage + note + "\n"; | ||
} | ||
function updateRuleFile(name, rule) { | ||
const baseUrl = 'https://github.com/buzinas/tslint-eslint-rules/blob/master'; | ||
const docFileName = `src/docs/rules/${name}Rule.md`; | ||
return new Promise((fulfill, reject) => { | ||
fs.readFile(docFileName, 'utf8', (readErr, data) => { | ||
rule.tslintUrl = rule.tslintUrl || `${baseUrl}/${docFileName}`; | ||
let content = readErr || !data ? '<!-- Start:AutoDoc\n End:AutoDoc -->' : data; | ||
var baseUrl = 'https://github.com/buzinas/tslint-eslint-rules/blob/master'; | ||
var docFileName = "src/docs/rules/" + name + "Rule.md"; | ||
return new es6_promise_1.Promise(function (fulfill, reject) { | ||
fs.readFile(docFileName, 'utf8', function (readErr, data) { | ||
rule.tslintUrl = rule.tslintUrl || baseUrl + "/" + docFileName; | ||
var content = readErr || !data ? '<!-- Start:AutoDoc\n End:AutoDoc -->' : data; | ||
content = content.replace(/^<!-- Start:AutoDoc((.*?(\n))+.*?)End:AutoDoc -->$/gm, [ | ||
@@ -80,7 +78,7 @@ '<!-- Start:AutoDoc:: Modify `src/readme/rules.ts` and run `gulp readme` to update block -->\n', | ||
].join('')); | ||
fs.writeFile(docFileName, content, 'utf8', (writeErr) => { | ||
fs.writeFile(docFileName, content, 'utf8', function (writeErr) { | ||
if (writeErr) { | ||
return reject(writeErr); | ||
} | ||
console.log(` - ${name}`); | ||
console.log(" - " + name); | ||
fulfill(); | ||
@@ -92,12 +90,12 @@ }); | ||
function updateRuleFiles(cb) { | ||
const ruleDir = 'src/rules/'; | ||
const allFiles = fs.readdirSync(ruleDir).filter(file => fs.lstatSync(path.join(ruleDir, file)).isFile()); | ||
const ruleNames = allFiles | ||
.filter(name => name.endsWith('.ts')) | ||
.map(name => name.substr(0, name.length - 7)); | ||
const allPromises = []; | ||
ruleNames.forEach((name) => { | ||
var ruleDir = 'src/rules/'; | ||
var allFiles = fs.readdirSync(ruleDir).filter(function (file) { return fs.lstatSync(path.join(ruleDir, file)).isFile(); }); | ||
var ruleNames = allFiles | ||
.filter(function (name) { return /\.ts$/.test(name); }) | ||
.map(function (name) { return name.substr(0, name.length - 7); }); | ||
var allPromises = []; | ||
ruleNames.forEach(function (name) { | ||
allPromises.push(updateRuleFile(name, rules_1.ruleTSMap[name])); | ||
}); | ||
Promise.all(allPromises).then(() => { | ||
es6_promise_1.Promise.all(allPromises).then(function () { | ||
console.log('[DONE] processing rule files ...'); | ||
@@ -109,2 +107,2 @@ cb(); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJlYWRtZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsTUFBWSxFQUFFLFdBQU0sSUFBSSxDQUFDLENBQUE7QUFDekIsTUFBWSxJQUFJLFdBQU0sTUFBTSxDQUFDLENBQUE7QUFDN0Isd0JBQW9ELFNBQVMsQ0FBQyxDQUFBO0FBRTlELHFCQUFxQixLQUFLO0lBQ3hCLE1BQU0sQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLE1BQU0sRUFBRSxLQUFLLENBQUMsQ0FBQyxPQUFPLENBQUMsZUFBZSxFQUFFLElBQUksQ0FBQyxDQUFDLE9BQU8sQ0FBQyxTQUFTLEVBQUUsRUFBRSxDQUFDLENBQUM7QUFDNUYsQ0FBQztBQTRHQyxtQkFBVyxlQTVHWjtBQUVEO0lBQ0UsTUFBTSxNQUFNLEdBQUcsRUFBRSxDQUFDO0lBQ2xCLElBQUksUUFBUSxHQUFHLElBQUksQ0FBQztJQUNwQixhQUFLLENBQUMsT0FBTyxDQUFDLENBQUMsSUFBSTtRQUNqQixFQUFFLENBQUMsQ0FBQyxRQUFRLEtBQUssSUFBSSxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUM7WUFDL0IsUUFBUSxHQUFHLElBQUksQ0FBQyxRQUFRLENBQUM7WUFDekIsTUFBTSxDQUFDLElBQUksQ0FBQyxTQUFTLFFBQVEsTUFBTSxDQUFDLENBQUM7WUFDckMsTUFBTSxDQUFDLElBQUksQ0FBQyxHQUFHLGtCQUFVLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQyxDQUFDO1lBQzNDLE1BQU0sQ0FBQyxJ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ALWAYS = 'always'; | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new ArrayBracketSpacingWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var OPTION_ALWAYS = 'always'; | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
Rule.prototype.apply = function (sourceFile) { | ||
var walker = new ArrayBracketSpacingWalker(sourceFile, this.getOptions()); | ||
return this.applyWithWalker(walker); | ||
} | ||
} | ||
Rule.FAILURE_STRING = { | ||
noBeginningSpace: 'There should be no space after "["', | ||
noEndingSpace: 'There should be no space before "]"', | ||
requiredBeginningSpace: 'A space is required after "["', | ||
requiredEndingSpace: 'A space is required before "]"' | ||
}; | ||
}; | ||
Rule.FAILURE_STRING = { | ||
noBeginningSpace: 'There should be no space after "["', | ||
noEndingSpace: 'There should be no space before "]"', | ||
requiredBeginningSpace: 'A space is required after "["', | ||
requiredEndingSpace: 'A space is required before "]"' | ||
}; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
class ArrayBracketSpacingWalker extends Lint.RuleWalker { | ||
constructor(sourceFile, options) { | ||
super(sourceFile, options); | ||
var ArrayBracketSpacingWalker = (function (_super) { | ||
__extends(ArrayBracketSpacingWalker, _super); | ||
function ArrayBracketSpacingWalker(sourceFile, options) { | ||
_super.call(this, sourceFile, options); | ||
this.singleValueException = false; | ||
this.objectsInArraysException = false; | ||
this.arraysInArraysException = false; | ||
const ruleOptions = this.getOptions(); | ||
var ruleOptions = this.getOptions(); | ||
this.spaced = this.hasOption(OPTION_ALWAYS) || (ruleOptions && ruleOptions.length === 0); | ||
@@ -32,20 +43,20 @@ if (ruleOptions[1]) { | ||
} | ||
visitNode(node) { | ||
ArrayBracketSpacingWalker.prototype.visitNode = function (node) { | ||
if (node.kind === ts.SyntaxKind.ArrayBindingPattern) { | ||
this.validateSquareBrackets(node); | ||
} | ||
super.visitNode(node); | ||
} | ||
visitArrayLiteralExpression(node) { | ||
_super.prototype.visitNode.call(this, node); | ||
}; | ||
ArrayBracketSpacingWalker.prototype.visitArrayLiteralExpression = function (node) { | ||
this.validateSquareBrackets(node); | ||
super.visitArrayLiteralExpression(node); | ||
} | ||
validateSquareBrackets(node) { | ||
const children = node.getChildren(); | ||
const isSpaceAfterOpeningBracket = this.isSpaceBetween(children[0], children[1]); | ||
const isBreakAfterOpeningBracket = this.isLineBreakBetween(children[0], children[1]); | ||
const isSpaceBeforeClosingBracket = this.isSpaceBetween(children[children.length - 2], children[children.length - 1]); | ||
const isBreakBeforeClosingBracket = this.isLineBreakBetween(children[children.length - 2], children[children.length - 1]); | ||
const syntaxList = node.getChildren()[1]; | ||
const itemsInArrayPattern = syntaxList.getChildren().filter(child => { | ||
_super.prototype.visitArrayLiteralExpression.call(this, node); | ||
}; | ||
ArrayBracketSpacingWalker.prototype.validateSquareBrackets = function (node) { | ||
var children = node.getChildren(); | ||
var isSpaceAfterOpeningBracket = this.isSpaceBetween(children[0], children[1]); | ||
var isBreakAfterOpeningBracket = this.isLineBreakBetween(children[0], children[1]); | ||
var isSpaceBeforeClosingBracket = this.isSpaceBetween(children[children.length - 2], children[children.length - 1]); | ||
var isBreakBeforeClosingBracket = this.isLineBreakBetween(children[children.length - 2], children[children.length - 1]); | ||
var syntaxList = node.getChildren()[1]; | ||
var itemsInArrayPattern = syntaxList.getChildren().filter(function (child) { | ||
return child.kind !== ts.SyntaxKind.CommaToken; | ||
@@ -56,7 +67,7 @@ }); | ||
} | ||
const openingBracketMustBeSpaced = (this.singleValueException && itemsInArrayPattern.length === 1) || | ||
var openingBracketMustBeSpaced = (this.singleValueException && itemsInArrayPattern.length === 1) || | ||
(this.arraysInArraysException && itemsInArrayPattern[0] && itemsInArrayPattern[0].kind === ts.SyntaxKind.ArrayLiteralExpression) || | ||
(this.objectsInArraysException && itemsInArrayPattern[0] && itemsInArrayPattern[0].kind === ts.SyntaxKind.ObjectLiteralExpression) | ||
? !this.spaced : this.spaced; | ||
const closingBracketMustBeSpaced = (this.singleValueException | ||
var closingBracketMustBeSpaced = (this.singleValueException | ||
&& itemsInArrayPattern.length === 1) || | ||
@@ -86,17 +97,18 @@ (this.arraysInArraysException && | ||
} | ||
} | ||
isSpaceBetween(node, nextNode) { | ||
}; | ||
ArrayBracketSpacingWalker.prototype.isSpaceBetween = function (node, nextNode) { | ||
return nextNode.getStart() - node.getEnd() > 0; | ||
} | ||
isLineBreakBetween(node, nextNode) { | ||
}; | ||
ArrayBracketSpacingWalker.prototype.isLineBreakBetween = function (node, nextNode) { | ||
return this.getEndPosition(node).line !== this.getStartPosition(nextNode).line; | ||
} | ||
getStartPosition(node) { | ||
}; | ||
ArrayBracketSpacingWalker.prototype.getStartPosition = function (node) { | ||
return node.getSourceFile().getLineAndCharacterOfPosition(node.getStart()); | ||
} | ||
getEndPosition(node) { | ||
}; | ||
ArrayBracketSpacingWalker.prototype.getEndPosition = function (node) { | ||
return node.getSourceFile().getLineAndCharacterOfPosition(node.getEnd()); | ||
} | ||
} | ||
}; | ||
return ArrayBracketSpacingWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL2FycmF5QnJhY2tldFNwYWNpbmdSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxNQUFZLEVBQUUsV0FBTSxZQUFZLENBQUMsQ0FBQTtBQUNqQyxNQUFZLElBQUksV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBRXhDLE1BQU0sYUFBYSxHQUFHLFFBQVEsQ0FBQztBQUUvQixtQ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0FBQztJQUVPLHNEQUFrQixHQUExQixVQUEyQixJQUFhLEVBQUUsUUFBaUI7UUFDekQsTUFBTSxDQUFDLElBQUksQ0FBQyxjQUFjLENBQUMsSUFBSSxDQUFDLENBQUMsSUFBSSxLQUFLLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxRQUFRLENBQUMsQ0FBQyxJQUFJLENBQUM7SUFDakYsQ0FBQztJQUVPLG9EQUFnQixHQUF4QixVQUF5QixJQUFhO1FBQ3BDLE1BQU0sQ0FBQyxJQUFJLENBQUMsYUFBYSxFQUFFLENBQUMsNkJBQTZCLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7SUFDN0UsQ0FBQztJQUVPLGtEQUFjLEdBQXRCLFVBQXVCLElBQWE7UUFDbEMsTUFBTSxDQUFDLElBQUksQ0FBQyxhQUFhLEVBQUUsQ0FBQyw2QkFBNkIsQ0FBQyxJQUFJLENBQUMsTUFBTSxFQUFFLENBQUMsQ0FBQztJQUMzRSxDQUFDO0lBQ0gsZ0NBQUM7QUFBRCxDQWxHQSxBQWtHQyxDQWxHdUMsSUFBSSxDQUFDLFVBQVUsR0FrR3REIiwiZmlsZSI6InJ1bGVzL2FycmF5QnJhY2tldFNwYWNpbmdSdWxlLmpzIiwic291cmNlUm9vdCI6ImQ6XFxwcm9qZWN0c1xcdHNsaW50LWVzbGludC1ydWxlc1xcc3JjIn0= |
"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
const OPTION_ALWAYS = 'always'; | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new BlockSpacingWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var OPTION_ALWAYS = 'always'; | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
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)' | ||
}; | ||
}; | ||
Rule.FAILURE_STRING = { | ||
always: 'Requires a space', | ||
never: 'Unexpected space(s)' | ||
}; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
class BlockSpacingWalker extends Lint.RuleWalker { | ||
constructor(sourceFile, options) { | ||
super(sourceFile, options); | ||
var BlockSpacingWalker = (function (_super) { | ||
__extends(BlockSpacingWalker, _super); | ||
function BlockSpacingWalker(sourceFile, options) { | ||
_super.call(this, sourceFile, options); | ||
this.always = this.hasOption(OPTION_ALWAYS) || (this.getOptions() && this.getOptions().length === 0); | ||
} | ||
visitNode(node) { | ||
BlockSpacingWalker.prototype.visitNode = function (node) { | ||
if (node.kind === ts.SyntaxKind.Block || node.kind === ts.SyntaxKind.CaseBlock) { | ||
this.checkSpacingInsideBraces(node); | ||
} | ||
super.visitNode(node); | ||
} | ||
checkSpacingInsideBraces(node) { | ||
const blockChildren = node.getChildren(); | ||
const syntaxList = blockChildren[1]; | ||
const openBraceLocation = this.getStartPosition(blockChildren[0]); | ||
const closeBraceLocation = this.getStartPosition(blockChildren[blockChildren.length - 1]); | ||
_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) { | ||
let failureString = this.always ? Rule.FAILURE_STRING.always : Rule.FAILURE_STRING.never; | ||
var failureString = this.always ? Rule.FAILURE_STRING.always : Rule.FAILURE_STRING.never; | ||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), failureString)); | ||
} | ||
} | ||
} | ||
isSpaceBetween(node, nextNode) { | ||
}; | ||
BlockSpacingWalker.prototype.isSpaceBetween = function (node, nextNode) { | ||
return nextNode.getStart() - node.getEnd() > 0; | ||
} | ||
getStartPosition(node) { | ||
}; | ||
BlockSpacingWalker.prototype.getStartPosition = function (node) { | ||
return node.getSourceFile().getLineAndCharacterOfPosition(node.getStart()); | ||
} | ||
} | ||
}; | ||
return BlockSpacingWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL2Jsb2NrU3BhY2luZ1J1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksRUFBRSxXQUFNLFlBQVksQ0FBQyxDQUFBO0FBQ2pDLE1BQVksSUFBSSxXQUFNLGlCQUFpQixDQUFDLENBQUE7QUFFeEMsTUFBTSxhQUFhLEdBQUcsUUFBUSxDQUFDO0FBRS9CLG1CQUEwQixJQUFJLENBQUMsS0FBSyxDQUFDLFlBQVk7SUFNeEMsS0FBSyxDQUFDLFVBQXlCO1FBQ3BDLE1BQU0sTUFBTSxHQUFHLElBQUksa0JBQWtCLENBQUMsVUFBVSxFQUFFLElBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDO1FBQ3JFLE1BQU0sQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBQ3RDLENBQUM7QUFDSCxD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DLFFBQVEsRUFBRSxHQUFHLElBQUksQ0FBQyxNQUFNLEVBQUUsR0FBRyxDQUFDLENBQUM7SUFDakQsQ0FBQztJQUVPLDZDQUFnQixHQUF4QixVQUF5QixJQUFhO1FBQ3BDLE1BQU0sQ0FBQyxJQUFJLENBQUMsYUFBYSxFQUFFLENBQUMsNkJBQTZCLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7SUFDN0UsQ0FBQztJQUNILHlCQUFDO0FBQUQsQ0F2Q0EsQUF1Q0MsQ0F2Q2dDLElBQUksQ0FBQyxVQUFVLEdBdUMvQyIsImZpbGUiOiJydWxlcy9ibG9ja1NwYWNpbmdSdWxlLmpzIiwic291cmNlUm9vdCI6ImQ6XFxwcm9qZWN0c1xcdHNsaW50LWVzbGludC1ydWxlc1xcc3JjIn0= |
"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
const OPTION_1TBS = '1tbs'; | ||
const OPTION_ALLMAN = 'allman'; | ||
const OPTION_STROUSTRUP = 'stroustrup'; | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var OPTION_1TBS = '1tbs'; | ||
var OPTION_ALLMAN = 'allman'; | ||
var OPTION_STROUSTRUP = 'stroustrup'; | ||
var BraceStyle; | ||
@@ -13,20 +18,26 @@ (function (BraceStyle) { | ||
})(BraceStyle || (BraceStyle = {})); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new BraceStyleWalker(sourceFile, this.getOptions()); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
Rule.prototype.apply = function (sourceFile) { | ||
var walker = new BraceStyleWalker(sourceFile, this.getOptions()); | ||
return this.applyWithWalker(walker); | ||
} | ||
} | ||
Rule.FAILURE_STRING = { | ||
open: 'Opening curly brace does not appear on the same line as controlling statement.', | ||
openAllman: 'Opening curly brace appears on the same line as controlling statement.', | ||
body: 'Statement inside of curly braces should be on next line.', | ||
close: 'Closing curly brace does not appear on the same line as the subsequent block.', | ||
closeSingle: 'Closing curly brace should be on the same line as opening curly brace or on the line after the previous block.', | ||
closeStroustrupAllman: 'Closing curly brace appears on the same line as the subsequent block.' | ||
}; | ||
}; | ||
Rule.FAILURE_STRING = { | ||
open: 'Opening curly brace does not appear on the same line as controlling statement.', | ||
openAllman: 'Opening curly brace appears on the same line as controlling statement.', | ||
body: 'Statement inside of curly braces should be on next line.', | ||
close: 'Closing curly brace does not appear on the same line as the subsequent block.', | ||
closeSingle: 'Closing curly brace should be on the same line as opening curly brace or on the line after the previous block.', | ||
closeStroustrupAllman: 'Closing curly brace appears on the same line as the subsequent block.' | ||
}; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
class BraceStyleWalker extends Lint.RuleWalker { | ||
constructor(sourceFile, options) { | ||
super(sourceFile, options); | ||
var BraceStyleWalker = (function (_super) { | ||
__extends(BraceStyleWalker, _super); | ||
function BraceStyleWalker(sourceFile, options) { | ||
_super.call(this, sourceFile, options); | ||
this.allowSingleLine = false; | ||
@@ -46,68 +57,69 @@ if (this.hasOption(OPTION_1TBS)) { | ||
} | ||
visitTryStatement(tryStatement) { | ||
super.visitTryStatement(tryStatement); | ||
const checkTryStatementError = (node) => { | ||
const previousNode = this.getPreviousNode(tryStatement.getChildren(), node); | ||
const openingBracketError = this.areOnSameLine(previousNode, node) !== (this.braceStyle === BraceStyle.OneTBS); | ||
if (this.allowSingleLine && this.getStartPosition(node).line === this.getEndPosition(tryStatement).line) { | ||
BraceStyleWalker.prototype.visitTryStatement = function (tryStatement) { | ||
var _this = this; | ||
_super.prototype.visitTryStatement.call(this, tryStatement); | ||
var checkTryStatementError = function (node) { | ||
var previousNode = _this.getPreviousNode(tryStatement.getChildren(), node); | ||
var openingBracketError = _this.areOnSameLine(previousNode, node) !== (_this.braceStyle === BraceStyle.OneTBS); | ||
if (_this.allowSingleLine && _this.getStartPosition(node).line === _this.getEndPosition(tryStatement).line) { | ||
return; | ||
} | ||
if (openingBracketError) { | ||
const failureString = this.braceStyle === BraceStyle.OneTBS ? Rule.FAILURE_STRING.open : Rule.FAILURE_STRING.openAllman; | ||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), failureString)); | ||
var failureString = _this.braceStyle === BraceStyle.OneTBS ? Rule.FAILURE_STRING.open : Rule.FAILURE_STRING.openAllman; | ||
_this.addFailure(_this.createFailure(node.getStart(), node.getWidth(), failureString)); | ||
} | ||
}; | ||
const catchClause = tryStatement.catchClause; | ||
var catchClause = tryStatement.catchClause; | ||
if (catchClause) { | ||
checkTryStatementError(catchClause); | ||
} | ||
const finallyBlock = tryStatement.finallyBlock; | ||
var finallyBlock = tryStatement.finallyBlock; | ||
if (finallyBlock) { | ||
checkTryStatementError(finallyBlock); | ||
} | ||
} | ||
visitIfStatement(ifStatement) { | ||
super.visitIfStatement(ifStatement); | ||
const elseKeyword = ifStatement.getChildren().filter(ch => ch.kind === ts.SyntaxKind.ElseKeyword).shift(); | ||
}; | ||
BraceStyleWalker.prototype.visitIfStatement = function (ifStatement) { | ||
_super.prototype.visitIfStatement.call(this, ifStatement); | ||
var elseKeyword = ifStatement.getChildren().filter(function (ch) { return ch.kind === ts.SyntaxKind.ElseKeyword; }).shift(); | ||
if (!elseKeyword) { | ||
return; | ||
} | ||
const previousNode = ifStatement.getChildren()[ifStatement.getChildren().indexOf(elseKeyword) - 1]; | ||
const openingBracketError = this.areOnSameLine(previousNode, elseKeyword) !== (this.braceStyle === BraceStyle.OneTBS); | ||
var previousNode = ifStatement.getChildren()[ifStatement.getChildren().indexOf(elseKeyword) - 1]; | ||
var openingBracketError = this.areOnSameLine(previousNode, elseKeyword) !== (this.braceStyle === BraceStyle.OneTBS); | ||
if (this.allowSingleLine && this.getStartPosition(elseKeyword).line === this.getEndPosition(ifStatement).line) { | ||
return; | ||
} | ||
if (!ifStatement.getChildren().some(ch => ch.kind === ts.SyntaxKind.Block)) { | ||
if (!ifStatement.getChildren().some(function (ch) { return ch.kind === ts.SyntaxKind.Block; })) { | ||
return; | ||
} | ||
if (openingBracketError) { | ||
const failureString = this.braceStyle === BraceStyle.OneTBS ? Rule.FAILURE_STRING.open : Rule.FAILURE_STRING.openAllman; | ||
var failureString = this.braceStyle === BraceStyle.OneTBS ? Rule.FAILURE_STRING.open : Rule.FAILURE_STRING.openAllman; | ||
this.addFailure(this.createFailure(elseKeyword.getStart(), elseKeyword.getWidth(), failureString)); | ||
} | ||
} | ||
visitBlock(block) { | ||
super.visitBlock(block); | ||
}; | ||
BraceStyleWalker.prototype.visitBlock = function (block) { | ||
_super.prototype.visitBlock.call(this, block); | ||
if (this.allowSingleLine && this.getStartPosition(block).line === this.getEndPosition(block).line) { | ||
return; | ||
} | ||
const blockChildren = block.getChildren(); | ||
const openingCurlyBrace = blockChildren.filter(ch => ch.kind === ts.SyntaxKind.OpenBraceToken).shift(); | ||
const closingCurlyBrace = blockChildren.filter(ch => ch.kind === ts.SyntaxKind.CloseBraceToken).pop(); | ||
const syntaxList = blockChildren.filter(ch => ch.kind === ts.SyntaxKind.SyntaxList).shift(); | ||
const blockPreviousNode = block.parent.getChildren()[block.parent.getChildren().indexOf(block) - 1]; | ||
var blockChildren = block.getChildren(); | ||
var openingCurlyBrace = blockChildren.filter(function (ch) { return ch.kind === ts.SyntaxKind.OpenBraceToken; }).shift(); | ||
var closingCurlyBrace = blockChildren.filter(function (ch) { return ch.kind === ts.SyntaxKind.CloseBraceToken; }).pop(); | ||
var syntaxList = blockChildren.filter(function (ch) { return ch.kind === ts.SyntaxKind.SyntaxList; }).shift(); | ||
var blockPreviousNode = block.parent.getChildren()[block.parent.getChildren().indexOf(block) - 1]; | ||
if (!openingCurlyBrace || !closingCurlyBrace || !syntaxList || !blockPreviousNode) { | ||
return; | ||
} | ||
const openingBracketError = this.areOnSameLine(blockPreviousNode, block) === (this.braceStyle === BraceStyle.Allman); | ||
var openingBracketError = this.areOnSameLine(blockPreviousNode, block) === (this.braceStyle === BraceStyle.Allman); | ||
if (openingBracketError) { | ||
const failureString = this.braceStyle === BraceStyle.Allman ? Rule.FAILURE_STRING.openAllman : Rule.FAILURE_STRING.open; | ||
var failureString = this.braceStyle === BraceStyle.Allman ? Rule.FAILURE_STRING.openAllman : Rule.FAILURE_STRING.open; | ||
this.addFailure(this.createFailure(openingCurlyBrace.getStart(), openingCurlyBrace.getWidth(), failureString)); | ||
} | ||
if (syntaxList.getChildCount() > 0) { | ||
const bodyError = this.areOnSameLine(openingCurlyBrace, syntaxList); | ||
var bodyError = this.areOnSameLine(openingCurlyBrace, syntaxList); | ||
if (bodyError) { | ||
this.addFailure(this.createFailure(syntaxList.getStart(), syntaxList.getWidth(), Rule.FAILURE_STRING.body)); | ||
} | ||
const nodeBeforeClosingBracket = syntaxList.getChildren()[syntaxList.getChildren().length - 1]; | ||
const closingBracketError = this.areOnSameLine(nodeBeforeClosingBracket, closingCurlyBrace); | ||
var nodeBeforeClosingBracket = syntaxList.getChildren()[syntaxList.getChildren().length - 1]; | ||
var closingBracketError = this.areOnSameLine(nodeBeforeClosingBracket, closingCurlyBrace); | ||
if (closingBracketError) { | ||
@@ -117,14 +129,14 @@ this.addFailure(this.createFailure(closingCurlyBrace.getStart(), closingCurlyBrace.getWidth(), Rule.FAILURE_STRING.closeSingle)); | ||
} | ||
} | ||
areOnSameLine(node, nextNode) { | ||
}; | ||
BraceStyleWalker.prototype.areOnSameLine = function (node, nextNode) { | ||
return this.getEndPosition(node).line === this.getStartPosition(nextNode).line; | ||
} | ||
getStartPosition(node) { | ||
}; | ||
BraceStyleWalker.prototype.getStartPosition = function (node) { | ||
return node.getSourceFile().getLineAndCharacterOfPosition(node.getStart()); | ||
} | ||
getEndPosition(node) { | ||
}; | ||
BraceStyleWalker.prototype.getEndPosition = function (node) { | ||
return node.getSourceFile().getLineAndCharacterOfPosition(node.getEnd()); | ||
} | ||
getPreviousNode(children, node) { | ||
let position = children.indexOf(node) - 1; | ||
}; | ||
BraceStyleWalker.prototype.getPreviousNode = function (children, node) { | ||
var position = children.indexOf(node) - 1; | ||
while (position >= 0) { | ||
@@ -136,5 +148,6 @@ if (children[position].kind === ts.SyntaxKind.Block || children[position].kind === ts.SyntaxKind.CatchClause) { | ||
} | ||
} | ||
} | ||
}; | ||
return BraceStyleWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL2JyYWNlU3R5bGVSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxNQUFZLEVBQUUsV0FBTSxZQUFZLENBQUMsQ0FBQTtBQUNqQyxNQUFZLElBQUksV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBRXhDLE1BQU0sV0FBVyxHQUFHLE1BQU0sQ0FBQztBQUMzQixNQUFNLGFBQWEsR0FBRyxRQUFRLENBQUM7QUFDL0IsTUFBTSxpQkFBaUIsR0FBRyxZQUFZLENBQUM7QUFFdkMsSUFBSyxVQUlKO0FBSkQsV0FBSyxVQUFVO0lBQ2IsK0NBQU0sQ0FBQTtJQUNOLCtDQUFNLENBQUE7SUFDTix1REFBVSxDQUFBO0FBQ1osQ0FBQyxFQUpJLFVBQVUsS0FBVixVQUFVLFFBSWQ7QUFFRCxtQkFBMEIsSUFBSSxDQUFDLEtBQUssQ0FBQyxZQUFZO0lBVXhDLEtBQUssQ0FBQyxVQUF5QjtRQUNwQyxNQUFNLE1BQU0sR0FBRyxJQUFJLGdCQUFnQixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQztRQUNuRSxNQUFNLENBQUMsSUFBSS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FFLENBQUMsVUFBVSxDQUFDLFdBQVcsQ0FBQyxDQUFDLENBQUM7Z0JBQzdHLE1BQU0sQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLENBQUM7WUFDNUIsQ0FBQztZQUNELFFBQVEsSUFBSSxDQUFDLENBQUM7UUFDaEIsQ0FBQztJQUNILENBQUM7SUFDSCx1QkFBQztBQUFELENBL0lBLEFBK0lDLENBL0k4QixJQUFJLENBQUMsVUFBVSxHQStJN0MiLCJmaWxlIjoicnVsZXMvYnJhY2VTdHlsZVJ1bGUuanMiLCJzb3VyY2VSb290IjoiZDpcXHByb2plY3RzXFx0c2xpbnQtZXNsaW50LXJ1bGVzXFxzcmMifQ== |
"use strict"; | ||
const Lint = require('tslint/lib/lint'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const languageService = Lint.createLanguageService(sourceFile.fileName, sourceFile.getFullText()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var Lint = require('tslint/lib/lint'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
Rule.prototype.apply = function (sourceFile) { | ||
var languageService = Lint.createLanguageService(sourceFile.fileName, sourceFile.getFullText()); | ||
return this.applyWithWalker(new ErrCallbackHandlerWalker(sourceFile, this.getOptions(), languageService)); | ||
} | ||
} | ||
Rule.FAILURE_STRING = 'Expected error to be handled'; | ||
}; | ||
Rule.FAILURE_STRING = 'Expected error to be handled'; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
class ErrCallbackHandlerWalker extends Lint.RuleWalker { | ||
constructor(sourceFile, options, languageService) { | ||
super(sourceFile, options); | ||
var ErrCallbackHandlerWalker = (function (_super) { | ||
__extends(ErrCallbackHandlerWalker, _super); | ||
function ErrCallbackHandlerWalker(sourceFile, options, languageService) { | ||
_super.call(this, sourceFile, options); | ||
this.languageService = languageService; | ||
const customExpression = options.ruleArguments[0] || 'err'; | ||
if (customExpression.charAt(0) === '^') { | ||
this.errorRegex = new RegExp(customExpression); | ||
var errorArgument = options.ruleArguments[0] || 'err'; | ||
if (errorArgument.charAt(0) === '^') { | ||
this.errorCheck = RegExp.prototype.test.bind(new RegExp(errorArgument)); | ||
} | ||
else { | ||
this.errorRegex = new RegExp(`^${customExpression}$`); | ||
this.errorCheck = function (name) { return name === errorArgument; }; | ||
} | ||
} | ||
visitFunctionDeclaration(node) { | ||
const parameter = node.parameters[0]; | ||
if (parameter && this.errorRegex.test(parameter.name.getText())) { | ||
this.validateReferencesForVariable(parameter); | ||
ErrCallbackHandlerWalker.prototype.visitFunctionExpression = function (node) { | ||
this.validateFunction(node); | ||
_super.prototype.visitFunctionExpression.call(this, node); | ||
}; | ||
ErrCallbackHandlerWalker.prototype.visitFunctionDeclaration = function (node) { | ||
this.validateFunction(node); | ||
_super.prototype.visitFunctionDeclaration.call(this, node); | ||
}; | ||
ErrCallbackHandlerWalker.prototype.visitArrowFunction = function (node) { | ||
this.validateFunction(node); | ||
_super.prototype.visitArrowFunction.call(this, node); | ||
}; | ||
ErrCallbackHandlerWalker.prototype.validateFunction = function (node) { | ||
var parameter = node.parameters[0]; | ||
if (parameter && this.errorCheck(parameter.name.getText())) { | ||
var fileName = this.getSourceFile().fileName; | ||
var highlights = this.languageService.getDocumentHighlights(fileName, parameter.pos, [fileName]); | ||
if (!highlights || highlights[0].highlightSpans.length <= 1) { | ||
this.addFailure(this.createFailure(parameter.name.getStart(), parameter.name.getWidth(), Rule.FAILURE_STRING)); | ||
} | ||
} | ||
super.visitFunctionDeclaration(node); | ||
} | ||
validateReferencesForVariable(node) { | ||
const fileName = this.getSourceFile().fileName; | ||
const highlights = this.languageService.getDocumentHighlights(fileName, node.pos, [fileName]); | ||
if (!highlights || highlights[0].highlightSpans.length <= 1) { | ||
this.addFailure(this.createFailure(node.name.getStart(), node.name.getWidth(), Rule.FAILURE_STRING)); | ||
} | ||
} | ||
} | ||
}; | ||
return ErrCallbackHandlerWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL2hhbmRsZUNhbGxiYWNrRXJyUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0EsTUFBWSxJQUFJLFdBQU0saUJBQWlCLENBQUMsQ0FBQTtBQUV4QyxtQkFBMEIsSUFBSSxDQUFDLEtBQUssQ0FBQyxZQUFZO0lBR3hDLEtBQUssQ0FBQyxVQUF5QjtRQUNwQyxNQUFNLGVBQWUsR0FBRyxJQUFJLENBQUMscUJBQXFCLENBQUMsVUFBVSxDQUFDLFFBQVEsRUFBRSxVQUFVLENBQUMsV0FBVyxFQUFFLENBQUMsQ0FBQztRQUNsRyxNQUFNLENBQUMsSUFBSSxDQUFDLGVBQWUsQ0FBQyxJQUFJLHdCQUF3QixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsVUFBVSxFQUFFLEVBQUUsZUFBZSxDQUFDLENBQUMsQ0FBQztJQUM1RyxDQUFDO0FBQ0gsQ0FBQztBQU5lLG1CQUFjLEdBQUcsOEJBQThCLENBQUM7QUFEbkQsWUFBSSxPQU9oQixDQUFBO0FBRUQsdUNBQXVDLElBQUksQ0FBQyxVQUFVO0lBSXBELFlBQVksVUFBeUIsRUFBRSxPQUFzQixFQUFFLGVBQW1DO1FBQ2hHLE1BQU0sVUFBVSxFQUFFLE9BQU8sQ0FBQyxDQUFDO1FBQzNCLElBQUksQ0FBQyxlQUFlLEdBQUcsZUFBZSxDQUFDO1FBQ3ZDLE1BQU0sZ0JBQWdCLEdBQUcsT0FBTyxDQUFDLGFBQWEsQ0FBQyxDQUFDLENBQUMsSUFBSSxLQUFLLENBQUM7UUFF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ENBQUMsQ0FBQztZQUNqSCxDQUFDO1FBQ0gsQ0FBQztJQUNILENBQUM7SUFDSCwrQkFBQztBQUFELENBM0NBLEFBMkNDLENBM0NzQyxJQUFJLENBQUMsVUFBVSxHQTJDckQiLCJmaWxlIjoicnVsZXMvaGFuZGxlQ2FsbGJhY2tFcnJSdWxlLmpzIiwic291cmNlUm9vdCI6ImQ6XFxwcm9qZWN0c1xcdHNsaW50LWVzbGludC1ydWxlc1xcc3JjIn0= |
"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
const token_1 = require('../support/token'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new NoConstantConditionWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var token_1 = require('../support/token'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
Rule.prototype.apply = function (sourceFile) { | ||
var walker = new NoConstantConditionWalker(sourceFile, this.getOptions()); | ||
return this.applyWithWalker(walker); | ||
} | ||
} | ||
Rule.FAILURE_STRING = 'unexpected constant condition'; | ||
}; | ||
Rule.FAILURE_STRING = 'unexpected constant condition'; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
class NoConstantConditionWalker extends Lint.RuleWalker { | ||
constructor(sourceFile, options) { | ||
super(sourceFile, options); | ||
var NoConstantConditionWalker = (function (_super) { | ||
__extends(NoConstantConditionWalker, _super); | ||
function NoConstantConditionWalker(sourceFile, options) { | ||
_super.call(this, sourceFile, options); | ||
this.checkLoops = true; | ||
this.isInConditional = false; | ||
const opts = this.getOptions(); | ||
var opts = this.getOptions(); | ||
if (opts.length && opts[0].checkLoops === false) { | ||
@@ -23,29 +34,29 @@ this.checkLoops = false; | ||
} | ||
visitIfStatement(node) { | ||
NoConstantConditionWalker.prototype.visitIfStatement = function (node) { | ||
this.validateCondition(node.expression); | ||
super.visitIfStatement(node); | ||
} | ||
visitWhileStatement(node) { | ||
_super.prototype.visitIfStatement.call(this, node); | ||
}; | ||
NoConstantConditionWalker.prototype.visitWhileStatement = function (node) { | ||
if (this.checkLoops) { | ||
this.validateCondition(node.expression); | ||
} | ||
super.visitWhileStatement(node); | ||
} | ||
visitDoStatement(node) { | ||
_super.prototype.visitWhileStatement.call(this, node); | ||
}; | ||
NoConstantConditionWalker.prototype.visitDoStatement = function (node) { | ||
if (this.checkLoops) { | ||
this.validateCondition(node.expression); | ||
} | ||
super.visitDoStatement(node); | ||
} | ||
visitForStatement(node) { | ||
_super.prototype.visitDoStatement.call(this, node); | ||
}; | ||
NoConstantConditionWalker.prototype.visitForStatement = function (node) { | ||
if (this.checkLoops && node.condition) { | ||
this.validateCondition(node.condition); | ||
} | ||
super.visitForStatement(node); | ||
} | ||
visitConditionalExpression(node) { | ||
_super.prototype.visitForStatement.call(this, node); | ||
}; | ||
NoConstantConditionWalker.prototype.visitConditionalExpression = function (node) { | ||
this.validateCondition(node.condition); | ||
super.visitConditionalExpression(node); | ||
} | ||
validateCondition(expression) { | ||
_super.prototype.visitConditionalExpression.call(this, node); | ||
}; | ||
NoConstantConditionWalker.prototype.validateCondition = function (expression) { | ||
this.isInConditional = true; | ||
@@ -57,4 +68,4 @@ if (this.isConstant(expression)) { | ||
this.isInConditional = false; | ||
} | ||
isConstant(node) { | ||
}; | ||
NoConstantConditionWalker.prototype.isConstant = function (node) { | ||
switch (node.kind) { | ||
@@ -88,5 +99,6 @@ case ts.SyntaxKind.StringLiteral: | ||
return false; | ||
} | ||
} | ||
}; | ||
return NoConstantConditionWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base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{ | ||
apply(sourceFile) { | ||
const walker = new NoControlRegexWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
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) { | ||
__extends(NoControlRegexWalker, _super); | ||
function NoControlRegexWalker() { | ||
_super.apply(this, arguments); | ||
} | ||
} | ||
Rule.FAILURE_STRING = 'unexpected control character in regular expression'; | ||
exports.Rule = Rule; | ||
class NoControlRegexWalker extends Lint.RuleWalker { | ||
visitRegularExpressionLiteral(node) { | ||
NoControlRegexWalker.prototype.visitRegularExpressionLiteral = function (node) { | ||
this.validateControlRegex(node); | ||
super.visitRegularExpressionLiteral(node); | ||
} | ||
visitNewExpression(node) { | ||
_super.prototype.visitRegularExpressionLiteral.call(this, node); | ||
}; | ||
NoControlRegexWalker.prototype.visitNewExpression = function (node) { | ||
if (node.expression.getText() === 'RegExp') { | ||
this.visitRegularExpressionFunction(node); | ||
} | ||
super.visitNewExpression(node); | ||
} | ||
visitCallExpression(node) { | ||
_super.prototype.visitNewExpression.call(this, node); | ||
}; | ||
NoControlRegexWalker.prototype.visitCallExpression = function (node) { | ||
if (node.expression.getText() === 'RegExp') { | ||
this.visitRegularExpressionFunction(node); | ||
} | ||
super.visitCallExpression(node); | ||
} | ||
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]); | ||
} | ||
} | ||
validateControlRegex(node) { | ||
}; | ||
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;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vQ29udHJvbFJlZ2V4UnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsTUFBWSxFQUFFLFdBQU0sWUFBWSxDQUFDLENBQUE7QUFDakMsTUFBWSxJQUFJLFdBQU0saUJBQWlCLENBQUMsQ0FBQTtBQUV4QyxtQkFBMEIsSUFBSSxDQUFDLEtBQUssQ0FBQyxZQUFZO0lBR3hDLEtBQUssQ0FBQyxVQUF5QjtRQUNwQyxNQUFNLE1BQU0sR0FBRyxJQUFJLG9CQUFvQixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQztRQUN2RSxNQUFNLENBQUMsSUFBSSxDQUFDLGVBQWUsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUN0QyxDQUFDO0FBQ0gsQ0FBQztBQU5lLG1CQUFjLEdBQUcsb0RBQW9ELENBQUM7QUFEekUsWUFBSSxPQU9oQixDQUFBO0FBRUQsbUNBQW1DLElBQUksQ0FBQyxVQUFVO0lBQ3RDLDZCQUE2QixDQUFDLElBQTBCO1FBQ2hFLElBQUksQ0FBQyxvQkFBb0IsQ0FBQyxJQUFJLENBQUMsQ0FBQztR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LFVBQVUsQ0FBQyxhQUFhLENBQUMsQ0FBQyxDQUFDO1lBQzFHLElBQUksQ0FBQyxvQkFBb0IsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBcUIsQ0FBQyxDQUFDO1FBQ25FLENBQUM7SUFDSCxDQUFDO0lBRU8sbURBQW9CLEdBQTVCLFVBQTZCLElBQTBCO1FBQ3JELEVBQUUsQ0FBQyxDQUFDLGFBQWEsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUNsQyxJQUFJLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxFQUFFLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsY0FBYyxDQUFDLENBQUMsQ0FBQztRQUM3RixDQUFDO0lBQ0gsQ0FBQztJQUNILDJCQUFDO0FBQUQsQ0EvQkEsQUErQkMsQ0EvQmtDLElBQUksQ0FBQyxVQUFVLEdBK0JqRCIsImZpbGUiOiJydWxlcy9ub0NvbnRyb2xSZWdleFJ1bGUuanMiLCJzb3VyY2VSb290IjoiZDpcXHByb2plY3RzXFx0c2xpbnQtZXNsaW50LXJ1bGVzXFxzcmMifQ== |
"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new NoDuplicateCaseWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
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) { | ||
__extends(NoDuplicateCaseWalker, _super); | ||
function NoDuplicateCaseWalker() { | ||
_super.apply(this, arguments); | ||
} | ||
} | ||
Rule.FAILURE_STRING = 'duplicate case label'; | ||
exports.Rule = Rule; | ||
class NoDuplicateCaseWalker extends Lint.RuleWalker { | ||
visitSwitchStatement(node) { | ||
NoDuplicateCaseWalker.prototype.visitSwitchStatement = function (node) { | ||
this.validateNoDupeCase(node); | ||
super.visitSwitchStatement(node); | ||
} | ||
validateNoDupeCase(node) { | ||
const cases = new Map(); | ||
node.caseBlock.clauses.forEach(clause => { | ||
_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) { | ||
const key = clause.getText(); | ||
if (cases.has(key)) { | ||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); | ||
var key = clause.getText(); | ||
if (cases[key]) { | ||
_this.addFailure(_this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); | ||
} | ||
else { | ||
cases.set(key, clause); | ||
cases[key] = clause; | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
}; | ||
return NoDuplicateCaseWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vRHVwbGljYXRlQ2FzZVJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijt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yxHQUFHLENBQUMsR0FBRyxNQUF1QixDQUFDO2dCQUN2QyxDQUFDO1lBQ0gsQ0FBQztRQUNILENBQUMsQ0FBQyxDQUFDO0lBQ0wsQ0FBQztJQUNILDRCQUFDO0FBQUQsQ0FyQkEsQUFxQkMsQ0FyQm1DLElBQUksQ0FBQyxVQUFVLEdBcUJsRCIsImZpbGUiOiJydWxlcy9ub0R1cGxpY2F0ZUNhc2VSdWxlLmpzIiwic291cmNlUm9vdCI6ImQ6XFxwcm9qZWN0c1xcdHNsaW50LWVzbGludC1ydWxlc1xcc3JjIn0= |
"use strict"; | ||
const Lint = require('tslint/lib/lint'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new NoEmptyCharacterClassWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var Lint = require('tslint/lib/lint'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
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) { | ||
__extends(NoEmptyCharacterClassWalker, _super); | ||
function NoEmptyCharacterClassWalker() { | ||
_super.apply(this, arguments); | ||
} | ||
} | ||
Rule.FAILURE_STRING = `don't use empty classes in regular expressions`; | ||
exports.Rule = Rule; | ||
class NoEmptyCharacterClassWalker extends Lint.RuleWalker { | ||
visitRegularExpressionLiteral(node) { | ||
NoEmptyCharacterClassWalker.prototype.visitRegularExpressionLiteral = function (node) { | ||
this.validateEmptyCharacterClass(node); | ||
super.visitRegularExpressionLiteral(node); | ||
} | ||
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;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vRW1wdHlDaGFyYWN0ZXJDbGFzc1J1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLE1BQVksSUFBSSxXQUFNLGlCQUFpQixDQUFDLENBQUE7QUFFeEMsbUJBQTBCLElBQUksQ0FBQyxLQUFLLENBQUMsWUFBWTtJQUd4QyxLQUFLLENBQUMsVUFBeUI7UUFDcEMsTUFBTSxNQUFNLEdBQUcsSUFBSSwyQkFBMkIsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFDLENBQUM7UUFDOUUsTUFBTSxDQUFDLElBQUksQ0FBQyxlQUFlLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdEMsQ0FBQztBQUNILENBQUM7QUFOZSxtQkFBYyxHQUFHLGdEQUFnRCxDQUFDO0FBRHJFLFlBQUksT0FPaEIsQ0FBQTtBQUVELDBDQUEwQyxJQUFJLENBQUMsVUFBVTtJQUM3Qyw2QkFBNkIsQ0FBQyxJQUEwQjtRQUNoRSxJQUFJLENBQUMsMkJBQTJCLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDdkMsS0FBSyxDQUFDLDZCQUE2QixDQUFDLElBQUksQ0FBQyxDQUFDO0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BQUFELENBUEEsQUFPQyxDQVB5QixJQUFJLENBQUMsS0FBSyxDQUFDLFlBQVksR0FPaEQ7QUFQWSxZQUFJLE9BT2hCLENBQUE7QUFFRDtJQUEwQywrQ0FBZTtJQUF6RDtRQUEwQyw4QkFBZTtJQVd6RCxDQUFDO0lBVlcsbUVBQTZCLEdBQXZDLFVBQXdDLElBQTBCO1FBQ2hFLElBQUksQ0FBQywyQkFBMkIsQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUN2QyxnQkFBSyxDQUFDLDZCQUE2QixZQUFDLElBQUksQ0FBQyxDQUFDO0lBQzVDLENBQUM7SUFFTyxpRUFBMkIsR0FBbkMsVUFBb0MsSUFBMEI7UUFDNUQsRUFBRSxDQUFDLENBQUMsQ0FBQyxDQUFDLDhDQUE4QyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7WUFDdEUsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUM7UUFDN0YsQ0FBQztJQUNILENBQUM7SUFDSCxrQ0FBQztBQUFELENBWEEsQUFXQyxDQVh5QyxJQUFJLENBQUMsVUFBVSxHQVd4RCIsImZpbGUiOiJydWxlcy9ub0VtcHR5Q2hhcmFjdGVyQ2xhc3NSdWxlLmpzIiwic291cmNlUm9vdCI6ImQ6XFxwcm9qZWN0c1xcdHNsaW50LWVzbGludC1ydWxlc1xcc3JjIn0= |
"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
const token_1 = require('../support/token'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new NoExAssignWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var token_1 = require('../support/token'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
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'; | ||
}; | ||
Rule.FAILURE_STRING = 'do not assign to the exception parameter'; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
class NoExAssignWalker extends Lint.RuleWalker { | ||
constructor() { | ||
super(...arguments); | ||
var NoExAssignWalker = (function (_super) { | ||
__extends(NoExAssignWalker, _super); | ||
function NoExAssignWalker() { | ||
_super.apply(this, arguments); | ||
this.isInCatchClause = false; | ||
this.variableNode = null; | ||
} | ||
visitCatchClause(node) { | ||
NoExAssignWalker.prototype.visitCatchClause = function (node) { | ||
this.variableNode = node.variableDeclaration; | ||
this.isInCatchClause = true; | ||
super.visitCatchClause(node); | ||
_super.prototype.visitCatchClause.call(this, node); | ||
this.isInCatchClause = false; | ||
this.variableNode = null; | ||
} | ||
visitBinaryExpression(node) { | ||
}; | ||
NoExAssignWalker.prototype.visitBinaryExpression = function (node) { | ||
var _this = this; | ||
if (this.isInCatchClause) { | ||
@@ -35,4 +47,4 @@ if (!token_1.isAssignmentToken(node.operatorToken)) { | ||
else if (node.left.kind === ts.SyntaxKind.ArrayLiteralExpression) { | ||
const els = node.left.elements; | ||
if (els.some(el => el.getText() === this.variableNode.getText())) { | ||
var els = node.left.elements; | ||
if (els.some(function (el) { return el.getText() === _this.variableNode.getText(); })) { | ||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); | ||
@@ -42,6 +54,7 @@ } | ||
} | ||
super.visitBinaryExpression(node); | ||
} | ||
} | ||
_super.prototype.visitBinaryExpression.call(this, node); | ||
}; | ||
return NoExAssignWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vRXhBc3NpZ25SdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxNQUFZLEVBQUUsV0FBTSxZQUFZLENBQUMsQ0FBQTtBQUNqQyxNQUFZLElBQUksV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQ3hDLHdCQUFrQyxrQkFBa0IsQ0FBQyxDQUFBO0FBRXJELG1CQUEwQixJQUFJLENBQUMsS0FBSyxDQUFDLFlBQVk7SUFHeEMsS0FBSyxDQUFDLFVBQXlCO1FBQ3BDLE1BQU0sTUFBTSxHQUFHLElBQUksZ0JBQWdCLENBQUMsVUFBVSxFQUFFLElBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDO1FBQ25FLE1BQU0sQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBQ3RDLENBQUM7QUFDSCxDQUFDO0FBTmUsbUJBQWMsR0FBRywwQ0FBMEMsQ0FBQztBQUQvRCxZQUFJLE9BT2hCLENBQUE7QUFFRCwrQkFBK0IsSUFBSSxDQUFDLFVBQVU7SUFBOUM7UUFBK0Isb0JBQWU7UUFDcEMsb0JBQWUsR0FBRyxLQUFLLENBQUM7UUFDeEIsaUJBQVksR0FBMkIsSUFBSSxDQUFDO0lBNEJ0RCxDQUFDO0lBMUJXLGdCQUFnQixDQUFDLElBQW9CO1FBQzdDLElBQUksQ0FBQyxZQUFZLEdBQUcsSUFBSSxDQUFDLG1CQUFtQixDQUFDO1FBQzdDLElBQUksQ0FBQyxlQUFlLEdBQUcsS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ksQ0FBQyxVQUFVLEdBOEI3QyIsImZpbGUiOiJydWxlcy9ub0V4QXNzaWduUnVsZS5qcyIsInNvdXJjZVJvb3QiOiJkOlxccHJvamVjdHNcXHRzbGludC1lc2xpbnQtcnVsZXNcXHNyYyJ9 |
"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new NoExtraBooleanCastWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
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) { | ||
__extends(NoExtraBooleanCastWalker, _super); | ||
function NoExtraBooleanCastWalker() { | ||
_super.apply(this, arguments); | ||
} | ||
} | ||
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' | ||
}; | ||
exports.Rule = Rule; | ||
class NoExtraBooleanCastWalker extends Lint.RuleWalker { | ||
visitPrefixUnaryExpression(node) { | ||
NoExtraBooleanCastWalker.prototype.visitPrefixUnaryExpression = function (node) { | ||
this.validateNoExtraBoolean(node); | ||
super.visitPrefixUnaryExpression(node); | ||
} | ||
validateNoExtraBoolean(node) { | ||
const parent = node.parent; | ||
let grandparent = parent.parent; | ||
_super.prototype.visitPrefixUnaryExpression.call(this, node); | ||
}; | ||
NoExtraBooleanCastWalker.prototype.validateNoExtraBoolean = function (node) { | ||
var parent = node.parent; | ||
var grandparent = parent.parent; | ||
if (node.operator !== ts.SyntaxKind.ExclamationToken || | ||
@@ -55,11 +69,12 @@ parent.kind !== ts.SyntaxKind.PrefixUnaryExpression || | ||
} | ||
else if (grandparent.kind === ts.SyntaxKind.CallExpression && grandparent.getText().startsWith('Boolean')) { | ||
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 && grandparent.getText().startsWith('new Boolean')) { | ||
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;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vRXh0cmFCb29sZWFuQ2FzdFJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6I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FDLElBQUksQ0FBQyxXQUFXLENBQUMsT0FBTyxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUM7WUFDckcsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxDQUFDLGNBQWMsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFDO1FBQ3hHLENBQUM7UUFDRCxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUMsV0FBVyxDQUFDLElBQUksS0FBSyxFQUFFLENBQUMsVUFBVSxDQUFDLGFBQWEsSUFBSSxjQUFjLENBQUMsSUFBSSxDQUFDLFdBQVcsQ0FBQyxPQUFPLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUN4RyxJQUFJLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxFQUFFLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsY0FBYyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7UUFDckcsQ0FBQztJQUNILENBQUM7SUFDSCwrQkFBQztBQUFELENBaERBLEFBZ0RDLENBaERzQyxJQUFJLENBQUMsVUFBVSxHQWdEckQiLCJmaWxlIjoicnVsZXMvbm9FeHRyYUJvb2xlYW5DYXN0UnVsZS5qcyIsInNvdXJjZVJvb3QiOiJkOlxccHJvamVjdHNcXHRzbGludC1lc2xpbnQtcnVsZXNcXHNyYyJ9 |
"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new NoExtraSemiWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
Rule.prototype.apply = function (sourceFile) { | ||
var walker = new NoExtraSemiWalker(sourceFile, this.getOptions()); | ||
return this.applyWithWalker(walker); | ||
} | ||
} | ||
Rule.FAILURE_STRING = 'unnecessary semicolon'; | ||
}; | ||
Rule.FAILURE_STRING = 'unnecessary semicolon'; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
class NoExtraSemiWalker extends Lint.RuleWalker { | ||
constructor() { | ||
super(...arguments); | ||
var NoExtraSemiWalker = (function (_super) { | ||
__extends(NoExtraSemiWalker, _super); | ||
function NoExtraSemiWalker() { | ||
_super.apply(this, arguments); | ||
this.ALLOWED_PARENT_TYPES = [ | ||
@@ -23,23 +34,25 @@ ts.SyntaxKind.ForStatement, | ||
} | ||
visitNode(node) { | ||
NoExtraSemiWalker.prototype.visitNode = function (node) { | ||
if (node.kind === ts.SyntaxKind.EmptyStatement) { | ||
this.visitEmptyStatement(node); | ||
} | ||
super.visitNode(node); | ||
} | ||
visitClassDeclaration(node) { | ||
_super.prototype.visitNode.call(this, node); | ||
}; | ||
NoExtraSemiWalker.prototype.visitClassDeclaration = function (node) { | ||
this.checkClass(node); | ||
super.visitClassDeclaration(node); | ||
} | ||
visitEmptyStatement(node) { | ||
_super.prototype.visitClassDeclaration.call(this, node); | ||
}; | ||
NoExtraSemiWalker.prototype.visitEmptyStatement = function (node) { | ||
if (this.ALLOWED_PARENT_TYPES.indexOf(node.parent.kind) === -1) { | ||
this.validateNoExtraSemi(node); | ||
} | ||
} | ||
checkClass(node) { | ||
const children = node.getChildren().slice(node.getChildren().indexOf(node.getChildren().find(child => child.kind === ts.SyntaxKind.FirstPunctuation))); | ||
}; | ||
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); | ||
} | ||
checkClassChildren(children) { | ||
for (let child of 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() === ';') { | ||
@@ -52,8 +65,9 @@ this.validateNoExtraSemi(child); | ||
} | ||
} | ||
validateNoExtraSemi(node) { | ||
}; | ||
NoExtraSemiWalker.prototype.validateNoExtraSemi = function (node) { | ||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); | ||
} | ||
} | ||
}; | ||
return NoExtraSemiWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vRXh0cmFTZW1pUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsTUFBWSxFQUFFLFdBQU0sWUFBWSxDQUFDLENBQUE7QUFDakMsTUFBWSxJQUFJLFdBQU0saUJBQWlCLENBQUMsQ0FBQTtBQUV4QyxtQkFBMEIsSUFBSSxDQUFDLEtBQUssQ0FBQyxZQUFZO0lBR3hDLEtBQUssQ0FBQyxVQUF5QjtRQUNwQyxNQUFNLE1BQU0sR0FBRyxJQUFJLGlCQUFpQixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQztRQUNwRSxNQUFNLENBQUMsSUFBSSxDQUFDLGVBQWUsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUN0QyxDQUFDO0FBQ0gsQ0FBQztBQU5lLG1CQU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DQUFDLE9BQU8sRUFBRSxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7Z0JBQ3hGLElBQUksQ0FBQyxrQkFBa0IsQ0FBQyxLQUFLLENBQUMsV0FBVyxFQUFFLENBQUMsQ0FBQztZQUMvQyxDQUFDO1NBQ0Y7SUFDSCxDQUFDO0lBRU8sK0NBQW1CLEdBQTNCLFVBQTRCLElBQWE7UUFDdkMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUM7SUFDN0YsQ0FBQztJQUNILHdCQUFDO0FBQUQsQ0FoREEsQUFnREMsQ0FoRCtCLElBQUksQ0FBQyxVQUFVLEdBZ0Q5QyIsImZpbGUiOiJydWxlcy9ub0V4dHJhU2VtaVJ1bGUuanMiLCJzb3VyY2VSb290IjoiZDpcXHByb2plY3RzXFx0c2xpbnQtZXNsaW50LXJ1bGVzXFxzcmMifQ== |
"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new NoInnerDeclarationsWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
Rule.prototype.apply = function (sourceFile) { | ||
var walker = new NoInnerDeclarationsWalker(sourceFile, this.getOptions()); | ||
return this.applyWithWalker(walker); | ||
} | ||
} | ||
}; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
class NoInnerDeclarationsWalker extends Lint.RuleWalker { | ||
constructor() { | ||
super(...arguments); | ||
var NoInnerDeclarationsWalker = (function (_super) { | ||
__extends(NoInnerDeclarationsWalker, _super); | ||
function NoInnerDeclarationsWalker() { | ||
_super.apply(this, arguments); | ||
this.VALID_PARENT_TYPES = [ | ||
@@ -24,24 +35,24 @@ ts.SyntaxKind.SourceFile, | ||
} | ||
visitFunctionDeclaration(node) { | ||
NoInnerDeclarationsWalker.prototype.visitFunctionDeclaration = function (node) { | ||
this.validateInnerDeclaration(node); | ||
super.visitFunctionDeclaration(node); | ||
} | ||
visitVariableStatement(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.visitVariableStatement(node); | ||
} | ||
validateInnerDeclaration(node) { | ||
const body = this.nearestBody(node); | ||
const isValid = (body.isSourceFile && body.distance === 1) || body.distance === 2; | ||
_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) { | ||
const decl = node.kind === ts.SyntaxKind.FunctionDeclaration ? 'function' : 'variable'; | ||
const root = body.isSourceFile ? 'program' : 'function body'; | ||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `move ${decl} declaration to ${root} root`)); | ||
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")); | ||
} | ||
} | ||
nearestBody(node) { | ||
let ancestor = node.parent; | ||
let generation = 1; | ||
}; | ||
NoInnerDeclarationsWalker.prototype.nearestBody = function (node) { | ||
var ancestor = node.parent; | ||
var generation = 1; | ||
while (ancestor && this.VALID_PARENT_TYPES.indexOf(ancestor.kind) === -1) { | ||
@@ -55,5 +66,6 @@ generation++; | ||
}; | ||
} | ||
} | ||
}; | ||
return NoInnerDeclarationsWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vSW5uZXJEZWNsYXJhdGlvbnNSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxNQUFZLEVBQUUsV0FBTSxZQUFZLENBQUMsQ0FBQTtBQUNqQyxNQUFZLElBQUksV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBRXhDLG1CQUEwQixJQUFJLENBQUMsS0FBSyxDQUFDLFlBQVk7SUFDeEMsS0FBSyxDQUFDLFVBQXlCO1FBQ3BDLE1BQU0sTUFBTSxHQUFHLElBQUkseUJBQXlCLENBQUMsVUFBVSxFQUFFLElBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDO1FBQzVFLE1BQU0sQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBQ3RDLENBQUM7QUFDSCxDQUFDO0FBTFksWUFBSSxPQUtoQixDQUFBO0FBRUQsd0NBQXdDLElBQUksQ0FBQyxVQUFVO0lBQXZEO1FBQXdDLG9CQUFlO1FBQzdDLHVCQUFrQixHQUFHO1lBQzNCLEVBQUUsQ0FBQyxVQUFVLENBQUMsVUFBVTtZQUN4QixFQUFFLENBQUMsVUFBVSxDQUFDLG1CQUFtQjtZQUNqQyxFQUFFLENBQUMsVUFBVSxDQUFDLGtCQUFrQjtZQUNoQyxFQUFFLENBQUMsVUFBV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| ||
const Lint = require('tslint/lib/lint'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new NoInvalidRegexpWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
Rule.prototype.apply = function (sourceFile) { | ||
var walker = new NoInvalidRegexpWalker(sourceFile, this.getOptions()); | ||
return this.applyWithWalker(walker); | ||
} | ||
} | ||
}; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
class NoInvalidRegexpWalker extends Lint.RuleWalker { | ||
visitNewExpression(node) { | ||
this.validateInvalidRegExp(node); | ||
super.visitNewExpression(node); | ||
var NoInvalidRegexpWalker = (function (_super) { | ||
__extends(NoInvalidRegexpWalker, _super); | ||
function NoInvalidRegexpWalker() { | ||
_super.apply(this, arguments); | ||
} | ||
visitCallExpression(node) { | ||
NoInvalidRegexpWalker.prototype.visitNewExpression = function (node) { | ||
this.validateInvalidRegExp(node); | ||
super.visitCallExpression(node); | ||
} | ||
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') { | ||
const args = node.arguments; | ||
var args = node.arguments; | ||
if (args && args.length > 0 && args[0].kind === ts.SyntaxKind.StringLiteral) { | ||
const expr = args[0].text; | ||
const flags = args.length > 1 && args[1].kind === ts.SyntaxKind.StringLiteral ? args[1].text : undefined; | ||
let regex; | ||
var expr = args[0].text; | ||
var flags = args.length > 1 && args[1].kind === ts.SyntaxKind.StringLiteral ? args[1].text : undefined; | ||
var regex = void 0; | ||
try { | ||
@@ -35,5 +49,6 @@ regex = new RegExp(expr, flags); | ||
} | ||
} | ||
} | ||
}; | ||
return NoInvalidRegexpWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vSW52YWxpZFJlZ2V4cFJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksRUFBRSxXQUFNLFlBQVksQ0FBQyxDQUFBO0FBQ2pDLE1BQVksSUFBSSxXQUFNLGlCQUFpQixDQUFDLENBQUE7QUFFeEMsbUJBQTBCLElBQUksQ0FBQyxLQUFLLENBQUMsWUFBWTtJQUN4QyxLQUFLLENBQUMsVUFBeUI7UUFDcEMsTUFBTSxNQUFNLEdBQUcsSUFBSSxxQkFBcUIsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFDLENBQUM7UUFDeEUsTUFBTSxDQUFDLElBQUksQ0FBQyxlQUFlLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdEMsQ0FBQztBQUNILENBQUM7QUFMWSxZQUFJLE9BS2hCLENBQUE7QUFFRCxvQ0FBb0MsSUFBSSxDQUFDLFVBQVU7SUFDdkMsa0JBQWtCLENBQUMsSUFBc0I7UUFDakQsSUFBSSxDQUFDLHFCQUFxQixDQUFDLElBQUksQ0FBQyxDQUFDO1FBQ2pDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUNqQyxDQUFDO0lBRVMsbUJBQW1CLENBQUMsSUFBdUI7UUFDbkQsSUFBSSxDQUFDLHFCQUFxQixDQUFDLElBQUksQ0FBQyxDQUFDO1FBQ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LENBQ0E7Z0JBQUEsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztvQkFDVCxJQUFJLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxFQUFFLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQztnQkFDbkYsQ0FBQztZQUNILENBQUM7UUFDSCxDQUFDO0lBQ0gsQ0FBQztJQUNILDRCQUFDO0FBQUQsQ0E1QkEsQUE0QkMsQ0E1Qm1DLElBQUksQ0FBQyxVQUFVLEdBNEJsRCIsImZpbGUiOiJydWxlcy9ub0ludmFsaWRSZWdleHBSdWxlLmpzIiwic291cmNlUm9vdCI6ImQ6XFxwcm9qZWN0c1xcdHNsaW50LWVzbGludC1ydWxlc1xcc3JjIn0= |
"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new NoIrregularWhitespaceWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
Rule.prototype.apply = function (sourceFile) { | ||
var walker = new NoIrregularWhitespaceWalker(sourceFile, this.getOptions()); | ||
return this.applyWithWalker(walker); | ||
} | ||
} | ||
Rule.RULE_NAME = 'no-irregular-whitespace'; | ||
Rule.FAILURE_STRING = 'irregular whitespace not allowed'; | ||
}; | ||
Rule.RULE_NAME = 'no-irregular-whitespace'; | ||
Rule.FAILURE_STRING = 'irregular whitespace not allowed'; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
class NoIrregularWhitespaceWalker extends Lint.RuleWalker { | ||
constructor() { | ||
super(...arguments); | ||
var NoIrregularWhitespaceWalker = (function (_super) { | ||
__extends(NoIrregularWhitespaceWalker, _super); | ||
function NoIrregularWhitespaceWalker() { | ||
_super.apply(this, arguments); | ||
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; | ||
} | ||
visitSourceFile(node) { | ||
NoIrregularWhitespaceWalker.prototype.visitSourceFile = function (node) { | ||
this.validateIrregularWhitespace(node); | ||
super.visitSourceFile(node); | ||
} | ||
visitNode(node) { | ||
_super.prototype.visitSourceFile.call(this, node); | ||
}; | ||
NoIrregularWhitespaceWalker.prototype.visitNode = function (node) { | ||
if (node.kind === ts.SyntaxKind.StringLiteral) { | ||
this.removeStringError(node); | ||
} | ||
super.visitNode(node); | ||
} | ||
removeStringError(node) { | ||
const start = node.getStart(); | ||
const end = node.getEnd(); | ||
const failures = this.getFailures(); | ||
for (let i = failures.length - 1; i >= 0; i--) { | ||
let failure = failures[i]; | ||
_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) { | ||
@@ -41,20 +52,22 @@ if (failure.getStartPosition().getPosition() >= start && failure.getEndPosition().getPosition() <= end) { | ||
} | ||
} | ||
validateIrregularWhitespace(node) { | ||
const lines = node.text.split(/\n/g); | ||
lines.forEach((line, i) => { | ||
let match = this.IRREGULAR_WHITESPACE.exec(line); | ||
}; | ||
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); | ||
_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); | ||
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); | ||
_this.addFailure(_this.createFailure(node.getPositionOfLineAndCharacter(i, match.index), 1, Rule.FAILURE_STRING)); | ||
match = _this.IRREGULAR_LINE_TERMINATORS.exec(line); | ||
} | ||
}); | ||
} | ||
} | ||
}; | ||
return NoIrregularWhitespaceWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vSXJyZWd1bGFyV2hpdGVzcGFjZVJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksRUFBRSxXQUFNLFlBQVksQ0FBQyxDQUFBO0FBQ2pDLE1BQVksSUFBSSxXQUFNLGlCQUFpQixDQUFDLENBQUE7QUFFeEMsbUJBQTBCLElBQUksQ0FBQyxLQUFLLENBQUMsWUFBWTtJQUl4QyxLQUFLLENBQUMsVUFBeUI7UUFDcEMsTUFBTSxNQUFNLEdBQUcsSUFBSSwyQkFBMk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"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new NoMultiSpacesWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
Rule.prototype.apply = function (sourceFile) { | ||
var walker = new NoMultiSpacesWalker(sourceFile, this.getOptions()); | ||
return this.applyWithWalker(walker); | ||
} | ||
} | ||
}; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
class NoMultiSpacesWalker extends Lint.RuleWalker { | ||
constructor(sourceFile, options) { | ||
super(sourceFile, options); | ||
this.EXCEPTION_MAP = { | ||
[ts.SyntaxKind.VariableDeclaration]: 'VariableDeclaration', | ||
[ts.SyntaxKind.PropertyAssignment]: 'PropertyAssignment', | ||
[ts.SyntaxKind.BinaryExpression]: 'BinaryExpression' | ||
}; | ||
var NoMultiSpacesWalker = (function (_super) { | ||
__extends(NoMultiSpacesWalker, _super); | ||
function NoMultiSpacesWalker(sourceFile, options) { | ||
_super.call(this, sourceFile, options); | ||
this.EXCEPTION_MAP = (_a = {}, | ||
_a[ts.SyntaxKind.VariableDeclaration] = 'VariableDeclaration', | ||
_a[ts.SyntaxKind.PropertyAssignment] = 'PropertyAssignment', | ||
_a[ts.SyntaxKind.BinaryExpression] = 'BinaryExpression', | ||
_a | ||
); | ||
this.STRING_TYPES = [ | ||
@@ -28,3 +40,3 @@ ts.SyntaxKind.NoSubstitutionTemplateLiteral, | ||
this.targetIndex = 0; | ||
const opt = this.getOptions(); | ||
var opt = this.getOptions(); | ||
this.src = sourceFile.getFullText(); | ||
@@ -37,3 +49,3 @@ if (opt.length) { | ||
} | ||
const pattern = /[^\n\r\u2028\u2029\t ].? {2,}/g; | ||
var pattern = /[^\n\r\u2028\u2029\t ].? {2,}/g; | ||
while (pattern.test(this.src)) { | ||
@@ -44,12 +56,13 @@ this.targets.push(pattern.lastIndex); | ||
this.lastNode = sourceFile.getLastToken(); | ||
var _a; | ||
} | ||
inRange(x, range) { | ||
NoMultiSpacesWalker.prototype.inRange = function (x, range) { | ||
return x >= range[0] && x <= range[1]; | ||
} | ||
warn(value, pos, node) { | ||
const msg = `Multiple spaces found before '${value}'.`; | ||
const exceptionName = this.EXCEPTION_MAP[node.parent.kind]; | ||
let report = true; | ||
const start = node.getFullStart() - 1; | ||
const previousChar = this.src.substring(start, start + 1); | ||
}; | ||
NoMultiSpacesWalker.prototype.warn = function (value, pos, node) { | ||
var msg = "Multiple spaces found before '" + value + "'."; | ||
var exceptionName = this.EXCEPTION_MAP[node.parent.kind]; | ||
var report = true; | ||
var start = node.getFullStart() - 1; | ||
var previousChar = this.src.substring(start, start + 1); | ||
if (exceptionName && this.exceptions[exceptionName]) { | ||
@@ -61,3 +74,3 @@ if (previousChar !== ',') { | ||
if (previousChar === ':') { | ||
let crt = node.parent; | ||
var crt = node.parent; | ||
while (crt.kind !== ts.SyntaxKind.SourceFile) { | ||
@@ -76,6 +89,7 @@ crt = crt.parent; | ||
} | ||
} | ||
walkChildren(node) { | ||
const range = [node.getStart(), node.getEnd()]; | ||
for (let i = this.targetIndex, len = this.targets.length, target; i < len; i++) { | ||
}; | ||
NoMultiSpacesWalker.prototype.walkChildren = function (node) { | ||
var _this = this; | ||
var range = [node.getStart(), node.getEnd()]; | ||
for (var i = this.targetIndex, len = this.targets.length, target = void 0; i < len; i++) { | ||
target = this.targets[i]; | ||
@@ -90,13 +104,13 @@ if (this.inRange(target, range)) { | ||
if (node === this.lastNode) { | ||
this.targets.forEach((target) => { | ||
const valid = this.targetNode[target]; | ||
this.targets.forEach(function (target) { | ||
var valid = _this.targetNode[target]; | ||
if (target === valid.getStart()) { | ||
this.warn(valid.getText(), target, valid); | ||
_this.warn(valid.getText(), target, valid); | ||
} | ||
else if (target === valid.getEnd() - 1 && this.STRING_TYPES.indexOf(valid.kind) === -1) { | ||
const endChar = this.src.substring(target, valid.getEnd()); | ||
this.warn(endChar, target, valid); | ||
else if (target === valid.getEnd() - 1 && _this.STRING_TYPES.indexOf(valid.kind) === -1) { | ||
var endChar = _this.src.substring(target, valid.getEnd()); | ||
_this.warn(endChar, target, valid); | ||
} | ||
else { | ||
if (this.src.charAt(target) !== '\n' && valid.kind !== ts.SyntaxKind.SourceFile) { | ||
if (_this.src.charAt(target) !== '\n' && valid.kind !== ts.SyntaxKind.SourceFile) { | ||
} | ||
@@ -106,9 +120,10 @@ } | ||
} | ||
const children = node.getChildren(); | ||
for (let index in children) { | ||
var children = node.getChildren(); | ||
for (var index in children) { | ||
this.visitNode(children[index]); | ||
} | ||
} | ||
} | ||
}; | ||
return NoMultiSpacesWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vTXVsdGlTcGFjZXNSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxNQUFZLEVBQUUsV0FBTSxZQUFZLENBQUMsQ0FBQTtBQUNqQyxNQUFZLElBQUksV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBRXhDLG1CQUEwQixJQUFJLENBQUMsS0FBSyxDQUFDLFlBQVk7SUFFeEMsS0FBSyxDQUFDLFVBQXlCO1FBQ3BDLE1BQU0sTUFBTSxHQUFHLElBQUksbUJBQW1CLENBQUMsVUFBVSxFQUFFLElBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDO1FBQ3RFLE1BQU0sQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLE1B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U0FBUyxDQUFDLFFBQVEsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDO1FBQ2xDLENBQUM7SUFDSCxDQUFDO0lBQ0gsMEJBQUM7QUFBRCxDQXBIQSxBQW9IQyxDQXBIaUMsSUFBSSxDQUFDLFVBQVUsR0FvSGhEIiwiZmlsZSI6InJ1bGVzL25vTXVsdGlTcGFjZXNSdWxlLmpzIiwic291cmNlUm9vdCI6ImQ6XFxwcm9qZWN0c1xcdHNsaW50LWVzbGludC1ydWxlc1xcc3JjIn0= |
"use strict"; | ||
const Lint = require('tslint/lib/lint'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new NoRegexSpacesWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var Lint = require('tslint/lib/lint'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
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) { | ||
__extends(NoRegexSpacesWalker, _super); | ||
function NoRegexSpacesWalker() { | ||
_super.apply(this, arguments); | ||
} | ||
} | ||
exports.Rule = Rule; | ||
class NoRegexSpacesWalker extends Lint.RuleWalker { | ||
visitRegularExpressionLiteral(node) { | ||
NoRegexSpacesWalker.prototype.visitRegularExpressionLiteral = function (node) { | ||
this.validateMultipleSpaces(node); | ||
super.visitRegularExpressionLiteral(node); | ||
} | ||
validateMultipleSpaces(node) { | ||
const res = /( {2,})+?/.exec(node.text); | ||
_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}}`)); | ||
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;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vUmVnZXhTcGFjZXNSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxNQUFZLElBQUksV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBRXhDLG1CQUEwQixJQUFJLENBQUMsS0FBSyxDQUFDLFlBQVk7SUFDeEMsS0FBSyxDQUFDLFVBQXlCO1FBQ3BDLE1BQU0sTUFBTSxHQUFHLElBQUksbUJBQW1CLENBQUMsVUFBVSxFQUFFLElBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDO1FBQ3RFLE1BQU0sQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBQ3RDLENBQUM7QUFDSCxDQUFDO0FBTFksWUFBSSxPQUtoQixDQUFBO0FBRUQsa0NBQWtDLElBQUksQ0FBQyxVQUFVO0lBQ3JDLDZCQUE2QixDQUFDLElBQTBCO1FBQ2hFLElBQUksQ0FBQyxzQkFBc0IsQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUNsQyxLQUFLLENBQUMsNkJBQTZCLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDNUMsQ0FBQztJQUVPLHNCQUFzQixDQUFDLElBQTBCO1FBQ3ZELE1BQU0sR0FBRyxHQUFHLFdBQVcsQ0FBQyxJQUFJLENBQUMsSUFBSS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0lBQWtDLHVDQUFlO0lBQWpEO1FBQWtDLDhCQUFlO0lBWWpELENBQUM7SUFYVywyREFBNkIsR0FBdkMsVUFBd0MsSUFBMEI7UUFDaEUsSUFBSSxDQUFDLHNCQUFzQixDQUFDLElBQUksQ0FBQyxDQUFDO1FBQ2xDLGdCQUFLLENBQUMsNkJBQTZCLFlBQUMsSUFBSSxDQUFDLENBQUM7SUFDNUMsQ0FBQztJQUVPLG9EQUFzQixHQUE5QixVQUErQixJQUEwQjtRQUN2RCxJQUFNLEdBQUcsR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUN4QyxFQUFFLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDO1lBQ1IsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUscUNBQW1DLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxNQUFNLE1BQUcsQ0FBQyxDQUFDLENBQUM7UUFDN0gsQ0FBQztJQUNILENBQUM7SUFDSCwwQkFBQztBQUFELENBWkEsQUFZQyxDQVppQyxJQUFJLENBQUMsVUFBVSxHQVloRCIsImZpbGUiOiJydWxlcy9ub1JlZ2V4U3BhY2VzUnVsZS5qcyIsInNvdXJjZVJvb3QiOiJkOlxccHJvamVjdHNcXHRzbGludC1lc2xpbnQtcnVsZXNcXHNyYyJ9 |
"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new NoSparseArraysWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
Rule.prototype.apply = function (sourceFile) { | ||
var walker = new NoSparseArraysWalker(sourceFile, this.getOptions()); | ||
return this.applyWithWalker(walker); | ||
}; | ||
Rule.FAILURE_STRING = 'unexpected comma in middle of array'; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
var NoSparseArraysWalker = (function (_super) { | ||
__extends(NoSparseArraysWalker, _super); | ||
function NoSparseArraysWalker() { | ||
_super.apply(this, arguments); | ||
} | ||
} | ||
Rule.FAILURE_STRING = 'unexpected comma in middle of array'; | ||
exports.Rule = Rule; | ||
class NoSparseArraysWalker extends Lint.RuleWalker { | ||
visitArrayLiteralExpression(node) { | ||
NoSparseArraysWalker.prototype.visitArrayLiteralExpression = function (node) { | ||
this.validateNoSparseArray(node); | ||
super.visitArrayLiteralExpression(node); | ||
} | ||
validateNoSparseArray(node) { | ||
const hasEmptySlot = node.elements.some(el => el.kind === ts.SyntaxKind.OmittedExpression); | ||
_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)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vU3BhcnNlQXJyYXlzUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsTUFBWSxFQUFFLFdBQU0sWUFBWS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PLG9EQUFxQixHQUE3QixVQUE4QixJQUErQjtRQUMzRCxJQUFNLFlBQVksR0FBRyxJQUFJLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxVQUFBLEVBQUUsSUFBSSxPQUFBLEVBQUUsQ0FBQyxJQUFJLEtBQUssRUFBRSxDQUFDLFVBQVUsQ0FBQyxpQkFBaUIsRUFBM0MsQ0FBMkMsQ0FBQyxDQUFDO1FBRTNGLEVBQUUsQ0FBQyxDQUFDLFlBQVksQ0FBQyxDQUFDLENBQUM7WUFDakIsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUM7UUFDN0YsQ0FBQztJQUNILENBQUM7SUFDSCwyQkFBQztBQUFELENBYkEsQUFhQyxDQWJrQyxJQUFJLENBQUMsVUFBVSxHQWFqRCIsImZpbGUiOiJydWxlcy9ub1NwYXJzZUFycmF5c1J1bGUuanMiLCJzb3VyY2VSb290IjoiZDpcXHByb2plY3RzXFx0c2xpbnQtZXNsaW50LXJ1bGVzXFxzcmMifQ== |
"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new NoUnexpectedMultilineWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
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) { | ||
__extends(NoUnexpectedMultilineWalker, _super); | ||
function NoUnexpectedMultilineWalker() { | ||
_super.apply(this, arguments); | ||
} | ||
} | ||
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' | ||
}; | ||
exports.Rule = Rule; | ||
class NoUnexpectedMultilineWalker extends Lint.RuleWalker { | ||
visitCallExpression(node) { | ||
const firstLeftParen = node.getChildren().filter(ch => ch.kind === ts.SyntaxKind.OpenParenToken)[0]; | ||
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.visitCallExpression(node); | ||
} | ||
visitElementAccessExpression(node) { | ||
const firstLeftSquareBracket = node.getChildren().filter(ch => ch.kind === ts.SyntaxKind.OpenBracketToken)[0]; | ||
_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.visitElementAccessExpression(node); | ||
} | ||
visitNode(node) { | ||
_super.prototype.visitElementAccessExpression.call(this, node); | ||
}; | ||
NoUnexpectedMultilineWalker.prototype.visitNode = function (node) { | ||
if (node.kind === ts.SyntaxKind.TaggedTemplateExpression) { | ||
const children = node.getChildren(); | ||
const tag = children.filter(ch => ch.kind === ts.SyntaxKind.Identifier)[0]; | ||
const tagIndex = children.indexOf(tag); | ||
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]) { | ||
const template = children[tagIndex + 1]; | ||
var template = children[tagIndex + 1]; | ||
if (this.isBreakBefore(template)) { | ||
@@ -43,11 +57,11 @@ this.addFailure(this.createFailure(node.getStart(), node.getWidth(), this.getMessage(node))); | ||
} | ||
super.visitNode(node); | ||
} | ||
isBreakBefore(node) { | ||
_super.prototype.visitNode.call(this, node); | ||
}; | ||
NoUnexpectedMultilineWalker.prototype.isBreakBefore = function (node) { | ||
if (node.parent) { | ||
const children = node.parent.getChildren(); | ||
const nodeIndex = children.indexOf(node); | ||
var children = node.parent.getChildren(); | ||
var nodeIndex = children.indexOf(node); | ||
if (nodeIndex > 0) { | ||
const nodeLine = this.getStartPosition(node).line; | ||
const previousNodeLine = this.getEndPosition(children[nodeIndex - 1]).line; | ||
var nodeLine = this.getStartPosition(node).line; | ||
var previousNodeLine = this.getEndPosition(children[nodeIndex - 1]).line; | ||
if (nodeLine !== previousNodeLine) { | ||
@@ -59,4 +73,4 @@ return true; | ||
return false; | ||
} | ||
getMessage(node) { | ||
}; | ||
NoUnexpectedMultilineWalker.prototype.getMessage = function (node) { | ||
switch (node.kind) { | ||
@@ -72,11 +86,12 @@ case ts.SyntaxKind.CallExpression: | ||
} | ||
} | ||
getStartPosition(node) { | ||
}; | ||
NoUnexpectedMultilineWalker.prototype.getStartPosition = function (node) { | ||
return node.getSourceFile().getLineAndCharacterOfPosition(node.getStart()); | ||
} | ||
getEndPosition(node) { | ||
}; | ||
NoUnexpectedMultilineWalker.prototype.getEndPosition = function (node) { | ||
return node.getSourceFile().getLineAndCharacterOfPosition(node.getEnd()); | ||
} | ||
} | ||
}; | ||
return NoUnexpectedMultilineWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vVW5leHBlY3RlZE11bHRpbGluZVJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksRUFBRSxXQUFNLFlBQVksQ0FBQyxDQUFBO0FBQ2pDLE1BQVksSUFBSSxXQUFNLGlCQUFpQixDQUFDLENBQUE7QUFFeEMsbUJBQTBCLElBQUksQ0FBQyxLQUFLLENBQUMsWUFBWTtJQU94QyxLQUFLLENBQUMsVUFBeUI7UUFDcEMsTUFBTSxNQUFNLEdBQUcsSUFBSSwyQkFBMkIsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFDLENBQUM7UUFDOUUsTUFBTSxDQUFDLElBQUksQ0FBQyxlQUFlLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdEMsQ0FBQztBQUNILENBQUM7QUFWZSxtQkFBYyxHQUFHO0lBQzdCLElBQUksRUFBRSw0REFBNEQ7SUFDbEUsSUFBSSxFQUFFLDREQUE0RDtJQUNsRSxRQUFRLEVBQUUsOERBQThEO0NBQ3pFLENBQUM7QUFMUyxZQUFJLE9BV2hCLENBQUE7QUFFRCwwQ0FBMEMsSUFBSSxDQUFDLFVBQVU7SUFDN0MsbUJBQW1CLENBQUMsSUFBdUI7UUFDbkQsTUFBTSxjQUFjLEdBQUcsSUFBSSxDQUFDLFdBQVcsRUFBRSxDQUFDLE1BQU0sQ0FBQyxFQUFFLElBQUksRUFBRSxDQUFDLElBQUksS0FBSyxFQUFFLENBQUMsVUFBVSxDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUMsQ0FBQ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ZCLENBQUMsSUFBSSxDQUFDLE1BQU0sRUFBRSxDQUFDLENBQUM7SUFDM0UsQ0FBQztJQUNILGtDQUFDO0FBQUQsQ0E3RUEsQUE2RUMsQ0E3RXlDLElBQUksQ0FBQyxVQUFVLEdBNkV4RCIsImZpbGUiOiJydWxlcy9ub1VuZXhwZWN0ZWRNdWx0aWxpbmVSdWxlLmpzIiwic291cmNlUm9vdCI6ImQ6XFxwcm9qZWN0c1xcdHNsaW50LWVzbGludC1ydWxlc1xcc3JjIn0= |
"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
const OPTION_ALWAYS = 'always'; | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new ObjectCurlySpacingWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var OPTION_ALWAYS = 'always'; | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
Rule.prototype.apply = function (sourceFile) { | ||
var walker = new ObjectCurlySpacingWalker(sourceFile, this.getOptions()); | ||
return this.applyWithWalker(walker); | ||
} | ||
} | ||
Rule.FAILURE_STRING = { | ||
always: { | ||
start: `A space is required after '{'`, | ||
end: `A space is required before '}'` | ||
}, | ||
never: { | ||
start: `There should be no space after '{'`, | ||
end: `There should be no space before '}'` | ||
} | ||
}; | ||
}; | ||
Rule.FAILURE_STRING = { | ||
always: { | ||
start: "A space is required after '{'", | ||
end: "A space is required before '}'" | ||
}, | ||
never: { | ||
start: "There should be no space after '{'", | ||
end: "There should be no space before '}'" | ||
} | ||
}; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
class ObjectCurlySpacingWalker extends Lint.RuleWalker { | ||
constructor(sourceFile, options) { | ||
super(sourceFile, options); | ||
var ObjectCurlySpacingWalker = (function (_super) { | ||
__extends(ObjectCurlySpacingWalker, _super); | ||
function ObjectCurlySpacingWalker(sourceFile, options) { | ||
_super.call(this, sourceFile, options); | ||
this.always = this.hasOption(OPTION_ALWAYS) || (this.getOptions() && this.getOptions().length === 0); | ||
} | ||
visitNode(node) { | ||
const bracedKind = [ | ||
ObjectCurlySpacingWalker.prototype.visitNode = function (node) { | ||
var bracedKind = [ | ||
ts.SyntaxKind.ObjectLiteralExpression, | ||
@@ -37,11 +48,11 @@ ts.SyntaxKind.ObjectBindingPattern, | ||
} | ||
super.visitNode(node); | ||
} | ||
checkSpacingInsideBraces(node) { | ||
const text = node.getText(); | ||
_super.prototype.visitNode.call(this, node); | ||
}; | ||
ObjectCurlySpacingWalker.prototype.checkSpacingInsideBraces = function (node) { | ||
var text = node.getText(); | ||
if (text.indexOf('\n') !== -1 || text === '{}') { | ||
return; | ||
} | ||
const leadingSpace = text.match(/^\{(\s{0,2})/)[1].length; | ||
const trailingSpace = text.match(/(\s{0,2})}$/)[1].length; | ||
var leadingSpace = text.match(/^\{(\s{0,2})/)[1].length; | ||
var trailingSpace = text.match(/(\s{0,2})}$/)[1].length; | ||
if (this.always) { | ||
@@ -63,5 +74,6 @@ if (leadingSpace === 0) { | ||
} | ||
} | ||
} | ||
}; | ||
return ObjectCurlySpacingWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL29iamVjdEN1cmx5U3BhY2luZ1J1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksRUFBRSxXQUFNLFlBQVksQ0FBQyxDQUFBO0FBQ2pDLE1BQVksSUFBSSxXQUFNLGlCQUFpQixDQUFDLENBQUE7QUFFeEMsTUFBT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1lBQzNGLENBQUM7WUFDRCxFQUFFLENBQUMsQ0FBQyxhQUFhLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQztnQkFDdEIsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxNQUFNLEVBQUUsR0FBRyxDQUFDLEVBQUUsQ0FBQyxFQUFFLElBQUksQ0FBQyxjQUFjLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7WUFDM0YsQ0FBQztRQUNILENBQUM7SUFDSCxDQUFDO0lBRUgsK0JBQUM7QUFBRCxDQS9DQSxBQStDQyxDQS9Dc0MsSUFBSSxDQUFDLFVBQVUsR0ErQ3JEIiwiZmlsZSI6InJ1bGVzL29iamVjdEN1cmx5U3BhY2luZ1J1bGUuanMiLCJzb3VyY2VSb290IjoiZDpcXHByb2plY3RzXFx0c2xpbnQtZXNsaW50LXJ1bGVzXFxzcmMifQ== |
"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new UseIsnanWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
Rule.prototype.apply = function (sourceFile) { | ||
var walker = new UseIsnanWalker(sourceFile, this.getOptions()); | ||
return this.applyWithWalker(walker); | ||
} | ||
} | ||
Rule.FAILURE_STRING = 'use the isNaN function to compare with NaN'; | ||
}; | ||
Rule.FAILURE_STRING = 'use the isNaN function to compare with NaN'; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
class UseIsnanWalker extends Lint.RuleWalker { | ||
constructor() { | ||
super(...arguments); | ||
var UseIsnanWalker = (function (_super) { | ||
__extends(UseIsnanWalker, _super); | ||
function UseIsnanWalker() { | ||
_super.apply(this, arguments); | ||
this.OPERATORS = [ts.SyntaxKind.EqualsEqualsToken, ts.SyntaxKind.EqualsEqualsEqualsToken, ts.SyntaxKind.ExclamationEqualsToken, ts.SyntaxKind.ExclamationEqualsEqualsToken]; | ||
} | ||
visitBinaryExpression(node) { | ||
UseIsnanWalker.prototype.visitBinaryExpression = function (node) { | ||
this.validateUseIsnan(node); | ||
super.visitBinaryExpression(node); | ||
} | ||
validateUseIsnan(node) { | ||
_super.prototype.visitBinaryExpression.call(this, node); | ||
}; | ||
UseIsnanWalker.prototype.validateUseIsnan = function (node) { | ||
if (this.OPERATORS.indexOf(node.operatorToken.kind) !== -1) { | ||
@@ -27,5 +38,6 @@ if (node.left.getText() === 'NaN' || node.right.getText() === 'NaN') { | ||
} | ||
} | ||
} | ||
}; | ||
return UseIsnanWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3VzZUlzbmFuUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsTUFBWSxFQUFFLFdBQU0sWUFBWSxDQUFDLENBQUE7QUFDakMsTUFBWSxJQUFJLFdBQU0saUJBQWlCLENBQUMsQ0FBQTtBQUV4QyxtQkFBMEIsSUFBSSxDQUFDLEtBQUssQ0FBQyxZQUFZO0lBR3hDLEtBQUssQ0FBQyxVQUF5QjtRQUNwQyxNQUFNLE1BQU0sR0FBRyxJQUFJLGNBQWMsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFDLENBQUM7UUFDakUsTUFBTSxDQUFDLElBQUksQ0FBQyxlQUFlLEN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IsRUFBRSxFQUFFLENBQUMsVUFBVSxDQUFDLDRCQUE0QixDQUFDLENBQUM7SUFjakwsQ0FBQztJQVpXLDhDQUFxQixHQUEvQixVQUFnQyxJQUF5QjtRQUN2RCxJQUFJLENBQUMsZ0JBQWdCLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDNUIsZ0JBQUssQ0FBQyxxQkFBcUIsWUFBQyxJQUFJLENBQUMsQ0FBQztJQUNwQyxDQUFDO0lBRU8seUNBQWdCLEdBQXhCLFVBQXlCLElBQXlCO1FBQ2hELEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQzNELEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxFQUFFLEtBQUssS0FBSyxJQUFJLElBQUksQ0FBQyxLQUFLLENBQUMsT0FBTyxFQUFFLEtBQUssS0FBSyxDQUFDLENBQUMsQ0FBQztnQkFDcEUsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUM7WUFDN0YsQ0FBQztRQUNILENBQUM7SUFDSCxDQUFDO0lBQ0gscUJBQUM7QUFBRCxDQWZBLEFBZUMsQ0FmNEIsSUFBSSxDQUFDLFVBQVUsR0FlM0MiLCJmaWxlIjoicnVsZXMvdXNlSXNuYW5SdWxlLmpzIiwic291cmNlUm9vdCI6ImQ6XFxwcm9qZWN0c1xcdHNsaW50LWVzbGludC1ydWxlc1xcc3JjIn0= |
"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
const doctrine = require('doctrine'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
let opts = this.getOptions().ruleArguments; | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var doctrine = require('doctrine'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
Rule.prototype.apply = function (sourceFile) { | ||
var opts = this.getOptions().ruleArguments; | ||
if (opts && opts.length > 0) { | ||
@@ -17,36 +26,38 @@ if (opts[0].prefer) { | ||
} | ||
const walker = new ValidJsdocWalker(sourceFile, this.getOptions()); | ||
var walker = new ValidJsdocWalker(sourceFile, this.getOptions()); | ||
return this.applyWithWalker(walker); | ||
} | ||
} | ||
Rule.FAILURE_STRING = { | ||
missingBrace: 'JSDoc type missing brace', | ||
syntaxError: 'JSDoc syntax error', | ||
missingParameterType: (name) => `missing JSDoc parameter type for '${name}'`, | ||
missingParameterDescription: (name) => `missing JSDoc parameter description for '${name}'`, | ||
duplicateParameter: (name) => `duplicate JSDoc parameter '${name}'`, | ||
unexpectedTag: (title) => `unexpected @${title} tag; function has no return statement`, | ||
missingReturnType: 'missing JSDoc return type', | ||
missingReturnDescription: 'missing JSDoc return description', | ||
prefer: (name) => `use @${name} instead`, | ||
missingReturn: (param) => `missing JSDoc @${param || 'returns'} for function`, | ||
wrongParam: (expected, actual) => `expected JSDoc for '${expected}'' but found '${actual}'`, | ||
missingParam: (name) => `missing JSDoc for parameter '${name}'`, | ||
wrongDescription: 'JSDoc description does not satisfy the regex pattern', | ||
invalidRegexDescription: (error) => `configured matchDescription is an invalid RegExp. Error: ${error}` | ||
}; | ||
Rule.prefer = {}; | ||
Rule.requireReturn = true; | ||
Rule.requireParamDescription = true; | ||
Rule.requireReturnDescription = true; | ||
}; | ||
Rule.FAILURE_STRING = { | ||
missingBrace: 'JSDoc type missing brace', | ||
syntaxError: 'JSDoc syntax error', | ||
missingParameterType: function (name) { return ("missing JSDoc parameter type for '" + name + "'"); }, | ||
missingParameterDescription: function (name) { return ("missing JSDoc parameter description for '" + name + "'"); }, | ||
duplicateParameter: function (name) { return ("duplicate JSDoc parameter '" + name + "'"); }, | ||
unexpectedTag: function (title) { return ("unexpected @" + title + " tag; function has no return statement"); }, | ||
missingReturnType: 'missing JSDoc return type', | ||
missingReturnDescription: 'missing JSDoc return description', | ||
prefer: function (name) { return ("use @" + name + " instead"); }, | ||
missingReturn: function (param) { return ("missing JSDoc @" + (param || 'returns') + " for function"); }, | ||
wrongParam: function (expected, actual) { return ("expected JSDoc for '" + expected + "'' but found '" + actual + "'"); }, | ||
missingParam: function (name) { return ("missing JSDoc for parameter '" + name + "'"); }, | ||
wrongDescription: 'JSDoc description does not satisfy the regex pattern', | ||
invalidRegexDescription: function (error) { return ("configured matchDescription is an invalid RegExp. Error: " + error); } | ||
}; | ||
Rule.prefer = {}; | ||
Rule.requireReturn = true; | ||
Rule.requireParamDescription = true; | ||
Rule.requireReturnDescription = true; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
class ValidJsdocWalker extends Lint.SkippableTokenAwareRuleWalker { | ||
constructor() { | ||
super(...arguments); | ||
var ValidJsdocWalker = (function (_super) { | ||
__extends(ValidJsdocWalker, _super); | ||
function ValidJsdocWalker() { | ||
_super.apply(this, arguments); | ||
this.fns = []; | ||
} | ||
visitSourceFile(node) { | ||
super.visitSourceFile(node); | ||
} | ||
visitNode(node) { | ||
ValidJsdocWalker.prototype.visitSourceFile = function (node) { | ||
_super.prototype.visitSourceFile.call(this, node); | ||
}; | ||
ValidJsdocWalker.prototype.visitNode = function (node) { | ||
if (node.kind === ts.SyntaxKind.ClassExpression) { | ||
@@ -56,46 +67,46 @@ this.visitClassExpression(node); | ||
else { | ||
super.visitNode(node); | ||
_super.prototype.visitNode.call(this, node); | ||
} | ||
} | ||
visitArrowFunction(node) { | ||
}; | ||
ValidJsdocWalker.prototype.visitArrowFunction = function (node) { | ||
this.startFunction(node); | ||
super.visitArrowFunction(node); | ||
_super.prototype.visitArrowFunction.call(this, node); | ||
this.checkJSDoc(node); | ||
} | ||
visitFunctionExpression(node) { | ||
}; | ||
ValidJsdocWalker.prototype.visitFunctionExpression = function (node) { | ||
this.startFunction(node); | ||
super.visitFunctionExpression(node); | ||
_super.prototype.visitFunctionExpression.call(this, node); | ||
this.checkJSDoc(node); | ||
} | ||
visitFunctionDeclaration(node) { | ||
}; | ||
ValidJsdocWalker.prototype.visitFunctionDeclaration = function (node) { | ||
this.startFunction(node); | ||
super.visitFunctionDeclaration(node); | ||
_super.prototype.visitFunctionDeclaration.call(this, node); | ||
this.checkJSDoc(node); | ||
} | ||
visitClassExpression(node) { | ||
}; | ||
ValidJsdocWalker.prototype.visitClassExpression = function (node) { | ||
this.startFunction(node); | ||
super.visitClassExpression(node); | ||
_super.prototype.visitClassExpression.call(this, node); | ||
this.checkJSDoc(node); | ||
} | ||
visitClassDeclaration(node) { | ||
}; | ||
ValidJsdocWalker.prototype.visitClassDeclaration = function (node) { | ||
this.startFunction(node); | ||
super.visitClassDeclaration(node); | ||
_super.prototype.visitClassDeclaration.call(this, node); | ||
this.checkJSDoc(node); | ||
} | ||
visitMethodDeclaration(node) { | ||
}; | ||
ValidJsdocWalker.prototype.visitMethodDeclaration = function (node) { | ||
this.startFunction(node); | ||
super.visitMethodDeclaration(node); | ||
_super.prototype.visitMethodDeclaration.call(this, node); | ||
this.checkJSDoc(node); | ||
} | ||
visitConstructorDeclaration(node) { | ||
}; | ||
ValidJsdocWalker.prototype.visitConstructorDeclaration = function (node) { | ||
this.startFunction(node); | ||
super.visitConstructorDeclaration(node); | ||
_super.prototype.visitConstructorDeclaration.call(this, node); | ||
this.checkJSDoc(node); | ||
} | ||
visitReturnStatement(node) { | ||
}; | ||
ValidJsdocWalker.prototype.visitReturnStatement = function (node) { | ||
this.addReturn(node); | ||
super.visitReturnStatement(node); | ||
} | ||
startFunction(node) { | ||
let returnPresent = false; | ||
_super.prototype.visitReturnStatement.call(this, node); | ||
}; | ||
ValidJsdocWalker.prototype.startFunction = function (node) { | ||
var returnPresent = false; | ||
if (node.kind === ts.SyntaxKind.ArrowFunction && node.body.kind !== ts.SyntaxKind.Block) | ||
@@ -105,7 +116,7 @@ returnPresent = true; | ||
returnPresent = true; | ||
this.fns.push({ node, returnPresent }); | ||
} | ||
addReturn(node) { | ||
let parent = node; | ||
let nodes = this.fns.map(fn => fn.node); | ||
this.fns.push({ node: node, returnPresent: returnPresent }); | ||
}; | ||
ValidJsdocWalker.prototype.addReturn = function (node) { | ||
var parent = node; | ||
var nodes = this.fns.map(function (fn) { return fn.node; }); | ||
while (parent && nodes.indexOf(parent) === -1) | ||
@@ -116,11 +127,11 @@ parent = parent.parent; | ||
} | ||
} | ||
isTypeClass(node) { | ||
}; | ||
ValidJsdocWalker.prototype.isTypeClass = function (node) { | ||
return node.kind === ts.SyntaxKind.ClassExpression || node.kind === ts.SyntaxKind.ClassDeclaration; | ||
} | ||
isValidReturnType(tag) { | ||
}; | ||
ValidJsdocWalker.prototype.isValidReturnType = function (tag) { | ||
return tag.type.name === 'void' || tag.type.type === 'UndefinedLiteral'; | ||
} | ||
getJSDocComment(node) { | ||
const ALLOWED_PARENTS = [ | ||
}; | ||
ValidJsdocWalker.prototype.getJSDocComment = function (node) { | ||
var ALLOWED_PARENTS = [ | ||
ts.SyntaxKind.BinaryExpression, | ||
@@ -131,3 +142,3 @@ ts.SyntaxKind.VariableDeclaration, | ||
]; | ||
if (!node.getFullText().trim().startsWith('/**')) { | ||
if (!/^\/\*\*/.test(node.getFullText().trim())) { | ||
if (ALLOWED_PARENTS.indexOf(node.parent.kind) !== -1) { | ||
@@ -138,17 +149,18 @@ return this.getJSDocComment(node.parent); | ||
} | ||
let comments = node.getFullText(); | ||
var comments = node.getFullText(); | ||
comments = comments.substring(comments.indexOf('/**')); | ||
comments = comments.substring(0, comments.indexOf('*/') + 2); | ||
let start = node.pos; | ||
let width = comments.length; | ||
if (!comments.startsWith('/**') || !comments.endsWith('*/')) { | ||
var start = node.pos; | ||
var width = comments.length; | ||
if (!/^\/\*\*/.test(comments) || !/\*\/$/.test(comments)) { | ||
return {}; | ||
} | ||
return { comments, start, width }; | ||
} | ||
checkJSDoc(node) { | ||
const { comments, start, width } = this.getJSDocComment(node); | ||
return { comments: comments, start: start, width: width }; | ||
}; | ||
ValidJsdocWalker.prototype.checkJSDoc = function (node) { | ||
var _this = this; | ||
var _a = this.getJSDocComment(node), comments = _a.comments, start = _a.start, width = _a.width; | ||
if (!comments) | ||
return; | ||
let jsdoc; | ||
var jsdoc; | ||
try { | ||
@@ -170,8 +182,9 @@ jsdoc = doctrine.parse(comments, { | ||
} | ||
const fn = this.fns.find(f => node === f.node); | ||
let params = {}; | ||
let hasReturns = false; | ||
let hasConstructor = false; | ||
let isOverride = false; | ||
for (let tag of jsdoc.tags) { | ||
var fn = this.fns.filter(function (f) { return node === f.node; })[0]; | ||
var params = {}; | ||
var hasReturns = false; | ||
var hasConstructor = false; | ||
var isOverride = false; | ||
for (var _i = 0, _b = jsdoc.tags; _i < _b.length; _i++) { | ||
var tag = _b[_i]; | ||
switch (tag.title) { | ||
@@ -218,3 +231,3 @@ case 'param': | ||
} | ||
let title = Rule.prefer[tag.title]; | ||
var title = Rule.prefer[tag.title]; | ||
if (Rule.prefer.hasOwnProperty(tag.title) && tag.title !== title) { | ||
@@ -229,13 +242,13 @@ this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.prefer(title))); | ||
} | ||
const jsdocParams = Object.keys(params); | ||
const parameters = node.parameters; | ||
var jsdocParams = Object.keys(params); | ||
var parameters = node.parameters; | ||
if (parameters) { | ||
parameters.forEach((param, i) => { | ||
parameters.forEach(function (param, i) { | ||
if (param.name.kind === ts.SyntaxKind.Identifier) { | ||
let name = param.name.text; | ||
if (jsdocParams[i] && name !== jsdocParams[i]) { | ||
this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.wrongParam(name, jsdocParams[i]))); | ||
var name_1 = param.name.text; | ||
if (jsdocParams[i] && name_1 !== jsdocParams[i]) { | ||
_this.addFailure(_this.createFailure(start, width, Rule.FAILURE_STRING.wrongParam(name_1, jsdocParams[i]))); | ||
} | ||
else if (!params[name] && !isOverride) { | ||
this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.missingParam(name))); | ||
else if (!params[name_1] && !isOverride) { | ||
_this.addFailure(_this.createFailure(start, width, Rule.FAILURE_STRING.missingParam(name_1))); | ||
} | ||
@@ -247,3 +260,3 @@ } | ||
try { | ||
const regex = new RegExp(Rule.matchDescription); | ||
var regex = new RegExp(Rule.matchDescription); | ||
if (!regex.test(jsdoc.description)) { | ||
@@ -257,5 +270,6 @@ this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.wrongDescription)); | ||
} | ||
} | ||
} | ||
}; | ||
return ValidJsdocWalker; | ||
}(Lint.SkippableTokenAwareRuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3ZhbGlkSnNkb2NSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxNQUFZLEVBQUUsV0FBTSxZQUFZLENBQUMsQ0FBQTtBQUNqQyxNQUFZLElBQUksV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQ3hDLE1BQVksUUFBUSxXQUFNLFVBQVUsQ0FBQyxDQUFBO0FBRXJDLG1CQUEwQixJQUFJLENBQUMsS0FBSyxDQUFDLFlBQVk7SUF3QnhDLEtBQUssQ0FBQyxVQUF5QjtRQUNwQyxJQUFJLElBQUksR0FBRyxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUMsYUFBYSxDQUFDO1FBQzNDLEVBQUUsQ0FBQyxDQ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ZVJvb3QiOiJkOlxccHJvamVjdHNcXHRzbGludC1lc2xpbnQtcnVsZXNcXHNyYyJ9 |
"use strict"; | ||
const ts = require('typescript'); | ||
const Lint = require('tslint/lib/lint'); | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const walker = new ValidTypeofWalker(sourceFile, this.getOptions()); | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var ts = require('typescript'); | ||
var Lint = require('tslint/lib/lint'); | ||
var Rule = (function (_super) { | ||
__extends(Rule, _super); | ||
function Rule() { | ||
_super.apply(this, arguments); | ||
} | ||
Rule.prototype.apply = function (sourceFile) { | ||
var walker = new ValidTypeofWalker(sourceFile, this.getOptions()); | ||
return this.applyWithWalker(walker); | ||
} | ||
} | ||
Rule.FAILURE_STRING = 'invalid typeof comparison value'; | ||
}; | ||
Rule.FAILURE_STRING = 'invalid typeof comparison value'; | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
class ValidTypeofWalker extends Lint.RuleWalker { | ||
constructor() { | ||
super(...arguments); | ||
var ValidTypeofWalker = (function (_super) { | ||
__extends(ValidTypeofWalker, _super); | ||
function ValidTypeofWalker() { | ||
_super.apply(this, arguments); | ||
this.VALID_TYPES = ['symbol', 'undefined', 'object', 'boolean', 'number', 'string', 'function']; | ||
this.OPERATORS = [ts.SyntaxKind.EqualsEqualsToken, ts.SyntaxKind.EqualsEqualsEqualsToken, ts.SyntaxKind.ExclamationEqualsToken, ts.SyntaxKind.ExclamationEqualsEqualsToken]; | ||
} | ||
visitNode(node) { | ||
ValidTypeofWalker.prototype.visitNode = function (node) { | ||
if (node.kind === ts.SyntaxKind.TypeOfExpression) { | ||
this.validateTypeOf(node); | ||
} | ||
super.visitNode(node); | ||
} | ||
validateTypeOf(node) { | ||
_super.prototype.visitNode.call(this, node); | ||
}; | ||
ValidTypeofWalker.prototype.validateTypeOf = function (node) { | ||
if (node.parent.kind === ts.SyntaxKind.BinaryExpression) { | ||
const parent = node.parent; | ||
if (this.OPERATORS.indexOf(parent.operatorToken.kind) !== -1) { | ||
const sibling = parent.left === node ? parent.right : parent.left; | ||
var parent_1 = node.parent; | ||
if (this.OPERATORS.indexOf(parent_1.operatorToken.kind) !== -1) { | ||
var sibling = parent_1.left === node ? parent_1.right : parent_1.left; | ||
if (sibling.kind === ts.SyntaxKind.StringLiteral && this.VALID_TYPES.indexOf(sibling.text) === -1) { | ||
@@ -34,5 +45,6 @@ this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); | ||
} | ||
} | ||
} | ||
}; | ||
return ValidTypeofWalker; | ||
}(Lint.RuleWalker)); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3ZhbGlkVHlwZW9mUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsTUFBWSxFQUFFLFdBQU0sWUFBWSxDQUFDLENBQUE7QUFDakMsTUFBWSxJQUFJLFdBQU0saUJBQWlCLENBQUMsQ0FBQTtBQUV4QyxtQkFBMEIsSUFBSSxDQUFDLEtBQUssQ0FBQyxZQUFZO0lBR3hDLEtBQUssQ0FBQyxVQUF5QjtRQUNwQyxNQUFNLE1BQU0sR0FBRyxJQUFJLGlCQUFpQixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQztRQUNwRSxNQUFNLENBQUMsSUFBSSxDQUFDLGVBQWUsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUN0QyxDQUFDO0FBQ0gsQ0FBQztBQU5lLG1CQUFjLEdBQUcsaUNBQWlDLENBQUM7QUFEdEQsWUFBSSxPQU9oQixDQUFBO0FBRUQsZ0NBQWdDLElBQU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lc1xcc3JjIn0= |
"use strict"; | ||
const ts = require('typescript'); | ||
var ts = require('typescript'); | ||
function isAssignmentToken(token) { | ||
@@ -8,2 +8,2 @@ return token.kind >= ts.SyntaxKind.FirstAssignment && token.kind <= ts.SyntaxKind.LastAssignment; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN1cHBvcnQvdG9rZW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksRUFBRSxXQUFNLFlBQVksQ0FBQyxDQUFBO0FBRWpDLDJCQUFrQyxLQUFjO0lBQzlDLE1BQU0sQ0FBQyxLQUFLLENBQUMsSUFBSSxJQUFJLEVBQUUsQ0FBQyxVQUFVLENBQUMsZUFBZSxJQUFJLEtBQUssQ0FBQyxJQUFJLElBQUksRUFBRSxDQUFDLFVBQVUsQ0FBQyxjQUFjLENBQUM7QUFDbkcsQ0FBQztBQUZlLHlCQUFpQixvQkFFaEMsQ0FBQSIsImZpbGUiOiJzdXBwb3J0L3Rva2VuLmpzIiwic291cmNlUm9vdCI6ImQ6XFxwcm9qZWN0c1xcdHNsaW50LWVzbGludC1ydWxlc1xcc3JjIn0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN1cHBvcnQvdG9rZW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQVksRUFBRSxXQUFNLFlBQVksQ0FBQyxDQUFBO0FBRWpDLDJCQUFrQyxLQUFjO0lBQzlDLE1BQU0sQ0FBQyxLQUFLLENBQUMsSUFBSSxJQUFJLEVBQUUsQ0FBQyxVQUFVLENBQUMsZUFBZSxJQUFJLEtBQUssQ0FBQyxJQUFJLElBQUksRUFBRSxDQUFDLFVBQVUsQ0FBQyxjQUFjLENBQUM7QUFDbkcsQ0FBQztBQUZlLHlCQUFpQixvQkFFaEMsQ0FBQSIsImZpbGUiOiJzdXBwb3J0L3Rva2VuLmpzIiwic291cmNlUm9vdCI6ImQ6XFxwcm9qZWN0c1xcdHNsaW50LWVzbGludC1ydWxlc1xcc3JjIn0= |
{ | ||
"name": "tslint-eslint-rules", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Improve your TSLint with the missing ESLint Rules", | ||
@@ -28,2 +28,3 @@ "main": "index.js", | ||
"chai": "^3.5.0", | ||
"es6-promise": "^4.0.4", | ||
"gulp": "^3.9.1", | ||
@@ -30,0 +31,0 @@ "gulp-sourcemaps": "^1.6.0", |
@@ -192,3 +192,3 @@ [![Build Status](https://travis-ci.org/buzinas/tslint-eslint-rules.svg)](https://travis-ci.org/buzinas/tslint-eslint-rules) | ||
|:ballot_box_with_check:|[no-unused-vars](http://eslint.org/docs/rules/no-unused-vars)|[no-unused-variable](http://palantir.github.io/tslint/rules/no-unused-variable)|disallow declaration of variables that are not used in the code (recommended)| | ||
|:ballot_box_with_check:|[no-use-before-define](http://eslint.org/docs/rules/no-use-before-define)|[no-use-before-define](http://palantir.github.io/tslint/rules/no-use-before-define)|disallow use of variables before they are defined| | ||
|: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| | ||
@@ -254,3 +254,3 @@ ### Node.js and CommonJS | ||
|: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| | ||
|:ballot_box_with_check:|[no-mixed-spaces-and-tabs](http://eslint.org/docs/rules/no-mixed-spaces-and-tabs)|[ident](http://palantir.github.io/tslint/rules/ident)|disallow mixed spaces and tabs for indentation (recommended)| | ||
|:ballot_box_with_check:|[no-mixed-spaces-and-tabs](http://eslint.org/docs/rules/no-mixed-spaces-and-tabs)|[indent](http://palantir.github.io/tslint/rules/indent)|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| | ||
@@ -268,3 +268,3 @@ |:x:|[no-negated-condition](http://eslint.org/docs/rules/no-negated-condition)|no-negated-condition|disallow negated conditions| | ||
|: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| | ||
|:x:|[one-var](http://eslint.org/docs/rules/one-var)|one-var|require or disallow one variable declaration per function| | ||
|: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| | ||
@@ -275,3 +275,3 @@ |:x:|[operator-assignment](http://eslint.org/docs/rules/operator-assignment)|operator-assignment|require assignment operator shorthand where possible or prohibit it entirely| | ||
|:x:|[quote-props](http://eslint.org/docs/rules/quote-props)|quote-props|require quotes around object literal property names| | ||
|:x:|[quotes](http://eslint.org/docs/rules/quotes)|quote-props|specify whether backticks, double or single quotes should be used| | ||
|: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| | ||
@@ -312,3 +312,3 @@ |: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:|[object-shorthand](http://eslint.org/docs/rules/object-shorthand)|object-shorthand|require method and property shorthand syntax for object literals| | ||
|:x:|[prefer-arrow-callback](http://eslint.org/docs/rules/prefer-arrow-callback)|prefer-arrow-callback|suggest using arrow functions as callbacks| | ||
|:ballot_box_with_check:|[prefer-arrow-callback](http://eslint.org/docs/rules/prefer-arrow-callback)|[only-arrow-functions](http://palantir.github.io/tslint/rules/only-arrow-functions/)|suggest using arrow functions as callbacks| | ||
|:x:|[prefer-const](http://eslint.org/docs/rules/prefer-const)|prefer-const|suggest using `const` declaration for variables that are never modified after declared| | ||
@@ -315,0 +315,0 @@ |:x:|[prefer-reflect](http://eslint.org/docs/rules/prefer-reflect)|prefer-reflect|suggest using Reflect methods where applicable| |
Sorry, the diff of this file is too big to display
419732
9
4681