Skip to content
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

ci: replace eslint with oxlint #1497

Merged
merged 1 commit into from
Sep 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: 0 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"streetsidesoftware.code-spell-checker",
"naumovs.color-highlight",
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"eamodio.gitlens",
"eg2.vscode-npm-scrip",
"gruntfuggly.todo-tree",
Expand Down
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,yaml,yml,md}": ["eslint --fix"]
"**/*.{js,ts,tsx,json,yaml,yml,md}": ["oxlint -c .oxlintrc.json --fix"]
}
6 changes: 6 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"rules": {
"eslint/no-unused-vars": "off",
"no-console": "error"
}
}
8 changes: 4 additions & 4 deletions e2e/cypress/e2e/plugin-automd/plugin.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('keep mark symbol', () => {
it('not a bold', () => {
cy.get('.editor').type('The lunatic is o__"n the grass__')
cy.get('.editor').get('p').should('have.text', 'The lunatic is o__"n the grass__')
cy.isMarkdown('The lunatic is o\\_\\_\"n the grass\\_\\_\n')
cy.isMarkdown('The lunatic is o\\_\\_"n the grass\\_\\_\n')
})

it('escape _', () => {
Expand All @@ -34,19 +34,19 @@ describe('keep mark symbol', () => {
it('italic with _', () => {
cy.get('.editor').type('The lunatic is "_on the grass_"')
cy.get('.editor').get('em').should('have.text', 'on the grass')
cy.isMarkdown('The lunatic is \"_on the grass_\"\n')
cy.isMarkdown('The lunatic is "_on the grass_"\n')
})

it('not an italic', () => {
cy.get('.editor').type('The lunatic is o*"n the grass*')
cy.get('.editor').get('p').should('have.text', 'The lunatic is o*"n the grass*')
cy.isMarkdown('The lunatic is o\\*\"n the grass\\*\n')
cy.isMarkdown('The lunatic is o\\*"n the grass\\*\n')
})

it('italic with *', () => {
cy.get('.editor').type('The lunatic is "*on the grass*"')
cy.get('.editor').get('em').should('have.text', 'on the grass')
cy.isMarkdown('The lunatic is \"*on the grass*\"\n')
cy.isMarkdown('The lunatic is "*on the grass*"\n')
})

it('escape _ in italic', () => {
Expand Down
3 changes: 0 additions & 3 deletions e2e/shim.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-disable vars-on-top */
/* eslint-disable no-var */

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

Expand Down
33 changes: 0 additions & 33 deletions eslint.config.mjs

This file was deleted.

10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test:unit:watch": "vitest",
"test:tsc": "pnpm --filter=@milkdown/* run tsc",
"test:tsc:cache": "nx run-many --target=tsc --all --parallel",
"test:lint": "eslint .",
"test:lint": "oxlint -c .oxlintrc.json",
"test:e2e": "nx e2e @milkdown/e2e",
"test:e2e:build": "nx build @milkdown/e2e",
"test:e2e:debug": "nx open-cypress @milkdown/e2e",
Expand All @@ -31,11 +31,9 @@
"storybook": "pnpm --filter=@milkdown/e2e run storybook"
},
"devDependencies": {
"@antfu/eslint-config": "^2.16.2",
"@changesets/cli": "^2.22.0",
"@commitlint/cli": "^19.0.0",
"@commitlint/config-conventional": "^19.0.0",
"@eslint-react/eslint-plugin": "^1.5.10",
"@nrwl/tao": "19.6.4",
"@nx/cypress": "19.6.4",
"@nx/storybook": "19.6.4",
Expand All @@ -60,13 +58,12 @@
"cross-env": "^7.0.3",
"cypress": "^13.13.0",
"esbuild": "^0.23.0",
"eslint": "^9.0.0",
"eslint-plugin-tailwindcss": "^3.15.1",
"git-cz": "^4.7.6",
"husky": "^9.0.10",
"jsdom": "^25.0.0",
"lint-staged": "^15.0.0",
"nx": "19.6.4",
"oxlint": "^0.9.2",
"pathe": "^1.0.0",
"postcss": "^8.4.38",
"postcss-cli": "^11.0.0",
Expand Down Expand Up @@ -100,8 +97,7 @@
"allowedVersions": {
"react": "18",
"react-dom": "18",
"typescript": "5",
"eslint": "9"
"typescript": "5"
}
},
"overrides": {
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/__internal__/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ export function defIfNotExists(tagName: string, element: CustomElementConstructo
if (current === element)
return

// eslint-disable-next-line no-console
console.warn(`Custom element ${tagName} has been defined before.`)
}
2 changes: 2 additions & 0 deletions packages/core/src/editor/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export class Editor {
/// Remove a plugin or a list of plugins from the editor.
readonly remove = async (plugins: MilkdownPlugin | MilkdownPlugin[]): Promise<Editor> => {
if (this.#status === EditorStatus.OnCreate) {
// eslint-disable-next-line no-console
console.warn('[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code.')
return new Promise((resolve) => {
setTimeout(() => {
Expand Down Expand Up @@ -272,6 +273,7 @@ export class Editor {
/// Make sure you have enabled inspector by `editor.enableInspector()` before calling this method.
readonly inspect = (): Telemetry[] => {
if (!this.#enableInspector) {
// eslint-disable-next-line no-console
console.warn('[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first.')
return []
}
Expand Down
2 changes: 0 additions & 2 deletions packages/integrations/vue/src/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import {
import type { EditorInfoCtx, GetEditor } from './types'
import { useGetEditor } from './useGetEditor'

// eslint-disable-next-line no-unused-expressions
h
// eslint-disable-next-line no-unused-expressions
Fragment

export const editorInfoCtxKey: InjectionKey<EditorInfoCtx> = Symbol('editorInfoCtxKey')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export function serializeForClipboard(view: EditorView, slice: Slice) {
let firstChild = wrap.firstChild
let needsWrap
let wrappers = 0
// eslint-disable-next-line no-cond-assign
while (firstChild && firstChild.nodeType === 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {
for (let i = needsWrap.length - 1; i >= 0; i--) {
const wrapper = doc.createElement(needsWrap[i] as string)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const twemojiPlugin: RemarkPluginRaw<TwemojiOptions> = (twemojiOptions) =
const output: Array<Node & { value: string }> = []
let match
let str = value
// eslint-disable-next-line no-cond-assign
while ((match = regex.exec(str))) {
const { index } = match
const emoji = match[0]
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-math/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ withMeta(mathInlineSchema.node, {
/// Input rule for inline math.
/// When you type $E=MC^2$, it will create an inline math node.
export const mathInlineInputRule = $inputRule(ctx =>
nodeRule(/(?:\$)([^\$]+)(?:\$)$/, mathInlineSchema.type(ctx), {
nodeRule(/(?:\$)([^$]+)(?:\$)$/, mathInlineSchema.type(ctx), {
beforeDispatch: ({ tr, match, start }) => {
tr.insertText(match[1] ?? '', start + 1)
},
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/plugin-prism/src/get-decorations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export function getDecorations(doc: Node, name: string, refractor: Refractor) {
let from = block.pos + 1
const { language } = block.node.attrs
if (!language || !allLanguages.includes(language)) {
// eslint-disable-next-line no-console
console.warn('Unsupported language detected, this language has not been supported by current prism config: ', language)
return
}
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/plugin-upload/src/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const uploadPlugin = $prose((ctx) => {
)
})
.catch((e) => {
// eslint-disable-next-line no-console
console.error(e)
})
return true
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/preset-commonmark/src/mark/inline-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ withMeta(toggleInlineCodeCommand, {

/// Input rule for create inlineCode mark.
export const inlineCodeInputRule = $inputRule((ctx) => {
return markRule(/(?:\`)([^\`]+)(?:\`)$/, inlineCodeSchema.type(ctx))
return markRule(/(?:`)([^`]+)(?:`)$/, inlineCodeSchema.type(ctx))
})

withMeta(inlineCodeInputRule, {
Expand Down
Loading