eslint-plugin-canonical
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -12,2 +12,8 @@ { | ||
"rules": { | ||
"canonical/destructuring-property-newline": [ | ||
2, | ||
{ | ||
"allowAllPropertiesOnSameLine": false | ||
} | ||
], | ||
"canonical/export-specifier-newline": 1, | ||
@@ -14,0 +20,0 @@ "canonical/filename-match-exported": 0, |
@@ -10,2 +10,4 @@ "use strict"; | ||
var _destructuringPropertyNewline = _interopRequireDefault(require("./rules/destructuringPropertyNewline")); | ||
var _exportSpecifierNewline = _interopRequireDefault(require("./rules/exportSpecifierNewline")); | ||
@@ -36,2 +38,3 @@ | ||
rules: { | ||
'destructuring-property-newline': _destructuringPropertyNewline.default, | ||
'export-specifier-newline': _exportSpecifierNewline.default, | ||
@@ -48,2 +51,3 @@ 'filename-match-exported': _filenameMatchExported.default, | ||
rulesConfig: { | ||
'destructuring-property-newline': 0, | ||
'export-specifier-newline': 0, | ||
@@ -50,0 +54,0 @@ 'filename-match-exported': 0, |
@@ -65,3 +65,3 @@ { | ||
}, | ||
"version": "2.2.0" | ||
"version": "2.3.0" | ||
} |
@@ -15,2 +15,3 @@ <a name="eslint-plugin-canonical"></a> | ||
* [Rules](#eslint-plugin-canonical-rules) | ||
* [`destructuring-property-newline`](#eslint-plugin-canonical-rules-destructuring-property-newline) | ||
* [`export-specifier-newline`](#eslint-plugin-canonical-rules-export-specifier-newline) | ||
@@ -107,2 +108,43 @@ * [`filename-match-exported`](#eslint-plugin-canonical-rules-filename-match-exported) | ||
<a name="eslint-plugin-canonical-rules-destructuring-property-newline"></a> | ||
### <code>destructuring-property-newline</code> | ||
Like [`object-property-newline`](https://eslint.org/docs/rules/object-property-newline), but for destructuring. | ||
The following patterns are considered problems: | ||
```js | ||
const {a,b} = obj; | ||
// Message: undefined | ||
const {a,b,c} = obj; | ||
// Message: undefined | ||
// Message: undefined | ||
const { | ||
a,b} = obj; | ||
// Message: undefined | ||
({a,b}) => {}; | ||
// Message: undefined | ||
``` | ||
The following patterns are not considered problems: | ||
```js | ||
const {a, | ||
b} = obj; | ||
const {a} = obj; | ||
const { | ||
a | ||
} = obj; | ||
({a, | ||
b}) => {}; | ||
``` | ||
<a name="eslint-plugin-canonical-rules-export-specifier-newline"></a> | ||
@@ -113,2 +155,23 @@ ### <code>export-specifier-newline</code> | ||
Tip: Combine this rule with `object-curly-newline` to have every specifier on its own line. | ||
```json | ||
"object-curly-newline": [ | ||
2, | ||
{ | ||
"ExportDeclaration": "always" | ||
} | ||
], | ||
``` | ||
Working together, both rules will produces exports such as: | ||
```ts | ||
export { | ||
a, | ||
b, | ||
c | ||
}; | ||
``` | ||
The following patterns are considered problems: | ||
@@ -768,2 +831,23 @@ | ||
Tip: Combine this rule with `object-curly-newline` to have every specifier on its own line. | ||
```json | ||
"object-curly-newline": [ | ||
2, | ||
{ | ||
"ImportDeclaration": "always" | ||
} | ||
], | ||
``` | ||
Working together, both rules will produces imports such as: | ||
```ts | ||
import { | ||
a, | ||
b, | ||
c | ||
} from 'foo'; | ||
``` | ||
The following patterns are considered problems: | ||
@@ -770,0 +854,0 @@ |
89487
20
1169
1800