eslint-plugin-prettier
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -182,18 +182,49 @@ /** | ||
// from the file type. | ||
const parserBlocklist = [null, 'markdown', 'html']; | ||
if (filepath === onDiskFilepath) { | ||
// The following list means the plugin process source into js content | ||
// but with same filename, so we need to change the parser to `babel` | ||
// by default. | ||
// Related ESLint plugins are: | ||
// 1. `eslint-plugin-graphql` (replacement: `@graphql-eslint/eslint-plugin`) | ||
// 2. `eslint-plugin-markdown@1` (replacement: `eslint-plugin-markdown@2+`) | ||
// 3. `eslint-plugin-html` | ||
const parserBlocklist = [null, 'markdown', 'html']; | ||
let inferParserToBabel = | ||
parserBlocklist.indexOf(inferredParser) !== -1; | ||
let inferParserToBabel = | ||
parserBlocklist.indexOf(inferredParser) !== -1; | ||
if ( | ||
// it could be processed by `@graphql-eslint/eslint-plugin` or `eslint-plugin-graphql` | ||
inferredParser === 'graphql' && | ||
// for `eslint-plugin-graphql`, see https://github.com/apollographql/eslint-plugin-graphql/blob/master/src/index.js#L416 | ||
source.startsWith('ESLintPluginGraphQLFile`') | ||
) { | ||
inferParserToBabel = true; | ||
} | ||
if ( | ||
// it could be processed by `@graphql-eslint/eslint-plugin` or `eslint-plugin-graphql` | ||
inferredParser === 'graphql' && | ||
// for `eslint-plugin-graphql`, see https://github.com/apollographql/eslint-plugin-graphql/blob/master/src/index.js#L416 | ||
source.startsWith('ESLintPluginGraphQLFile`') | ||
) { | ||
inferParserToBabel = true; | ||
} | ||
if (filepath === onDiskFilepath && inferParserToBabel) { | ||
initialOptions.parser = 'babel'; | ||
if (inferParserToBabel) { | ||
initialOptions.parser = 'babel'; | ||
} | ||
} else { | ||
// Similar to https://github.com/prettier/stylelint-prettier/pull/22 | ||
// In all of the following cases ESLint extracts a part of a file to | ||
// be formatted and there exists a prettier parser for the whole file. | ||
// If you're interested in prettier you'll want a fully formatted file so | ||
// you're about to run prettier over the whole file anyway. | ||
// Therefore running prettier over just the style section is wasteful, so | ||
// skip it. | ||
const parserBlocklist = [ | ||
'babel', | ||
'babylon', | ||
'flow', | ||
'typescript', | ||
'vue', | ||
'markdown', | ||
'html', | ||
'mdx', | ||
'angular', | ||
]; | ||
if (parserBlocklist.indexOf(inferredParser) !== -1) { | ||
return; | ||
} | ||
} | ||
@@ -200,0 +231,0 @@ |
{ | ||
"name": "eslint-plugin-prettier", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "Runs prettier as an eslint rule", | ||
@@ -38,14 +38,18 @@ "keywords": [ | ||
"devDependencies": { | ||
"@graphql-eslint/eslint-plugin": "^2.0.1", | ||
"@graphql-eslint/eslint-plugin": "^2.5.0", | ||
"@not-an-aardvark/node-release-script": "^0.1.0", | ||
"eslint": "^7.28.0", | ||
"@typescript-eslint/parser": "^5.29.0", | ||
"eslint": "^8.18.0", | ||
"eslint-config-not-an-aardvark": "^2.1.0", | ||
"eslint-config-prettier": "^6.0.0", | ||
"eslint-plugin-eslint-plugin": "^2.0.0", | ||
"eslint-plugin-node": "^8.0.0", | ||
"eslint-plugin-self": "^1.1.0", | ||
"graphql": "^15.5.1", | ||
"mocha": "^6.0.0", | ||
"prettier": "^2.3.0", | ||
"vue-eslint-parser": "^6.0.0" | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-mdx": "^1.17.0", | ||
"eslint-plugin-eslint-plugin": "^4.3.0", | ||
"eslint-plugin-mdx": "^1.17.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "link:.", | ||
"eslint-plugin-self": "^1.2.1", | ||
"graphql": "^16.5.0", | ||
"mocha": "^9.2.2", | ||
"prettier": "^2.7.1", | ||
"vue-eslint-parser": "^8.3.0" | ||
}, | ||
@@ -57,6 +61,9 @@ "peerDependenciesMeta": { | ||
}, | ||
"resolutions": { | ||
"@babel/traverse": "^7.18.5" | ||
}, | ||
"engines": { | ||
"node": ">=6.0.0" | ||
"node": ">=12.0.0" | ||
}, | ||
"license": "MIT" | ||
} |
# eslint-plugin-prettier [![Build Status](https://github.com/prettier/eslint-plugin-prettier/workflows/CI/badge.svg?branch=master)](https://github.com/prettier/eslint-plugin-prettier/actions?query=workflow%3ACI+branch%3Amaster) | ||
Runs [Prettier](https://github.com/prettier/prettier) as an [ESLint](http://eslint.org) rule and reports differences as individual ESLint issues. | ||
Runs [Prettier](https://github.com/prettier/prettier) as an [ESLint](https://eslint.org) rule and reports differences as individual ESLint issues. | ||
@@ -5,0 +5,0 @@ If your desired formatting does not match Prettier’s output, you should use a different tool such as [prettier-eslint](https://github.com/prettier/prettier-eslint) instead. |
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
255
20162
16
4
1