Skip to content

fix: remove console log + add lint rule #793

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
},
ignorePatterns: ["**/ui/*"],
rules: {
"no-console": "error",
curly: 1,
"import/no-extraneous-dependencies": [
"error",
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/editor/BlockNoteEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ export class BlockNoteEditor<
this.resolveFileUrl = newOptions.resolveFileUrl || (async (url) => url);

if (newOptions.collaboration && newOptions.initialContent) {
// eslint-disable-next-line no-console
console.warn(
"When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
);
Expand Down Expand Up @@ -777,6 +778,7 @@ export class BlockNoteEditor<
for (const mark of marks) {
const config = this.schema.styleSchema[mark.type.name];
if (!config) {
// eslint-disable-next-line no-console
console.warn("mark not found in styleschema", mark.type.name);
continue;
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/editor/BlockNoteTipTapEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class BlockNoteTipTapEditor extends TiptapEditor {
this.options.parseOptions
);
} catch (e) {
// eslint-disable-next-line no-console
console.error(
"Error creating document from blocks passed as `initialContent`. Caused by exception: ",
e
Expand Down
2 changes: 2 additions & 0 deletions packages/dev-scripts/examples/gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ async function writeTemplate(project: Project, templateFile: string) {
// try {
// // fs.unlinkSync(targetFilePath);
// } catch (e) {}
// eslint-disable-next-line no-console
console.log("written", targetFilePath);
}

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

for (const project of projects) {
// eslint-disable-next-line no-console
console.log("generating code for example", project);
await generateCodeForExample(project);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ export const FormattingToolbarController = (props: {
{
placement,
middleware: [offset(10), flip()],
onOpenChange: (open, event) => {
console.log("change", event);
onOpenChange: (open, _event) => {
// console.log("change", event);
if (!open) {
editor.formattingToolbar.closeMenu();
editor.focus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ it("has good typing", () => {
suggestionMenuComponent={undefined as any}
getItems={async () => [{ hello: "hello" }]}
onItemClick={(item) => {
// eslint-disable-next-line no-console
console.log(item.hello);
}}
triggerCharacter="/"
/>
);

// prevent typescript unused error
// eslint-disable-next-line no-console
console.log("menu", menu);
});
1 change: 1 addition & 0 deletions packages/react/src/schema/@util/ReactRenderUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export function renderToDOMSpec(

if (!div.childElementCount) {
// TODO
// eslint-disable-next-line no-console
console.warn("ReactInlineContentSpec: renderHTML() failed");
return {
dom: document.createElement("span"),
Expand Down
1 change: 0 additions & 1 deletion playground/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ const App = (props: { project: (typeof examples.basic)["projects"][0] }) => {
React.useEffect(() => {
(async () => {
// load app async
console.log("../../" + props.project.pathFromRoot + "/App.tsx");
const c: any = await modules[
"../../" + props.project.pathFromRoot + "/App.tsx"
]();
Expand Down
6 changes: 2 additions & 4 deletions tests/src/utils/components/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { BlockNoteSchema, filterSuggestionItems } from "@blocknote/core";
import "@blocknote/core/style.css";
import { BlockNoteView } from "@blocknote/mantine";
import "@blocknote/mantine/style.css";
import {
BlockNoteDefaultUI,
SuggestionMenuController,
getDefaultReactSlashMenuItems,
useCreateBlockNote,
} from "@blocknote/react";
import { BlockNoteView } from "@blocknote/mantine";
import "@blocknote/mantine/style.css";

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

console.log(editor);

// Give tests a way to get prosemirror instance
(window as WindowWithProseMirror).ProseMirror = editor?._tiptapEditor;
// editor.insertBlocks([{
Expand Down
1 change: 1 addition & 0 deletions tests/src/utils/customblocks/Alert.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import {
BlockNoteEditor,
BlockSchemaWithBlock,
Expand Down
1 change: 1 addition & 0 deletions tests/src/utils/customblocks/ReactAlert.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import { BlockNoteEditor, defaultProps } from "@blocknote/core";
import { createReactBlockSpec } from "@blocknote/react";
import { useEffect, useState } from "react";
Expand Down
Loading