Skip to content

Commit ec10f8a

Browse files
feat: export basic type definitions for swagger editor and props-change-watcher plugin
1 parent 9adc640 commit ec10f8a

File tree

15 files changed

+97
-58
lines changed

15 files changed

+97
-58
lines changed

.eslintrc

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
2+
"parser": "@typescript-eslint/parser",
23
"extends": [
34
"react-app",
45
"react-app/jest",
56
"airbnb",
6-
"airbnb-typescript",
77
"plugin:cypress/recommended",
88
"plugin:jsx-a11y/recommended",
99
"prettier",
10-
"plugin:prettier/recommended"
10+
"plugin:prettier/recommended",
11+
"plugin:@typescript-eslint/recommended"
1112
],
1213
"globals": {
1314
"File": true,
@@ -20,8 +21,7 @@
2021
"parserOptions": {
2122
"ecmaFeatures": {
2223
"jsx": true
23-
},
24-
"project": "tsconfig.json"
24+
}
2525
},
2626
"plugins": [
2727
"jsx-a11y",
@@ -38,8 +38,10 @@
3838
}],
3939
"no-nested-ternary": "off",
4040
"prettier/prettier": "error",
41+
"no-shadow": "off",
4142
"react/react-in-jsx-scope": 0,
4243
"react/require-default-props": "off",
44+
"@typescript-eslint/no-empty-function": "off",
4345
"react/function-component-definition": [1, {
4446
"namedComponents": ["arrow-function"]
4547
}],
@@ -55,7 +57,15 @@
5557
"^@codingame\/monaco-vscode-api",
5658
"^@swagger-api\/apidom-json-pointer"
5759
]
58-
}]
60+
}],
61+
"react/jsx-filename-extension": [2,
62+
{
63+
"extensions": [
64+
".tsx",
65+
".jsx"
66+
]
67+
}
68+
]
5969
},
6070
"overrides": [
6171
{
@@ -72,7 +82,7 @@
7282
}
7383
},
7484
{
75-
"files": ["globals.d.ts"],
85+
"files": ["*.d.ts"],
7686
"rules": {
7787
"vars-on-top": "off",
7888
"no-var": "off"

package-lock.json

Lines changed: 3 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@
1414
"module": "./dist/esm/swagger-editor.js",
1515
"browser": "./dist/esm/swagger-editor.js",
1616
"jsnext:main": "./dist/esm/swagger-editor.js",
17-
"types": "./dist/types/app.d.ts",
17+
"types": "./dist/types/App.d.ts",
1818
"exports": {
1919
"./package.json": "./package.json",
2020
"./swagger-editor.css": "./dist/swagger-editor.css",
2121
".": {
22-
"browser": "./dist/esm/swagger-editor.js"
22+
"browser": "./dist/esm/swagger-editor.js",
23+
"types": "./dist/types/App.d.ts"
2324
},
2425
"./plugins/*": {
25-
"browser": "./dist/esm/plugins/*/index.js"
26+
"browser": "./dist/esm/plugins/*/index.js",
27+
"types": "./dist/types/plugins/*/index.d.ts"
2628
},
2729
"./presets/*": {
2830
"browser": "./dist/esm/presets/*/index.js"
@@ -34,6 +36,13 @@
3436
"browser": "./dist/esm/editor.worker.js"
3537
}
3638
},
39+
"typesVersions": {
40+
"*": {
41+
"plugins/*": [
42+
"./dist/types/plugins/*/index.d.ts"
43+
]
44+
}
45+
},
3746
"scripts": {
3847
"start": "cross-env DISABLE_ESLINT_PLUGIN=false ENABLE_PROGRESS_PLUGIN=true react-scripts start",
3948
"build": "npm run build:app && npm run build:bundle:esm && npm run build:bundle:umd && npm run build:definitions",
@@ -52,8 +61,8 @@
5261
"cy:run:chrome": "cross-env BROWSERSLIST_ENV=production cypress run --browser chrome",
5362
"cy:run:firefox": "cross-env BROWSERSLIST_ENV=production cypress run --browser firefox",
5463
"cy:run:electron": "cross-env BROWSERSLIST_ENV=production cypress run --browser electron",
55-
"lint": "eslint . --ext .jsx,.js",
56-
"lint:fix": "eslint . --ext .jsx,.js --fix",
64+
"lint": "eslint . --ext .jsx,.js,.tsx,.ts",
65+
"lint:fix": "eslint . --ext .jsx,.js,.tsx,.ts --fix",
5766
"clean": "rimraf ./build ./dist",
5867
"link:apidom": "npm link @swagger-api/apidom-ast @swagger-api/apidom-core @swagger-api/apidom-error @swagger-api/apidom-json-path @swagger-api/apidom-json-pointer @swagger-api/apidom-ls @swagger-api/apidom-ns-api-design-systems @swagger-api/apidom-ns-asyncapi-2 @swagger-api/apidom-ns-json-schema-draft-4 @swagger-api/apidom-ns-json-schema-draft-6 @swagger-api/apidom-ns-json-schema-draft-7 @swagger-api/apidom-ns-openapi-2 @swagger-api/apidom-ns-openapi-3-0 @swagger-api/apidom-ns-openapi-3-1 @swagger-api/apidom-parser-adapter-api-design-systems-json @swagger-api/apidom-parser-adapter-api-design-systems-yaml @swagger-api/apidom-parser-adapter-asyncapi-json-2 @swagger-api/apidom-parser-adapter-asyncapi-yaml-2 @swagger-api/apidom-parser-adapter-json @swagger-api/apidom-parser-adapter-openapi-json-2 @swagger-api/apidom-parser-adapter-openapi-json-3-0 @swagger-api/apidom-parser-adapter-openapi-json-3-1 @swagger-api/apidom-parser-adapter-openapi-yaml-2 @swagger-api/apidom-parser-adapter-openapi-yaml-3-0 @swagger-api/apidom-parser-adapter-openapi-yaml-3-1 @swagger-api/apidom-parser-adapter-yaml-1-2 @swagger-api/apidom-parser @swagger-api/apidom-reference",
5968
"link:apidom-ls": "npm link @swagger-api/apidom-ls"
@@ -140,12 +149,12 @@
140149
"@types/lodash": "^4.17.17",
141150
"@types/swagger-ui-react": "^5.18.0",
142151
"@typescript-eslint/eslint-plugin": "^5.62.0",
152+
"@typescript-eslint/parser": "^5.62.0",
143153
"copyfiles": "^2.4.1",
144154
"cross-env": "^7.0.3",
145155
"cypress": "^13.15.2",
146156
"cypress-file-upload": "^5.0.8",
147157
"eslint-config-airbnb": "^19.0.4",
148-
"eslint-config-airbnb-typescript": "^17.1.0",
149158
"eslint-config-prettier": "^9.1.0",
150159
"eslint-plugin-cypress": "^3.3.0",
151160
"eslint-plugin-prettier": "^5.4.0",

src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import EditorContentFixturesPlugin from 'plugins/editor-content-fixtures/index.j
3030
import EditorContentFromFilePlugin from 'plugins/editor-content-from-file/index.js';
3131
import EditorSafeRenderPlugin from 'plugins/editor-safe-render/index.js';
3232
import SwaggerUIAdapterPlugin from 'plugins/swagger-ui-adapter/index.js';
33-
import PropsChangeWatcherPlugin from 'plugins/props-change-watcher/index.ts';
33+
import PropsChangeWatcherPlugin from 'plugins/props-change-watcher/index';
3434
import UtilPlugin from 'plugins/util/index.js';
3535
/**
3636
* Presets
@@ -40,7 +40,7 @@ import MonacoPreset from 'presets/monaco/index.js';
4040
/**
4141
* Types
4242
*/
43-
import { SwaggerEditorType } from 'types/swagger-editor.ts';
43+
import { SwaggerEditorType } from 'types/swagger-editor';
4444

4545
import './styles/main.scss';
4646

src/index.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { createRoot } from 'react-dom/client';
33
import 'swagger-ui-react/swagger-ui.css';
44

5-
import SwaggerEditor from './App.tsx';
5+
import SwaggerEditor from './App';
66

77
const root = createRoot(document.getElementById('swagger-editor') as HTMLElement);
88

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { default as usePropChange } from './use-prop-change.ts';
2-
export { default as useMountPlugin } from './use-mount-plugin.ts';
1+
export { default as usePropChange } from './use-prop-change';
2+
export { default as useMountPlugin } from './use-mount-plugin';

src/plugins/props-change-watcher/hooks/use-mount-plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useRef } from 'react';
2-
import { GetSystemValues, System } from 'types/system.ts';
2+
import { GetSystemValues, System } from 'types/system';
33

4-
import pluginImpl from '../plugin-impl.ts';
4+
import pluginImpl from '../plugin-impl';
55

66
const useMountPlugin = () => {
77
const system = useRef<null | GetSystemValues>(null);

src/plugins/props-change-watcher/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import pluginImpl from './plugin-impl.ts';
2-
import { usePropChange, useMountPlugin } from './hooks/index.ts';
1+
import pluginImpl from './plugin-impl';
2+
import { usePropChange, useMountPlugin } from './hooks/index';
33

44
/**
55
* This plugin is meant to be utilized via the `useMountPlugin` hook.

src/plugins/props-change-watcher/plugin-impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { propChanged } from './actions.ts';
1+
import { propChanged } from './actions';
22

33
export default {
44
statePlugins: {

0 commit comments

Comments
 (0)