Skip to content

ci: add eslint to lint errors not supported by oxlint #1812

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 4 commits into from
Apr 14, 2025
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
- name: Run lint
run: pnpm test:lint --format github

- name: Run eslint
run: pnpm test:eslint

unit:
runs-on: ubuntu-latest
needs: install-deps
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ e2e/cypress/downloads

sitemap.xml

.eslintcache

.env
*.local
*.cache
Expand Down
5 changes: 4 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
pnpm-lock.yaml
pnpm-lock.yaml
**/storybook-static
**/lib
**/.storybook
12 changes: 7 additions & 5 deletions dev/src/generate.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { applyEdits, modify } from 'jsonc-parser'
import { Workspace } from './workspace'
import type { Path } from './path'
import { type BuiltInParserName, format } from 'prettier'
import { readFileSync, writeFileSync } from 'node:fs'
import { Logger } from './logger'
import { type BuiltInParserName, format } from 'prettier'

import type { Package } from './package'
import type { Path } from './path'

import { Logger } from './logger'
import { Workspace } from './workspace'

export function generateTsConfig() {
const generator = new Generator()
generator.run()
generator.run().catch(console.error)
}

export class Generator {
Expand Down
5 changes: 3 additions & 2 deletions dev/src/package.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { readFileSync } from 'node:fs'
import { parse } from 'node:path'

import { Path } from './path'
import type { PackageItem } from './pnpm'
import type { CommonPackageJsonContent } from './types'
import type { Workspace } from './workspace'
import type { PackageItem } from './pnpm'

import { Path } from './path'
import { pnpmList } from './pnpm'

export function readPackageJson(path: Path): CommonPackageJsonContent {
Expand Down
3 changes: 2 additions & 1 deletion dev/src/vite.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { BuildOptions, UserConfig } from 'vite'

import { readFileSync } from 'node:fs'
import { basename, dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import type { BuildOptions, UserConfig } from 'vite'
import { defineConfig } from 'vite'

import globalPackageJson from '../../package.json' with { type: 'json' }
Expand Down
3 changes: 2 additions & 1 deletion dev/src/workspace.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { CommonPackageJsonContent } from './types'

import { Logger } from './logger'
import { Package, readPackageJson } from './package'
import { ProjectRoot } from './path'
import type { CommonPackageJsonContent } from './types'
import { pnpmList } from './pnpm'

class CircularDependenciesError extends Error {
Expand Down
1 change: 1 addition & 0 deletions e2e/entry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { resolve } from 'node:path'

import { cases } from './src/data'

const data = cases.reduce(
Expand Down
2 changes: 1 addition & 1 deletion e2e/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import process from 'node:process'
import { defineConfig, devices } from '@playwright/test'
import process from 'node:process'

/**
* Read environment variables from file.
Expand Down
4 changes: 2 additions & 2 deletions e2e/shim.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/// <reference types="vite/client" />

import type { Editor } from '@milkdown/core'
import type { EditorView } from '@milkdown/prose/view'
import type { Telemetry } from '@milkdown/ctx'
import type { Crepe } from '@milkdown/crepe'
import type { Telemetry } from '@milkdown/ctx'
import type { EditorView } from '@milkdown/prose/view'

declare global {
var __milkdown__: Editor
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/crepe/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ setup(async () => {
globalThis.__afterCrepeCreated__(crepe)
}
return crepe.editor
})
}).catch(console.error)
2 changes: 2 additions & 0 deletions e2e/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import './style.css'

import { c, html } from 'atomico'

import { cases } from './data'

function App() {
Expand Down
24 changes: 14 additions & 10 deletions e2e/src/multi-editor/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Editor, rootCtx } from '@milkdown/core'
import { nord } from '@milkdown/theme-nord'
import { commonmark } from '@milkdown/preset-commonmark'
import { history } from '@milkdown/plugin-history'
import { commonmark } from '@milkdown/preset-commonmark'
import { gfm, insertTableCommand } from '@milkdown/preset-gfm'
import { nord } from '@milkdown/theme-nord'
import { callCommand } from '@milkdown/utils'

import { setup } from '../utils'
Expand All @@ -22,11 +22,13 @@ setup(() => {
.use(gfm)
.use(history)
.create()
}).then((editor1) => {
globalThis.commands.addTable = () => {
editor1.action(callCommand(insertTableCommand.key))
}
})
.then((editor1) => {
globalThis.commands.addTable = () => {
editor1.action(callCommand(insertTableCommand.key))
}
})
.catch(console.error)

setup(() => {
return Editor.make()
Expand All @@ -39,8 +41,10 @@ setup(() => {
.use(gfm)
.use(history)
.create()
}).then((editor2) => {
globalThis.commands.addTable2 = () => {
editor2.action(callCommand(insertTableCommand.key))
}
})
.then((editor2) => {
globalThis.commands.addTable2 = () => {
editor2.action(callCommand(insertTableCommand.key))
}
})
.catch(console.error)
8 changes: 4 additions & 4 deletions e2e/src/plugin-automd/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Editor, rootCtx } from '@milkdown/core'
import { nord } from '@milkdown/theme-nord'
import { listener, listenerCtx } from '@milkdown/plugin-listener'
import { automd } from '@milkdown/plugin-automd'
import { listener, listenerCtx } from '@milkdown/plugin-listener'
import { commonmark, markInputRules } from '@milkdown/preset-commonmark'
import { markInputRules as GFMMarkInputRules, gfm } from '@milkdown/preset-gfm'
import { nord } from '@milkdown/theme-nord'

import { setup } from '../utils'

Expand All @@ -16,7 +16,7 @@ setup(() => {
.config((ctx) => {
ctx.set(rootCtx, document.getElementById('app'))
ctx.get(listenerCtx).markdownUpdated((_, markdown) => {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.log(markdown)
})
})
Expand All @@ -26,4 +26,4 @@ setup(() => {
.use(listener)
.use(automd)
.create()
})
}).catch(console.error)
8 changes: 4 additions & 4 deletions e2e/src/plugin-listener/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Editor, defaultValueCtx, rootCtx } from '@milkdown/core'
import { nord } from '@milkdown/theme-nord'
import { commonmark } from '@milkdown/preset-commonmark'
import { listener, listenerCtx } from '@milkdown/plugin-listener'
import { commonmark } from '@milkdown/preset-commonmark'
import { nord } from '@milkdown/theme-nord'

import { setup } from '../utils'

Expand All @@ -15,12 +15,12 @@ setup(() => {
ctx.set(rootCtx, document.getElementById('app'))
ctx.set(defaultValueCtx, 'test')
ctx.get(listenerCtx).markdownUpdated((_, markdown, prevMarkdown) => {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.log(markdown, prevMarkdown)
})
})
.config(nord)
.use(commonmark)
.use(listener)
.create()
})
}).catch(console.error)
27 changes: 15 additions & 12 deletions e2e/src/preset-commonmark/main.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Editor, rootCtx } from '@milkdown/core'
import { nord } from '@milkdown/theme-nord'
import { clipboard } from '@milkdown/plugin-clipboard'
import { history } from '@milkdown/plugin-history'
import {
commonmark,
toggleEmphasisCommand,
toggleStrongCommand,
} from '@milkdown/preset-commonmark'
import { clipboard } from '@milkdown/plugin-clipboard'
import { history } from '@milkdown/plugin-history'
import { nord } from '@milkdown/theme-nord'
import { callCommand } from '@milkdown/utils'

import { setup } from '../utils'
Expand All @@ -27,13 +27,16 @@ setup(() => {
.use(clipboard)
.create()

editor.then((instance) => {
globalThis.commands.toggleStrong = () => {
instance.action(callCommand(toggleStrongCommand.key))
}
globalThis.commands.toggleEmphasis = () => {
instance.action(callCommand(toggleEmphasisCommand.key))
}
})
editor
.then((instance) => {
globalThis.commands.toggleStrong = () => {
instance.action(callCommand(toggleStrongCommand.key))
}
globalThis.commands.toggleEmphasis = () => {
instance.action(callCommand(toggleEmphasisCommand.key))
}
})
.catch(console.error)

return editor
})
}).catch(console.error)
6 changes: 3 additions & 3 deletions e2e/src/preset-gfm/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Editor, rootCtx } from '@milkdown/core'
import { nord } from '@milkdown/theme-nord'
import { commonmark } from '@milkdown/preset-commonmark'
import { history } from '@milkdown/plugin-history'
import { commonmark } from '@milkdown/preset-commonmark'
import { gfm } from '@milkdown/preset-gfm'
import { nord } from '@milkdown/theme-nord'

import { setup } from '../utils'

Expand All @@ -21,4 +21,4 @@ setup(() => {
.use(gfm)
.use(history)
.create()
})
}).catch(console.error)
5 changes: 3 additions & 2 deletions e2e/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Editor } from '@milkdown/core'

import { editorViewCtx, parserCtx, serializerCtx } from '@milkdown/core'
import { Slice } from '@milkdown/prose/model'

Expand Down Expand Up @@ -33,13 +34,13 @@ export async function setup(createEditor: () => Promise<Editor>) {

const logButton = document.querySelector<HTMLDivElement>('#log')
if (logButton) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
logButton.onclick = () => console.log(globalThis.__getMarkdown__())
}

const inspectButton = document.querySelector<HTMLDivElement>('#inspect')
if (inspectButton) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
inspectButton.onclick = () => console.log(globalThis.__inspect__())
}
return editor
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/command/bold.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor, loadFixture, selectAll, setMarkdown } from '../misc'

test.beforeEach(async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/crepe/latex.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor, getMarkdown } from '../misc'

test.beforeEach(async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/crepe/listener.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor } from '../misc'

test('listen change before editor is created', async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/input/blockquote.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor, getMarkdown } from '../misc'

test.beforeEach(async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/input/bold.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor, getMarkdown } from '../misc'

test.beforeEach(async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/input/bullet-list.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor, getMarkdown } from '../misc'

test.beforeEach(async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/input/code-block.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor, getMarkdown } from '../misc'

test.beforeEach(async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/input/code-inline.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor, getMarkdown } from '../misc'

test.beforeEach(async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/input/heading.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor, getMarkdown, waitNextFrame } from '../misc'

test.beforeEach(async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/input/hr.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor, getMarkdown } from '../misc'

test.beforeEach(async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/input/italic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor, getMarkdown } from '../misc'

test.beforeEach(async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/input/ordered-list.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor, getMarkdown } from '../misc'

test.beforeEach(async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/input/paragraph.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor, getMarkdown } from '../misc'

test.beforeEach(async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/input/strike-through.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor } from '../misc'

test.beforeEach(async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/input/table.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor, pressMetaKey } from '../misc'

test.beforeEach(async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/input/task-list.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test'

import { focusEditor } from '../misc'

test.beforeEach(async ({ page }) => {
Expand Down
Loading