eslint-plugin-prettier
Advanced tools
Comparing version 2.1.0 to 2.1.1
# Changelog | ||
## v2.1.1 (2017-05-19) | ||
* Fix: Support ESLint <3.11.0 ([#24](git@github.com:prettier/eslint-plugin-prettier/issues/24)) ([fde7fdf](git@github.com:prettier/eslint-plugin-prettier/commit/fde7fdf2e2dcb3a1f164e1fddb337070802d2c68)) | ||
* Chore: add yarn.lock ([#23](git@github.com:prettier/eslint-plugin-prettier/issues/23)) ([8b55518](git@github.com:prettier/eslint-plugin-prettier/commit/8b555187937a7e37ad84324c4331478b04898493)) | ||
* Docs: fix links in changelog ([#22](git@github.com:prettier/eslint-plugin-prettier/issues/22)) ([7e70e11](git@github.com:prettier/eslint-plugin-prettier/commit/7e70e11de37ca77f5aeb3dcdb216e1a421b54f0d)) | ||
## v2.1.0 (2017-05-16) | ||
* Merge with eslint-plugin-prettify ([#21](git@github.com:prettier/eslint-plugin-prettier/issues/21)) ([6de494f](git@github.com:prettier/eslint-plugin-prettier/commit/6de494fd685a107f3a9a371e663a1f8d68d6d31f)) | ||
* Docs: update repo links to new URL ([#18](git@github.com:prettier/eslint-plugin-prettier/issues/18)) ([6b69492](git@github.com:prettier/eslint-plugin-prettier/commit/6b694928e6e6c192dcb06e6287272fb40cbad17d)) | ||
* Chore: Upgrade development dependencies ([#16](git@github.com:prettier/eslint-plugin-prettier/issues/16)) ([12984ea](git@github.com:prettier/eslint-plugin-prettier/commit/12984ead6c46156b25607c9a8b03ae17def7ef9e)) | ||
* Docs: fix outdated info about prettier's semicolon support ([da6aad1](git@github.com:prettier/eslint-plugin-prettier/commit/da6aad15ea22aa899b26b5ce0979f4a945d80319)) | ||
* Docs: update prettier options in example ([#14](git@github.com:prettier/eslint-plugin-prettier/issues/14)) ([0ae173f](git@github.com:prettier/eslint-plugin-prettier/commit/0ae173f2731b02c0ed72a6cb49efdbdcff54a419)) | ||
* Docs: Change the order of dependencies install ([#13](git@github.com:prettier/eslint-plugin-prettier/issues/13)) ([cbf803c](git@github.com:prettier/eslint-plugin-prettier/commit/cbf803ccf0add6e324ae1513b5260e31bf9a3c05)) | ||
* Docs: Add CONTRIBUTING.md (fixes [#9](git@github.com:prettier/eslint-plugin-prettier/issues/9)) ([40fe55b](git@github.com:prettier/eslint-plugin-prettier/commit/40fe55b3d8c000787b0dcbfa0aed4f0d930808a9)) | ||
* Merge with eslint-plugin-prettify ([#21](https://github.com/prettier/eslint-plugin-prettier/issues/21)) ([6de494f](https://github.com/prettier/eslint-plugin-prettier/commit/6de494fd685a107f3a9a371e663a1f8d68d6d31f)) | ||
* Docs: update repo links to new URL ([#18](https://github.com/prettier/eslint-plugin-prettier/issues/18)) ([6b69492](https://github.com/prettier/eslint-plugin-prettier/commit/6b694928e6e6c192dcb06e6287272fb40cbad17d)) | ||
* Chore: Upgrade development dependencies ([#16](https://github.com/prettier/eslint-plugin-prettier/issues/16)) ([12984ea](https://github.com/prettier/eslint-plugin-prettier/commit/12984ead6c46156b25607c9a8b03ae17def7ef9e)) | ||
* Docs: fix outdated info about prettier's semicolon support ([da6aad1](https://github.com/prettier/eslint-plugin-prettier/commit/da6aad15ea22aa899b26b5ce0979f4a945d80319)) | ||
* Docs: update prettier options in example ([#14](https://github.com/prettier/eslint-plugin-prettier/issues/14)) ([0ae173f](https://github.com/prettier/eslint-plugin-prettier/commit/0ae173f2731b02c0ed72a6cb49efdbdcff54a419)) | ||
* Docs: Change the order of dependencies install ([#13](https://github.com/prettier/eslint-plugin-prettier/issues/13)) ([cbf803c](https://github.com/prettier/eslint-plugin-prettier/commit/cbf803ccf0add6e324ae1513b5260e31bf9a3c05)) | ||
* Docs: Add CONTRIBUTING.md (fixes [#9](https://github.com/prettier/eslint-plugin-prettier/issues/9)) ([40fe55b](https://github.com/prettier/eslint-plugin-prettier/commit/40fe55b3d8c000787b0dcbfa0aed4f0d930808a9)) | ||
@@ -13,0 +19,0 @@ ## v2.0.1 (2017-02-26) |
@@ -48,5 +48,4 @@ /** | ||
function getLocFromIndex(context, index) { | ||
// If `sourceCode.getLocFromIndex` is available from ESLint, use it. | ||
// Otherwise, use the private version from eslint/lib/ast-utils. | ||
// `sourceCode.getLocFromIndex` was added in ESLint 3.16.0. | ||
// If `sourceCode.getLocFromIndex` is available from ESLint, use it - added | ||
// in ESLint 3.16.0. | ||
const sourceCode = context.getSourceCode(); | ||
@@ -56,4 +55,27 @@ if (typeof sourceCode.getLocFromIndex === 'function') { | ||
} | ||
const astUtils = require('eslint/lib/ast-utils'); | ||
return astUtils.getLocationFromRangeIndex(sourceCode, index); | ||
const text = sourceCode.getText(); | ||
if (typeof index !== 'number') { | ||
throw new TypeError('Expected `index` to be a number.'); | ||
} | ||
if (index < 0 || index > text.length) { | ||
throw new RangeError('Index out of range.'); | ||
} | ||
// Loosely based on | ||
// https://github.com/eslint/eslint/blob/18a519fa/lib/ast-utils.js#L408-L438 | ||
const lineEndingPattern = /\r\n|[\r\n\u2028\u2029]/g; | ||
let offset = 0; | ||
let line = 0; | ||
let match; | ||
while ((match = lineEndingPattern.exec(text))) { | ||
const next = match.index + match[0].length; | ||
if (index < next) { | ||
break; | ||
} | ||
line++; | ||
offset = next; | ||
} | ||
return { | ||
line: line + 1, | ||
column: index - offset | ||
}; | ||
} | ||
@@ -60,0 +82,0 @@ |
{ | ||
"name": "eslint-plugin-prettier", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Runs prettier as an eslint rule", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
20529
310
0