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.5.0 to 2.6.0

6

CHANGELOG.md
# Changelog
## v2.6.0 (2018-02-02)
* Update: Add option to skip loading prettierrc ([#83](https://github.com/prettier/eslint-plugin-prettier/issues/83)) ([9e0fb48](https://github.com/prettier/eslint-plugin-prettier/commit/9e0fb48d077214a81ac549731308ab11512c37cd))
* Build: add Node 8 and 9 to Travis ([e5b5fa7](https://github.com/prettier/eslint-plugin-prettier/commit/e5b5fa74d06a06a53d04c4748b31e24fcd7a41b9))
* Chore: add test for vue parsing ([1ab43fd](https://github.com/prettier/eslint-plugin-prettier/commit/1ab43fd601a67100cb03bbfe614203fd399d40bb))
## v2.5.0 (2018-01-16)

@@ -4,0 +10,0 @@

46

eslint-plugin-prettier.js

@@ -285,2 +285,21 @@ /**

/**
* Get the pragma from the ESLint rule context.
* @param {RuleContext} context - The ESLint rule context.
* @returns {string|null}
*/
function getPragma(context) {
const pluginOptions = context.options[1];
if (!pluginOptions) {
return null;
}
const pragmaRef =
typeof pluginOptions === 'string' ? pluginOptions : pluginOptions.pragma;
// Remove leading @
return pragmaRef ? pragmaRef.slice(1) : null;
}
// ------------------------------------------------------------------------------

@@ -317,11 +336,22 @@ // Module Definition

},
// Pragma:
{ type: 'string', pattern: '^@\\w+$' }
{
anyOf: [
// Pragma:
{ type: 'string', pattern: '^@\\w+$' },
{
type: 'object',
properties: {
pragma: { type: 'string', pattern: '^@\\w+$' },
usePrettierrc: { type: 'boolean' }
},
additionalProperties: true
}
]
}
]
},
create(context) {
const pragma = context.options[1]
? context.options[1].slice(1) // Remove leading @
: null;
const pragma = getPragma(context);
const usePrettierrc =
!context.options[1] || context.options[1].usePrettierrc !== false;
const sourceCode = context.getSourceCode();

@@ -370,3 +400,5 @@ const source = sourceCode.text;

const prettierRcOptions =
prettier.resolveConfig && prettier.resolveConfig.sync
usePrettierrc &&
prettier.resolveConfig &&
prettier.resolveConfig.sync
? prettier.resolveConfig.sync(context.getFilename())

@@ -373,0 +405,0 @@ : null;

5

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

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

"prettier": "^1.10.2",
"semver": "^5.3.0"
"semver": "^5.3.0",
"vue-eslint-parser": "^2.0.2"
},

@@ -48,0 +49,0 @@ "engines": {

@@ -144,2 +144,20 @@ # eslint-plugin-prettier [![Build Status](https://travis-ci.org/prettier/eslint-plugin-prettier.svg?branch=master)](https://travis-ci.org/prettier/eslint-plugin-prettier)

_This option is useful if you're migrating a large codebase and already use pragmas like `@flow`._
- An object with the following options
- `pragma`: Also sets the aforementioned `pragma`: a string with a pragma that triggers this rule. By default, this rule applies to all files. However, if you set a pragma (this option), only files with that pragma in the heading docblock will be checked. All pragmas must start with `@`.
```json
"prettier/prettier": ["error", null, {
"pragma": "@prettier"
}]
```
- `usePrettierrc`: Enables loading of the Prettier configuration file, (default: `true`). May be useful if you are using multiple tools that conflict with each other, or do not wish to mix your ESLint settings with your Prettier configuration.
```json
"prettier/prettier": ["error", null, {
"usePrettierrc": false
}]
```

@@ -146,0 +164,0 @@ * The rule is autofixable -- if you run `eslint` with the `--fix` flag, your code will be formatted according to `prettier` style.

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