Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(esm): flipping on our ESM ESLint config in all packages #814

Merged
merged 4 commits into from
Oct 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["@readme/eslint-config", "@readme/eslint-config/typescript", "@readme/eslint-config/esm"],
"root": true
}
2 changes: 0 additions & 2 deletions packages/oas-extensions/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"extends": ["@readme/eslint-config", "@readme/eslint-config/typescript"],
"root": true,
"rules": {
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/explicit-module-boundary-types": "off"
2 changes: 1 addition & 1 deletion packages/oas-extensions/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import petstore from '@readme/oas-examples/3.0/json/petstore.json';
import Oas from 'oas';
import { describe, beforeEach, it, expect } from 'vitest';

import * as extensions from '../src';
import * as extensions from '../src/index.js';

describe('oas-extensions', () => {
it.each([
2 changes: 1 addition & 1 deletion packages/oas-extensions/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import type { Options } from 'tsup';
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from 'tsup';

import config from '../../tsup.config';
import config from '../../tsup.config.js';

export default defineConfig((options: Options) => ({
...options,
6 changes: 1 addition & 5 deletions packages/oas-normalize/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{
"extends": ["@readme/eslint-config", "@readme/eslint-config/typescript"],
"root": true,
"rules": {
"@typescript-eslint/no-explicit-any": "off",

"camelcase": ["error", { "allow": ["OpenAPIV3_1"] }],

"no-case-declarations": "off",

"unicorn/prefer-node-protocol": "error"
"no-case-declarations": "off"
}
}
4 changes: 2 additions & 2 deletions packages/oas-normalize/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Options } from './lib/types';
import type { Options } from './lib/types.js';
import type { OpenAPI } from 'openapi-types';

import fs from 'node:fs';
@@ -7,7 +7,7 @@ import openapiParser from '@readme/openapi-parser';
import postmanToOpenAPI from '@readme/postman-to-openapi';
import converter from 'swagger2openapi';

import * as utils from './lib/utils';
import * as utils from './lib/utils.js';

export default class OASNormalize {
cache: {
5 changes: 3 additions & 2 deletions packages/oas-normalize/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable unicorn/prefer-module -- We use `require.resolve` for reading YAML fixtures. */
import type { OpenAPIV3 } from 'openapi-types';

import fs from 'node:fs';
@@ -6,8 +7,8 @@ import path from 'node:path';
import fetchMock from 'fetch-mock';
import { describe, afterEach, beforeAll, beforeEach, it, expect } from 'vitest';

import OASNormalize from '../src';
import { getAPIDefinitionType, isAPIDefinition, isOpenAPI, isPostman, isSwagger } from '../src/lib/utils';
import OASNormalize from '../src/index.js';
import { getAPIDefinitionType, isAPIDefinition, isOpenAPI, isPostman, isSwagger } from '../src/lib/utils.js';

function cloneObject(obj) {
return JSON.parse(JSON.stringify(obj));
2 changes: 1 addition & 1 deletion packages/oas-normalize/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import type { Options } from 'tsup';
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from 'tsup';

import config from '../../tsup.config';
import config from '../../tsup.config.js';

export default defineConfig((options: Options) => ({
...options,
2 changes: 0 additions & 2 deletions packages/oas-to-har/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"extends": ["@readme/eslint-config", "@readme/eslint-config/typescript", "@readme/eslint-config/esm"],
"root": true,
"rules": {
// `any` types are fine because we're dealing with a lot of unknown data.
"@typescript-eslint/no-explicit-any": "off",
14 changes: 12 additions & 2 deletions packages/oas/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
{
"extends": ["@readme/eslint-config", "@readme/eslint-config/typescript"],
"root": true,
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-use-before-define": ["error", { "classes": false }],

"camelcase": "off",

"max-classes-per-file": "off",

"node/no-extraneous-import": [
"error",
{
"allowModules": [
// When we use this module we only load TS types which come from our `@types/json-schema`
// dependency.
"json-schema"
]
}
],

"no-param-reassign": "off",

"no-underscore-dangle": [
6 changes: 3 additions & 3 deletions packages/oas/src/analyzer/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { OASDocument } from '../rmoas.types';
import type { OASDocument } from '../rmoas.types.js';

import * as OPENAPI_QUERIES from './queries/openapi';
import * as README_QUERIES from './queries/readme';
import * as OPENAPI_QUERIES from './queries/openapi.js';
import * as README_QUERIES from './queries/readme.js';

export interface OASAnalysisFeature {
locations: string[];
6 changes: 3 additions & 3 deletions packages/oas/src/analyzer/queries/openapi.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { OASDocument } from '../../rmoas.types';
import type { OASDocument } from '../../rmoas.types.js';

import Oas from '../..';
import { query, refizePointer } from '../util';
import Oas from '../../index.js';
import { query, refizePointer } from '../util.js';

/**
* Determine if a given API definition uses the `additionalProperties` schema property.
4 changes: 2 additions & 2 deletions packages/oas/src/analyzer/queries/readme.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { OASDocument } from '../../rmoas.types';
import type { OASDocument } from '../../rmoas.types.js';

import { query, refizePointer } from '../util';
import { query, refizePointer } from '../util.js';

/**
* Determine if a given API definition is using our `x-default` extension for defining auth
12 changes: 6 additions & 6 deletions packages/oas/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type * as RMOAS from './rmoas.types';
import type * as RMOAS from './rmoas.types.js';
import type { OpenAPIV3_1 } from 'openapi-types';
import type { MatchResult } from 'path-to-regexp';

import $RefParser from '@readme/json-schema-ref-parser';
import { pathToRegexp, match } from 'path-to-regexp';

import getAuth from './lib/get-auth';
import getUserVariable from './lib/get-user-variable';
import { isPrimitive } from './lib/helpers';
import Operation, { Webhook } from './operation';
import utils from './utils';
import getAuth from './lib/get-auth.js';
import getUserVariable from './lib/get-user-variable.js';
import { isPrimitive } from './lib/helpers.js';
import Operation, { Webhook } from './operation.js';
import utils from './utils.js';

interface PathMatch {
match?: MatchResult;
2 changes: 1 addition & 1 deletion packages/oas/src/lib/dedupe-common-parameters.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as RMOAS from '../rmoas.types';
import * as RMOAS from '../rmoas.types.js';

/**
* With an array of common parameters filter down them to what isn't already present in a list of
2 changes: 1 addition & 1 deletion packages/oas/src/lib/get-auth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type * as RMOAS from '../rmoas.types';
import type * as RMOAS from '../rmoas.types.js';
import type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';

type authKey = null | unknown | { password: string | number; user: string | number };
6 changes: 3 additions & 3 deletions packages/oas/src/lib/get-mediatype-examples.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type * as RMOAS from '../rmoas.types';
import type * as RMOAS from '../rmoas.types.js';

import sampleFromSchema from '../samples';
import sampleFromSchema from '../samples/index.js';

import matchesMimeType from './matches-mimetype';
import matchesMimeType from './matches-mimetype.js';

export interface MediaTypeExample {
description?: string;
2 changes: 1 addition & 1 deletion packages/oas/src/lib/get-user-variable.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type * as RMOAS from '../rmoas.types';
import type * as RMOAS from '../rmoas.types.js';

/**
* Retrieve a user variable off of a given user.
2 changes: 1 addition & 1 deletion packages/oas/src/lib/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { SchemaObject } from '../rmoas.types';
import type { SchemaObject } from '../rmoas.types.js';

export function hasSchemaType(schema: SchemaObject, discriminator: 'array' | 'object') {
if (Array.isArray(schema.type)) {
6 changes: 3 additions & 3 deletions packages/oas/src/lib/openapi-to-json-schema.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* eslint-disable no-continue */
import type { SchemaObject } from '../rmoas.types';
import type { SchemaObject } from '../rmoas.types.js';
import type { JSONSchema7TypeName } from 'json-schema';
import type { OpenAPIV3_1 } from 'openapi-types';

import mergeJSONSchemaAllOf from 'json-schema-merge-allof';
import jsonpointer from 'jsonpointer';
import removeUndefinedObjects from 'remove-undefined-objects';

import * as RMOAS from '../rmoas.types';
import * as RMOAS from '../rmoas.types.js';

import { hasSchemaType, isObject, isPrimitive } from './helpers';
import { hasSchemaType, isObject, isPrimitive } from './helpers.js';

/**
* This list has been pulled from `openapi-schema-to-json-schema` but been slightly modified to fit
4 changes: 2 additions & 2 deletions packages/oas/src/lib/reducer.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { ComponentsObject, HttpMethods, OASDocument, TagObject } from '../rmoas.types';
import type { ComponentsObject, HttpMethods, OASDocument, TagObject } from '../rmoas.types.js';

import jsonPointer from 'jsonpointer';
import { getAPIDefinitionType } from 'oas-normalize/lib/utils';

import { query } from '../analyzer/util';
import { query } from '../analyzer/util.js';

export interface ReducerOptions {
/** A key-value object of path + method combinations to reduce by. */
28 changes: 14 additions & 14 deletions packages/oas/src/operation.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import type { CallbackExamples } from './operation/get-callback-examples';
import type { getParametersAsJSONSchemaOptions } from './operation/get-parameters-as-json-schema';
import type { RequestBodyExamples } from './operation/get-requestbody-examples';
import type { ResponseExamples } from './operation/get-response-examples';
import type { CallbackExamples } from './operation/get-callback-examples.js';
import type { getParametersAsJSONSchemaOptions } from './operation/get-parameters-as-json-schema.js';
import type { RequestBodyExamples } from './operation/get-requestbody-examples.js';
import type { ResponseExamples } from './operation/get-response-examples.js';
import type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';

import dedupeCommonParameters from './lib/dedupe-common-parameters';
import findSchemaDefinition from './lib/find-schema-definition';
import matchesMimeType from './lib/matches-mimetype';
import getCallbackExamples from './operation/get-callback-examples';
import getParametersAsJSONSchema from './operation/get-parameters-as-json-schema';
import getRequestBodyExamples from './operation/get-requestbody-examples';
import getResponseAsJSONSchema from './operation/get-response-as-json-schema';
import getResponseExamples from './operation/get-response-examples';
import * as RMOAS from './rmoas.types';
import utils from './utils';
import dedupeCommonParameters from './lib/dedupe-common-parameters.js';
import findSchemaDefinition from './lib/find-schema-definition.js';
import matchesMimeType from './lib/matches-mimetype.js';
import getCallbackExamples from './operation/get-callback-examples.js';
import getParametersAsJSONSchema from './operation/get-parameters-as-json-schema.js';
import getRequestBodyExamples from './operation/get-requestbody-examples.js';
import getResponseAsJSONSchema from './operation/get-response-as-json-schema.js';
import getResponseExamples from './operation/get-response-examples.js';
import * as RMOAS from './rmoas.types.js';
import utils from './utils.js';

type SecurityType = 'Basic' | 'Bearer' | 'Query' | 'Header' | 'Cookie' | 'OAuth2' | 'http' | 'apiKey';

4 changes: 2 additions & 2 deletions packages/oas/src/operation/get-callback-examples.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type * as RMOAS from '../rmoas.types';
import type * as RMOAS from '../rmoas.types.js';

import getResponseExamples from './get-response-examples';
import getResponseExamples from './get-response-examples.js';

export type CallbackExamples = {
example: unknown;
14 changes: 7 additions & 7 deletions packages/oas/src/operation/get-parameters-as-json-schema.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { toJSONSchemaOptions } from '../lib/openapi-to-json-schema';
import type Operation from '../operation';
import type { ComponentsObject, ExampleObject, OASDocument, ParameterObject, SchemaObject } from '../rmoas.types';
import type { toJSONSchemaOptions } from '../lib/openapi-to-json-schema.js';
import type Operation from '../operation.js';
import type { ComponentsObject, ExampleObject, OASDocument, ParameterObject, SchemaObject } from '../rmoas.types.js';
import type { OpenAPIV3_1 } from 'openapi-types';

import cloneObject from '../lib/clone-object';
import { isPrimitive } from '../lib/helpers';
import matchesMimetype from '../lib/matches-mimetype';
import toJSONSchema, { getSchemaVersionString } from '../lib/openapi-to-json-schema';
import cloneObject from '../lib/clone-object.js';
import { isPrimitive } from '../lib/helpers.js';
import matchesMimetype from '../lib/matches-mimetype.js';
import toJSONSchema, { getSchemaVersionString } from '../lib/openapi-to-json-schema.js';

export interface SchemaWrapper {
$schema?: string;
4 changes: 2 additions & 2 deletions packages/oas/src/operation/get-requestbody-examples.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type * as RMOAS from '../rmoas.types';
import type * as RMOAS from '../rmoas.types.js';

import getMediaTypeExamples from '../lib/get-mediatype-examples';
import getMediaTypeExamples from '../lib/get-mediatype-examples.js';

export type RequestBodyExamples = {
examples: any;
12 changes: 6 additions & 6 deletions packages/oas/src/operation/get-response-as-json-schema.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import type Operation from '../operation';
import type Operation from '../operation.js';
import type {
ComponentsObject,
MediaTypeObject,
OASDocument,
ResponseObject,
SchemaObject,
HeaderObject,
} from '../rmoas.types';
} from '../rmoas.types.js';

import cloneObject from '../lib/clone-object';
import { isPrimitive } from '../lib/helpers';
import matches from '../lib/matches-mimetype';
import toJSONSchema, { getSchemaVersionString } from '../lib/openapi-to-json-schema';
import cloneObject from '../lib/clone-object.js';
import { isPrimitive } from '../lib/helpers.js';
import matches from '../lib/matches-mimetype.js';
import toJSONSchema, { getSchemaVersionString } from '../lib/openapi-to-json-schema.js';

const isJSON = matches.json;

8 changes: 4 additions & 4 deletions packages/oas/src/operation/get-response-examples.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { MediaTypeExample } from '../lib/get-mediatype-examples';
import type * as RMOAS from '../rmoas.types';
import type { MediaTypeExample } from '../lib/get-mediatype-examples.js';
import type * as RMOAS from '../rmoas.types.js';

import getMediaTypeExamples from '../lib/get-mediatype-examples';
import { isRef } from '../rmoas.types';
import getMediaTypeExamples from '../lib/get-mediatype-examples.js';
import { isRef } from '../rmoas.types.js';

export type ResponseExamples = {
mediaTypes: Record<string, MediaTypeExample[]>;
4 changes: 2 additions & 2 deletions packages/oas/src/samples/index.ts
Original file line number Diff line number Diff line change
@@ -4,12 +4,12 @@
* @license Apache-2.0
* @see {@link https://github.com/swagger-api/swagger-ui/blob/master/src/core/plugins/samples/fn.js}
*/
import type * as RMOAS from '../rmoas.types';
import type * as RMOAS from '../rmoas.types.js';

import mergeJSONSchemaAllOf from 'json-schema-merge-allof';
import memoize from 'memoizee';

import { objectify, usesPolymorphism, isFunc, normalizeArray, deeplyStripKey } from './utils';
import { objectify, usesPolymorphism, isFunc, normalizeArray, deeplyStripKey } from './utils.js';

const sampleDefaults = (genericSample: string | number | boolean) => {
return (schema: RMOAS.SchemaObject): typeof genericSample =>
4 changes: 2 additions & 2 deletions packages/oas/src/samples/utils.ts
Original file line number Diff line number Diff line change
@@ -4,9 +4,9 @@
* @license Apache-2.0
* @see {@link https://github.com/swagger-api/swagger-ui/blob/master/src/core/utils.js}
*/
import type * as RMOAS from '../rmoas.types';
import type * as RMOAS from '../rmoas.types.js';

import { isObject } from '../lib/helpers';
import { isObject } from '../lib/helpers.js';

export function usesPolymorphism(schema: RMOAS.SchemaObject) {
if (schema.oneOf) {
6 changes: 3 additions & 3 deletions packages/oas/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import findSchemaDefinition from './lib/find-schema-definition';
import matchesMimeType from './lib/matches-mimetype';
import { types as jsonSchemaTypes } from './operation/get-parameters-as-json-schema';
import findSchemaDefinition from './lib/find-schema-definition.js';
import matchesMimeType from './lib/matches-mimetype.js';
import { types as jsonSchemaTypes } from './operation/get-parameters-as-json-schema.js';

const supportedMethods = new Set(['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']);

4 changes: 2 additions & 2 deletions packages/oas/test/__fixtures__/create-oas.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type * as RMOAS from '../../src/rmoas.types';
import type * as RMOAS from '../../src/rmoas.types.js';

import Oas from '../../src';
import Oas from '../../src/index.js';

/**
* @param operation Operation to create a fake API definition and Oas instance for.
2 changes: 1 addition & 1 deletion packages/oas/test/__fixtures__/json-schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { SchemaObject } from '../../src/rmoas.types';
import type { SchemaObject } from '../../src/rmoas.types.js';

const SCHEMA_SCENARIOS = {
'array of primitives': (props, allowEmptyValue) => {
3 changes: 0 additions & 3 deletions packages/oas/test/__fixtures__/json-stringify-clean.js

This file was deleted.

3 changes: 3 additions & 0 deletions packages/oas/test/__fixtures__/json-stringify-clean.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function jsonStringifyClean(obj: any) {
return JSON.stringify(obj, undefined, 2);
}
4 changes: 2 additions & 2 deletions packages/oas/test/analyzer/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { OASDocument } from '../../src/rmoas.types';
import type { OASDocument } from '../../src/rmoas.types.js';

import { describe, beforeAll, it, expect } from 'vitest';

import analyzer from '../../src/analyzer';
import analyzer from '../../src/analyzer/index.js';

let petstore: OASDocument;

4 changes: 2 additions & 2 deletions packages/oas/test/analyzer/queries/openapi.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { OASDocument } from '../../../src/rmoas.types';
import type { OASDocument } from '../../../src/rmoas.types.js';

import { describe, beforeAll, expect, it } from 'vitest';

import * as QUERIES from '../../../src/analyzer/queries/openapi';
import * as QUERIES from '../../../src/analyzer/queries/openapi.js';

function loadSpec(r: any) {
return r.default as unknown as OASDocument;
4 changes: 2 additions & 2 deletions packages/oas/test/analyzer/queries/readme.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { OASDocument } from '../../../src/rmoas.types';
import type { OASDocument } from '../../../src/rmoas.types.js';

import { describe, beforeAll, expect, it } from 'vitest';

import * as QUERIES from '../../../src/analyzer/queries/readme';
import * as QUERIES from '../../../src/analyzer/queries/readme.js';

function loadSpec(r: any) {
return r.default as unknown as OASDocument;
8 changes: 4 additions & 4 deletions packages/oas/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type * as RMOAS from '../src/rmoas.types';
import type * as RMOAS from '../src/rmoas.types.js';

import petstoreSpec from '@readme/oas-examples/3.0/json/petstore.json';
import { beforeAll, describe, test, it, expect, vi } from 'vitest';

import Oas from '../src';
import Operation, { Webhook } from '../src/operation';
import utils from '../src/utils';
import Oas from '../src/index.js';
import Operation, { Webhook } from '../src/operation.js';
import utils from '../src/utils.js';

let petstore: Oas;
let webhooks: Oas;
2 changes: 1 addition & 1 deletion packages/oas/test/lib/find-schema-definition.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import petstore from '@readme/oas-examples/3.0/json/petstore.json';
import { test, expect } from 'vitest';

import findSchemaDefinition from '../../src/lib/find-schema-definition';
import findSchemaDefinition from '../../src/lib/find-schema-definition.js';

test('should return a definition for a given ref', () => {
expect(findSchemaDefinition('#/components/schemas/Pet', petstore)).toStrictEqual(petstore.components.schemas.Pet);
4 changes: 2 additions & 2 deletions packages/oas/test/lib/get-auth.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, describe, it, expect } from 'vitest';

import Oas from '../../src';
import getAuth, { getByScheme } from '../../src/lib/get-auth';
import Oas from '../../src/index.js';
import getAuth, { getByScheme } from '../../src/lib/get-auth.js';
import multipleSecurities from '../__datasets__/multiple-securities.json';

// We need to forcetype this definition to an OASDocument because it's got weird use cases in it
2 changes: 1 addition & 1 deletion packages/oas/test/lib/get-user-variable.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect } from 'vitest';

import getUserVariable from '../../src/lib/get-user-variable';
import getUserVariable from '../../src/lib/get-user-variable.js';

const topLevelUser = { apiKey: '123456', user: 'user', pass: 'pass' };
const keysUser = {
2 changes: 1 addition & 1 deletion packages/oas/test/lib/matches-mimetype.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect } from 'vitest';

import matchesMimeType from '../../src/lib/matches-mimetype';
import matchesMimeType from '../../src/lib/matches-mimetype.js';

describe('#formUrlEncoded', () => {
it('should recognize `application/x-www-form-urlencoded`', () => {
10 changes: 5 additions & 5 deletions packages/oas/test/lib/openapi-to-json-schema.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { SchemaObject } from '../../src/rmoas.types';
import type { SchemaObject } from '../../src/rmoas.types.js';
import type { JSONSchema4, JSONSchema7, JSONSchema7Definition, JSONSchema7TypeName } from 'json-schema';

import { beforeAll, expect, describe, it } from 'vitest';

import Oas from '../../src';
import toJSONSchema from '../../src/lib/openapi-to-json-schema';
import createOas from '../__fixtures__/create-oas';
import generateJSONSchemaFixture from '../__fixtures__/json-schema';
import Oas from '../../src/index.js';
import toJSONSchema from '../../src/lib/openapi-to-json-schema.js';
import createOas from '../__fixtures__/create-oas.js';
import generateJSONSchemaFixture from '../__fixtures__/json-schema.js';

let petstore: Oas;

6 changes: 3 additions & 3 deletions packages/oas/test/lib/openapi-to-json-schema/default.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { SchemaObject } from '../../../src/rmoas.types';
import type { SchemaObject } from '../../../src/rmoas.types.js';

import { describe, it, expect } from 'vitest';

import toJSONSchema from '../../../src/lib/openapi-to-json-schema';
import generateJSONSchemaFixture from '../../__fixtures__/json-schema';
import toJSONSchema from '../../../src/lib/openapi-to-json-schema.js';
import generateJSONSchemaFixture from '../../__fixtures__/json-schema.js';

describe('`default` support in `openapi-to-json-schema`', () => {
it('should support default', () => {
6 changes: 3 additions & 3 deletions packages/oas/test/lib/openapi-to-json-schema/required.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { SchemaObject } from '../../../src/rmoas.types';
import type { SchemaObject } from '../../../src/rmoas.types.js';

import { describe, it, expect } from 'vitest';

import toJSONSchema from '../../../src/lib/openapi-to-json-schema';
import generateJSONSchemaFixture from '../../__fixtures__/json-schema';
import toJSONSchema from '../../../src/lib/openapi-to-json-schema.js';
import generateJSONSchemaFixture from '../../__fixtures__/json-schema.js';

describe('`required` support in `openapi-to-json-schema`', () => {
it('should support required', () => {
2 changes: 1 addition & 1 deletion packages/oas/test/lib/reducer.test.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import petstore from '@readme/oas-examples/3.0/json/petstore.json';
import uspto from '@readme/oas-examples/3.0/json/uspto.json';
import { expect, describe, it } from 'vitest';

import reducer from '../../src/lib/reducer';
import reducer from '../../src/lib/reducer.js';
import complexNesting from '../__datasets__/complex-nesting.json';
import petstoreRefQuirks from '../__datasets__/petstore-ref-quirks.json';
import securityRootLevel from '../__datasets__/security-root-level.json';
6 changes: 3 additions & 3 deletions packages/oas/test/operation.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type * as RMOAS from '../src/rmoas.types';
import type * as RMOAS from '../src/rmoas.types.js';

import petstoreSpec from '@readme/oas-examples/3.0/json/petstore.json';
import openapiParser from '@readme/openapi-parser';
import { beforeAll, describe, it, expect } from 'vitest';

import Oas from '../src';
import Operation, { Callback } from '../src/operation';
import Oas from '../src/index.js';
import Operation, { Callback } from '../src/operation.js';

let petstore: Oas;
let callbackSchema: Oas;
4 changes: 2 additions & 2 deletions packages/oas/test/operation/get-callback-examples.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { HttpMethods } from '../../src/rmoas.types';
import type { HttpMethods } from '../../src/rmoas.types.js';

import { beforeAll, test, expect, describe, it } from 'vitest';

import Oas from '../../src';
import Oas from '../../src/index.js';

let operationExamples: Oas;
let callbacks: Oas;
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { OperationObject, RequestBodyObject, SchemaObject } from '../../src/rmoas.types';
import type { OperationObject, RequestBodyObject, SchemaObject } from '../../src/rmoas.types.js';

import { beforeAll, test, expect, it, describe } from 'vitest';

import Oas from '../../src';
import createOas from '../__fixtures__/create-oas';
import Oas from '../../src/index.js';
import createOas from '../__fixtures__/create-oas.js';

let ably: Oas;
let circular: Oas;
4 changes: 2 additions & 2 deletions packages/oas/test/operation/get-requestbody-examples.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { beforeAll, test, expect, it, describe } from 'vitest';

import Oas from '../../src';
import cleanStringify from '../__fixtures__/json-stringify-clean';
import Oas from '../../src/index.js';
import cleanStringify from '../__fixtures__/json-stringify-clean.js';

let operationExamples: Oas;
let petstore: Oas;
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { HttpMethods, ResponseObject, SchemaObject } from '../../src/rmoas.types';
import type { HttpMethods, ResponseObject, SchemaObject } from '../../src/rmoas.types.js';

import openapiParser from '@readme/openapi-parser';
import { beforeAll, describe, test, expect, it } from 'vitest';

import Oas from '../../src';
import cloneObject from '../../src/lib/clone-object';
import createOas from '../__fixtures__/create-oas';
import Oas from '../../src/index.js';
import cloneObject from '../../src/lib/clone-object.js';
import createOas from '../__fixtures__/create-oas.js';

let circular: Oas;
let petstore: Oas;
8 changes: 4 additions & 4 deletions packages/oas/test/operation/get-response-examples.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { MediaTypeExample } from '../../src/lib/get-mediatype-examples';
import type * as RMOAS from '../../src/rmoas.types';
import type { MediaTypeExample } from '../../src/lib/get-mediatype-examples.js';
import type * as RMOAS from '../../src/rmoas.types.js';

import { beforeAll, describe, test, expect, it } from 'vitest';

import Oas from '../../src';
import cleanStringify from '../__fixtures__/json-stringify-clean';
import Oas from '../../src/index.js';
import cleanStringify from '../__fixtures__/json-stringify-clean.js';

let operationExamples: Oas;
let petstore: Oas;
4 changes: 2 additions & 2 deletions packages/oas/test/samples/index.test.ts
Original file line number Diff line number Diff line change
@@ -4,11 +4,11 @@
* @license Apache-2.0
* @see {@link https://github.com/swagger-api/swagger-ui/blob/master/test/unit/core/plugins/samples/fn.js}
*/
import type * as RMOAS from '../../src/rmoas.types';
import type * as RMOAS from '../../src/rmoas.types.js';

import { describe, it, expect } from 'vitest';

import sampleFromSchema from '../../src/samples';
import sampleFromSchema from '../../src/samples/index.js';

describe('sampleFromSchema', () => {
it('should be memoized', async () => {
2 changes: 1 addition & 1 deletion packages/oas/test/ts-quirks.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect } from 'vitest';

// eslint-disable-next-line import/extensions
// eslint-disable-next-line import/extensions, require-extensions/require-index
import Oas from '..';

/**
2 changes: 1 addition & 1 deletion packages/oas/test/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect } from 'vitest';

import utils from '../src/utils';
import utils from '../src/utils.js';

test('should expose `jsonSchemaTypes`', () => {
expect(utils.jsonSchemaTypes).toStrictEqual({
2 changes: 1 addition & 1 deletion packages/oas/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import type { Options } from 'tsup';
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from 'tsup';

import config from '../../tsup.config';
import config from '../../tsup.config.js';

export default defineConfig((options: Options) => ({
...options,