eslint-plugin-putout 24.1.0 → 25.0.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.
- package/README.md +17 -44
- package/lib/html.mjs +11 -0
- package/lib/{index.js → index.mjs} +61 -96
- package/lib/{json.js → json.mjs} +18 -7
- package/lib/{jsx.js → jsx.mjs} +10 -7
- package/lib/{markdown.js → markdown.mjs} +35 -23
- package/lib/plugin.js +47 -0
- package/lib/putout/sync/index.js +1 -1
- package/lib/{ts.js → ts.mjs} +47 -21
- package/package.json +13 -9
- package/lib/config/index.js +0 -39
- package/lib/html.js +0 -8
- package/lib/yaml.js +0 -9
package/README.md
CHANGED
|
@@ -17,13 +17,12 @@ npm i putout eslint eslint-plugin-putout -D
|
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Update `eslint.config.js` with:
|
|
21
21
|
|
|
22
|
-
```
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
22
|
+
```js
|
|
23
|
+
import {recommended} from 'eslint-plugin-putout';
|
|
24
|
+
|
|
25
|
+
export default recommended;
|
|
27
26
|
```
|
|
28
27
|
|
|
29
28
|
Then configure the rules you want to use under the rules section.
|
|
@@ -117,11 +116,10 @@ Then configure the rules you want to use under the rules section.
|
|
|
117
116
|
|
|
118
117
|
When using 🐊**Putout** in IDE with `--fix` on save, or when you want to disable the most dangerous rules, use:
|
|
119
118
|
|
|
120
|
-
```
|
|
121
|
-
{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
119
|
+
```js
|
|
120
|
+
import {safe} from 'eslint-plugin-putout';
|
|
121
|
+
|
|
122
|
+
export default safe;
|
|
125
123
|
```
|
|
126
124
|
|
|
127
125
|
Disabled **ESLint** rules:
|
|
@@ -155,23 +153,18 @@ Disabled 🐊**Putout** rules:
|
|
|
155
153
|
- ❌ [`maybe/noop`](https://github.com/coderaiser/putout/tree/29.2.4/packages/plugin-maybe#noop);
|
|
156
154
|
- ❌ [`remove-useless-push`](https://github.com/coderaiser/putout/tree/38.1.2/packages/plugin-remove-useless-push#readme);
|
|
157
155
|
|
|
158
|
-
###
|
|
156
|
+
### safeAlign
|
|
159
157
|
|
|
160
|
-
When you want to enable ability to align spaces on empty lines, while have all benefits of `safe` preset: use `
|
|
158
|
+
When you want to enable ability to align spaces on empty lines, while have all benefits of `safe` preset: use `safeAlign`.
|
|
161
159
|
|
|
162
160
|
### jsx
|
|
163
161
|
|
|
164
162
|
When you need to support `jsx` in files using `js` extension, use:
|
|
165
163
|
|
|
166
|
-
```
|
|
167
|
-
{
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
],
|
|
171
|
-
"plugins": [
|
|
172
|
-
"putout"
|
|
173
|
-
]
|
|
174
|
-
}
|
|
164
|
+
```js
|
|
165
|
+
import {jsx} from 'eslint-plugin-putout;
|
|
166
|
+
|
|
167
|
+
export default jsx;
|
|
175
168
|
```
|
|
176
169
|
|
|
177
170
|
### esm
|
|
@@ -179,31 +172,11 @@ When you need to support `jsx` in files using `js` extension, use:
|
|
|
179
172
|
If you want to use **ESM** plugins of 🐊**Putout** you need to use `esm` preset:
|
|
180
173
|
|
|
181
174
|
```json
|
|
182
|
-
{
|
|
183
|
-
"extends": [
|
|
184
|
-
"plugin:putout/esm"
|
|
185
|
-
],
|
|
186
|
-
"plugins": [
|
|
187
|
-
"putout"
|
|
188
|
-
]
|
|
189
|
-
}
|
|
190
|
-
```
|
|
175
|
+
import {esm} from 'eslint-plugin-putout;
|
|
191
176
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
The time is came for a [FlatConfig](https://eslint.org/blog/2022/08/new-config-system-part-2/). To use it with `eslint-plugin-putout` add to `eslint.config.js`:
|
|
195
|
-
|
|
196
|
-
```js
|
|
197
|
-
const {recommended} = require('eslint-plugin-putout/config');
|
|
198
|
-
|
|
199
|
-
module.exports = [
|
|
200
|
-
...recommended,
|
|
201
|
-
{},
|
|
202
|
-
];
|
|
177
|
+
export default esm;
|
|
203
178
|
```
|
|
204
179
|
|
|
205
|
-
`safe` and `safeAlign` supported as well.
|
|
206
|
-
|
|
207
180
|
## License
|
|
208
181
|
|
|
209
182
|
MIT
|
package/lib/html.mjs
ADDED
|
@@ -1,65 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import config from '@putout/eslint-config';
|
|
2
|
+
import nPlugin from 'eslint-plugin-n';
|
|
3
|
+
import markdown from './markdown.mjs';
|
|
4
|
+
import json from './json.mjs';
|
|
5
|
+
import html from './html.mjs';
|
|
6
|
+
import ts from './ts.mjs';
|
|
7
|
+
import jsxConfig, {jsx} from './jsx.mjs';
|
|
8
|
+
import putout from './plugin.js';
|
|
2
9
|
|
|
3
|
-
const
|
|
10
|
+
const n = nPlugin.configs['flat/mixed-esm-and-cjs'];
|
|
4
11
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const ts = require('./ts');
|
|
11
|
-
const jsx = require('./jsx');
|
|
12
|
-
|
|
13
|
-
const getRule = (a) => ({
|
|
14
|
-
[a]: require(`./${a}`),
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const getWrapRule = (a) => ({
|
|
18
|
-
[a]: createPlugin(require(`./${a}`)),
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
module.exports.rules = {
|
|
22
|
-
...getWrapRule('array-element-newline'),
|
|
23
|
-
...getWrapRule('single-property-destructuring'),
|
|
24
|
-
...getWrapRule('multiple-properties-destructuring'),
|
|
25
|
-
...getWrapRule('for-of-multiple-properties-destructuring'),
|
|
26
|
-
...getWrapRule('long-properties-destructuring'),
|
|
27
|
-
...getWrapRule('destructuring-as-function-argument'),
|
|
28
|
-
...getWrapRule('align-spaces'),
|
|
29
|
-
...getWrapRule('keyword-spacing'),
|
|
30
|
-
...getWrapRule('newline-function-call-arguments'),
|
|
31
|
-
...getWrapRule('function-declaration-paren-newline'),
|
|
32
|
-
...getWrapRule('add-newlines-between-types-in-union'),
|
|
33
|
-
...getWrapRule('add-newlines-between-specifiers'),
|
|
34
|
-
...getWrapRule('add-newline-before-return'),
|
|
35
|
-
...getWrapRule('add-newline-before-function-call'),
|
|
36
|
-
...getWrapRule('add-newline-after-function-call'),
|
|
37
|
-
...getWrapRule('remove-newline-after-default-import'),
|
|
38
|
-
...getWrapRule('remove-newline-from-empty-object'),
|
|
39
|
-
...getWrapRule('remove-empty-newline-before-first-specifier'),
|
|
40
|
-
...getWrapRule('remove-empty-newline-after-last-specifier'),
|
|
41
|
-
...getWrapRule('remove-empty-newline-after-last-element'),
|
|
42
|
-
...getWrapRule('remove-empty-specifiers'),
|
|
43
|
-
...getWrapRule('objects-braces-inside-array'),
|
|
44
|
-
...getWrapRule('object-property-newline'),
|
|
45
|
-
...getWrapRule('no-unresolved'),
|
|
46
|
-
...getWrapRule('remove-duplicate-extensions'),
|
|
47
|
-
...getWrapRule('evaluate'),
|
|
48
|
-
...getWrapRule('tape-add-newline-before-assertion'),
|
|
49
|
-
...getWrapRule('tape-add-newline-between-tests'),
|
|
50
|
-
...getWrapRule('tape-remove-newline-before-t-end'),
|
|
51
|
-
...getWrapRule('nonblock-statement-body-newline'),
|
|
52
|
-
...getRule('putout'),
|
|
53
|
-
...getRule('remove-empty-newline-after-import'),
|
|
54
|
-
...getRule('remove-empty-newline-between-declarations'),
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const {rules} = config;
|
|
58
|
-
|
|
59
|
-
const recommended = {
|
|
60
|
-
...config,
|
|
12
|
+
const putoutConfig = [{
|
|
13
|
+
name: 'putout: js',
|
|
14
|
+
plugins: {
|
|
15
|
+
putout,
|
|
16
|
+
},
|
|
61
17
|
rules: {
|
|
62
|
-
...rules,
|
|
18
|
+
...config.rules,
|
|
63
19
|
'no-debugger': 'off',
|
|
64
20
|
'no-unused-vars': 'off',
|
|
65
21
|
'putout/array-element-newline': 'error',
|
|
@@ -100,17 +56,20 @@ const recommended = {
|
|
|
100
56
|
'n/no-missing-require': 'off',
|
|
101
57
|
'n/no-process-exit': 'off',
|
|
102
58
|
},
|
|
103
|
-
|
|
104
|
-
...markdown,
|
|
105
|
-
...json,
|
|
106
|
-
...yaml,
|
|
107
|
-
...html,
|
|
108
|
-
...ts,
|
|
109
|
-
...jsx,
|
|
110
|
-
],
|
|
111
|
-
};
|
|
59
|
+
}];
|
|
112
60
|
|
|
113
|
-
const
|
|
61
|
+
export const recommended = [
|
|
62
|
+
...n,
|
|
63
|
+
...config,
|
|
64
|
+
...putoutConfig,
|
|
65
|
+
...markdown,
|
|
66
|
+
...html,
|
|
67
|
+
...ts,
|
|
68
|
+
...jsxConfig,
|
|
69
|
+
...json,
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
export const safeRules = {
|
|
114
73
|
'apply-template-literals': 'off',
|
|
115
74
|
'remove-empty': 'off',
|
|
116
75
|
'merge-duplicate-functions': 'off',
|
|
@@ -135,32 +94,33 @@ const safeRules = {
|
|
|
135
94
|
'remove-useless-push': 'off',
|
|
136
95
|
};
|
|
137
96
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
};
|
|
97
|
+
export const safe = [
|
|
98
|
+
...n,
|
|
99
|
+
...recommended, {
|
|
100
|
+
rules: {
|
|
101
|
+
...recommended.rules,
|
|
102
|
+
'no-implicit-coercion': 'off',
|
|
103
|
+
'no-useless-return': 'off',
|
|
104
|
+
'putout/align-spaces': 'off',
|
|
105
|
+
'putout/remove-newline-from-empty-object': 'off',
|
|
106
|
+
'putout/putout': ['error', {
|
|
107
|
+
esm: false,
|
|
108
|
+
rules: safeRules,
|
|
109
|
+
}],
|
|
110
|
+
},
|
|
111
|
+
}];
|
|
154
112
|
|
|
155
|
-
const safeAlign =
|
|
156
|
-
...
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
113
|
+
export const safeAlign = [
|
|
114
|
+
...n,
|
|
115
|
+
...safe, {
|
|
116
|
+
rules: {
|
|
117
|
+
...safe.rules,
|
|
118
|
+
'putout/align-spaces': 'error',
|
|
119
|
+
},
|
|
120
|
+
}];
|
|
162
121
|
|
|
163
|
-
const esm = {
|
|
122
|
+
export const esm = {
|
|
123
|
+
...n,
|
|
164
124
|
...safeAlign,
|
|
165
125
|
rules: {
|
|
166
126
|
...safeAlign.rules,
|
|
@@ -171,10 +131,15 @@ const esm = {
|
|
|
171
131
|
},
|
|
172
132
|
};
|
|
173
133
|
|
|
174
|
-
|
|
134
|
+
export const configs = {
|
|
175
135
|
recommended,
|
|
176
|
-
|
|
136
|
+
jsx,
|
|
177
137
|
safe,
|
|
178
|
-
|
|
138
|
+
safeAlign,
|
|
179
139
|
esm,
|
|
180
140
|
};
|
|
141
|
+
|
|
142
|
+
export default {
|
|
143
|
+
rules: putout.rules,
|
|
144
|
+
configs,
|
|
145
|
+
};
|
package/lib/{json.js → json.mjs}
RENAMED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import stylisticJs from '@stylistic/eslint-plugin-js';
|
|
2
|
+
import putout from './plugin.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
export default [{
|
|
5
|
+
name: 'putout: json',
|
|
4
6
|
files: [
|
|
5
|
-
'
|
|
6
|
-
'
|
|
7
|
+
'**/*.json',
|
|
8
|
+
'**/*{json}',
|
|
7
9
|
],
|
|
8
10
|
rules: {
|
|
9
11
|
'no-undef': 'off',
|
|
@@ -28,7 +30,8 @@ module.exports = [{
|
|
|
28
30
|
'@stylistic/js/no-multi-spaces': 'off',
|
|
29
31
|
},
|
|
30
32
|
}, {
|
|
31
|
-
|
|
33
|
+
name: 'putout: json: package.json',
|
|
34
|
+
files: ['**/package.json'],
|
|
32
35
|
rules: {
|
|
33
36
|
'@stylistic/js/indent': [
|
|
34
37
|
'error',
|
|
@@ -36,13 +39,21 @@ module.exports = [{
|
|
|
36
39
|
],
|
|
37
40
|
},
|
|
38
41
|
}, {
|
|
39
|
-
|
|
42
|
+
name: 'putout: json: ignore',
|
|
43
|
+
files: ['**/*ignore{json}'],
|
|
40
44
|
rules: {
|
|
41
45
|
'@stylistic/js/comma-dangle': 'off',
|
|
42
46
|
},
|
|
43
47
|
}, {
|
|
44
|
-
|
|
48
|
+
name: 'putout: json: yaml',
|
|
49
|
+
files: ['**/*.{yml,yaml}{json}'],
|
|
50
|
+
plugins: {
|
|
51
|
+
'@stylistic': stylisticJs,
|
|
52
|
+
putout,
|
|
53
|
+
},
|
|
45
54
|
rules: {
|
|
55
|
+
'putout/objects-braces-inside-array': 'off',
|
|
46
56
|
'@stylistic/js/indent': 'off',
|
|
57
|
+
'comma-spacing': 'off',
|
|
47
58
|
},
|
|
48
59
|
}];
|
package/lib/{jsx.js → jsx.mjs}
RENAMED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import stylisticJsx from '@stylistic/eslint-plugin-jsx';
|
|
2
|
+
import react from 'eslint-plugin-react';
|
|
2
3
|
|
|
3
|
-
const jsx = {
|
|
4
|
+
export const jsx = {
|
|
5
|
+
name: 'putout: jsx',
|
|
4
6
|
rules: {
|
|
5
7
|
'@stylistic/js/no-extra-parens': 'off',
|
|
6
8
|
'@stylistic/jsx/jsx-indent': 'error',
|
|
@@ -10,7 +12,10 @@ const jsx = {
|
|
|
10
12
|
declaration: 'parens-new-line',
|
|
11
13
|
}],
|
|
12
14
|
},
|
|
13
|
-
plugins:
|
|
15
|
+
plugins: {
|
|
16
|
+
react,
|
|
17
|
+
'@stylistic/jsx': stylisticJsx,
|
|
18
|
+
},
|
|
14
19
|
settings: {
|
|
15
20
|
react: {
|
|
16
21
|
version: 'latest',
|
|
@@ -18,9 +23,7 @@ const jsx = {
|
|
|
18
23
|
},
|
|
19
24
|
};
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
files: ['
|
|
26
|
+
export default [{
|
|
27
|
+
files: ['**/*.jsx'],
|
|
23
28
|
...jsx,
|
|
24
29
|
}];
|
|
25
|
-
|
|
26
|
-
module.exports.jsx = jsx;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import parserOpts from '@putout/engine-parser/babel/options';
|
|
2
|
+
import parserPlugins from '@putout/engine-parser/babel/plugins';
|
|
3
|
+
import babel from '@babel/eslint-parser/experimental-worker';
|
|
4
|
+
import tsConfig from './ts.mjs';
|
|
5
|
+
import {jsx} from './jsx.mjs';
|
|
2
6
|
|
|
3
|
-
const
|
|
4
|
-
const parserPlugins = require('@putout/engine-parser/babel/plugins');
|
|
5
|
-
const [ts, tsx] = require('./ts');
|
|
6
|
-
const {jsx} = require('./jsx');
|
|
7
|
+
const [ts, tsx] = tsConfig;
|
|
7
8
|
|
|
8
9
|
const commonRules = {
|
|
9
10
|
'@stylistic/js/eol-last': [
|
|
@@ -41,48 +42,59 @@ const parserOptions = {
|
|
|
41
42
|
},
|
|
42
43
|
};
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
const mdTsCommonRules = {
|
|
46
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
47
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
48
|
+
'@typescript-eslint/no-inferrable-types': 'off',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default [{
|
|
52
|
+
name: 'putout: md: js',
|
|
53
|
+
files: ['**/*.md{js}'],
|
|
46
54
|
rules: commonRules,
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
languageOptions: {
|
|
56
|
+
parser: babel,
|
|
57
|
+
parserOptions,
|
|
58
|
+
},
|
|
49
59
|
}, {
|
|
50
|
-
|
|
60
|
+
name: 'putout: md: jsx',
|
|
61
|
+
files: ['**/*.md{jsx}'],
|
|
51
62
|
rules: {
|
|
52
63
|
...commonRules,
|
|
53
64
|
...jsx.rules,
|
|
54
65
|
},
|
|
55
66
|
plugins: jsx.plugins,
|
|
56
|
-
|
|
57
|
-
|
|
67
|
+
languageOptions: {
|
|
68
|
+
parser: babel,
|
|
69
|
+
parserOptions,
|
|
70
|
+
},
|
|
58
71
|
}, {
|
|
59
72
|
...tsx,
|
|
60
73
|
...jsx,
|
|
61
|
-
|
|
74
|
+
name: 'putout: md: tsx',
|
|
75
|
+
files: ['**/*.md{tsx}'],
|
|
62
76
|
rules: {
|
|
63
77
|
...commonRules,
|
|
64
78
|
...ts.rules,
|
|
65
79
|
...jsx.rules,
|
|
66
|
-
|
|
67
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
68
|
-
'@typescript-eslint/no-inferrable-types': 'off',
|
|
80
|
+
...mdTsCommonRules,
|
|
69
81
|
},
|
|
70
|
-
plugins:
|
|
82
|
+
plugins: {
|
|
71
83
|
...tsx.plugins,
|
|
72
84
|
...jsx.plugins,
|
|
73
|
-
|
|
85
|
+
},
|
|
74
86
|
}, {
|
|
75
87
|
...ts,
|
|
76
|
-
|
|
88
|
+
name: 'putout: md: ts',
|
|
89
|
+
files: ['**/*.md{ts}'],
|
|
77
90
|
rules: {
|
|
78
91
|
...commonRules,
|
|
79
92
|
...ts.rules,
|
|
80
|
-
|
|
81
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
82
|
-
'@typescript-eslint/no-inferrable-types': 'off',
|
|
93
|
+
...mdTsCommonRules,
|
|
83
94
|
},
|
|
84
95
|
}, {
|
|
85
|
-
|
|
96
|
+
name: 'putout: md: json',
|
|
97
|
+
files: ['**/*.md{json}'],
|
|
86
98
|
rules: {
|
|
87
99
|
'@stylistic/js/eol-last': [
|
|
88
100
|
'error',
|
package/lib/plugin.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const {createPlugin} = require('@putout/eslint/create-plugin');
|
|
4
|
+
|
|
5
|
+
const getRule = (a) => ({
|
|
6
|
+
[a]: require(`./${a}`),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const getWrapRule = (a) => ({
|
|
10
|
+
[a]: createPlugin(require(`./${a}`)),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
module.exports.rules = {
|
|
14
|
+
...getWrapRule('array-element-newline'),
|
|
15
|
+
...getWrapRule('single-property-destructuring'),
|
|
16
|
+
...getWrapRule('multiple-properties-destructuring'),
|
|
17
|
+
...getWrapRule('for-of-multiple-properties-destructuring'),
|
|
18
|
+
...getWrapRule('long-properties-destructuring'),
|
|
19
|
+
...getWrapRule('destructuring-as-function-argument'),
|
|
20
|
+
...getWrapRule('align-spaces'),
|
|
21
|
+
...getWrapRule('keyword-spacing'),
|
|
22
|
+
...getWrapRule('newline-function-call-arguments'),
|
|
23
|
+
...getWrapRule('function-declaration-paren-newline'),
|
|
24
|
+
...getWrapRule('add-newlines-between-types-in-union'),
|
|
25
|
+
...getWrapRule('add-newlines-between-specifiers'),
|
|
26
|
+
...getWrapRule('add-newline-before-return'),
|
|
27
|
+
...getWrapRule('add-newline-before-function-call'),
|
|
28
|
+
...getWrapRule('add-newline-after-function-call'),
|
|
29
|
+
...getWrapRule('remove-newline-after-default-import'),
|
|
30
|
+
...getWrapRule('remove-newline-from-empty-object'),
|
|
31
|
+
...getWrapRule('remove-empty-newline-before-first-specifier'),
|
|
32
|
+
...getWrapRule('remove-empty-newline-after-last-specifier'),
|
|
33
|
+
...getWrapRule('remove-empty-newline-after-last-element'),
|
|
34
|
+
...getWrapRule('remove-empty-specifiers'),
|
|
35
|
+
...getWrapRule('objects-braces-inside-array'),
|
|
36
|
+
...getWrapRule('object-property-newline'),
|
|
37
|
+
...getWrapRule('no-unresolved'),
|
|
38
|
+
...getWrapRule('remove-duplicate-extensions'),
|
|
39
|
+
...getWrapRule('evaluate'),
|
|
40
|
+
...getWrapRule('tape-add-newline-before-assertion'),
|
|
41
|
+
...getWrapRule('tape-add-newline-between-tests'),
|
|
42
|
+
...getWrapRule('tape-remove-newline-before-t-end'),
|
|
43
|
+
...getWrapRule('nonblock-statement-body-newline'),
|
|
44
|
+
...getRule('putout'),
|
|
45
|
+
...getRule('remove-empty-newline-after-import'),
|
|
46
|
+
...getRule('remove-empty-newline-between-declarations'),
|
|
47
|
+
};
|
package/lib/putout/sync/index.js
CHANGED
package/lib/{ts.js → ts.mjs}
RENAMED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import {rules} from '@putout/eslint-config';
|
|
2
|
+
import parser from '@typescript-eslint/parser';
|
|
3
|
+
import tseslint from 'typescript-eslint';
|
|
4
|
+
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
|
5
|
+
import stylisticTs from '@stylistic/eslint-plugin-ts';
|
|
6
|
+
import {jsx} from './jsx.mjs';
|
|
7
|
+
import plugin from './plugin.js';
|
|
2
8
|
|
|
3
|
-
const {
|
|
4
|
-
const {jsx} = require('./jsx');
|
|
9
|
+
const {assign} = Object;
|
|
5
10
|
|
|
6
11
|
const reEnable = (rule) => ({
|
|
7
12
|
[`@stylistic/ts/${rule}`]: 'error',
|
|
@@ -70,18 +75,35 @@ const extensionRules = {
|
|
|
70
75
|
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
|
71
76
|
};
|
|
72
77
|
|
|
78
|
+
const getTSESLintConfigs = (configs) => {
|
|
79
|
+
const result = {};
|
|
80
|
+
|
|
81
|
+
for (const config of configs) {
|
|
82
|
+
assign(result, config);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return result;
|
|
86
|
+
};
|
|
87
|
+
|
|
73
88
|
const ts = {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
89
|
+
name: 'putout: ts',
|
|
90
|
+
files: ['**/*.ts'],
|
|
91
|
+
languageOptions: {
|
|
92
|
+
parser,
|
|
93
|
+
parserOptions: {
|
|
94
|
+
warnOnUnsupportedTypeScriptVersion,
|
|
95
|
+
ecmaFeatures: {
|
|
96
|
+
jsx: false,
|
|
97
|
+
},
|
|
80
98
|
},
|
|
81
99
|
},
|
|
82
|
-
plugins:
|
|
83
|
-
|
|
100
|
+
plugins: {
|
|
101
|
+
'@typescript-eslint': tsPlugin,
|
|
102
|
+
'@stylistic/ts': stylisticTs,
|
|
103
|
+
'putout': plugin,
|
|
104
|
+
},
|
|
84
105
|
rules: {
|
|
106
|
+
...getTSESLintConfigs(tseslint.configs.recommended).rules,
|
|
85
107
|
...extensionRules,
|
|
86
108
|
'putout/no-unresolved': 'off',
|
|
87
109
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
@@ -91,23 +113,27 @@ const ts = {
|
|
|
91
113
|
},
|
|
92
114
|
};
|
|
93
115
|
|
|
94
|
-
|
|
116
|
+
export default [
|
|
95
117
|
ts, {
|
|
96
118
|
...ts,
|
|
97
119
|
...jsx,
|
|
120
|
+
name: 'putout: tsx',
|
|
121
|
+
files: ['**/*.tsx'],
|
|
98
122
|
rules: {
|
|
99
|
-
...ts.rules,
|
|
100
123
|
...jsx.rules,
|
|
124
|
+
...ts.rules,
|
|
101
125
|
},
|
|
102
|
-
plugins:
|
|
103
|
-
...ts.plugins,
|
|
126
|
+
plugins: {
|
|
104
127
|
...jsx.plugins,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
128
|
+
...ts.plugins,
|
|
129
|
+
},
|
|
130
|
+
languageOptions: {
|
|
131
|
+
parser,
|
|
132
|
+
parserOptions: {
|
|
133
|
+
warnOnUnsupportedTypeScriptVersion,
|
|
134
|
+
ecmaFeatures: {
|
|
135
|
+
jsx: true,
|
|
136
|
+
},
|
|
111
137
|
},
|
|
112
138
|
},
|
|
113
139
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-putout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "ESLint plugin for 🐊Putout",
|
|
6
6
|
"release": false,
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
"url": "git+https://github.com/coderaiser/putout.git"
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
|
-
".": "./lib/index.
|
|
16
|
-
"./config": "./lib/config/index.js"
|
|
15
|
+
".": "./lib/index.mjs"
|
|
17
16
|
},
|
|
18
17
|
"keywords": [
|
|
19
18
|
"putout",
|
|
@@ -42,20 +41,25 @@
|
|
|
42
41
|
"@babel/eslint-parser": "^8.0.0-alpha.1",
|
|
43
42
|
"@eslint/eslintrc": "^3.0.0",
|
|
44
43
|
"@putout/engine-parser": "^12.0.0",
|
|
45
|
-
"@putout/eslint": "^
|
|
46
|
-
"@putout/eslint-config": "^
|
|
47
|
-
"@
|
|
48
|
-
"@stylistic/eslint-plugin-
|
|
44
|
+
"@putout/eslint": "^4.0.0",
|
|
45
|
+
"@putout/eslint-config": "^10.0.0",
|
|
46
|
+
"@putout/eslint-flat": "^2.0.0",
|
|
47
|
+
"@stylistic/eslint-plugin-js": "^4.0.1",
|
|
48
|
+
"@stylistic/eslint-plugin-jsx": "^4.0.1",
|
|
49
|
+
"@stylistic/eslint-plugin-ts": "^4.0.1",
|
|
49
50
|
"@typescript-eslint/eslint-plugin": "^8.3.0",
|
|
50
51
|
"@typescript-eslint/parser": "^8.3.0",
|
|
51
52
|
"align-spaces": "^2.0.0",
|
|
52
53
|
"eslint-plugin-n": "^17.0.0",
|
|
54
|
+
"eslint-plugin-putout": "^24.1.0",
|
|
53
55
|
"eslint-plugin-react": "^7.32.2",
|
|
56
|
+
"globals": "^16.0.0",
|
|
54
57
|
"parse-import-specifiers": "^1.0.1",
|
|
55
58
|
"synckit": "^0.9.0",
|
|
56
59
|
"try-catch": "^3.0.0",
|
|
57
60
|
"try-to-catch": "^3.0.1",
|
|
58
|
-
"typescript": "^5.0.4"
|
|
61
|
+
"typescript": "^5.0.4",
|
|
62
|
+
"typescript-eslint": "^8.24.1"
|
|
59
63
|
},
|
|
60
64
|
"devDependencies": {
|
|
61
65
|
"@babel/plugin-syntax-typescript": "^8.0.0-alpha.1",
|
|
@@ -74,7 +78,7 @@
|
|
|
74
78
|
"node": ">=18"
|
|
75
79
|
},
|
|
76
80
|
"peerDependencies": {
|
|
77
|
-
"eslint": ">=
|
|
81
|
+
"eslint": ">=9",
|
|
78
82
|
"putout": ">=38"
|
|
79
83
|
},
|
|
80
84
|
"license": "MIT",
|
package/lib/config/index.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const nPlugin = require('eslint-plugin-n');
|
|
4
|
-
const {FlatCompat} = require('@eslint/eslintrc');
|
|
5
|
-
const putoutPlugin = require('..');
|
|
6
|
-
|
|
7
|
-
const getPutoutConfig = (name) => compat.config(putoutPlugin.configs[name]);
|
|
8
|
-
|
|
9
|
-
const compat = new FlatCompat({
|
|
10
|
-
languageOptions: {
|
|
11
|
-
baseDirectory: __dirname,
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const n = nPlugin.configs['flat/mixed-esm-and-cjs'];
|
|
16
|
-
|
|
17
|
-
const plugins = [{
|
|
18
|
-
plugins: {
|
|
19
|
-
putout: putoutPlugin,
|
|
20
|
-
},
|
|
21
|
-
}];
|
|
22
|
-
|
|
23
|
-
module.exports.recommended = [
|
|
24
|
-
...n,
|
|
25
|
-
...getPutoutConfig('recommended'),
|
|
26
|
-
...plugins,
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
module.exports.safe = [
|
|
30
|
-
...n,
|
|
31
|
-
...getPutoutConfig('safe'),
|
|
32
|
-
...plugins,
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
module.exports.safeAlign = [
|
|
36
|
-
...n,
|
|
37
|
-
...getPutoutConfig('safe+align'),
|
|
38
|
-
...plugins,
|
|
39
|
-
];
|
package/lib/html.js
DELETED