@amritk/lint 0.3.3 → 0.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/AI.md +55 -0
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -1
- package/dist/fix/apply.d.ts +1 -1
- package/dist/fix/types.d.ts +1 -1
- package/dist/functions/alphabetical.d.ts +1 -1
- package/dist/functions/casing.d.ts +1 -1
- package/dist/functions/defined.d.ts +1 -1
- package/dist/functions/enumeration.d.ts +1 -1
- package/dist/functions/falsy.d.ts +1 -1
- package/dist/functions/index.d.ts +1 -1
- package/dist/functions/length.d.ts +1 -1
- package/dist/functions/or.d.ts +1 -1
- package/dist/functions/pattern.d.ts +1 -1
- package/dist/functions/schema.d.ts +1 -1
- package/dist/functions/truthy.d.ts +1 -1
- package/dist/functions/typed-enum.d.ts +1 -1
- package/dist/functions/undefined.d.ts +1 -1
- package/dist/functions/unreferenced-reusable-object.d.ts +1 -1
- package/dist/functions/xor.d.ts +1 -1
- package/dist/index.d.ts +17 -4
- package/dist/index.js +39 -4
- package/dist/parsers/index.d.ts +1 -1
- package/dist/parsers/index.js +2 -1
- package/dist/rules/openapi/functions/example-validation.d.ts +1 -1
- package/dist/rules/openapi/functions/index.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-additional-operations.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-discriminator.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-example-external-value.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-example-value.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-mutually-exclusive.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-no-nullable.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-op-form-data-consume-check.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-op-id-unique.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-op-params.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-op-security-defined.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-op-success-response.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-path-param.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-schema-example-deprecated.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-schema.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-server-name-unique.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-server-variables.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-tag-defined.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-tag-kind.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-tag-parent-defined.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-tags-unique.d.ts +1 -1
- package/dist/rules/openapi/functions/oas-unused-component.d.ts +1 -1
- package/dist/rules/openapi/functions/ref-siblings.d.ts +1 -1
- package/dist/rules/openapi/index.d.ts +2 -1
- package/dist/rules/openapi/oas.d.ts +1 -1
- package/package.json +10 -5
package/AI.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @amritk/lint — notes for AI coding agents
|
|
2
|
+
|
|
3
|
+
A fast, format-agnostic JSON/YAML style-guide linter: JSON Schema validation
|
|
4
|
+
plus custom rules, emitting findings with exact `line:column` ranges. Full
|
|
5
|
+
reference is [README.md](./README.md).
|
|
6
|
+
|
|
7
|
+
> Pre-alpha: APIs change in **minor** versions.
|
|
8
|
+
|
|
9
|
+
## Minimal example
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { lintDocument } from '@amritk/lint'
|
|
13
|
+
|
|
14
|
+
const ruleset = {
|
|
15
|
+
rules: {
|
|
16
|
+
'require-name': { given: '$', severity: 'error', then: { field: 'name', function: 'truthy' } },
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const findings = await lintDocument('version: 1\n', { ruleset, source: 'service.yaml' })
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Gotchas — where agents fail
|
|
24
|
+
|
|
25
|
+
1. **Two `severity` vocabularies.** In a **ruleset** you author strings
|
|
26
|
+
(`'error' | 'warn' | 'info' | 'hint' | 'off'`). In a **finding** `severity`
|
|
27
|
+
is **numeric** (`0` error, `1` warn, `2` info, `3` hint). Don't cross them.
|
|
28
|
+
2. **Ranges are zero-based** (`{ line, character }` from 0). Add 1 to both to
|
|
29
|
+
print `file:line:col`.
|
|
30
|
+
3. **The engine ships no resolver, no built-in ruleset, no fixers.** `$ref`s are
|
|
31
|
+
only dereferenced if you pass a `resolve` hook (e.g. wrapping
|
|
32
|
+
`@amritk/resolve-refs`); `fixDocument` is a no-op until you supply a
|
|
33
|
+
`FixerRegistry`; `createRuleset()` with no argument runs zero rules.
|
|
34
|
+
4. **`extends` targets are file paths or npm packages only** — there are no
|
|
35
|
+
named built-in rulesets in core. String `extends` resolve relative to
|
|
36
|
+
`rulesetBasePath` (or the ruleset file's own directory).
|
|
37
|
+
5. **OpenAPI support is a separate subpath**, `@amritk/lint/rules/openapi`
|
|
38
|
+
(`createOpenApiRuleset`, `oas`, `oasFixers`, …) — not the package root.
|
|
39
|
+
|
|
40
|
+
## Exports
|
|
41
|
+
|
|
42
|
+
- `lintDocument(input, options?)` → findings only.
|
|
43
|
+
- `lintDocumentWithResult(input, options?)` → `{ diagnostics, output?, pluginData }`.
|
|
44
|
+
- `fixDocument(input, options?)` → `{ output, fixed, applied, remaining }` (needs `fixers`).
|
|
45
|
+
- `createRuleset(def?, basePath?)`, `resolveNamedRuleset(name, basePath?)`,
|
|
46
|
+
`builtinFunctions` (`alphabetical`, `casing`, `truthy`, `pattern`, `schema`, …).
|
|
47
|
+
|
|
48
|
+
## Subpaths
|
|
49
|
+
|
|
50
|
+
| Import | Purpose |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `@amritk/lint` | core engine, `lintDocument`/`fixDocument`, built-in functions |
|
|
53
|
+
| `@amritk/lint/rules/openapi` | ready-made OpenAPI preset (`createOpenApiRuleset`, `oas`) |
|
|
54
|
+
|
|
55
|
+
Install: `bun add @amritk/lint`.
|
package/dist/core/index.d.ts
CHANGED
|
@@ -7,5 +7,4 @@ export { type LintPlugin, type LintPluginContext, type LintPluginResult, type Pl
|
|
|
7
7
|
export { pointerToPath, resolveSourceOrigin, resolveSourceOriginFromMap, resolveSourcePath, } from './pointers.js';
|
|
8
8
|
export { type AliasDefinition, createRuleset, type ExtendModifier, type ExtendResolver, type ResolvedExtend, type Ruleset, type RulesetOptions, } from './ruleset.js';
|
|
9
9
|
export { createLinter, type IRunOptions, type Linter } from './runner.js';
|
|
10
|
-
export * from './types.js';
|
|
11
10
|
export { type IRulesetProblem, validateRuleset } from './validate-ruleset.js';
|
package/dist/core/index.js
CHANGED
|
@@ -7,7 +7,6 @@ import { runPlugins } from "./plugin.js";
|
|
|
7
7
|
import { pointerToPath, resolveSourceOrigin, resolveSourceOriginFromMap, resolveSourcePath } from "./pointers.js";
|
|
8
8
|
import { createRuleset } from "./ruleset.js";
|
|
9
9
|
import { createLinter } from "./runner.js";
|
|
10
|
-
export * from "./types.js";
|
|
11
10
|
import { validateRuleset } from "./validate-ruleset.js";
|
|
12
11
|
export {
|
|
13
12
|
compileQuery,
|
package/dist/fix/apply.d.ts
CHANGED
package/dist/fix/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IDiagnostic, JsonPath } from '../core/
|
|
1
|
+
import type { IDiagnostic, JsonPath } from '../core/types.js';
|
|
2
2
|
import type { EditOp, ParserFormat } from '../parsers/index.js';
|
|
3
3
|
export type { EditOp, ParserFormat };
|
|
4
4
|
/** What a {@link Fixer} is handed for a single finding it might repair. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../core/
|
|
1
|
+
import type { RulesetFunction } from '../core/types.js';
|
|
2
2
|
/** The supported casing styles a value can be checked against. */
|
|
3
3
|
export type CasingType = 'flat' | 'camel' | 'pascal' | 'kebab' | 'cobol' | 'snake' | 'macro';
|
|
4
4
|
/** Options for {@link casing}. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FunctionRegistry } from '../core/
|
|
1
|
+
import type { FunctionRegistry } from '../core/types.js';
|
|
2
2
|
export { alphabetical, type IAlphabeticalOptions } from './alphabetical.js';
|
|
3
3
|
export { type CasingType, casing, type ICasingOptions } from './casing.js';
|
|
4
4
|
export { defined } from './defined.js';
|
package/dist/functions/or.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../core/
|
|
1
|
+
import type { RulesetFunction } from '../core/types.js';
|
|
2
2
|
/** Validates that each `enum` entry matches the schema's declared `type`. */
|
|
3
3
|
export declare const typedEnum: RulesetFunction<Record<string, unknown>, never>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../core/
|
|
1
|
+
import type { RulesetFunction } from '../core/types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Flags a value that is defined. Exported as `undefinedFn` because `undefined`
|
|
4
4
|
* is a reserved identifier; it is registered under the name `undefined`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../core/
|
|
1
|
+
import type { RulesetFunction } from '../core/types.js';
|
|
2
2
|
/** Options for {@link unreferencedReusableObject}. */
|
|
3
3
|
export type IUnreferencedReusableObjectOptions = {
|
|
4
4
|
/** JSON pointer to the map of reusable objects, e.g. "#/components/schemas". */
|
package/dist/functions/xor.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type IDocumentOptions, type LintPlugin, type LintResolver, type ResolvedExtend, type Ruleset } from './core/index.js';
|
|
2
|
+
import type { IDiagnostic, RulesetDefinition } from './core/types.js';
|
|
2
3
|
import { type AppliedFix, type FixerRegistry } from './fix/index.js';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export { type AliasDefinition, type CompiledPath, compileQuery, createDocument, createLinter, type Document, detectFormats, type ExtendModifier, type ExtendResolver, type Format, globToRegExp, type IDocumentOptions, type IQueryMatch, type IRulesetProblem, type IRunOptions, type Linter, type LintOptions, type LintPlugin, type LintPluginContext, type LintPluginResult, type LintResolver, type LintResolverResult, type LintResult, lint, lintWithResult, matchesGlob, type PluginRunResult, pointerToPath, query, queryCompiled, queryMany, type ResolvedExtend, type Ruleset, type RulesetOptions, resolveSourceOrigin, resolveSourceOriginFromMap, resolveSourcePath, runPlugins, validateRuleset, } from './core/index.js';
|
|
5
|
+
export { type AppliedFix, type ApplyFixesOptions, applyFixes, createFixPlugin, type EditOp, FIX_PLUGIN_NAME, type FixContext, type Fixer, type FixerRegistry, type FixPluginData, type FixResult, type ParserFormat, } from './fix/index.js';
|
|
6
|
+
export { alphabetical, builtinFunctions, type CasingType, casing, defined, enumeration, falsy, type IAlphabeticalOptions, type ICasingOptions, type IOrOptions, type ISchemaOptions, type IUnreferencedReusableObjectOptions, type IXorOptions, length, or, pattern, schema, truthy, typedEnum, undefinedFn, unreferencedReusableObject, xor, } from './functions/index.js';
|
|
6
7
|
export { detectFormat, parseWithPointers } from './parsers/index.js';
|
|
7
8
|
/**
|
|
8
9
|
* Resolves an `extends` reference to a ruleset definition. Supports:
|
|
@@ -53,6 +54,18 @@ export type ILintResult = {
|
|
|
53
54
|
* Lints a JSON/YAML `input` end to end: parses with source maps and applies the
|
|
54
55
|
* ruleset. Returns just the findings; use {@link lintDocumentWithResult} for the
|
|
55
56
|
* full result.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const ruleset = {
|
|
61
|
+
* rules: {
|
|
62
|
+
* 'require-name': { given: '$', severity: 'error', then: { field: 'name', function: 'truthy' } },
|
|
63
|
+
* },
|
|
64
|
+
* }
|
|
65
|
+
* const findings = await lintDocument('version: 1\n', { ruleset, source: 'service.yaml' })
|
|
66
|
+
* // findings[].range is ZERO-based; add 1 to line/character to print file:line:col.
|
|
67
|
+
* // findings[].severity is numeric (0 error, 1 warn, 2 info, 3 hint).
|
|
68
|
+
* ```
|
|
56
69
|
*/
|
|
57
70
|
export declare const lintDocument: (input: string, options?: ILintOptions) => Promise<IDiagnostic[]>;
|
|
58
71
|
/**
|
package/dist/index.js
CHANGED
|
@@ -5,9 +5,9 @@ import { createRuleset as createCoreRuleset, lintWithResult } from "./core/index
|
|
|
5
5
|
import { createFixPlugin, FIX_PLUGIN_NAME } from "./fix/index.js";
|
|
6
6
|
import { builtinFunctions } from "./functions/index.js";
|
|
7
7
|
import { parseWithPointers } from "./parsers/index.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import { compileQuery, createDocument, createLinter, detectFormats, globToRegExp, lint, lintWithResult as lintWithResult2, matchesGlob, pointerToPath, query, queryCompiled, queryMany, resolveSourceOrigin, resolveSourceOriginFromMap, resolveSourcePath, runPlugins, validateRuleset } from "./core/index.js";
|
|
9
|
+
import { applyFixes, createFixPlugin as createFixPlugin2, FIX_PLUGIN_NAME as FIX_PLUGIN_NAME2 } from "./fix/index.js";
|
|
10
|
+
import { alphabetical, builtinFunctions as builtinFunctions2, casing, defined, enumeration, falsy, length, or, pattern, schema, truthy, typedEnum, undefinedFn, unreferencedReusableObject, xor } from "./functions/index.js";
|
|
11
11
|
import { detectFormat, parseWithPointers as parseWithPointers2 } from "./parsers/index.js";
|
|
12
12
|
const require2 = createRequire(import.meta.url);
|
|
13
13
|
const loadRulesetFile = (file) => {
|
|
@@ -116,11 +116,46 @@ const fixDocument = async (input, options = {}) => {
|
|
|
116
116
|
return { output: current, fixed: applied.length > 0, remaining, applied };
|
|
117
117
|
};
|
|
118
118
|
export {
|
|
119
|
+
FIX_PLUGIN_NAME2 as FIX_PLUGIN_NAME,
|
|
120
|
+
alphabetical,
|
|
121
|
+
applyFixes,
|
|
122
|
+
builtinFunctions2 as builtinFunctions,
|
|
123
|
+
casing,
|
|
124
|
+
compileQuery,
|
|
125
|
+
createDocument,
|
|
126
|
+
createFixPlugin2 as createFixPlugin,
|
|
127
|
+
createLinter,
|
|
119
128
|
createRuleset,
|
|
129
|
+
defined,
|
|
120
130
|
detectFormat,
|
|
131
|
+
detectFormats,
|
|
132
|
+
enumeration,
|
|
133
|
+
falsy,
|
|
121
134
|
fixDocument,
|
|
135
|
+
globToRegExp,
|
|
136
|
+
length,
|
|
137
|
+
lint,
|
|
122
138
|
lintDocument,
|
|
123
139
|
lintDocumentWithResult,
|
|
140
|
+
lintWithResult2 as lintWithResult,
|
|
141
|
+
matchesGlob,
|
|
142
|
+
or,
|
|
124
143
|
parseWithPointers2 as parseWithPointers,
|
|
125
|
-
|
|
144
|
+
pattern,
|
|
145
|
+
pointerToPath,
|
|
146
|
+
query,
|
|
147
|
+
queryCompiled,
|
|
148
|
+
queryMany,
|
|
149
|
+
resolveNamedRuleset,
|
|
150
|
+
resolveSourceOrigin,
|
|
151
|
+
resolveSourceOriginFromMap,
|
|
152
|
+
resolveSourcePath,
|
|
153
|
+
runPlugins,
|
|
154
|
+
schema,
|
|
155
|
+
truthy,
|
|
156
|
+
typedEnum,
|
|
157
|
+
undefinedFn,
|
|
158
|
+
unreferencedReusableObject,
|
|
159
|
+
validateRuleset,
|
|
160
|
+
xor
|
|
126
161
|
};
|
package/dist/parsers/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { type ApplyEditOpsResult, applyEditOps, applyEditOpsWithChanges, type EditOp } from './edit-model.js';
|
|
2
2
|
export { parseJson } from './json.js';
|
|
3
3
|
export { createLineMap, type LineMap } from './lines.js';
|
|
4
|
-
export
|
|
4
|
+
export { DiagnosticSeverity, type IDiagnostic, type ILocation, type IParseResult, type IParserOptions, type IPosition, type IRange, type JsonPath, } from './types.js';
|
|
5
5
|
export { parseYaml } from './yaml.js';
|
|
6
6
|
import type { IParseResult, IParserOptions } from './types.js';
|
|
7
7
|
/** Which concrete parser a document is routed to. */
|
package/dist/parsers/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { applyEditOps, applyEditOpsWithChanges } from "./edit-model.js";
|
|
2
2
|
import { parseJson } from "./json.js";
|
|
3
3
|
import { createLineMap } from "./lines.js";
|
|
4
|
-
|
|
4
|
+
import { DiagnosticSeverity } from "./types.js";
|
|
5
5
|
import { parseYaml } from "./yaml.js";
|
|
6
6
|
import { parseJson as parseJson2 } from "./json.js";
|
|
7
7
|
import { parseYaml as parseYaml2 } from "./yaml.js";
|
|
@@ -14,6 +14,7 @@ const parseWithPointers = (source, options = {}) => {
|
|
|
14
14
|
return format === "json" ? parseJson2(source) : parseYaml2(source, options);
|
|
15
15
|
};
|
|
16
16
|
export {
|
|
17
|
+
DiagnosticSeverity,
|
|
17
18
|
applyEditOps,
|
|
18
19
|
applyEditOpsWithChanges,
|
|
19
20
|
createLineMap,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../../../core/
|
|
1
|
+
import type { RulesetFunction } from '../../../core/types.js';
|
|
2
2
|
/** Options selecting the OpenAPI major version an example rule runs against. */
|
|
3
3
|
export type IOasExampleOptions = {
|
|
4
4
|
/** 2 for OpenAPI 2.0 (Swagger), 3 for OpenAPI 3.x. Defaults to 3. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FunctionRegistry } from '../../../core/
|
|
1
|
+
import type { FunctionRegistry } from '../../../core/types.js';
|
|
2
2
|
export { type IOasExampleOptions, oasMediaExample, oasSchemaExample } from './example-validation.js';
|
|
3
3
|
export { oasAdditionalOperations } from './oas-additional-operations.js';
|
|
4
4
|
export { oasDiscriminator } from './oas-discriminator.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../../../core/
|
|
1
|
+
import type { RulesetFunction } from '../../../core/types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Flags standard HTTP methods inside an OpenAPI 3.2 `additionalOperations` map.
|
|
4
4
|
* The spec reserves that map for methods without a dedicated fixed field, so a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../../../core/
|
|
1
|
+
import type { RulesetFunction } from '../../../core/types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Enforces that an Example Object carries exactly one inline value source. Across
|
|
4
4
|
* all of OpenAPI 3.x an Example must use either `value` or `externalValue` (not
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../../../core/
|
|
1
|
+
import type { RulesetFunction } from '../../../core/types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Flags objects that carry more than one of a set of mutually exclusive
|
|
4
4
|
* properties. OpenAPI 3.1's License Object, for example, defines `identifier`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../../../core/
|
|
1
|
+
import type { RulesetFunction } from '../../../core/types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Flags a Schema Object's `nullable` keyword, removed in OpenAPI 3.1+ (JSON
|
|
4
4
|
* Schema 2020-12 uses a `"null"` type instead). Targets the *parent* of a
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../../../core/
|
|
1
|
+
import type { RulesetFunction } from '../../../core/types.js';
|
|
2
2
|
/** Validates OpenAPI v2 formData operations declare a compatible `consumes`. */
|
|
3
3
|
export declare const oasOpFormDataConsumeCheck: RulesetFunction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../../../core/
|
|
1
|
+
import type { RulesetFunction } from '../../../core/types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Validates an operation's `parameters` array, mirroring Spectral's `oasOpParams`:
|
|
4
4
|
* flags duplicate `name`+`in` combinations, and — for OpenAPI 2.0, where the body
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../../../core/
|
|
1
|
+
import type { RulesetFunction } from '../../../core/types.js';
|
|
2
2
|
/** Validates that every referenced security scheme is defined. */
|
|
3
3
|
export declare const oasOpSecurityDefined: RulesetFunction<Record<string, unknown>, {
|
|
4
4
|
schemesPath: string[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../../../core/
|
|
1
|
+
import type { RulesetFunction } from '../../../core/types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Validates path templating per operation, mirroring Spectral's `oasPathParam`.
|
|
4
4
|
* For each operation on a path it checks that (a) every `{template}` in the path
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../../../core/
|
|
1
|
+
import type { RulesetFunction } from '../../../core/types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Flags a Schema Object's singular `example`, deprecated in OpenAPI 3.1 (JSON
|
|
4
4
|
* Schema 2020-12) in favor of the `examples` array. Targets the parent of an
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../../../core/
|
|
1
|
+
import type { RulesetFunction } from '../../../core/types.js';
|
|
2
2
|
import { type OasVersion } from '../schemas/index.js';
|
|
3
3
|
/** Options for {@link oasSchema}: which OpenAPI version's meta-schema to validate against. */
|
|
4
4
|
export type IOasSchemaOptions = {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../../../core/
|
|
1
|
+
import type { RulesetFunction } from '../../../core/types.js';
|
|
2
2
|
/** Flags duplicate OpenAPI 3.2 Server Object `name` values across the servers array. */
|
|
3
3
|
export declare const oasServerNameUnique: RulesetFunction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../../../core/
|
|
1
|
+
import type { RulesetFunction } from '../../../core/types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Validates a Server Object's `variables`, mirroring Spectral's `serverVariables`:
|
|
4
4
|
* every `{template}` in the URL must have a matching variable and vice versa, and
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../../../core/
|
|
1
|
+
import type { RulesetFunction } from '../../../core/types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Validates the OpenAPI 3.2 Tag Object `parent` hierarchy: every `parent` must
|
|
4
4
|
* name a tag that exists in the top-level `tags` list, a tag must not be its own
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesetFunction } from '../../../core/
|
|
1
|
+
import type { RulesetFunction } from '../../../core/types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Flags reusable `components/*` entries that nothing `$ref`s. Spectral's
|
|
4
4
|
* `oas3-unused-component` checks every reusable component type (not just
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ResolvedExtend, type Ruleset } from '../../core/index.js';
|
|
2
|
+
import type { FunctionRegistry, RulesetDefinition } from '../../core/types.js';
|
|
2
3
|
export { oasFixers } from './fixers.js';
|
|
3
4
|
export { oas2, oas3, oas3_0, oas3_1, oas3_2, oasFormats } from './formats.js';
|
|
4
5
|
export { oasFunctions } from './functions/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amritk/lint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "A fast, format-agnostic JSON/YAML style-guide linter with JSON Schema and custom rules.",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"url": "https://github.com/amritk/mjst/issues"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
|
-
"dist"
|
|
30
|
+
"dist",
|
|
31
|
+
"AI.md"
|
|
31
32
|
],
|
|
32
33
|
"publishConfig": {
|
|
33
34
|
"access": "public"
|
|
@@ -45,18 +46,22 @@
|
|
|
45
46
|
"types": "./dist/index.d.ts",
|
|
46
47
|
"default": "./dist/index.js"
|
|
47
48
|
},
|
|
49
|
+
"./types": {
|
|
50
|
+
"types": "./dist/core/types.d.ts",
|
|
51
|
+
"default": "./dist/core/types.js"
|
|
52
|
+
},
|
|
48
53
|
"./rules/openapi": {
|
|
49
54
|
"types": "./dist/rules/openapi/index.d.ts",
|
|
50
55
|
"default": "./dist/rules/openapi/index.js"
|
|
51
56
|
}
|
|
52
57
|
},
|
|
53
58
|
"dependencies": {
|
|
54
|
-
"@amritk/runtime-validators": "0.
|
|
55
|
-
"@amritk/yaml": "0.3.
|
|
59
|
+
"@amritk/runtime-validators": "0.8.0",
|
|
60
|
+
"@amritk/yaml": "0.3.4",
|
|
56
61
|
"jsonc-parser": "^3.3.1"
|
|
57
62
|
},
|
|
58
63
|
"devDependencies": {
|
|
59
|
-
"@amritk/resolve-refs": "0.4.
|
|
64
|
+
"@amritk/resolve-refs": "0.4.4",
|
|
60
65
|
"@stoplight/spectral-core": "^1.23.1",
|
|
61
66
|
"@stoplight/spectral-parsers": "^1.0.5",
|
|
62
67
|
"@stoplight/spectral-rulesets": "^1.22.6"
|