eslint-plugin-putout 21.0.2 β†’ 21.1.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.
package/README.md CHANGED
@@ -142,7 +142,8 @@ Disabled 🐊**Putout** rules:
142
142
  - ❌ [`remove-useless-arguments`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-useless-arguments#readme);
143
143
  - ❌ [`remove-useless-return`](https://github.com/coderaiser/putout/tree/v29.0.0/packages/plugin-remove-useless-return#readme);
144
144
  - ❌ [`remove-useless-spread`](https://github.com/coderaiser/putout/tree/v29.0.0/packages/plugin-remove-useless-spread/#readme);
145
- - ❌ [`remove-useless-variables/rename`](https://github.com/coderaiser/putout/tree/v29.0.0/packages/plugin-remove-useless-variables#rename);
145
+ - ❌ [`remove-useless-variables/rename`](https://github.com/coderaiser/putout/tree/v33.13.4/packages/plugin-remove-useless-variables#rename);
146
+ - ❌ [`remove-useless-variables/declaration`](https://github.com/coderaiser/putout/tree/v33.13.4/packages/plugin-remove-useless-variables#declaration);
146
147
  - ❌ [`remove-skip`](https://github.com/coderaiser/putout/tree/v29.0.0/packages/plugin-tape#remove-skip);
147
148
  - ❌ [`remove-only`](https://github.com/coderaiser/putout/tree/v29.0.0/packages/plugin-tape#remove-only);
148
149
  - ❌ [`remove-console`](https://github.com/coderaiser/putout/tree/v29.0.0/packages/plugin-remove-console#readme);
@@ -31,10 +31,11 @@ function evaluate({value, filename}) {
31
31
  fix: true,
32
32
  rules: {
33
33
  'nodejs/convert-top-level-return': 'off',
34
+ 'nodejs/convert-commonjs-to-esm': 'off',
35
+ 'nodejs/convert-esm-to-commonjs': 'on',
34
36
  },
35
37
  plugins: [
36
38
  'nodejs',
37
- 'convert-esm-to-commonjs',
38
39
  'declare',
39
40
  ],
40
41
  });
package/lib/index.js CHANGED
@@ -118,6 +118,8 @@ const safeRules = {
118
118
  'remove-unused-expressions': 'off',
119
119
  'remove-unreachable-code': 'off',
120
120
  'remove-useless-arguments': 'off',
121
+ 'remove-useless-variables': 'off',
122
+ 'remove-useless-variables/declaration': 'off',
121
123
  'remove-useless-variables/rename': 'off',
122
124
  'remove-useless-return': 'off',
123
125
  'remove-useless-spread': 'off',
@@ -132,6 +134,8 @@ const safeRules = {
132
134
  'maybe/noop': 'off',
133
135
  };
134
136
 
137
+ module.exports.safeRules = safeRules;
138
+
135
139
  const safe = {
136
140
  ...recommended,
137
141
  rules: {
@@ -4,9 +4,8 @@ module.exports.parseError = ({code, message, name}) => {
4
4
  if (message.includes('buildError'))
5
5
  return 'Parser error';
6
6
 
7
- if (code === 'ERR_REQUIRE_ESM') {
7
+ if (code === 'ERR_REQUIRE_ESM')
8
8
  return `☝️ Looks like '${name}' is ESM, extend from 'plugin:putout/esm'`;
9
- }
10
9
 
11
10
  return message;
12
11
  };
@@ -81,7 +81,9 @@ const fix = ({ast, text, node, source, resultOptions}) => (fixer) => {
81
81
  includeComments,
82
82
  });
83
83
 
84
- transform(ast, text, resultOptions);
84
+ transform(ast, text, {
85
+ ...resultOptions,
86
+ });
85
87
 
86
88
  const [, last] = lastToken.range;
87
89
  const code = print(ast);
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const {isBuiltIn} = require('./is-built-in');
3
+ const {isBuiltin} = require('node:module');
4
4
  const isLocal = (a) => /^\./.test(a.source.value);
5
- const isNode = (a) => isBuiltIn(a.source.value);
5
+ const isNode = (a) => isBuiltin(a.source.value);
6
6
 
7
7
  const isSameGroup = (a, b) => {
8
8
  if (isLocal(a) && isLocal(b))
@@ -48,9 +48,8 @@ module.exports.filter = ({node, text, getText, getCommentsInside}) => {
48
48
  };
49
49
 
50
50
  module.exports.fix = ({text, node, getText}) => {
51
- if (isImportDeclaration(node)) {
51
+ if (isImportDeclaration(node))
52
52
  return text.replace(NewLinesReg, '');
53
- }
54
53
 
55
54
  const {id} = node;
56
55
  const idText = getText(id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-putout",
3
- "version": "21.0.2",
3
+ "version": "21.1.0",
4
4
  "type": "commonjs",
5
5
  "description": "ESLint plugin for 🐊Putout",
6
6
  "release": false,
@@ -1,46 +0,0 @@
1
- 'use strict';
2
-
3
- const builtInsList = [
4
- 'assert',
5
- 'async_hooks',
6
- 'buffer',
7
- 'child_process',
8
- 'cluster',
9
- 'console',
10
- 'crypto',
11
- 'dgram',
12
- 'diagnostics_channel',
13
- 'dns',
14
- 'domain',
15
- 'fs',
16
- 'fs/promises',
17
- 'http',
18
- 'http2',
19
- 'https',
20
- 'inspector',
21
- 'module',
22
- 'os',
23
- 'path',
24
- 'perf_hooks',
25
- 'process',
26
- 'punycode',
27
- 'querystring',
28
- 'readline',
29
- 'repl',
30
- 'stream',
31
- 'string_decoder',
32
- 'timers',
33
- 'tls',
34
- 'trace_events',
35
- 'tty',
36
- 'url',
37
- 'util',
38
- 'vm',
39
- 'web_crypto_api',
40
- 'web_streams_api',
41
- 'wasi',
42
- 'worker_threads',
43
- 'zlib',
44
- ];
45
-
46
- module.exports.isBuiltIn = (name) => builtInsList.includes(name);