putout 22.3.1 → 22.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/ChangeLog CHANGED
@@ -1,3 +1,37 @@
1
+ 2021.12.02, v22.4.0
2
+
3
+ feature:
4
+ - (putout) add env variable PUTOUT_CONFIG_FILE
5
+ - (eslint-plugin-putout) ts: add extension rules
6
+ - (eslint-plugin-putout) ts: enable @typescript-eslint/type-annotation-spacing
7
+ - (eslint-plugin-putout) safe: add remove-useless-arguments
8
+ - (eslint-plugin-putout) tape-remove-newline-before-t-end: add support of case when no assertions found before t.end()
9
+ - (eslint-plugin-putout) ts: disable: ban-types, no-explicit-any, no-empty-function
10
+ - (package) eslint-plugin-putout v12.0.0
11
+ - (eslint-plugin-putout) drop support of putout < 22
12
+ - (eslint-plugin-putout) add first class support of typescript
13
+ - (eslint-plugin-putout) improve support of add-newline-{before,after}-function-call
14
+ - (@putout/plugin-remove-empty-pattern) add support of nested ArrayPattern
15
+
16
+
17
+ 2021.12.01, v22.3.4
18
+
19
+ fix:
20
+ - (putout) validate-options: add support of boolean
21
+
22
+
23
+ 2021.11.30, v22.3.3
24
+
25
+ fix:
26
+ - (putout) validate-options: add support of optional message
27
+
28
+
29
+ 2021.11.30, v22.3.2
30
+
31
+ fix:
32
+ - (putout) validate-options: rm rule names: has no sense for validation as any rule provided by plugin supported
33
+
34
+
1
35
  2021.11.30, v22.3.1
2
36
 
3
37
  feature:
package/README.md CHANGED
@@ -153,6 +153,8 @@ putout lib --plugins remove-debugger,remove-unused-variables
153
153
  🐊`Putout` supports next `environment variables`:
154
154
 
155
155
  - `PUTOUT_FILES` - files that should be processed by putout, divided by ",";
156
+ - `PUTOUT_CONFIG_FILE` - path to 🐊`Putout` config file;
157
+ - `ESLINT_CONFIG_FILE` - path to `ESLint` config file;
156
158
 
157
159
  ```sh
158
160
  PUTOUT_FILES=lib,test putout --fix
@@ -1,19 +1,34 @@
1
1
  'use strict';
2
2
 
3
- const {dirname} = require('path');
3
+ const {
4
+ join,
5
+ dirname,
6
+ } = require('path');
4
7
 
5
8
  const buildPlugins = require('./build-plugins');
6
9
  const parseOptions = require('../parse-options');
7
10
 
11
+ const {assign} = Object;
12
+ const {env} = process;
13
+ const {PUTOUT_CONFIG_FILE} = env;
14
+
15
+ const maybeConfig = {
16
+ plugins: [],
17
+ };
18
+
19
+ PUTOUT_CONFIG_FILE && assign(maybeConfig, require(join(process.cwd(), PUTOUT_CONFIG_FILE)));
20
+
8
21
  module.exports = ({noConfig, plugins, name, transform, rulesdir}) => {
9
22
  const transformPlugins = buildPlugins(transform);
10
23
 
11
24
  if (noConfig)
12
25
  return {
26
+ ...maybeConfig,
13
27
  dir: dirname(name),
14
28
  plugins: [
15
29
  ...plugins,
16
30
  ...transformPlugins,
31
+ ...maybeConfig.plugins,
17
32
  ],
18
33
  };
19
34
 
@@ -24,9 +39,11 @@ module.exports = ({noConfig, plugins, name, transform, rulesdir}) => {
24
39
 
25
40
  return {
26
41
  ...result,
42
+ ...maybeConfig,
27
43
  plugins: [
28
44
  ...result.plugins,
29
45
  ...transformPlugins,
46
+ ...maybeConfig.plugins,
30
47
  ],
31
48
  };
32
49
  };
@@ -5,152 +5,54 @@
5
5
  "definitions": {
6
6
  "rule": {
7
7
  "oneOf": [{
8
- "description": "🐊Putout rule\n\n\"off\" means rule is off\n\"on\" means it is a on\n",
9
- "enum": [ "on", "off"]
8
+ "$ref": "#/definitions/ruleToggle"
10
9
  }, {
11
10
  "type": "array",
12
11
  "items": [{
13
- "enum": [ "on", "off"]
12
+ "$ref": "#/definitions/ruleToggle"
14
13
  }, {
15
14
  "type": "object"
16
15
  }],
17
16
  "minItems": 2,
18
17
  "additionalItems": false
18
+ }, {
19
+ "type": "array",
20
+ "items": [{
21
+ "$ref": "#/definitions/ruleToggle"
22
+ }, {
23
+ "type": "string"
24
+ }, {
25
+ "type": "object"
26
+ }],
27
+ "minItems": 3,
28
+ "additionalItems": false
29
+ }, {
30
+ "type": "array",
31
+ "items": [{
32
+ "$ref": "#/definitions/ruleToggle"
33
+ }, {
34
+ "type": "string"
35
+ }],
36
+ "minItems": 2,
37
+ "additionalItems": false
19
38
  }]
20
39
  },
21
40
  "rules": {
22
41
  "description": "🐊Putout comes with a large number of rules. You can modify which rules your project uses.",
23
42
  "type": "object",
24
- "properties": {
25
- "add-return-await": {"$ref": "#/definitions/rule"},
26
- "apply-array-at": {"$ref": "#/definitions/rule"},
27
- "apply-as-type-assertions": {"$ref": "#/definitions/rule"},
28
- "apply-destructuring": {"$ref": "#/definitions/rule"},
29
- "apply-early-return": {"$ref": "#/definitions/rule"},
30
- "apply-if-condition": {"$ref": "#/definitions/rule"},
31
- "apply-is-array": {"$ref": "#/definitions/rule"},
32
- "apply-montag": {"$ref": "#/definitions/rule"},
33
- "apply-nullish-coalescing": {"$ref": "#/definitions/rule"},
34
- "apply-numeric-separators": {"$ref": "#/definitions/rule"},
35
- "apply-optional-chaining": {"$ref": "#/definitions/rule"},
36
- "apply-shorthand-properties": {"$ref": "#/definitions/rule"},
37
- "apply-top-level-await": {"$ref": "#/definitions/rule"},
38
- "apply-try-catch": {"$ref": "#/definitions/rule"},
39
- "apply-utility-types": {"$ref": "#/definitions/rule"},
40
- "browserlist": {"$ref": "#/definitions/rule"},
41
- "cloudcmd": {"$ref": "#/definitions/rule"},
42
- "convert-any-to-primitive": {"$ref": "#/definitions/rule"},
43
- "convert-apply-to-spread": {"$ref": "#/definitions/rule"},
44
- "convert-arguments-to-rest": {"$ref": "#/definitions/rule"},
45
- "convert-array-copy-to-slice": {"$ref": "#/definitions/rule"},
46
- "convert-assignment-to-arrow-function": {"$ref": "#/definitions/rule"},
47
- "convert-assignment-to-comparison": {"$ref": "#/definitions/rule"},
48
- "convert-bitwise-to-logical": {"$ref": "#/definitions/rule"},
49
- "convert-commonjs-to-esm": {"$ref": "#/definitions/rule"},
50
- "convert-comparison-to-boolean": {"$ref": "#/definitions/rule"},
51
- "convert-concat-to-flat": {"$ref": "#/definitions/rule"},
52
- "convert-equal-to-strict-equal": {"$ref": "#/definitions/rule"},
53
- "convert-esm-to-commonjs": {"$ref": "#/definitions/rule"},
54
- "convert-for-each-to-for-of": {"$ref": "#/definitions/rule"},
55
- "convert-for-in-to-for-of": {"$ref": "#/definitions/rule"},
56
- "convert-for-to-for-of": {"$ref": "#/definitions/rule"},
57
- "convert-generic-to-shorthand": {"$ref": "#/definitions/rule"},
58
- "convert-index-of-to-includes": {"$ref": "#/definitions/rule"},
59
- "convert-is-nan-to-number-is-nan": {"$ref": "#/definitions/rule"},
60
- "convert-map-to-for-of": {"$ref": "#/definitions/rule"},
61
- "convert-math-pow": {"$ref": "#/definitions/rule"},
62
- "convert-mock-require-to-mock-import": {"$ref": "#/definitions/rule"},
63
- "convert-object-assign-to-merge-spread": {"$ref": "#/definitions/rule"},
64
- "convert-quotes-to-backticks": {"$ref": "#/definitions/rule"},
65
- "convert-spread-to-array-from": {"$ref": "#/definitions/rule"},
66
- "convert-template-to-string": {"$ref": "#/definitions/rule"},
67
- "convert-throw": {"$ref": "#/definitions/rule"},
68
- "convert-to-arrow-function": {"$ref": "#/definitions/rule"},
69
- "convert-top-level-return": {"$ref": "#/definitions/rule"},
70
- "convert-typeof-to-is-type": {"$ref": "#/definitions/rule"},
71
- "convert-while-to-for-of": {"$ref": "#/definitions/rule"},
72
- "declare-undefined-variables": {"$ref": "#/definitions/rule"},
73
- "eslint": {"$ref": "#/definitions/rule"},
74
- "extract-object-properties": {"$ref": "#/definitions/rule"},
75
- "extract-sequence-expressions": {"$ref": "#/definitions/rule"},
76
- "github": {"$ref": "#/definitions/rule"},
77
- "gitignore": {"$ref": "#/definitions/rule"},
78
- "jest": {"$ref": "#/definitions/rule"},
79
- "madrun": {"$ref": "#/definitions/rule"},
80
- "merge-destructuring-properties": {"$ref": "#/definitions/rule"},
81
- "merge-duplicate-imports": {"$ref": "#/definitions/rule"},
82
- "merge-if-statements": {"$ref": "#/definitions/rule"},
83
- "nodejs": {"$ref": "#/definitions/rule"},
84
- "npmignore": {"$ref": "#/definitions/rule"},
85
- "package-json": {"$ref": "#/definitions/rule"},
86
- "postcss": {"$ref": "#/definitions/rule"},
87
- "promises": {"$ref": "#/definitions/rule"},
88
- "putout": {"$ref": "#/definitions/rule"},
89
- "putout-config": {"$ref": "#/definitions/rule"},
90
- "react-hooks": {"$ref": "#/definitions/rule"},
91
- "regexp": {"$ref": "#/definitions/rule"},
92
- "remove-boolean-from-assertions": {"$ref": "#/definitions/rule"},
93
- "remove-boolean-from-logical-expressions": {"$ref": "#/definitions/rule"},
94
- "remove-console": {"$ref": "#/definitions/rule"},
95
- "remove-constant-conditions": {"$ref": "#/definitions/rule"},
96
- "remove-debugger": {"$ref": "#/definitions/rule"},
97
- "remove-double-negations": {"$ref": "#/definitions/rule"},
98
- "remove-duplicate-case": {"$ref": "#/definitions/rule"},
99
- "remove-duplicate-interface-keys": {"$ref": "#/definitions/rule"},
100
- "remove-duplicate-keys": {"$ref": "#/definitions/rule"},
101
- "remove-duplicates-from-logical-expressions": {"$ref": "#/definitions/rule"},
102
- "remove-duplicates-from-union": {"$ref": "#/definitions/rule"},
103
- "remove-empty": {"$ref": "#/definitions/rule"},
104
- "remove-empty-pattern": {"$ref": "#/definitions/rule"},
105
- "remove-iife": {"$ref": "#/definitions/rule"},
106
- "remove-nested-blocks": {"$ref": "#/definitions/rule"},
107
- "remove-only": {"$ref": "#/definitions/rule"},
108
- "remove-process-exit": {"$ref": "#/definitions/rule"},
109
- "remove-skip": {"$ref": "#/definitions/rule"},
110
- "remove-undeclared-properties": {"$ref": "#/definitions/rule"},
111
- "remove-unreachable-code": {"$ref": "#/definitions/rule"},
112
- "remove-unreferenced-variables": {"$ref": "#/definitions/rule"},
113
- "remove-unused-expressions": {"$ref": "#/definitions/rule"},
114
- "remove-unused-for-of-variables": {"$ref": "#/definitions/rule"},
115
- "remove-unused-private-fields": {"$ref": "#/definitions/rule"},
116
- "remove-unused-types": {"$ref": "#/definitions/rule"},
117
- "remove-unused-variables": {"$ref": "#/definitions/rule"},
118
- "remove-useless-arguments": {"$ref": "#/definitions/rule"},
119
- "remove-useless-array-constructor": {"$ref": "#/definitions/rule"},
120
- "remove-useless-array-from": {"$ref": "#/definitions/rule"},
121
- "remove-useless-async": {"$ref": "#/definitions/rule"},
122
- "remove-useless-await": {"$ref": "#/definitions/rule"},
123
- "remove-useless-conditions": {"$ref": "#/definitions/rule"},
124
- "remove-useless-constructor": {"$ref": "#/definitions/rule"},
125
- "remove-useless-continue": {"$ref": "#/definitions/rule"},
126
- "remove-useless-escape": {"$ref": "#/definitions/rule"},
127
- "remove-useless-for-of": {"$ref": "#/definitions/rule"},
128
- "remove-useless-functions": {"$ref": "#/definitions/rule"},
129
- "remove-useless-map": {"$ref": "#/definitions/rule"},
130
- "remove-useless-mapped-types": {"$ref": "#/definitions/rule"},
131
- "remove-useless-mapping-modifiers": {"$ref": "#/definitions/rule"},
132
- "remove-useless-new": {"$ref": "#/definitions/rule"},
133
- "remove-useless-operand": {"$ref": "#/definitions/rule"},
134
- "remove-useless-return": {"$ref": "#/definitions/rule"},
135
- "remove-useless-spread": {"$ref": "#/definitions/rule"},
136
- "remove-useless-template-expressions": {"$ref": "#/definitions/rule"},
137
- "remove-useless-templates": {"$ref": "#/definitions/rule"},
138
- "remove-useless-type-conversion": {"$ref": "#/definitions/rule"},
139
- "remove-useless-typeof": {"$ref": "#/definitions/rule"},
140
- "remove-useless-types": {"$ref": "#/definitions/rule"},
141
- "remove-useless-types-from-constants": {"$ref": "#/definitions/rule"},
142
- "remove-useless-variables": {"$ref": "#/definitions/rule"},
143
- "reuse-duplicate-init": {"$ref": "#/definitions/rule"},
144
- "simplify-assignment": {"$ref": "#/definitions/rule"},
145
- "simplify-logical-expressions": {"$ref": "#/definitions/rule"},
146
- "simplify-ternary": {"$ref": "#/definitions/rule"},
147
- "split-nested-destructuring": {"$ref": "#/definitions/rule"},
148
- "split-variable-declarations": {"$ref": "#/definitions/rule"},
149
- "strict-mode": {"$ref": "#/definitions/rule"},
150
- "tape": {"$ref": "#/definitions/rule"},
151
- "travis": {"$ref": "#/definitions/rule"},
152
- "webpack": {"$ref": "#/definitions/rule"}
43
+ "patternProperties": {
44
+ "^.*$": {
45
+ "$ref": "#/definitions/rule"
46
+ }
153
47
  }
48
+ },
49
+ "ruleToggle": {
50
+ "oneOf": [{
51
+ "description": "🐊Putout rule\n\n\"off\" means rule is off\n\"on\" means it is a on\n",
52
+ "enum": [ "on", "off"]
53
+ }, {
54
+ "enum": [true, false]
55
+ }]
154
56
  }
155
57
  },
156
58
  "properties": {
@@ -184,8 +86,7 @@
184
86
  "patternProperties": {
185
87
  "^.*$": {
186
88
  "$ref": "#/definitions/rules"
187
- },
188
- "additionalProperties": false
89
+ }
189
90
  }
190
91
  },
191
92
  "plugins": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "22.3.1",
3
+ "version": "22.4.0",
4
4
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5
5
  "description": "🐊 Pluggable and configurable code transformer with built-in eslint, babel plugins and jscodeshift codemods support of js, jsx typescript, flow files, markdown, yaml and json",
6
6
  "homepage": "http://github.com/coderaiser/putout",
@@ -220,7 +220,7 @@
220
220
  "currify": "^4.0.0",
221
221
  "eslint": "^8.0.1",
222
222
  "eslint-plugin-node": "^11.0.0",
223
- "eslint-plugin-putout": "^11.0.0",
223
+ "eslint-plugin-putout": "^12.0.0",
224
224
  "just-camel-case": "^4.0.2",
225
225
  "lerna": "^4.0.0",
226
226
  "madrun": "^8.6.0",