tslint-plugin-prettier
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.3.0"></a> | ||
# [1.3.0](https://github.com/ikatyang/tslint-plugin-prettier/compare/v1.2.0...v1.3.0) (2017-09-28) | ||
### Features | ||
* add ability to specify config file search path ([#48](https://github.com/ikatyang/tslint-plugin-prettier/issues/48)) ([fe39a1d](https://github.com/ikatyang/tslint-plugin-prettier/commit/fe39a1d)) | ||
<a name="1.2.0"></a> | ||
@@ -7,0 +17,0 @@ # [1.2.0](https://github.com/ikatyang/tslint-plugin-prettier/compare/v1.1.0...v1.2.0) (2017-09-15) |
{ | ||
"name": "tslint-plugin-prettier", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Runs Prettier as a TSLint rule and reports differences as individual TSLint issues.", | ||
@@ -35,6 +35,6 @@ "keywords": [ | ||
"@types/eslint-plugin-prettier": "2.2.0", | ||
"@types/node": "8.0.28", | ||
"@types/prettier": "1.6.1", | ||
"@types/node": "8.0.31", | ||
"@types/prettier": "1.7.0", | ||
"nyc": "11.2.1", | ||
"prettier": "1.7.0", | ||
"prettier": "1.7.2", | ||
"prettier-config-ikatyang": "1.1.1", | ||
@@ -45,3 +45,3 @@ "standard-version": "4.2.0", | ||
"tslint-config-prettier": "1.5.0", | ||
"typescript": "2.5.2" | ||
"typescript": "2.5.3" | ||
}, | ||
@@ -48,0 +48,0 @@ "peerDependencies": { |
@@ -85,2 +85,13 @@ # tslint-plugin-prettier | ||
If you'd like to specify where to find the config file, just put the search path (relative to `process.cwd()`) in the second argument, the following example shows how to use the config file from `<cwd>/configs/.prettierrc`: | ||
```json | ||
{ | ||
"extends": ["tslint-plugin-prettier"], | ||
"rules": { | ||
"prettier": [true, "configs"] | ||
} | ||
} | ||
``` | ||
If you'd like to specify options manually, just put [Prettier Options](https://github.com/prettier/prettier#options) in the second argument, for example: | ||
@@ -87,0 +98,0 @@ |
@@ -6,2 +6,3 @@ "use strict"; | ||
var utils = require("eslint-plugin-prettier"); | ||
var path = require("path"); | ||
var prettier = require("prettier"); | ||
@@ -34,8 +35,24 @@ var tslint = require("tslint"); | ||
break; | ||
default: | ||
case 'string': { | ||
try { | ||
// tslint:disable-next-line:strict-type-predicates | ||
assert(typeof prettier.resolveConfig.sync === 'function'); | ||
assert_existence_of_resolve_config_sync(); | ||
} | ||
catch (_a) { | ||
// istanbul ignore next | ||
throw new Error("Require prettier@1.7.0+ to specify config file, but got prettier@" + prettier.version + "."); | ||
} | ||
var file_path = path.resolve(process.cwd(), rule_argument_1); | ||
var resolved_config = prettier.resolveConfig.sync(file_path); | ||
// istanbul ignore next | ||
if (resolved_config === null) { | ||
throw new Error("Config file not found: " + file_path); | ||
} | ||
options = resolved_config; | ||
break; | ||
} | ||
default: { | ||
try { | ||
assert_existence_of_resolve_config_sync(); | ||
} | ||
catch (_b) { | ||
// backward compatibility: use default options if no resolveConfig.sync() | ||
@@ -50,2 +67,3 @@ // istanbul ignore next | ||
break; | ||
} | ||
} | ||
@@ -80,1 +98,5 @@ var source = source_file.getFullText(); | ||
}(tslint.AbstractWalker)); | ||
function assert_existence_of_resolve_config_sync() { | ||
// tslint:disable-next-line:strict-type-predicates | ||
assert(typeof prettier.resolveConfig.sync === 'function'); | ||
} |
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
11801
109
128