eslint-plugin-putout 14.3.0 → 14.4.0
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.
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# destructuring-as-function-argument
|
|
2
2
|
|
|
3
|
-
When
|
|
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.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Examples of **incorrect** code for this rule:
|
|
8
|
+
## ❌ Example of incorrect code
|
|
10
9
|
|
|
11
10
|
```js
|
|
12
11
|
const login = ({
|
|
@@ -16,7 +15,7 @@ const login = ({
|
|
|
16
15
|
};
|
|
17
16
|
```
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
## ✅ Example of correct code
|
|
20
19
|
|
|
21
20
|
```js
|
|
22
21
|
const login = ({username, password}) => {
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# no-unresolved
|
|
2
2
|
|
|
3
|
+
Check if path can be resolved and fix if cannot.
|
|
3
4
|
Similar to [`no-unresolved`](https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/no-unresolved.md) from
|
|
4
|
-
[`eslint-plugin-
|
|
5
|
+
[`eslint-plugin-import`](https://github.com/import-js/eslint-plugin-import). But supports only `ESM` and have `autofix`.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
[File extension is mandatory](https://nodejs.org/api/esm.html#esm_mandatory_file_extensions) and will produce an error from `node.js`:
|
|
9
10
|
|
|
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
|
|
11
17
|
|
|
12
18
|
```js
|
|
13
19
|
import x from './y';
|
|
@@ -18,14 +24,7 @@ export * as dir from './dir';
|
|
|
18
24
|
export {m} from './y';
|
|
19
25
|
```
|
|
20
26
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/coderaiser/putout/y' imported from /Users/coderaiser/putout/x.mjs
|
|
25
|
-
Did you mean to import ../y.js?
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Examples of **correct** code for this rule:
|
|
27
|
+
## ✅ Example of correct code
|
|
29
28
|
|
|
30
29
|
```js
|
|
31
30
|
import x from './y.js';
|
package/lib/ts.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const {rules} = require('@putout/eslint-config');
|
|
4
|
+
const warnOnUnsupportedTypeScriptVersion = false;
|
|
4
5
|
|
|
5
6
|
const extensionRules = {
|
|
6
7
|
'no-undef': 'off',
|
|
@@ -68,6 +69,7 @@ const ts = {
|
|
|
68
69
|
files: '*.ts',
|
|
69
70
|
parser: '@typescript-eslint/parser',
|
|
70
71
|
parserOptions: {
|
|
72
|
+
warnOnUnsupportedTypeScriptVersion,
|
|
71
73
|
ecmaFeatures: {
|
|
72
74
|
jsx: false,
|
|
73
75
|
},
|
|
@@ -94,6 +96,7 @@ module.exports = [
|
|
|
94
96
|
...ts,
|
|
95
97
|
files: '*.tsx',
|
|
96
98
|
parserOptions: {
|
|
99
|
+
warnOnUnsupportedTypeScriptVersion,
|
|
97
100
|
ecmaFeatures: {
|
|
98
101
|
jsx: true,
|
|
99
102
|
},
|