New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tslint-eslint-rules

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tslint-eslint-rules

Improve your TSLint with the missing ESLint Rules

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
108K
decreased by-21.38%
Maintainers
2
Weekly downloads
 
Created
Source

"use strict"; var es6_promise_1 = require('es6-promise'); var https = require('https'); var rules_1 = require('./rules'); function camelCaseToDash(str) { return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); } function arrayDiff(source, target) { return source.filter(function (item) { return target.indexOf(item) === -1; }); } function requestFromGithub(path, callback) { var options = { path: path, host: 'api.github.com', headers: { 'User-Agent': 'tslint-eslint-rules' } }; https.get(options, function (resp) { resp.setEncoding('utf8'); var buffer = []; resp.on('data', function (chunk) { buffer.push(chunk); }); resp.on('end', function () { var data = JSON.parse(buffer.join('')); callback(data); }); }).on('error', function (e) { console.error(e); }); } function compareToESLint() { return new es6_promise_1.Promise(function (fulfill) { 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(function (rule) { var name = camelCaseToDash(rule); buffer.push("- " + name); }); } if (deprecated.length) { buffer.push('Deprecated ESLint rules:'); deprecated.forEach(function (rule) { var name = camelCaseToDash(rule); buffer.push("- " + name); }); } if (missing.length + deprecated.length === 0) { buffer.push('ESLint rules are in sync!'); } console.log(buffer.join('\n'), '\n'); fulfill(); }); }); } exports.compareToESLint = compareToESLint; function compareToTSLint() { return new es6_promise_1.Promise(function (fulfill) { 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) { rules.splice(index, 1); } }); 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(function (rule) { var name = camelCaseToDash(rule); buffer.push("- " + name); }); } else { buffer.push('TSLint rules are in sync!'); } console.log(buffer.join('\n'), '\n'); fulfill(); }); }); } exports.compareToTSLint = compareToTSLint;

//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJlYWRtZS9mZXRjaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsNEJBQXdCLGFBQWEsQ0FBQyxDQUFBO0FBQ3RDLElBQVksS0FBSyxXQUFNLE9BQU8sQ0FBQyxDQUFBO0FBQy9CLHNCQUFrRCxTQUFTLENBQUMsQ0FBQTtBQUU1RCx5QkFBeUIsR0FBRztJQUMxQixNQUFNLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxpQkFBaUIsRUFBRSxPQUFPLENBQUMsQ0FBQyxXQUFXLEVBQUUsQ0FBQztBQUMvRCxDQUFDO0FBRUQsbUJBQW1CLE1BQU0sRUFBRSxNQUFNO0lBQy9CLE1BQU0sQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDLFVBQUEsSUFBSSxJQUFJLE9BQUEsTUFBTSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLENBQUMsRUFBM0IsQ0FBMkIsQ0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QUFJO29CQUNuQixJQUFNLElBQUksR0FBRyxlQUFlLENBQUMsSUFBSSxDQUFDLENBQUM7b0JBQ25DLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBSyxJQUFNLENBQUMsQ0FBQztnQkFDM0IsQ0FBQyxDQUFDLENBQUM7WUFDTCxDQUFDO1lBQUMsSUFBSSxDQUFDLENBQUM7Z0JBQ04sTUFBTSxDQUFDLElBQUksQ0FBQywyQkFBMkIsQ0FBQyxDQUFDO1lBQzNDLENBQUM7WUFDRCxPQUFPLENBQUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLEVBQUUsSUFBSSxDQUFDLENBQUM7WUFDckMsT0FBTyxFQUFFLENBQUM7UUFDWixDQUFDLENBQUMsQ0FBQztJQUNMLENBQUMsQ0FBQyxDQUFDO0FBQ0wsQ0FBQztBQUlDLHVCQUFlLG1CQUpoQjtBQUtDIiwiZmlsZSI6InJlYWRtZS9mZXRjaC5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei9Xb3Jrc3BhY2UvdHNsaW50LWVzbGludC1ydWxlcy9zcmMifQ==

Keywords

FAQs

Package last updated on 21 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc