putout 22.3.0 → 22.3.4

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,29 @@
1
+ 2021.12.01, v22.3.4
2
+
3
+ fix:
4
+ - (putout) validate-options: add support of boolean
5
+
6
+
7
+ 2021.11.30, v22.3.3
8
+
9
+ fix:
10
+ - (putout) validate-options: add support of optional message
11
+
12
+
13
+ 2021.11.30, v22.3.2
14
+
15
+ fix:
16
+ - (putout) validate-options: rm rule names: has no sense for validation as any rule provided by plugin supported
17
+
18
+
19
+ 2021.11.30, v22.3.1
20
+
21
+ feature:
22
+ - validate-options: improve support of rules, match
23
+ - (putout) validate-options: improve validations: ignore, processors
24
+ - (putout) validate-options: add descriptions
25
+
26
+
1
27
  2021.11.30, v22.3.0
2
28
 
3
29
  feature:
@@ -16,9 +16,18 @@ module.exports.validateOptions = (options) => {
16
16
  const [error] = validate.errors || [];
17
17
 
18
18
  if (error)
19
- throw Error(`.putout.json: ${parsePath(error)}${parseAdditional(error)}${parseMessage(error)}`);
19
+ throw Error(`.putout.json: ${parsePath(error)}${parseAdditional(error)}${parseMessage(error)}${parseAllowed(error)}`);
20
20
  };
21
21
 
22
+ function parseAllowed(error) {
23
+ const {allowedValues} = error.params;
24
+
25
+ if (!allowedValues)
26
+ return '';
27
+
28
+ return ` (${allowedValues.join('/')})`;
29
+ }
30
+
22
31
  function parseMessage(error) {
23
32
  return error.message.replace(',', ' or ');
24
33
  }
@@ -2,32 +2,98 @@
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "type": "object",
4
4
  "additionalProperties": false,
5
+ "definitions": {
6
+ "rule": {
7
+ "oneOf": [{
8
+ "$ref": "#/definitions/ruleToggle"
9
+ }, {
10
+ "type": "array",
11
+ "items": [{
12
+ "$ref": "#/definitions/ruleToggle"
13
+ }, {
14
+ "type": "object"
15
+ }],
16
+ "minItems": 2,
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
38
+ }]
39
+ },
40
+ "rules": {
41
+ "description": "🐊Putout comes with a large number of rules. You can modify which rules your project uses.",
42
+ "type": "object",
43
+ "patternProperties": {
44
+ "^.*$": {
45
+ "$ref": "#/definitions/rule"
46
+ }
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
+ }]
56
+ }
57
+ },
5
58
  "properties": {
6
59
  "parser": {
60
+ "description": "Tell 🐊Putout which parser to use",
7
61
  "type": "string"
8
62
  },
9
63
  "formatter": {
64
+ "description": "Choose the way to show information about errors found",
10
65
  "type": ["string", "array"]
11
66
  },
12
67
  "processors": {
68
+ "description": "Tell 🐊Putout which processors to use to support file types other then JavaScript",
13
69
  "type": "array",
14
- "uniqueItems": true
70
+ "uniqueItems": true,
71
+ "items": {
72
+ "type": "string"
73
+ }
15
74
  },
16
75
  "ignore": {
76
+ "description": "Tell 🐊Putout to ignore specific files and directories.",
17
77
  "type": "array",
18
- "uniqueItems": true
78
+ "uniqueItems": true,
79
+ "items": {
80
+ "type": "string"
81
+ }
19
82
  },
20
83
  "match": {
21
- "type": "object"
84
+ "description": "Allows to match rules for files and folders, specified by glob patterns.",
85
+ "type": "object",
86
+ "patternProperties": {
87
+ "^.*$": {
88
+ "$ref": "#/definitions/rules"
89
+ }
90
+ }
22
91
  },
23
92
  "plugins": {
24
- "description": "List of plugins to load",
93
+ "description": "Tell 🐊Putout which plugins to load",
25
94
  "type": "array",
26
95
  "uniqueItems": true
27
96
  },
28
- "rules": {
29
- "description": "Names list of rules",
30
- "type": "object"
31
- }
97
+ "rules": {"$ref": "#/definitions/rules"}
32
98
  }
33
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "22.3.0",
3
+ "version": "22.3.4",
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",