eslint-plugin-putout 23.2.0 β†’ 23.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.
package/README.md CHANGED
@@ -134,6 +134,7 @@ Disabled 🐊**Putout** rules:
134
134
 
135
135
  - ❌ [`apply-template-literals`](https://github.com/coderaiser/putout/tree/v29.0.0/packages/plugin-remove-empty#readme);
136
136
  - ❌ [`remove-empty`](https://github.com/coderaiser/putout/tree/v29.0.0/packages/plugin-remove-empty#readme);
137
+ - ❌ [`merge-duplicate-functions`](https://github.com/coderaiser/putout/tree/v37.12.0/packages/plugin-merge-duplicate-functions#readme);
137
138
  - ❌ [`nodejs/remove-process-exit`](https://github.com/coderaiser/putout/tree/v29.0.0/packages/plugin-nodejs#remove-process-exit#readme);
138
139
  - ❌ [`remove-unused-variables`](https://github.com/coderaiser/putout/tree/v29.0.0/packages/plugin-remove-unused-variables#readme);
139
140
  - ❌ [`typescript/remove-unused-types`](https://github.com/coderaiser/putout/tree/v24.0.2/packages/plugin-typescript#remove-unused-types#readme);
@@ -21,9 +21,7 @@ module.exports.filter = ({text, node}) => {
21
21
  return regExp.test(text);
22
22
  };
23
23
 
24
- module.exports.fix = ({text}) => {
25
- return text.replace(/\s\|/g, '\n |');
26
- };
24
+ module.exports.fix = ({text}) => '\n | ' + text.replace(/\s\|/g, '\n |');
27
25
 
28
26
  module.exports.include = () => [
29
27
  'TSUnionType',
package/lib/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const {createPlugin} = require('@putout/eslint/create-plugin');
4
+
5
+ const config = require('@putout/eslint-config');
4
6
  const markdown = require('./markdown');
5
7
  const json = require('./json');
6
8
  const yaml = require('./yaml');
@@ -52,7 +54,6 @@ module.exports.rules = {
52
54
  ...getRule('remove-empty-newline-between-declarations'),
53
55
  };
54
56
 
55
- const config = require('@putout/eslint-config');
56
57
  const {rules} = config;
57
58
 
58
59
  const recommended = {
@@ -112,6 +113,7 @@ const recommended = {
112
113
  const safeRules = {
113
114
  'apply-template-literals': 'off',
114
115
  'remove-empty': 'off',
116
+ 'merge-duplicate-functions': 'off',
115
117
  'nodejs/remove-process-exit': 'off',
116
118
  'typescript/remove-unused-types': 'off',
117
119
  'remove-unused-variables': 'off',
@@ -84,16 +84,12 @@ function checkCatch(text) {
84
84
  return before || after || afterOptional;
85
85
  }
86
86
 
87
- function checkSwitch(text) {
88
- return text.includes('switch (');
89
- }
87
+ const checkSwitch = (text) => text.includes('switch (');
90
88
 
91
- function fixCatch(text) {
92
- return text
93
- .replaceAll('catch{', 'catch {')
94
- .replaceAll('}catch', '} catch')
95
- .replaceAll('catch (', 'catch(');
96
- }
89
+ const fixCatch = (text) => text
90
+ .replaceAll('catch{', 'catch {')
91
+ .replaceAll('}catch', '} catch')
92
+ .replaceAll('catch (', 'catch(');
97
93
 
98
94
  function fixSwitch(text) {
99
95
  return text.replaceAll('switch (', 'switch(');
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  const process = require('node:process');
4
- const tryCatch = require('try-catch');
5
4
 
6
5
  const {accessSync} = require('node:fs');
7
6
 
@@ -11,6 +10,8 @@ const {
11
10
  join,
12
11
  } = require('node:path');
13
12
 
13
+ const tryCatch = require('try-catch');
14
+
14
15
  const cwd = process.cwd();
15
16
 
16
17
  const RELATIVE = '\\.\\.?\\/?';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-putout",
3
- "version": "23.2.0",
3
+ "version": "23.4.0",
4
4
  "type": "commonjs",
5
5
  "description": "ESLint plugin for 🐊Putout",
6
6
  "release": false,
@@ -65,7 +65,7 @@
65
65
  "eslint": "^9.0.0",
66
66
  "eslint-plugin-eslint-plugin": "^6.1.0",
67
67
  "madrun": "^10.0.0",
68
- "mocha": "^10.0.0",
68
+ "mocha": "^11.0.1",
69
69
  "montag": "^1.0.0",
70
70
  "simport": "^1.2.0",
71
71
  "supertape": "^10.0.0"