Skip to content

Commit

Permalink
Merge pull request #3910 from udecode/improve-ts
Browse files Browse the repository at this point in the history
chore: stricter typescript settings and some cleanup.
  • Loading branch information
zbeyens authored Dec 26, 2024
2 parents 63c4652 + c30304b commit 69f4f72
Show file tree
Hide file tree
Showing 81 changed files with 41 additions and 132 deletions.
14 changes: 1 addition & 13 deletions apps/www/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": "src",
Expand All @@ -25,7 +14,6 @@
"name": "next"
}
],
"strictNullChecks": true
},
"include": [
".eslintrc.cjs",
Expand Down
2 changes: 0 additions & 2 deletions apps/www/tsconfig.scripts.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "es6",
"module": "ESNext",
"moduleResolution": "node",
"esModuleInterop": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ai/src/lib/BaseAIPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
type OmitFirst,
type PluginConfig,
bindFirst,
createTSlatePlugin,
type OmitFirst,
type PluginConfig,
} from '@udecode/plate-common';

import { removeAIMarks, undoAI } from './transforms';
Expand Down
1 change: 0 additions & 1 deletion packages/ai/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/alignment/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/autoformat/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/basic-elements/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/basic-marks/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/block-quote/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/break/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/callout/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/callout/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/caption/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/cli/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
5 changes: 2 additions & 3 deletions packages/cmdk/src/cmdk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ const Command = React.forwardRef<HTMLDivElement, CommandProps>(
const propsRef = useAsRef(props);
const {
children,
disablePointerSelection = false,
filter,
label,
loop,
Expand Down Expand Up @@ -664,9 +663,9 @@ const Command = React.forwardRef<HTMLDivElement, CommandProps>(
selectFirstItem,
selectItem: updateSelectedToIndex,
selectLastItem: last,
selectNextGroup: (e) => updateSelectedByGroup(1),
selectNextGroup: () => updateSelectedByGroup(1),
selectNextItem: next,
selectPrevGroup: (e) => updateSelectedByGroup(-1),
selectPrevGroup: () => updateSelectedByGroup(-1),
selectPrevItem: prev,
setSearch,
};
Expand Down
1 change: 0 additions & 1 deletion packages/cmdk/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/cn/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/code-block/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/combobox/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/comments/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/common/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
14 changes: 1 addition & 13 deletions packages/core/src/lib/plugins/getCorePlugins.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
import type { AnyPluginConfig, PluginConfig } from '../plugin/BasePlugin';
import type { SlatePlugin } from '../plugin/SlatePlugin';

import {
createSlatePlugin,
createTSlatePlugin,
} from '../plugin/createSlatePlugin';
import { AstPlugin } from './AstPlugin';
import { DOMPlugin } from './DOMPlugin';
import { HistoryPlugin } from './HistoryPlugin';
import { InlineVoidPlugin } from './InlineVoidPlugin';
import { ParserPlugin } from './ParserPlugin';
import { type DebugErrorType, type LogLevel, DebugPlugin } from './debug';
import { type DebugErrorType, DebugPlugin, type LogLevel } from './debug';
import { SlateNextPlugin } from './editor-protocol';
import { HtmlPlugin } from './html';
import { LengthPlugin } from './length';
import { BaseParagraphPlugin } from './paragraph';

// Somehow needed to avoid cyclic dependency
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _ = () => {
createSlatePlugin();
createTSlatePlugin();
};

export type CorePlugin = ReturnType<typeof getCorePlugins>[number];

export type GetCorePluginsOptions = {
Expand Down
9 changes: 4 additions & 5 deletions packages/core/src/lib/static/utils/stripHtmlClassNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ export const stripHtmlClassNames = (
.split(/\s+/)
.filter((cn) => preserveRegExp.test(cn));

return classesToKeep.length === 0
? ''
: ` class="${classesToKeep.join(' ')}"`;
}
);
return classesToKeep.length === 0
? ''
: ` class="${classesToKeep.join(' ')}"`;
});
};
11 changes: 9 additions & 2 deletions packages/core/src/react/components/PlateControllerEffect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
usePlateSelectors,
usePlateStore,
} from '../stores';
import type { WritableAtom } from 'jotai/vanilla/atom';
import type { JotaiStore } from 'jotai-x';

export interface PlateControllerEffectProps {
id?: string;
Expand All @@ -23,8 +25,13 @@ export const PlateControllerEffect = ({

const currentStoreAtom = React.useMemo(
() =>
focusAtom(plateControllerStore.atom.editorStores, (optic) =>
optic.prop(id)
focusAtom(
plateControllerStore.atom.editorStores as WritableAtom<
Record<string, JotaiStore | null>,
any,
any
>,
(optic) => optic.prop(id)
),
[id]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export const {
usePlateControllerStore,
} = createAtomStore(
{
activeId: atom(null as string | null),
editorStores: atom({} as Record<string, JotaiStore | null>),
primaryEditorIds: atom([] as string[]),
activeId: atom<string | null>(null),
editorStores: atom<Record<string, JotaiStore | null>>({}),
primaryEditorIds: atom<string[]>([]),
},
{
name: 'plateController',
Expand Down
1 change: 0 additions & 1 deletion packages/core/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/csv/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/cursor/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/date/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/diff/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/dnd/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/docx/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/emoji/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/excalidraw/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/find-replace/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/floating/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/font/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/heading/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
1 change: 0 additions & 1 deletion packages/highlight/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
Expand Down
Loading

0 comments on commit 69f4f72

Please sign in to comment.