@alint-js/tools-fs 0.0.22 → 0.0.23

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.
Files changed (2) hide show
  1. package/dist/index.mjs +19 -11
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -99,15 +99,16 @@ function createTools(cwd, options = {}) {
99
99
  ];
100
100
  }
101
101
  function fileSearchParameters(requiresQuery) {
102
+ const properties = {
103
+ directory: nullableStringSchema(),
104
+ ignore: stringOrStringArraySchema(),
105
+ patterns: stringOrStringArraySchema(),
106
+ ...requiresQuery ? { query: { type: "string" } } : {}
107
+ };
102
108
  return {
103
109
  additionalProperties: false,
104
- properties: {
105
- directory: { type: "string" },
106
- ignore: stringOrStringArraySchema(),
107
- patterns: stringOrStringArraySchema(),
108
- ...requiresQuery ? { query: { type: "string" } } : {}
109
- },
110
- required: requiresQuery ? ["query"] : [],
110
+ properties,
111
+ required: Object.keys(properties),
111
112
  type: "object"
112
113
  };
113
114
  }
@@ -134,11 +135,18 @@ function getStringProperty(input, key) {
134
135
  const value = input[key];
135
136
  return typeof value === "string" ? value : void 0;
136
137
  }
138
+ function nullableStringSchema() {
139
+ return { anyOf: [{ type: "string" }, { type: "null" }] };
140
+ }
137
141
  function stringOrStringArraySchema() {
138
- return { anyOf: [{ type: "string" }, {
139
- items: { type: "string" },
140
- type: "array"
141
- }] };
142
+ return { anyOf: [
143
+ { type: "string" },
144
+ {
145
+ items: { type: "string" },
146
+ type: "array"
147
+ },
148
+ { type: "null" }
149
+ ] };
142
150
  }
143
151
  //#endregion
144
152
  export { DEFAULT_IGNORE_PATTERNS, createTools, listFiles, readFile, searchFiles, searchInFiles, toStringArray };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alint-js/tools-fs",
3
3
  "type": "module",
4
- "version": "0.0.22",
4
+ "version": "0.0.23",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.mts",
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "dependencies": {
16
16
  "tinyglobby": "^0.2.17",
17
- "@alint-js/core": "0.0.22"
17
+ "@alint-js/core": "0.0.23"
18
18
  },
19
19
  "scripts": {
20
20
  "build": "tsdown",