eslint-plugin-putout 22.4.0 β†’ 22.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/lib/multiple-properties-destructuring/index.js +2 -2
  2. package/package.json +1 -1
  3. package/lib/add-newline-after-function-call/README.md +0 -26
  4. package/lib/add-newline-before-function-call/README.md +0 -32
  5. package/lib/add-newline-before-return/README.md +0 -24
  6. package/lib/add-newlines-between-specifiers/README.md +0 -36
  7. package/lib/add-newlines-between-types-in-union/README.md +0 -18
  8. package/lib/align-spaces/README.md +0 -27
  9. package/lib/array-element-newline/README.md +0 -28
  10. package/lib/destructuring-as-function-argument/README.md +0 -23
  11. package/lib/evaluate/README.md +0 -31
  12. package/lib/for-of-multiple-properties-destructuring/README.md +0 -25
  13. package/lib/function-declaration-paren-newline/README.md +0 -45
  14. package/lib/keyword-spacing/README.md +0 -55
  15. package/lib/long-properties-destructuring/README.md +0 -19
  16. package/lib/multiple-properties-destructuring/README.md +0 -45
  17. package/lib/newline-function-call-arguments/README.md +0 -26
  18. package/lib/no-unresolved/README.md +0 -36
  19. package/lib/nonblock-statement-body-newline/README.md +0 -39
  20. package/lib/object-property-newline/README.md +0 -36
  21. package/lib/objects-braces-inside-array/README.md +0 -27
  22. package/lib/putout/README.md +0 -19
  23. package/lib/remove-duplicate-extensions/README.md +0 -24
  24. package/lib/remove-empty-newline-after-import/README.md +0 -22
  25. package/lib/remove-empty-newline-after-last-element/README.md +0 -23
  26. package/lib/remove-empty-newline-after-last-specifier/README.md +0 -34
  27. package/lib/remove-empty-newline-before-first-specifier/README.md +0 -34
  28. package/lib/remove-empty-newline-between-declarations/README.md +0 -17
  29. package/lib/remove-empty-specifiers/README.md +0 -16
  30. package/lib/remove-newline-after-default-import/README.md +0 -24
  31. package/lib/remove-newline-from-empty-object/README.md +0 -17
  32. package/lib/single-property-destructuring/README.md +0 -29
  33. package/lib/tape-add-newline-before-assertion/README.md +0 -29
  34. package/lib/tape-add-newline-between-tests/README.md +0 -39
  35. package/lib/tape-remove-newline-before-t-end/README.md +0 -27
@@ -24,7 +24,7 @@ module.exports.include = ({options}) => {
24
24
 
25
25
  return [
26
26
  `VariableDeclarator[id.type="ObjectPattern"][id.properties.length>${minProperties}]`,
27
- `ImportDeclaration[specifiers.length>=${minProperties}]`,
27
+ `ImportDeclaration[specifiers.length>${minProperties}]`,
28
28
  ];
29
29
  };
30
30
 
@@ -41,7 +41,7 @@ module.exports.filter = ({node}, options) => {
41
41
  if (isImportDeclaration(node)) {
42
42
  const {defaults, imports} = parseImportSpecifiers(node.specifiers);
43
43
 
44
- if (defaults.length === 1 && imports.length < minProperties)
44
+ if (defaults.length === 1 && imports.length <= minProperties)
45
45
  return false;
46
46
 
47
47
  return !isCorrectImportLoc(line, specifiers);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-putout",
3
- "version": "22.4.0",
3
+ "version": "22.4.1",
4
4
  "type": "commonjs",
5
5
  "description": "ESLint plugin for 🐊Putout",
6
6
  "release": false,
@@ -1,26 +0,0 @@
1
- # add-newline-after-function-call
2
-
3
- This rule aims to add newline after function call.
4
-
5
- ## ❌ Example of incorrect code
6
-
7
- ```js
8
- export function parse() {
9
- const a = 1;
10
-
11
- fn();
12
- const b = 2;
13
- }
14
- ```
15
-
16
- ## βœ… Example of correct code
17
-
18
- ```js
19
- export function parse() {
20
- const a = 1;
21
-
22
- fn();
23
-
24
- const b = 2;
25
- }
26
- ```
@@ -1,32 +0,0 @@
1
- # add-newline-before-function-call
2
-
3
- This rule aims to add newline before `function call` and `assignment`. Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
4
-
5
- ## ❌ Example of incorrect code
6
-
7
- ```js
8
- export function parse() {
9
- const a = 1;
10
- const b = 2;
11
- fn();
12
- }
13
-
14
- export function calc() {
15
- const b = 2;
16
- }
17
- ```
18
-
19
- ## βœ… Example of correct code
20
-
21
- ```js
22
- export function parse() {
23
- const a = 1;
24
- const b = 2;
25
-
26
- fn();
27
- }
28
-
29
- export function calc() {
30
- const b = 2;
31
- }
32
- ```
@@ -1,24 +0,0 @@
1
- # add-newline-before-return
2
-
3
- This rule aims to add newline before `return`. Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
4
-
5
- ## ❌ Example of incorrect code
6
-
7
- ```js
8
- export function sum() {
9
- const a = 1;
10
- const b = 2;
11
- return a + b;
12
- }
13
- ```
14
-
15
- ## βœ… Example of correct code
16
-
17
- ```js
18
- export function parse() {
19
- const a = 1;
20
- const b = 2;
21
-
22
- return a + b;
23
- }
24
- ```
@@ -1,36 +0,0 @@
1
- # add-newlines-between-specifiers
2
-
3
- This rule aims to add newlines between specifiers.
4
-
5
- ## ❌ Example of incorrect code
6
-
7
- ```js
8
- let a;
9
- let b;
10
- let c;
11
- let d;
12
- let e;
13
- let f;
14
-
15
- export {a, b, c, d, e, f};
16
- ```
17
-
18
- ## βœ… Example of correct code
19
-
20
- ```js
21
- let a;
22
- let b;
23
- let c;
24
- let d;
25
- let e;
26
- let f;
27
-
28
- export {
29
- a,
30
- b,
31
- c,
32
- d,
33
- e,
34
- f,
35
- };
36
- ```
@@ -1,18 +0,0 @@
1
- # add-newlines-between-types-in-union
2
-
3
- This rule aims to add newlines between types in union. Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
4
-
5
- ## ❌ Example of incorrect code
6
-
7
- ```js
8
- type a = string | number | object | boolean;
9
- ```
10
-
11
- ## βœ… Example of correct code
12
-
13
- ```js
14
- type a = string
15
- | number
16
- | object
17
- | boolean;
18
- ```
@@ -1,27 +0,0 @@
1
- # align-spaces
2
-
3
- When 🐊**Putout** processes files it can remove spaces from empty line, this `rule` fixes it.
4
-
5
- ## ❌ Example of incorrect code
6
-
7
- ```js
8
- function hello() {
9
- const result = [];
10
- // ⬇ no spaces ⬇
11
-
12
- // ⬆ no spaces ⬆
13
- return result;
14
- }
15
- ```
16
-
17
- ## βœ… Example of correct code
18
-
19
- ```js
20
- function hello() {
21
- const result = [];
22
- // ⬇ spaces ⬇
23
-
24
- // ⬆ spaces ⬆
25
- return result;
26
- }
27
- ```
@@ -1,28 +0,0 @@
1
- # array-element-newline
2
-
3
- This rule aims to add newlines between array elements.
4
- It exists because [`array-element-newline`](https://eslint.org/docs/rules/array-element-newline) requires [`array-bracket-newline`](https://eslint.org/docs/rules/array-bracket-newline) which conflicts with [`object-braces-inside-array`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout/lib/objects-braces-inside-array#readme).
5
-
6
- Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
7
-
8
- ## ❌ Example of incorrect code
9
-
10
- ```js
11
- const a = [1, 2, 3, 4, 5, 6, 7];
12
- ```
13
-
14
- ## βœ… Example of correct code
15
-
16
- ```js
17
- const a = [
18
- 1,
19
- 2,
20
- 3,
21
- 4,
22
- 5,
23
- 6,
24
- 7,
25
- ];
26
-
27
- const stdio = [0, 1, 2, 'pipe'];
28
- ```
@@ -1,23 +0,0 @@
1
- # destructuring-as-function-argument
2
-
3
- When 🐊[**Putout**](https://github.com/coderaiser/putout) [removes unused variables](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-unused-variables#readme) located in function argument object pattern, it formats it in a multiple lines.
4
- This rule aims keep curly braces in one line when you use destructuring as function argument.
5
-
6
- Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
7
-
8
- ## ❌ Example of incorrect code
9
-
10
- ```js
11
- const login = ({
12
- username,
13
- password,
14
- }) => {
15
- };
16
- ```
17
-
18
- ## βœ… Example of correct code
19
-
20
- ```js
21
- const login = ({username, password}) => {
22
- };
23
- ```
@@ -1,31 +0,0 @@
1
- # Evaluate
2
-
3
- Evaluate expression started with `__putout_evaluate: `. Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
4
- Provided code is processed with [`@putout/plugin-declare`](https://github.com/coderaiser/putout/tree/master/packages/plugin-declare):
5
-
6
- ```js
7
- __putout_evaluate: join('hello', ' ', 'world');
8
- ```
9
-
10
- and converted to:
11
-
12
- ```js
13
- const fn = (__filename, __dirname, require) => {
14
- const {join} = require('path');
15
- return join('hello', ' ', 'world');
16
- };
17
- ```
18
-
19
- When you want to evaluate expressions `source` of `ImportDeclaration`:
20
-
21
- ## ❌ Example of incorrect code
22
-
23
- ```js
24
- import {readFile} from '__putout_evaluate: `./` + basename(__filename).replace(`.spec.js`, `.js`)';
25
- ```
26
-
27
- ## βœ… Example of correct code
28
-
29
- ```js
30
- import {readFile} from './hello.js';
31
- ```
@@ -1,25 +0,0 @@
1
- # for-of-multiple-properties-destructuring
2
-
3
- This rule aims to shorten destructuring in `for-of` statements, keeping all properties in one line.
4
- Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
5
-
6
- ## ❌ Example of incorrect code
7
-
8
- ```js
9
- for ({
10
- username,
11
- password,
12
- } of users) {
13
- }
14
- ```
15
-
16
- ## βœ… Example of correct code
17
-
18
- ```js
19
- for ({username, password} of users) {
20
- }
21
- ```
22
-
23
- ## Options
24
-
25
- `maxProperties` - maximum properties count to work with, defaults to **8**.
@@ -1,45 +0,0 @@
1
- # function-declaration-paren-newline
2
-
3
- Remove newlines between parens in function declaration. Similar to `ESLint` rule [function-paren-newline](https://eslint.org/docs/rules/function-declaration-paren-newline), but forbids new lines in function declarations and expressions arguments.
4
- Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
5
-
6
- ## ❌ Example of incorrect code
7
-
8
- ```js
9
- function f(
10
- {a, b, c},
11
- ) {}
12
-
13
- const fn = (
14
- {a, b, c},
15
- ) => {};
16
-
17
- regexpTree.traverse(ast, {
18
- RegExp(
19
- {node},
20
- ) {
21
- const {body} = node;
22
- },
23
- });
24
- ```
25
-
26
- ## βœ… Example of correct code
27
-
28
- ```js
29
- function f({a, b, c}) {}
30
-
31
- const fn = ({a, b, c}) => {};
32
-
33
- const fnWithCall = ({a, b, c}) => {
34
- return x(
35
- a,
36
- b,
37
- );
38
- };
39
-
40
- regexpTree.traverse(ast, {
41
- RegExp({node}) {
42
- const {body} = node;
43
- },
44
- });
45
- ```
@@ -1,55 +0,0 @@
1
- # keyword-spacing
2
-
3
- When 🐊[**Putout**](https://github.com/coderaiser/putout) removes unused variable in `catch` [eslint keyword spacing](https://eslint.org/docs/rules/keyword-spacing) can't handle [optional catch binding](https://github.com/tc39/proposal-optional-catch-binding) correctly. This rule adds spaces around `catch`.
4
-
5
- Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
6
-
7
- ## ❌ Example of incorrect code
8
-
9
- ```js
10
- try{
11
- } catch{
12
- }
13
-
14
- try {
15
- }catch{
16
- }
17
-
18
- try {
19
- }catch(error) {
20
- }
21
-
22
- if(a) {
23
- }
24
-
25
- for(i = 0; i < n; i++) {}
26
-
27
- for(x of y) {}
28
-
29
- async () => {
30
- for await(x of y) {}
31
- };
32
- ```
33
-
34
- ## βœ… Example of correct code
35
-
36
- ```js
37
- try {
38
- }catch {
39
- }
40
-
41
- try {
42
- } catch(error) {
43
- }
44
-
45
- if (a) {
46
- }
47
-
48
- for (i = 0; i < n; i++) {}
49
-
50
- for (x of y) {}
51
-
52
- async () => {
53
- for await (x of y) {}
54
- };
55
- ```
@@ -1,19 +0,0 @@
1
- # long-properties-destructuring
2
-
3
- Keep each property on separate line when destructuring properties with name length **15** characters and more.
4
-
5
- Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
6
-
7
- ## ❌ Example of incorrect code
8
-
9
- ```js
10
- const {isIdentifier} = user;
11
- ```
12
-
13
- ## βœ… Example of correct code
14
-
15
- ```js
16
- const {
17
- isIdentifier,
18
- } = user;
19
- ```
@@ -1,45 +0,0 @@
1
- # multiple-properties-destructuring
2
-
3
- Keep each property on separate line when using multiple destructuring properties
4
- In the same way as **ESLint** [object-property-newline](https://eslint.org/docs/rules/object-property-newline), but for destructuring.
5
-
6
- Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
7
-
8
- ## ❌ Example of incorrect code
9
-
10
- ```js
11
- const {a, b, c} = user;
12
- ```
13
-
14
- ```js
15
- import {a, b, c} from 'user';
16
- ```
17
-
18
- ## βœ… Example of correct code
19
-
20
- ```js
21
- const {
22
- a,
23
- b,
24
- c,
25
- } = user;
26
- ```
27
-
28
- ```js
29
- import {
30
- a,
31
- b,
32
- c,
33
- } from 'user';
34
- ```
35
-
36
- ## Options
37
-
38
- `minProperties` - minimum properties count to work with, defaults: `2`.
39
-
40
- ```js
41
- const {
42
- username,
43
- password,
44
- } = user;
45
- ```
@@ -1,26 +0,0 @@
1
- # newline-function-call-arguments
2
-
3
- Addition to eslint's [function-paren-newline](https://eslint.org/docs/rules/function-paren-newline)
4
- This rule aims to fix eslint transform adding new line after opening brace.
5
-
6
- Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
7
-
8
- ## ❌ Example of incorrect code
9
-
10
- ```js
11
- const onConnectError = squad(superFn(connect_error),
12
- logWrapped(isLog, importStr),
13
- addUrl(colorUrl),
14
- getDescription);
15
- ```
16
-
17
- ## βœ… Example of correct code
18
-
19
- ```js
20
- const onConnectError = squad(
21
- superFn(connect_error),
22
- logWrapped(isLog, importStr),
23
- addUrl(colorUrl),
24
- getDescription,
25
- );
26
- ```
@@ -1,36 +0,0 @@
1
- # no-unresolved
2
-
3
- Check if path can be resolved and fix if cannot.
4
- Similar to [`no-unresolved`](https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/no-unresolved.md) from
5
- [`eslint-plugin-import`](https://github.com/import-js/eslint-plugin-import). But supports only `ESM` and have `autofix`.
6
-
7
- Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
8
-
9
- [File extension is mandatory](https://nodejs.org/api/esm.html#esm_mandatory_file_extensions) and will produce an error from `node.js`:
10
-
11
- ```
12
- Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/coderaiser/putout/y' imported from /Users/coderaiser/putout/x.mjs
13
- Did you mean to import ../y.js?
14
- ```
15
-
16
- ## ❌ Example of incorrect code
17
-
18
- ```js
19
- import x from './y';
20
- import dir from './dir';
21
-
22
- export * from './y';
23
- export * as dir from './dir';
24
- export {m} from './y';
25
- ```
26
-
27
- ## βœ… Example of correct code
28
-
29
- ```js
30
- import x from './y.js';
31
- import dir from './dir/index.js';
32
-
33
- export * from './y.js';
34
- export * as dir from './dir/index.js';
35
- export {m} from './y.js';
36
- ```
@@ -1,39 +0,0 @@
1
- # nonblock-statement-body-newline
2
-
3
- Remove newline inside statement body. Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
4
-
5
- ## ❌ Example of incorrect code
6
-
7
- ```js
8
- if (a)
9
-
10
- b();
11
-
12
- for (a of b)
13
-
14
- a();
15
-
16
- while (a)
17
-
18
- b();
19
-
20
- for (;;)
21
-
22
- a();
23
- ```
24
-
25
- ## βœ… Example of correct code
26
-
27
- ```js
28
- if (a)
29
- b();
30
-
31
- for (a of b)
32
- a();
33
-
34
- while (a)
35
- b();
36
-
37
- for (;;)
38
- a();
39
- ```
@@ -1,36 +0,0 @@
1
- # object-property-newline
2
-
3
- Keep each property on separate line when initializing an object. In the same way as **ESLint** [`object-property-newline`](https://eslint.org/docs/rules/object-property-newline) but for initializing variables with [**Object Expression**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects) or using `type` and `interface` keywords in **TypeScript**.
4
-
5
- Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
6
-
7
- ## ❌ Example of incorrect code
8
-
9
- ```ts
10
- const user = {name};
11
-
12
- module.exports = {lint: 'putout lint'};
13
-
14
- type User = {name: string};
15
- interface Place {message: string}
16
- ```
17
-
18
- ## βœ… Example of correct code
19
-
20
- ```ts
21
- const user = {
22
- name,
23
- };
24
-
25
- module.exports = {
26
- lint: 'putout lint',
27
- };
28
-
29
- type User = {
30
- name: string,
31
- };
32
-
33
- interface Place {
34
- message: string;
35
- }
36
- ```
@@ -1,27 +0,0 @@
1
- # object-braces-inside-array
2
-
3
- Keep braces on the same line as brackets.
4
- Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
5
-
6
- ## ❌ Example of incorrect code
7
-
8
- ```js
9
- const expected = [
10
- {
11
- hello: 'world',
12
- },
13
- {
14
- how: 'come',
15
- },
16
- ];
17
- ```
18
-
19
- ## βœ… Example of correct code
20
-
21
- ```js
22
- const expected = [{
23
- hello: 'world',
24
- }, {
25
- how: 'come',
26
- }];
27
- ```
@@ -1,19 +0,0 @@
1
- # Putout
2
-
3
- Run 🐊[**Putout**](https://github.com/coderaiser/putout#built-in-transforms) rules from [**ESLint**](https://eslint.org/).
4
-
5
- And can be [configured](https://eslint.org/docs/user-guide/configuring#configuring-rules) according to [**Putout** configuration](https://github.com/coderaiser/putout#configuration).
6
-
7
- For example, if you want to disable the rule [remove-unused-variables](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-unused-variables) you can use:
8
-
9
- ```json
10
- {
11
- "rules": {
12
- "putout/putout": ["error", {
13
- "rules": {
14
- "remove-unused-variables": "off"
15
- }
16
- }]
17
- }
18
- }
19
- ```
@@ -1,24 +0,0 @@
1
- # remove-duplicate-extension
2
-
3
- Check if path has duplicate extension `.js.js` can be resolved and fix if cannot.
4
- Duplicates can happen when **IDE** like **WebStorm** inserts filename and mistakenly adds duplicate.
5
-
6
- Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
7
-
8
- ## ❌ Example of incorrect code
9
-
10
- ```js
11
- import x from './y.js.js';
12
- export * from './y.js.js';
13
- export * as dir from './dir.js.js';
14
- export {m} from './y.js.js';
15
- ```
16
-
17
- ## βœ… Example of correct code
18
-
19
- ```js
20
- import x from './y.js';
21
- export * from './y.js';
22
- export * as dir from './dir.js';
23
- export {m} from './y.js';
24
- ```
@@ -1,22 +0,0 @@
1
- # remove-empty-newline-after-import
2
-
3
- This rule aims to remove empty newline after [`import` statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import). Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
4
-
5
- ## ❌ Example of incorrect code
6
-
7
- ```js
8
- import {readFile} from 'fs';
9
-
10
- import {promisify} from 'util';
11
-
12
- import index from './index.js';
13
- ```
14
-
15
- ## βœ… Example of correct code
16
-
17
- ```js
18
- import {readFile} from 'fs';
19
- import {promisify} from 'util';
20
-
21
- import index from './index.js';
22
- ```
@@ -1,23 +0,0 @@
1
- # remove-empty-newline-after-last-element
2
-
3
- Remove empty newline after last element.
4
- Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
5
-
6
- ## ❌ Example of incorrect code
7
-
8
- ```js
9
- push([
10
- a,
11
- b,
12
-
13
- ]);
14
- ```
15
-
16
- ## βœ… Example of correct code
17
-
18
- ```js
19
- push([
20
- a,
21
- b,
22
- ]);
23
- ```
@@ -1,34 +0,0 @@
1
- # remove-empty-newline-after-last-specifier
2
-
3
- Remove empty newline after last specifier.
4
- Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
5
-
6
- ## ❌ Example of incorrect code
7
-
8
- ```js
9
- import {
10
- a,
11
- b,
12
-
13
- } from 'y';
14
-
15
- push({
16
- a,
17
- b,
18
-
19
- });
20
- ```
21
-
22
- ## βœ… Example of correct code
23
-
24
- ```js
25
- import {
26
- a,
27
- b,
28
- } from 'y';
29
-
30
- push({
31
- a,
32
- b,
33
- });
34
- ```
@@ -1,34 +0,0 @@
1
- # remove-empty-newline-before-first-specifier
2
-
3
- This rule aims to remove empty newline before first specifier.
4
- Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
5
-
6
- ## ❌ Example of incorrect code
7
-
8
- ```js
9
- import {
10
-
11
- a,
12
- b,
13
- } from 'y';
14
-
15
- push({
16
-
17
- a,
18
- b,
19
- });
20
- ```
21
-
22
- ## βœ… Example of correct code
23
-
24
- ```js
25
- import {
26
- a,
27
- b,
28
- } from 'y';
29
-
30
- push({
31
- a,
32
- b,
33
- });
34
- ```
@@ -1,17 +0,0 @@
1
- # remove-empty-newline-between-declarations
2
-
3
- This rule aims to remove empty newline between Variable Declarations. Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
4
-
5
- ## ❌ Example of incorrect code
6
-
7
- ```js
8
- const {a} = b;
9
- const {c} = a;
10
- ```
11
-
12
- ## βœ… Example of correct code
13
-
14
- ```js
15
- const {a} = b;
16
- const {c} = a;
17
- ```
@@ -1,16 +0,0 @@
1
- # remove-empty-specifiers
2
-
3
- This rule aims to remove empty specifiers.
4
- Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
5
-
6
- ## ❌ Example of incorrect code
7
-
8
- ```js
9
- import putout, {} from 'putout';
10
- ```
11
-
12
- ## βœ… Example of correct code
13
-
14
- ```js
15
- import putout from 'putout';
16
- ```
@@ -1,24 +0,0 @@
1
- # remove-newline-after-default-import
2
-
3
- This rule aims to remove newline after default import, before opening curly brace (`{`).
4
- Fixes [`object-curly-newline`](https://eslint.org/docs/rules/object-curly-newline) + [`eslint-plugin-modules-newline`](https://github.com/gmsorrow/eslint-plugin-modules-newline).
5
- Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
6
-
7
- ## ❌ Example of incorrect code
8
-
9
- ```js
10
- import x,
11
- {
12
- a,
13
- b,
14
- } from 'y';
15
- ```
16
-
17
- ## βœ… Example of correct code
18
-
19
- ```js
20
- import x, {
21
- a,
22
- b,
23
- } from 'y';
24
- ```
@@ -1,17 +0,0 @@
1
- # remove-newline-from-empty-object
2
-
3
- This rule aims to remove newline from empty object.
4
- Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
5
-
6
- ## ❌ Example of incorrect code
7
-
8
- ```js
9
- const a = {
10
- };
11
- ```
12
-
13
- ## βœ… Example of correct code
14
-
15
- ```js
16
- const a = {};
17
- ```
@@ -1,29 +0,0 @@
1
- # single-property-destructuring
2
-
3
- When 🐊[**Putout**](https://github.com/coderaiser/putout) removes unused variables declared as destructured properties, it keeps one property to take 3 lines, instead of 1.
4
- This rule aims to shorten destructuring of one property, keeping curly braces in one line.
5
-
6
- Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
7
-
8
- ## ❌ Example of incorrect code
9
-
10
- ```js
11
- import {
12
- password,
13
- } from './user.js';
14
-
15
- const {
16
- username,
17
- } = user;
18
- ```
19
-
20
- ## βœ… Example of correct code
21
-
22
- ```js
23
- import {password} from './user.js';
24
- import {
25
- helloWorld as simpleHello,
26
- } from './hello.js';
27
-
28
- const {username} = user;
29
- ```
@@ -1,29 +0,0 @@
1
- # add-newline-before-assertion
2
-
3
- Add newline before `t.equal()` etc, for πŸ“Ό[`Supertape`](https://github.com/coderaiser/supertape).
4
- Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
5
-
6
- ## ❌ Example of incorrect code
7
-
8
- ```js
9
- test('lint: do some check', (t) => {
10
- const expected = 1 + 2;
11
-
12
- fn();
13
- t.equal(result, 3);
14
- t.end();
15
- });
16
- ```
17
-
18
- ## βœ… Example of correct code
19
-
20
- ```js
21
- test('lint: do some check', (t) => {
22
- const result = 1 + 2;
23
-
24
- fn();
25
-
26
- t.equal(result, 3);
27
- t.end();
28
- });
29
- ```
@@ -1,39 +0,0 @@
1
- # add-newline-between-tests
2
-
3
- Add newline between tests, for πŸ“Ό[`Supertape`](https://github.com/coderaiser/supertape).
4
- Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
5
-
6
- ## ❌ Example of incorrect code
7
-
8
- ```js
9
- test('lint: do some check', (t) => {
10
- const result = 1 + 2;
11
-
12
- t.equal(result, 3);
13
- t.end();
14
- });
15
- test('lint: do some check', (t) => {
16
- const result = 1 + 2;
17
-
18
- t.equal(result, 3);
19
- t.end();
20
- });
21
- ```
22
-
23
- ## βœ… Example of correct code
24
-
25
- ```js
26
- test('lint: do some check', (t) => {
27
- const result = 1 + 2;
28
-
29
- t.equal(result, 3);
30
- t.end();
31
- });
32
-
33
- test('lint: do some check', (t) => {
34
- const result = 1 + 2;
35
-
36
- t.equal(result, 3);
37
- t.end();
38
- });
39
- ```
@@ -1,27 +0,0 @@
1
- # remove-newline-before-t-end
2
-
3
- Remove newline before `t.end()`, for πŸ“Ό[**Supertape**](https://github.com/coderaiser/supertape).
4
- Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
5
-
6
- ## ❌ Example of incorrect code
7
-
8
- ```js
9
- test('lint: do some check', (t) => {
10
- const result = 1 + 2;
11
-
12
- t.equal(result, 3);
13
-
14
- t.end();
15
- });
16
- ```
17
-
18
- ## βœ… Example of correct code
19
-
20
- ```js
21
- test('lint: do some check', (t) => {
22
- const result = 1 + 2;
23
-
24
- t.equal(result, 3);
25
- t.end();
26
- });
27
- ```