Skip to content

Commit

Permalink
fix(deps): update dependency @antfu/eslint-config to v1 (#56)
Browse files Browse the repository at this point in the history
* fix(deps): update dependency @antfu/eslint-config to v1

* chore: upgrade eslint

* chore: fix e2e

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Mirone <Saul-Mirone@outlook.com>
  • Loading branch information
renovate[bot] and Saul-Mirone authored Nov 2, 2023
1 parent 3b74d4c commit d189139
Show file tree
Hide file tree
Showing 48 changed files with 701 additions and 511 deletions.
38 changes: 0 additions & 38 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"**/*.{js,ts,tsx,json,md,yml,yaml}": ["eslint --fix"]
"**/*.{js,ts,tsx,json,md,yml,yaml}": ["eslint --fix"]
}
7 changes: 0 additions & 7 deletions .prettierrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion e2e/src/createEditorView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { EditorState } from 'prosemirror-state'
import type { NodeViewConstructor } from 'prosemirror-view'
import { EditorView } from 'prosemirror-view'

export const createEditorView = (element: HTMLElement | ShadowRoot, nodeViews: Record<string, NodeViewConstructor>, plugins: Plugin[]) => {
export function createEditorView(element: HTMLElement | ShadowRoot, nodeViews: Record<string, NodeViewConstructor>, plugins: Plugin[]) {
const content = document.querySelector('#content')
if (!content)
throw new Error('Content element not found')
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/react/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { StrictMode, useState } from 'react'

import { Editor } from './components/Editor'

export const App = () => {
export function App() {
const [counter, setCounter] = useState(0)
return (
<StrictMode>
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/react/components/Hashes.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Copyright 2021, Prosemirror Adapter by Mirone. */
import { useWidgetViewContext } from '@prosemirror-adapter/react'

export const Hashes = () => {
export function Hashes() {
const { spec } = useWidgetViewContext()
const level = spec?.level
const hashes = Array(level || 0).fill('#').join('')
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/react/components/Heading.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Copyright 2021, Prosemirror Adapter by Mirone. */
import { useNodeViewContext } from '@prosemirror-adapter/react'

export const Heading = () => {
export function Heading() {
const { contentRef, node } = useNodeViewContext()
const Tag = `h${node.attrs.level}` as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
return <Tag ref={contentRef} />
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/react/components/Paragraph.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Copyright 2021, Prosemirror Adapter by Mirone. */
import { useNodeViewContext } from '@prosemirror-adapter/react'

export const Paragraph = () => {
export function Paragraph() {
const { contentRef, selected } = useNodeViewContext()
return <div style={{ outline: selected ? 'blue solid 1px' : 'none' }} role="presentation" ref={contentRef} />
}
10 changes: 8 additions & 2 deletions e2e/src/react/components/Size.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@

import { usePluginViewContext } from '@prosemirror-adapter/react'

export const Size = () => {
export function Size() {
const { view } = usePluginViewContext()
const size = view.state.doc.nodeSize
return <div data-test-id="size-view-plugin">Size for document: {size}</div>
return (
<div data-test-id="size-view-plugin">
Size for document:
{' '}
{size}
</div>
)
}
2 changes: 0 additions & 2 deletions e2e/src/vue/shim.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* Copyright 2021, Prosemirror Adapter by Mirone. */

/* eslint-disable @typescript-eslint/ban-types */

/// <reference types="vite/client" />

declare module '*.vue' {
Expand Down
4 changes: 2 additions & 2 deletions e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"sourceMap": false,
"noEmit": true
"noEmit": true,
"sourceMap": false
}
}
60 changes: 60 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/* Copyright 2021, Prosemirror Adapter by Mirone. */

const antfu = require('@antfu/eslint-config').default
const header = require('eslint-plugin-header')
const react = require('eslint-plugin-react')
const hooks = require('eslint-plugin-react-hooks')

module.exports = antfu(
{
stylistic: true,
markdown: false,
typescript: {
tsconfigPath: 'tsconfig.json',
},
ignores: [
'.idea',
'**/lib',
'**/.svelte-kit',
'CHANGELOG.md',
],
overrides: {
typescript: {
'ts/no-unsafe-assignment': 'off',
'ts/no-unsafe-member-access': 'off',
'ts/no-unsafe-argument': 'off',
'ts/no-unsafe-call': 'off',
'ts/no-unsafe-return': 'off',
'ts/unbound-method': 'off',
'ts/ban-types': 'off',
},
},
},
{
files: ['**/*.ts', '**/*.tsx'],
plugins: {
header,
},
rules: {
'header/header': ['error', 'block', ' Copyright 2021, Prosemirror Adapter by Mirone. '],
},
},
{
files: ['**/react/**/*.tsx', '**/react/**/*.ts'],
plugins: {
'react': react,
'react-hooks': hooks,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
...react.configs.recommended.rules,
...hooks.configs.recommended.rules,
'jsx-quotes': ['error', 'prefer-double'],
'react/react-in-jsx-scope': 'off',
},
},
)
2 changes: 1 addition & 1 deletion examples/lit/src/createEditorView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { EditorState } from 'prosemirror-state'
import type { NodeViewConstructor } from 'prosemirror-view'
import { EditorView } from 'prosemirror-view'

export const createEditorView = (element: HTMLElement, nodeViews: Record<string, NodeViewConstructor>, plugins: Plugin[]) => {
export function createEditorView(element: HTMLElement, nodeViews: Record<string, NodeViewConstructor>, plugins: Plugin[]) {
const content = document.querySelector('#content')
if (!content)
throw new Error('Content element not found')
Expand Down
14 changes: 7 additions & 7 deletions examples/lit/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"compilerOptions": {
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"experimentalDecorators": true,
"useDefineForClassFields": false,
"experimentalDecorators": true,
"module": "ESNext",
"moduleResolution": "Node",
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "./types",
"isolatedModules": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "./types",
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"skipLibCheck": true
},
"references": [{ "path": "./tsconfig.node.json" }],
Expand Down
2 changes: 1 addition & 1 deletion examples/react/components/Hashes.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Copyright 2021, Prosemirror Adapter by Mirone. */
import { useWidgetViewContext } from '@prosemirror-adapter/react'

export const Hashes = () => {
export function Hashes() {
const { spec } = useWidgetViewContext()
const level = spec?.level
const hashes = Array(level || 0).fill('#').join('')
Expand Down
2 changes: 1 addition & 1 deletion examples/react/components/Heading.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Copyright 2021, Prosemirror Adapter by Mirone. */
import { useNodeViewContext } from '@prosemirror-adapter/react'

export const Heading = () => {
export function Heading() {
const { contentRef, node } = useNodeViewContext()
const Tag = `h${node.attrs.level}` as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
return <Tag ref={contentRef} />
Expand Down
2 changes: 1 addition & 1 deletion examples/react/components/Paragraph.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Copyright 2021, Prosemirror Adapter by Mirone. */
import { useNodeViewContext } from '@prosemirror-adapter/react'

export const Paragraph = () => {
export function Paragraph() {
const { contentRef, selected } = useNodeViewContext()
return <div style={{ outline: selected ? 'blue solid 1px' : 'none' }} role="presentation" ref={contentRef} />
}
9 changes: 7 additions & 2 deletions examples/react/components/Size.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
/* Copyright 2021, Prosemirror Adapter by Mirone. */
import { usePluginViewContext } from '@prosemirror-adapter/react'

export const Size = () => {
export function Size() {
const { view } = usePluginViewContext()
const size = view.state.doc.nodeSize
return <div>Size for document: {size}</div>
return (
<div>
Size for document:
{size}
</div>
)
}
2 changes: 1 addition & 1 deletion examples/react/createEditorView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { EditorState } from 'prosemirror-state'
import type { NodeViewConstructor } from 'prosemirror-view'
import { EditorView } from 'prosemirror-view'

export const createEditorView = (element: HTMLElement, nodeViews: Record<string, NodeViewConstructor>, plugins: Plugin[]) => {
export function createEditorView(element: HTMLElement, nodeViews: Record<string, NodeViewConstructor>, plugins: Plugin[]) {
const content = document.querySelector('#content')
if (!content)
throw new Error('Content element not found')
Expand Down
12 changes: 6 additions & 6 deletions examples/react/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ if (!root$)
const root = createRoot(root$)

root.render(
<StrictMode>
<h1>Prosemirror Adapter React</h1>
<ProsemirrorAdapterProvider>
<Editor />
</ProsemirrorAdapterProvider>
</StrictMode>,
<StrictMode>
<h1>Prosemirror Adapter React</h1>
<ProsemirrorAdapterProvider>
<Editor />
</ProsemirrorAdapterProvider>
</StrictMode>,
)
2 changes: 1 addition & 1 deletion examples/svelte/src/libs/createEditorView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { EditorState } from 'prosemirror-state'
import type { NodeViewConstructor } from 'prosemirror-view'
import { EditorView } from 'prosemirror-view'

export const createEditorView = (element: HTMLElement, nodeViews: Record<string, NodeViewConstructor>, plugins: Plugin[]) => {
export function createEditorView(element: HTMLElement, nodeViews: Record<string, NodeViewConstructor>, plugins: Plugin[]) {
const content = document.querySelector('#content')
if (!content)
throw new Error('Content element not found')
Expand Down
2 changes: 1 addition & 1 deletion examples/svelte/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"resolveJsonModule": true,
"allowJs": true,
"checkJs": true,
"strict": true,
"sourceMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
Expand Down
2 changes: 1 addition & 1 deletion examples/vue/createEditorView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { EditorState } from 'prosemirror-state'
import type { NodeViewConstructor } from 'prosemirror-view'
import { EditorView } from 'prosemirror-view'

export const createEditorView = (element: HTMLElement, nodeViews: Record<string, NodeViewConstructor>, plugins: Plugin[]) => {
export function createEditorView(element: HTMLElement, nodeViews: Record<string, NodeViewConstructor>, plugins: Plugin[]) {
const content = document.querySelector('#content')
if (!content)
throw new Error('Content element not found')
Expand Down
2 changes: 0 additions & 2 deletions examples/vue/shim.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* Copyright 2021, Prosemirror Adapter by Mirone. */

/* eslint-disable @typescript-eslint/ban-types */

/// <reference types="vite/client" />

declare module '*.vue' {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"prepare": "husky install"
},
"dependencies": {
"@antfu/eslint-config": "^0.43.0",
"@antfu/eslint-config": "^1.0.0",
"@changesets/cli": "^2.26.1",
"@commitlint/cli": "^18.0.0",
"@commitlint/config-conventional": "^18.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/lit/src/LitRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface LitRendererResult {
readonly removeLitRenderer: (renderer: LitRenderer<unknown>) => void
}

export const useLitRenderer = (): LitRendererResult => {
export function useLitRenderer(): LitRendererResult {
const portals = new Map<string, LitElement>()

const renderLitRenderer = (renderer: LitRenderer<unknown>) => {
Expand Down
5 changes: 1 addition & 4 deletions packages/lit/src/nodeView/useLitNodeViewCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import type { LitRendererResult } from '../LitRenderer'
import type { NodeViewFactory } from './nodeViewContext'
import { LitNodeView } from './LitNodeView'

export const useLitNodeViewCreator = (
renderLitRenderer: LitRendererResult['renderLitRenderer'],
removeLitRenderer: LitRendererResult['removeLitRenderer'],
) => {
export function useLitNodeViewCreator(renderLitRenderer: LitRendererResult['renderLitRenderer'], removeLitRenderer: LitRendererResult['removeLitRenderer']) {
const createLitNodeView: NodeViewFactory = options => (node, view, getPos, decorations, innerDecorations) => {
const nodeView = new LitNodeView({
node,
Expand Down
5 changes: 1 addition & 4 deletions packages/lit/src/pluginView/useLitPluginViewCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import type { LitRendererResult } from '../LitRenderer'
import type { PluginViewFactory } from './pluginViewContext'
import { LitPluginView } from './LitPluginView'

export const useLitPluginViewCreator = (
renderLitRenderer: LitRendererResult['renderLitRenderer'],
removeLitRenderer: LitRendererResult['removeLitRenderer'],
) => {
export function useLitPluginViewCreator(renderLitRenderer: LitRendererResult['renderLitRenderer'], removeLitRenderer: LitRendererResult['removeLitRenderer']) {
const createLitPluginView: PluginViewFactory = options => (view) => {
const pluginView = new LitPluginView({
view,
Expand Down
5 changes: 1 addition & 4 deletions packages/lit/src/widgetView/useLitWidgetViewCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import type { LitRendererResult } from '../LitRenderer'
import { LitWidgetView } from './LitWidgetView'
import type { LitWidgetViewUserOptions } from './LitWidgetViewOptions'

export const useLitWidgetViewCreator = (
renderLitRenderer: LitRendererResult['renderLitRenderer'],
removeLitRenderer: LitRendererResult['removeLitRenderer'],
) => {
export function useLitWidgetViewCreator(renderLitRenderer: LitRendererResult['renderLitRenderer'], removeLitRenderer: LitRendererResult['removeLitRenderer']) {
const createWidgetPluginView = (options: LitWidgetViewUserOptions): WidgetDecorationFactory => {
return (pos, userSpec = {}) => {
const widgetView = new LitWidgetView({
Expand Down
Loading

0 comments on commit d189139

Please sign in to comment.