Skip to content

Commit e5734d1

Browse files
authored
fix: remove console log + add lint rule (#793)
1 parent 422ae49 commit e5734d1

File tree

11 files changed

+15
-7
lines changed

11 files changed

+15
-7
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = {
2626
},
2727
ignorePatterns: ["**/ui/*"],
2828
rules: {
29+
"no-console": "error",
2930
curly: 1,
3031
"import/no-extraneous-dependencies": [
3132
"error",

packages/core/src/editor/BlockNoteEditor.ts

+2
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ export class BlockNoteEditor<
307307
this.resolveFileUrl = newOptions.resolveFileUrl || (async (url) => url);
308308

309309
if (newOptions.collaboration && newOptions.initialContent) {
310+
// eslint-disable-next-line no-console
310311
console.warn(
311312
"When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
312313
);
@@ -777,6 +778,7 @@ export class BlockNoteEditor<
777778
for (const mark of marks) {
778779
const config = this.schema.styleSchema[mark.type.name];
779780
if (!config) {
781+
// eslint-disable-next-line no-console
780782
console.warn("mark not found in styleschema", mark.type.name);
781783
continue;
782784
}

packages/core/src/editor/BlockNoteTipTapEditor.ts

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export class BlockNoteTipTapEditor extends TiptapEditor {
8787
this.options.parseOptions
8888
);
8989
} catch (e) {
90+
// eslint-disable-next-line no-console
9091
console.error(
9192
"Error creating document from blocks passed as `initialContent`. Caused by exception: ",
9293
e

packages/dev-scripts/examples/gen.ts

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ async function writeTemplate(project: Project, templateFile: string) {
5151
// try {
5252
// // fs.unlinkSync(targetFilePath);
5353
// } catch (e) {}
54+
// eslint-disable-next-line no-console
5455
console.log("written", targetFilePath);
5556
}
5657

@@ -79,6 +80,7 @@ async function generateExamplesData(projects: Project[]) {
7980
const projects = getExampleProjects();
8081

8182
for (const project of projects) {
83+
// eslint-disable-next-line no-console
8284
console.log("generating code for example", project);
8385
await generateCodeForExample(project);
8486
}

packages/react/src/components/FormattingToolbar/FormattingToolbarController.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ export const FormattingToolbarController = (props: {
8080
{
8181
placement,
8282
middleware: [offset(10), flip()],
83-
onOpenChange: (open, event) => {
84-
console.log("change", event);
83+
onOpenChange: (open, _event) => {
84+
// console.log("change", event);
8585
if (!open) {
8686
editor.formattingToolbar.closeMenu();
8787
editor.focus();

packages/react/src/components/SuggestionMenu/SuggestionMenu.test.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ it("has good typing", () => {
3333
suggestionMenuComponent={undefined as any}
3434
getItems={async () => [{ hello: "hello" }]}
3535
onItemClick={(item) => {
36+
// eslint-disable-next-line no-console
3637
console.log(item.hello);
3738
}}
3839
triggerCharacter="/"
3940
/>
4041
);
4142

4243
// prevent typescript unused error
44+
// eslint-disable-next-line no-console
4345
console.log("menu", menu);
4446
});

packages/react/src/schema/@util/ReactRenderUtil.ts

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export function renderToDOMSpec(
2828

2929
if (!div.childElementCount) {
3030
// TODO
31+
// eslint-disable-next-line no-console
3132
console.warn("ReactInlineContentSpec: renderHTML() failed");
3233
return {
3334
dom: document.createElement("span"),

playground/src/main.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ const App = (props: { project: (typeof examples.basic)["projects"][0] }) => {
9696
React.useEffect(() => {
9797
(async () => {
9898
// load app async
99-
console.log("../../" + props.project.pathFromRoot + "/App.tsx");
10099
const c: any = await modules[
101100
"../../" + props.project.pathFromRoot + "/App.tsx"
102101
]();

tests/src/utils/components/Editor.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { BlockNoteSchema, filterSuggestionItems } from "@blocknote/core";
22
import "@blocknote/core/style.css";
3+
import { BlockNoteView } from "@blocknote/mantine";
4+
import "@blocknote/mantine/style.css";
35
import {
46
BlockNoteDefaultUI,
57
SuggestionMenuController,
68
getDefaultReactSlashMenuItems,
79
useCreateBlockNote,
810
} from "@blocknote/react";
9-
import { BlockNoteView } from "@blocknote/mantine";
10-
import "@blocknote/mantine/style.css";
1111

1212
import { Alert, insertAlert } from "../customblocks/Alert";
1313
import { Button } from "../customblocks/Button";
@@ -24,8 +24,6 @@ const schema = BlockNoteSchema.create({
2424
export default function Editor() {
2525
const editor = useCreateBlockNote({ schema });
2626

27-
console.log(editor);
28-
2927
// Give tests a way to get prosemirror instance
3028
(window as WindowWithProseMirror).ProseMirror = editor?._tiptapEditor;
3129
// editor.insertBlocks([{

tests/src/utils/customblocks/Alert.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-console */
12
import {
23
BlockNoteEditor,
34
BlockSchemaWithBlock,

tests/src/utils/customblocks/ReactAlert.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-console */
12
import { BlockNoteEditor, defaultProps } from "@blocknote/core";
23
import { createReactBlockSpec } from "@blocknote/react";
34
import { useEffect, useState } from "react";

0 commit comments

Comments
 (0)