diff --git a/packages/apidom-json-path/.eslintrc b/packages/apidom-json-path/.eslintrc new file mode 100644 index 0000000000..86a24bfc5c --- /dev/null +++ b/packages/apidom-json-path/.eslintrc @@ -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 + } + ] + } +} diff --git a/packages/apidom-json-path/package.json b/packages/apidom-json-path/package.json index 74fb8ca984..3f49c17344 100644 --- a/packages/apidom-json-path/package.json +++ b/packages/apidom-json-path/package.json @@ -25,7 +25,7 @@ "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: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" diff --git a/packages/apidom-json-path/src/errors/EvaluationJsonPathError.ts b/packages/apidom-json-path/src/errors/EvaluationJsonPathError.ts index 490af457ce..78e3df7fc9 100644 --- a/packages/apidom-json-path/src/errors/EvaluationJsonPathError.ts +++ b/packages/apidom-json-path/src/errors/EvaluationJsonPathError.ts @@ -1,7 +1,7 @@ import { Element } from '@swagger-api/apidom-core'; import { ApiDOMErrorOptions } from '@swagger-api/apidom-error'; -import JsonPathError from './JsonPathError'; +import JsonPathError from './JsonPathError.ts'; export interface EvaluationJsonPathErrorOptions extends ApiDOMErrorOptions { path: string | string[]; diff --git a/packages/apidom-json-path/src/errors/MultiEvaluationJsonPathError.ts b/packages/apidom-json-path/src/errors/MultiEvaluationJsonPathError.ts index 14734df392..be4c39ecf3 100644 --- a/packages/apidom-json-path/src/errors/MultiEvaluationJsonPathError.ts +++ b/packages/apidom-json-path/src/errors/MultiEvaluationJsonPathError.ts @@ -1,7 +1,7 @@ import { Element } from '@swagger-api/apidom-core'; import { ApiDOMErrorOptions } from '@swagger-api/apidom-error'; -import JsonPathError from './JsonPathError'; +import JsonPathError from './JsonPathError.ts'; export interface MultiEvaluationJsonPathErrorOptions extends ApiDOMErrorOptions { paths: string[] | string[][]; diff --git a/packages/apidom-json-path/src/evaluate-multi.ts b/packages/apidom-json-path/src/evaluate-multi.ts index b05cbc1bde..302ce45068 100644 --- a/packages/apidom-json-path/src/evaluate-multi.ts +++ b/packages/apidom-json-path/src/evaluate-multi.ts @@ -2,7 +2,7 @@ import { JSONPath } from 'jsonpath-plus'; import { Element, toValue, cloneDeep } from '@swagger-api/apidom-core'; import { evaluate as jsonPointerEvaluate } from '@swagger-api/apidom-json-pointer'; -import MultiEvaluationJsonPathError from './errors/MultiEvaluationJsonPathError'; +import MultiEvaluationJsonPathError from './errors/MultiEvaluationJsonPathError.ts'; type JSONPathEvalTuple = [string, Element[]]; diff --git a/packages/apidom-json-path/src/evaluate.ts b/packages/apidom-json-path/src/evaluate.ts index cf94fbf28b..410322c59c 100644 --- a/packages/apidom-json-path/src/evaluate.ts +++ b/packages/apidom-json-path/src/evaluate.ts @@ -2,7 +2,7 @@ import { JSONPath } from 'jsonpath-plus'; import { Element, toValue, cloneDeep } from '@swagger-api/apidom-core'; import { evaluate as jsonPointerEvaluate } from '@swagger-api/apidom-json-pointer'; -import EvaluationJsonPathError from './errors/EvaluationJsonPathError'; +import EvaluationJsonPathError from './errors/EvaluationJsonPathError.ts'; type Evaluate = { (path: string, element: T): Element[]; diff --git a/packages/apidom-json-path/src/index.ts b/packages/apidom-json-path/src/index.ts index e5e9c7fffc..e244743c0b 100644 --- a/packages/apidom-json-path/src/index.ts +++ b/packages/apidom-json-path/src/index.ts @@ -1,8 +1,8 @@ -import './polyfills'; +import './polyfills.ts'; -export { default as EvaluationJsonPathError } from './errors/EvaluationJsonPathError'; -export type { EvaluationJsonPathErrorOptions } from './errors/EvaluationJsonPathError'; -export { default as MultiEvaluationJsonPathError } from './errors/MultiEvaluationJsonPathError'; -export type { MultiEvaluationJsonPathErrorOptions } from './errors/MultiEvaluationJsonPathError'; -export { default as evaluate } from './evaluate'; -export { default as evaluateMulti } from './evaluate-multi'; +export { default as EvaluationJsonPathError } from './errors/EvaluationJsonPathError.ts'; +export type { EvaluationJsonPathErrorOptions } from './errors/EvaluationJsonPathError.ts'; +export { default as MultiEvaluationJsonPathError } from './errors/MultiEvaluationJsonPathError.ts'; +export type { MultiEvaluationJsonPathErrorOptions } from './errors/MultiEvaluationJsonPathError.ts'; +export { default as evaluate } from './evaluate.ts'; +export { default as evaluateMulti } from './evaluate-multi.ts'; diff --git a/packages/apidom-json-path/test/evaluate-multi.ts b/packages/apidom-json-path/test/evaluate-multi.ts index dfbaf58a1e..e39c74746c 100644 --- a/packages/apidom-json-path/test/evaluate-multi.ts +++ b/packages/apidom-json-path/test/evaluate-multi.ts @@ -1,7 +1,7 @@ import { assert } from 'chai'; import { ObjectElement, NumberElement } from '@swagger-api/apidom-core'; -import { evaluateMulti } from '../src'; +import { evaluateMulti } from '../src/index.ts'; describe('apidom-json-path', function () { context('evaluateMulti', function () { diff --git a/packages/apidom-json-path/test/evaluate.ts b/packages/apidom-json-path/test/evaluate.ts index fb380b336a..4382631f3f 100644 --- a/packages/apidom-json-path/test/evaluate.ts +++ b/packages/apidom-json-path/test/evaluate.ts @@ -1,7 +1,7 @@ import { assert } from 'chai'; import { ObjectElement, NumberElement } from '@swagger-api/apidom-core'; -import { evaluate } from '../src'; +import { evaluate } from '../src/index.ts'; describe('apidom-json-path', function () { context('evaluate', function () { diff --git a/packages/apidom-json-path/declaration.tsconfig.json b/packages/apidom-json-path/tsconfig.declaration.json similarity index 100% rename from packages/apidom-json-path/declaration.tsconfig.json rename to packages/apidom-json-path/tsconfig.declaration.json diff --git a/packages/apidom-json-path/tsconfig.json b/packages/apidom-json-path/tsconfig.json index 4081635a03..a86c615aaa 100644 --- a/packages/apidom-json-path/tsconfig.json +++ b/packages/apidom-json-path/tsconfig.json @@ -1,5 +1,10 @@ { "extends": "../../tsconfig.json", + "compilerOptions": { + "module": "nodenext", + "moduleResolution": "nodenext", + "allowImportingTsExtensions": true + }, "include": [ "src/**/*", "test/**/*"