tslint-config-prettier
Advanced tools
Comparing version 1.10.0 to 1.11.0
#!/usr/bin/env node | ||
try { | ||
require("../lib/checker").check(process.argv[2]); | ||
} catch (e) { | ||
if (e.name === "ConflictRules") { | ||
console.log(e.message); | ||
process.exitCode = 1; | ||
} else { | ||
throw e; | ||
} | ||
} | ||
require("../lib/checker").check(process.argv.slice(2)); |
@@ -6,21 +6,37 @@ "use strict"; | ||
var tslintConfigPrettier = require(".."); | ||
exports.check = function (configFilePath) { | ||
if (typeof configFilePath !== "string") { | ||
throw new Error("Usage: tslint-config-prettier-check <pathToConfigFile>"); | ||
exports.check = function (configFilePaths) { | ||
if (configFilePaths.length === 0) { | ||
// tslint:disable-next-line:no-console | ||
console.log("Usage: tslint-config-prettier-check <pathToConfigFile> ..."); | ||
return; | ||
} | ||
var _a = tslint_1.Linter.loadConfigurationFromPath(configFilePath), rules = _a.rules, jsRules = _a.jsRules; | ||
var conflictRules = []; | ||
Object.keys(tslintConfigPrettier.rules).forEach(function (conflictRuleName) { | ||
if (isConflict(conflictRuleName, rules) || isConflict(conflictRuleName, jsRules)) { | ||
conflictRules.push(conflictRuleName); | ||
configFilePaths.forEach(function (configFilePath) { | ||
try { | ||
var conflictRules = getConflictRules(configFilePath); | ||
if (conflictRules.length === 0) { | ||
// tslint:disable-next-line:no-console | ||
console.log("No conflict rule detected in " + configFilePath); | ||
} | ||
else { | ||
// tslint:disable-next-line:no-console | ||
console.error("Conflict rule(s) detected in " + configFilePath + ":\n" + conflictRules | ||
.map(function (conflictRule) { return " " + conflictRule; }) | ||
.join("\n")); | ||
process.exitCode = 1; | ||
} | ||
} | ||
catch (error) { | ||
// tslint:disable-next-line:no-console | ||
console.error(error.message); | ||
process.exitCode = 1; | ||
} | ||
}); | ||
if (conflictRules.length !== 0) { | ||
var error = new Error("Conflict rule(s) detected in " + configFilePath + ":\n" + conflictRules.join("\n")); | ||
error.name = "ConflictRules"; | ||
throw error; | ||
} | ||
// tslint:disable-next-line:no-console | ||
console.log("No conflict rule detected in " + configFilePath); | ||
}; | ||
function getConflictRules(configFilePath) { | ||
var _a = tslint_1.Linter.loadConfigurationFromPath(configFilePath), rules = _a.rules, jsRules = _a.jsRules; | ||
return Object.keys(tslintConfigPrettier.rules).filter(function (conflictRuleName) { | ||
return isConflict(conflictRuleName, rules) || | ||
isConflict(conflictRuleName, jsRules); | ||
}); | ||
} | ||
function isConflict(conflictRuleName, rules) { | ||
@@ -27,0 +43,0 @@ return (rules.has(conflictRuleName) && |
{ | ||
"name": "tslint-config-prettier", | ||
"version": "1.10.0", | ||
"version": "1.11.0", | ||
"description": "Do you wanna use tslint and prettier without conflicts? tslint-config-prettier disables all conflicting rules that may cause such problems. Prettier takes care of formatting and tslint the rest.", | ||
@@ -39,3 +39,3 @@ "keywords": [ | ||
"generate-config": "node ./build/generate.js", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post", | ||
"semantic-release": "semantic-release", | ||
"commit": "git-cz", | ||
@@ -70,3 +70,2 @@ "prepush": "npm run test && npm run lint", | ||
}, | ||
"mapCoverage": true, | ||
"coverageThreshold": { | ||
@@ -90,16 +89,16 @@ "global": { | ||
"husky": "^0.14.3", | ||
"jest": "^22.0.4", | ||
"jest": "^22.4.0", | ||
"lodash": "^4.17.4", | ||
"make-dir": "^1.0.0", | ||
"prettier": "1.11.1", | ||
"prettier": "1.12.1", | ||
"rimraf": "^2.6.1", | ||
"semantic-release": "^8.0.0", | ||
"semantic-release": "^15.0.0", | ||
"ts-jest": "^22.0.0", | ||
"tslint": "5.9.1", | ||
"tslint-consistent-codestyle": "1.12.0", | ||
"tslint-consistent-codestyle": "1.13.0", | ||
"tslint-divid": "1.3.0", | ||
"tslint-eslint-rules": "5.1.0", | ||
"tslint-immutable": "4.5.2", | ||
"tslint-immutable": "4.5.4", | ||
"tslint-microsoft-contrib": "5.0.3", | ||
"tslint-misc-rules": "3.3.1", | ||
"tslint-misc-rules": "3.3.3", | ||
"tslint-plugin-ikatyang": "1.1.1", | ||
@@ -109,4 +108,4 @@ "tslint-react": "3.5.1", | ||
"validate-commit-msg": "^2.10.1", | ||
"vrsource-tslint-rules": "5.8.1" | ||
"vrsource-tslint-rules": "5.8.2" | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13215
155