Socket
Socket
Sign inDemoInstall

eslint-config-prettier

Package Overview
Dependencies
1
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.6.0 to 2.7.0

17

bin/validators.js

@@ -13,2 +13,19 @@ "use strict";

"lines-around-comment"(options) {
if (options.length < 1) {
return false;
}
const firstOption = options[0];
return Boolean(
firstOption &&
firstOption.allowBlockStart &&
firstOption.allowBlockEnd &&
firstOption.allowObjectStart &&
firstOption.allowObjectEnd &&
firstOption.allowArrayStart &&
firstOption.allowArrayEnd
);
},
"no-confusing-arrow"(options) {

@@ -15,0 +32,0 @@ if (options.length < 1) {

@@ -0,1 +1,10 @@

### Version 2.7.0 (2017-11-01)
- Added: The [lines-around-comment] rule (as a [special
rule][lines-around-comment-special]). Thanks to Maurice de Beijer
(@mauricedb)!
- Added: The [no-unexpected-multiline] rule (as a [special
rule][no-unexpected-multiline-special]). Thanks to Suhas Karanth
(@sudo-suhas)!
### Version 2.6.0 (2017-09-23)

@@ -133,2 +142,4 @@

[indent-legacy]: https://eslint.org/docs/rules/indent-legacy
[lines-around-comment-special]: https://github.com/prettier/eslint-config-prettier/blob/5399175c37466747aae9d407021dffec2c169c8b/README.md#lines-around-comment
[lines-around-comment]: https://eslint.org/docs/rules/lines-around-comment
[no-confusing-arrow-special]: https://github.com/prettier/eslint-config-prettier/blob/08ac5bcc25c9cdc71864b4a1e4191e7d28dd2bc2/README.md#no-confusing-arrow

@@ -139,2 +150,4 @@ [no-confusing-arrow]: https://eslint.org/docs/rules/no-confusing-arrow

[no-tabs]: https://eslint.org/docs/rules/no-tabs
[no-unexpected-multiline-special]: https://github.com/prettier/eslint-config-prettier/blob/5399175c37466747aae9d407021dffec2c169c8b/README.md#no-unexpected-multiline
[no-unexpected-multiline]: https://eslint.org/docs/rules/no-unexpected-multiline
[nonblock-statement-body-position]: https://eslint.org/docs/rules/nonblock-statement-body-position

@@ -141,0 +154,0 @@ [one-var-declaration-per-line]: https://eslint.org/docs/rules/one-var-declaration-per-line

2

index.js

@@ -9,2 +9,3 @@ "use strict";

curly: 0,
"lines-around-comment": 0,
"max-len": 0,

@@ -14,2 +15,3 @@ "no-confusing-arrow": 0,

"no-tabs": 0,
"no-unexpected-multiline": 0,
quotes: 0,

@@ -16,0 +18,0 @@ // The rest are rules that you never need to enable when using Prettier.

14

package.json
{
"name": "eslint-config-prettier",
"version": "2.6.0",
"version": "2.7.0",
"license": "MIT",

@@ -35,12 +35,12 @@ "author": "Simon Lydell",

"devDependencies": {
"ava": "^0.22.0",
"ava": "^0.23.0",
"babel-eslint": "^7.2.3",
"dedent": "^0.7.0",
"eslint": "^4.7.0",
"eslint": "^4.10.0",
"eslint-config-google": "^0.9.1",
"eslint-plugin-flowtype": "^2.35.1",
"eslint-plugin-prettier": "^2.2.0",
"eslint-plugin-react": "^7.3.0",
"eslint-plugin-flowtype": "^2.39.1",
"eslint-plugin-prettier": "^2.3.1",
"eslint-plugin-react": "^7.4.0",
"eslint-plugin-standard": "^3.0.1",
"prettier": "^1.7.0",
"prettier": "^1.7.4",
"rimraf": "^2.6.2"

@@ -47,0 +47,0 @@ },

@@ -149,6 +149,2 @@ # eslint-config-prettier [![Build Status][travis-badge]][travis]

The [eslint-config-airbnb] config includes `curly` with the `"multi-line"`
option turned on by default. Since that config is very popular, it makes sense
for eslint-config-prettier to turn this rule off.
If you like this rule, it can be used just fine with Prettier as long as you

@@ -167,2 +163,61 @@ don’t use the `"multi-line"` or `"multi-or-nest"` option.

### [lines-around-comment]
**This rule can be used with certain options.**
This rule requires empty lines before and/or after comments. Prettier preserves
blank lines, with two exceptions:
- Several blank lines in a row are collapsed into a single blank line. This is
fine.
- Blank lines at the beginning and end of blocks, objects and arrays are always
removed. This may lead to conflicts.
By default, ESLint requires a blank line above the comment is this case:
```js
if (result) {
/* comment */
return result;
}
```
However, Prettier removes the blank line:
```js
if (result) {
/* comment */
return result;
}
```
If you like this rule, it can be used just fine with Prettier as long as add
extra configuration to allow comments at the start and end of blocks, objects
and arrays.
Example configuration:
```json
{
"rules": {
"lines-around-comment": [
"error",
{
"beforeBlockComment": true,
"afterBlockComment": true,
"beforeLineComment": true,
"afterLineComment": true,
"allowBlockStart": true,
"allowBlockEnd": true,
"allowObjectStart": true,
"allowObjectEnd": true,
"allowArrayStart": true,
"allowArrayEnd": true
}
]
}
}
```
### [max-len]

@@ -226,6 +281,2 @@

[eslint-config-airbnb] config includes `no-confusing-arrow` with the
`allowParens` option turned on by default. Since that config is very popular, it
makes sense for eslint-config-prettier to turn this rule off.
If you like this rule, it can be used just fine with Prettier as long as the

@@ -294,2 +345,4 @@ `allowParens` option is off.

**This rule requires certain Prettier options.**
This rule disallows the use of tab characters at all. It can be used just fine

@@ -308,2 +361,71 @@ with Prettier as long as you don’t configure Prettier to indent using tabs.

### [no-unexpected-multiline]
**This rule requires special attention when writing code.**
This rule disallows confusing multiline expressions where a newline looks like
it is ending a statement, but is not.
For example, the rule could warn about this:
```js
var hello = "world"
[1, 2, 3].forEach(addNumber)
```
Prettier usually formats this in a way that makes it obvious that a semicolon
was missing:
```js
var hello = "world"[(1, 2, 3)].forEach(addNumber);
```
However, there are cases where Prettier breaks things into several lines such
that the `no-unexpected-multiline` conflicts.
```js
const value = text.trim().split("\n")[position].toLowerCase();
```
Prettier breaks it up into several lines, though, causing a conflict:
```js
const value = text
.trim()
.split("\n")
[position].toLowerCase();
```
If you like this rule, it can usually be used with Prettier without problems,
but occasionally you might need to either temporarily disable the rule or
refactor your code.
```js
const value = text
.trim()
.split("\n")
// eslint-disable-next-line no-unexpected-multiline
[position].toLowerCase();
// Or:
const lines = text.trim().split("\n");
const value = lines[position].toLowerCase();
```
**Note:** If you _do_ enable this rule, you have to run ESLint and Prettier as
two separate steps (and ESLint first) in order to get any value out of it.
Otherwise Prettier might reformat your code in such a way that ESLint never gets
a chance to report anything (as seen in the first example).
Example configuration:
```json
{
"rules": {
"no-unexpected-multiline": "error"
}
}
```
### [quotes]

@@ -327,2 +449,3 @@

## Contributing

@@ -332,6 +455,6 @@

- ESLint 4.7.0 (eslint-config-prettier 2.1.1 and older were tested with ESLint 3.x)
- prettier 1.7.0
- eslint-plugin-flowtype 2.35.1
- eslint-plugin-react 7.3.0
- ESLint 4.10.0 (eslint-config-prettier 2.1.1 and older were tested with ESLint 3.x)
- prettier 1.7.4
- eslint-plugin-flowtype 2.39.1
- eslint-plugin-react 7.4.0
- eslint-plugin-standard 3.0.1

@@ -401,4 +524,4 @@

[Prettier]: https://github.com/prettier/prettier
[curly]: https://eslint.org/docs/rules/curly
[eslint-config-airbnb]: https://www.npmjs.com/package/eslint-config-airbnb
[eslint-plugin-flowtype]: https://github.com/gajus/eslint-plugin-flowtype

@@ -408,2 +531,3 @@ [eslint-plugin-prettier]: https://github.com/prettier/eslint-plugin-prettier

[eslint-plugin-standard]: https://github.com/xjamundx/eslint-plugin-standard
[lines-around-comment]: https://eslint.org/docs/rules/lines-around-comment
[max-len]: https://eslint.org/docs/rules/max-len

@@ -413,5 +537,5 @@ [no-confusing-arrow]: https://eslint.org/docs/rules/no-confusing-arrow

[no-tabs]: https://eslint.org/docs/rules/no-tabs
[Prettier]: https://github.com/prettier/prettier
[no-unexpected-multiline]: https://eslint.org/docs/rules/no-unexpected-multiline
[quotes]: https://eslint.org/docs/rules/quotes
[travis-badge]: https://travis-ci.org/prettier/eslint-config-prettier.svg?branch=master
[travis]: https://travis-ci.org/prettier/eslint-config-prettier
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc