Skip to content

Commit

Permalink
Use prettier-linter-helpers
Browse files Browse the repository at this point in the history
Use the helper package directly instead of eslint-plugin-prettier
  • Loading branch information
BPScott committed Oct 1, 2018
1 parent b3de194 commit ea98c3e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 20 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"homepage": "https://github.com/prettier/stylelint-prettier#readme",
"dependencies": {
"eslint-plugin-prettier": "^2.6.2"
"prettier-linter-helpers": "^1.0.0"
},
"peerDependencies": {
"prettier": ">= 0.11.0"
Expand All @@ -38,6 +38,7 @@
"eslint": "^5.0.1",
"eslint-config-prettier": "^3.1.0",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-prettier": "^3.0.0",
"jest": "^23.6.0",
"prettier": "^1.13.7",
"stylelint": "^9.2.1",
Expand Down
19 changes: 12 additions & 7 deletions stylelint-prettier.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
const stylelint = require('stylelint');
const {showInvisibles, generateDifferences} = require('eslint-plugin-prettier');
const {
showInvisibles,
generateDifferences,
} = require('prettier-linter-helpers');

const {INSERT, DELETE, REPLACE} = generateDifferences;

let prettier;

Expand Down Expand Up @@ -95,13 +100,13 @@ module.exports = stylelint.createPlugin(
let insertText = '';
let deleteText = '';
switch (difference.operation) {
case 'insert':
case INSERT:
insertText = difference.insertText;
break;
case 'delete':
case DELETE:
deleteText = difference.deleteText;
break;
case 'replace':
case REPLACE:
insertText = difference.insertText;
deleteText = difference.deleteText;
break;
Expand Down Expand Up @@ -139,13 +144,13 @@ module.exports = stylelint.createPlugin(
// Report in the the order the differences appear in the content
differences.forEach((difference) => {
switch (difference.operation) {
case 'insert':
case INSERT:
report(messages.insert(difference.insertText), difference.offset);
break;
case 'delete':
case DELETE:
report(messages.delete(difference.deleteText), difference.offset);
break;
case 'replace':
case REPLACE:
report(
messages.replace(difference.deleteText, difference.insertText),
difference.offset
Expand Down
25 changes: 13 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1009,12 +1009,11 @@ eslint-plugin-node@^7.0.1:
resolve "^1.8.1"
semver "^5.5.0"

eslint-plugin-prettier@^2.6.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.2.tgz#71998c60aedfa2141f7bfcbf9d1c459bf98b4fad"
eslint-plugin-prettier@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.0.0.tgz#f6b823e065f8c36529918cdb766d7a0e975ec30c"
dependencies:
fast-diff "^1.1.1"
jest-docblock "^21.0.0"
prettier-linter-helpers "^1.0.0"

eslint-scope@^4.0.0:
version "4.0.0"
Expand Down Expand Up @@ -1237,9 +1236,9 @@ fast-deep-equal@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"

fast-diff@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.1.tgz#0aea0e4e605b6a2189f0e936d4b7fbaf1b7cfd9b"
fast-diff@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.2.tgz#4b62c42b8e03de3f848460b639079920695d0154"

fast-glob@^2.0.2:
version "2.2.2"
Expand Down Expand Up @@ -2150,10 +2149,6 @@ jest-diff@^23.6.0:
jest-get-type "^22.1.0"
pretty-format "^23.6.0"

jest-docblock@^21.0.0:
version "21.1.0"
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.1.0.tgz#43154be2441fb91403e36bb35cb791a5017cea81"

jest-docblock@^23.2.0:
version "23.2.0"
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-23.2.0.tgz#f085e1f18548d99fdd69b20207e6fd55d91383a7"
Expand Down Expand Up @@ -3259,6 +3254,12 @@ preserve@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"

prettier-linter-helpers@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b"
dependencies:
fast-diff "^1.1.2"

prettier@^1.13.7:
version "1.13.7"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.7.tgz#850f3b8af784a49a6ea2d2eaa7ed1428a34b7281"
Expand Down

0 comments on commit ea98c3e

Please sign in to comment.