Socket
Socket
Sign inDemoInstall

eslint-plugin-prettier

Package Overview
Dependencies
3
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.6.2 to 2.7.0

5

CHANGELOG.md
# Changelog
## v2.7.0 (2018-09-26)
* Update: Support prettierignore and custom processors ([#111](https://github.com/prettier/eslint-plugin-prettier/issues/111)) ([38537ba](https://github.com/prettier/eslint-plugin-prettier/commit/38537ba35fc9152852c3b91f3041d72556b43013))
* Build: switch to release script package ([047dc8f](https://github.com/prettier/eslint-plugin-prettier/commit/047dc8ffdf006c74267df4902fec684c589dad12))
## v2.6.2 (2018-07-06)

@@ -4,0 +9,0 @@

50

eslint-plugin-prettier.js

@@ -359,2 +359,3 @@ /**

const sourceCode = context.getSourceCode();
const filepath = context.getFilename();
const source = sourceCode.text;

@@ -401,2 +402,3 @@

: context.options[0];
const prettierRcOptions =

@@ -406,11 +408,55 @@ usePrettierrc &&

prettier.resolveConfig.sync
? prettier.resolveConfig.sync(context.getFilename(), {
? prettier.resolveConfig.sync(filepath, {
editorconfig: true
})
: null;
// prettier.getFileInfo was added in v1.13
const prettierFileInfo =
prettier.getFileInfo && prettier.getFileInfo.sync
? prettier.getFileInfo.sync(filepath, {
ignorePath: '.prettierignore'
})
: { ignored: false, inferredParser: null };
// Skip if file is ignored using a .prettierignore file
if (prettierFileInfo.ignored) {
return;
}
const initialOptions = {};
// ESLint suppports processors that let you extract and lint JS
// fragments within a non-JS language. In the cases where prettier
// supports the same language as a processor, we want to process
// the provided source code as javascript (as ESLint provides the
// rules with fragments of JS) instead of guessing the parser
// based off the filename. Otherwise, for instance, on a .md file we
// end up trying to run prettier over a fragment of JS using the
// markdown parser, which throws an error.
// If we can't infer the parser from from the filename, either
// because no filename was provided or because there is no parser
// found for the filename, use javascript.
// This is added to the options first, so that
// prettierRcOptions and eslintPrettierOptions can still override
// the parser.
//
// `parserBlocklist` should contain the list of prettier parser
// names for file types where:
// * Prettier supports parsing the file type
// * There is an ESLint processor that extracts JavaScript snippets
// from the file type.
const parserBlocklist = [null, 'graphql', 'markdown', 'html'];
if (
parserBlocklist.indexOf(prettierFileInfo.inferredParser) !== -1
) {
initialOptions.parser = 'babylon';
}
const prettierOptions = Object.assign(
{},
initialOptions,
prettierRcOptions,
eslintPrettierOptions,
{ filepath: context.getFilename() }
{ filepath }
);

@@ -417,0 +463,0 @@

8

package.json
{
"name": "eslint-plugin-prettier",
"version": "2.6.2",
"version": "2.7.0",
"description": "Runs prettier as an eslint rule",

@@ -18,3 +18,4 @@ "keywords": [

"lint": "eslint .",
"test": "npm run lint && mocha"
"test": "npm run lint && mocha",
"generate-release": "node-release-script"
},

@@ -37,2 +38,3 @@ "repository": {

"devDependencies": {
"@not-an-aardvark/node-release-script": "^0.1.0",
"eslint": "^3.14.1",

@@ -46,3 +48,3 @@ "eslint-config-not-an-aardvark": "^2.0.0",

"moment": "^2.18.1",
"prettier": "^1.10.2",
"prettier": "^1.13.0",
"semver": "^5.3.0",

@@ -49,0 +51,0 @@ "vue-eslint-parser": "^2.0.2"

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc