Skip to content

Commit

Permalink
build(parser-adapter-api-design-systems-json): use nodenext for TypeS…
Browse files Browse the repository at this point in the history
…cript modules (#4485)

Refs #4385
  • Loading branch information
glowcloud authored Nov 13, 2024
1 parent 18ff61e commit 1ace076
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 12 deletions.
22 changes: 22 additions & 0 deletions packages/apidom-parser-adapter-api-design-systems-json/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"settings": {
"import/resolver": {
"typescript": {
"project": ["./tsconfig.json"]
}
}
},
"rules": {
"import/extensions": [
"error",
"always",
{
"ts": "always",
"tsx": "always",
"js": "always",
"jsx": "never",
"ignorePackages": true
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"lint": "eslint ./",
"lint:fix": "eslint ./ --fix",
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
"typescript:check-types": "tsc --noEmit",
"typescript:declaration": "tsc -p declaration.tsconfig.json && rollup -c config/rollup/types.dist.js",
"typescript:check-types": "tsc --noEmit && tsc -p ./test/tsconfig.json --noEmit",
"typescript:declaration": "tsc -p tsconfig.declaration.json && rollup -c config/rollup/types.dist.js",
"test": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha",
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
"postpack": "rimraf NOTICE LICENSES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ParseResultElement, createNamespace } from '@swagger-api/apidom-core';
import { parse as parseJSON, detect as detectJSON } from '@swagger-api/apidom-parser-adapter-json';
import apiDesignSystemsNamespace, { MainElement } from '@swagger-api/apidom-ns-api-design-systems';

export { default as mediaTypes } from './media-types';
export { default as mediaTypes } from './media-types.ts';

export const detectionRegExp = /"version"\s*:\s*"(?<version_json>2021-05-07)"/;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { assert, expect } from 'chai';
import { isParseResultElement, sexprs } from '@swagger-api/apidom-core';
import { isMainElement } from '@swagger-api/apidom-ns-api-design-systems';

import * as adapter from '../src/adapter';
import * as adapter from '../src/adapter.ts';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const jsonSpec = fs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assert } from 'chai';
import ApiDOMParser from '@swagger-api/apidom-parser';

import * as apiDesignSystemsJsonAdapter from '../src/adapter';
import * as apiDesignSystemsJsonAdapter from '../src/adapter.ts';

describe('given adapter is used in parser', function () {
const parser = new ApiDOMParser().use(apiDesignSystemsJsonAdapter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import * as chai from 'chai';
import { jestSnapshotPlugin, addSerializer } from 'mocha-chai-jest-snapshot';

// @ts-ignore
import * as jestApiDOMSerializer from '../../../scripts/jest-serializer-apidom';
import * as jestApiDOMSerializer from '../../../scripts/jest-serializer-apidom.mjs';
// @ts-ignore
import * as jestStringSerializer from '../../../scripts/jest-serializer-string';
import * as jestStringSerializer from '../../../scripts/jest-serializer-string.mjs';

chai.use(jestSnapshotPlugin());
addSerializer(jestApiDOMSerializer);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "esnext",
"moduleResolution": "node"
},
"include": [
"."
]
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"extends": "./tsconfig.json",
"exclude": [
"test/**/*"
],
"compilerOptions": {
"declaration": true,
"declarationDir": "types",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "nodenext",
"moduleResolution": "nodenext",
"allowImportingTsExtensions": true
},
"include": [
"src/**/*",
"test/**/*"
"src/**/*"
]
}

0 comments on commit 1ace076

Please sign in to comment.