diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index c2c0cfd..0000000 --- a/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -/auto-imports.d.ts diff --git a/auto-imports.d.ts b/auto-imports.d.ts deleted file mode 100644 index 13dd447..0000000 --- a/auto-imports.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable */ -/* prettier-ignore */ -// @ts-nocheck -// noinspection JSUnusedGlobalSymbols -// Generated by unplugin-auto-import -export {} -declare global { - const afterAll: typeof import('vitest')['afterAll'] - const afterEach: typeof import('vitest')['afterEach'] - const assert: typeof import('vitest')['assert'] - const beforeAll: typeof import('vitest')['beforeAll'] - const beforeEach: typeof import('vitest')['beforeEach'] - const chai: typeof import('vitest')['chai'] - const describe: typeof import('vitest')['describe'] - const expect: typeof import('vitest')['expect'] - const it: typeof import('vitest')['it'] - const suite: typeof import('vitest')['suite'] - const test: typeof import('vitest')['test'] - const vi: typeof import('vitest')['vi'] - const vitest: typeof import('vitest')['vitest'] -} diff --git a/package.json b/package.json index 75ddfed..2562ece 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "release": "run-s build release:only", "release:only": "changeset publish", "version": "changeset version && yarn --no-immutable", - "test": "vitest run --coverage --passWithNoTests", + "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest", "typecov": "type-coverage" }, "devDependencies": { @@ -34,21 +34,24 @@ "@types/acorn": "^6.0.0", "@types/eslint": "^8.56.0", "@types/eslint-plugin-markdown": "^2.0.2", + "@types/jest": "^29.5.11", "@types/node": "^20.10.6", "@types/react": "^18.2.46", "@types/unist": "^3.0.2", - "@vitest/coverage-istanbul": "^1.1.1", + "cross-env": "^7.0.3", "eslint": "^8.56.0", + "jest": "^30.0.0-alpha.2", "lint-staged": "^15.2.0", "npm-run-all2": "^6.1.1", "patch-package": "^8.0.0", + "prettier": "^3.1.1", "react": "^18.2.0", "rimraf": "^5.0.5", "simple-git-hooks": "^2.9.0", + "ts-jest": "^29.1.1", + "ts-node": "^10.9.2", "type-coverage": "^2.27.1", - "typescript": "^5.3.3", - "unplugin-auto-import": "^0.17.3", - "vitest": "^1.1.1" + "typescript": "^5.3.3" }, "resolutions": { "@types/acorn": "^6.0.0", @@ -75,10 +78,28 @@ "fixtures", "lib", "CHANGELOG.md", - "/auto-imports.d.ts", "/test.*", "!/.*.js" ], + "jest": { + "preset": "ts-jest", + "setupFiles": [ + "/node_modules/eslint/lib/linter/linter.js" + ], + "moduleNameMapper": { + "^eslint-mdx$": "/packages/eslint-mdx/src", + "^eslint-plugin-mdx$": "/packages/eslint-plugin-mdx/src" + }, + "collectCoverage": true, + "coverageThreshold": { + "global": { + "branches": 100, + "functions": 100, + "lines": 100, + "statements": 100 + } + } + }, "prettier": "@1stg/prettier-config", "remarkConfig": { "plugins": [ diff --git a/packages/eslint-mdx/src/parser.ts b/packages/eslint-mdx/src/parser.ts index 965e1a5..84a4d99 100644 --- a/packages/eslint-mdx/src/parser.ts +++ b/packages/eslint-mdx/src/parser.ts @@ -62,9 +62,6 @@ export class Parser { ignoreRemarkConfig, }) } catch (err: unknown) { - if (process.argv.includes('--debug')) { - console.error(err) - } const { message, line, column, place } = err as VFileMessage const point = place && ('start' in place ? place.start : place) throw Object.assign( diff --git a/packages/eslint-plugin-mdx/src/configs/recommended.ts b/packages/eslint-plugin-mdx/src/configs/recommended.ts index 9242fcc..cc62987 100644 --- a/packages/eslint-plugin-mdx/src/configs/recommended.ts +++ b/packages/eslint-plugin-mdx/src/configs/recommended.ts @@ -65,6 +65,7 @@ const addPrettierRules = () => { return } + /* istanbul ignore next */ overrides.push( { files: '*.md', diff --git a/test/__snapshots__/fixtures.test.ts.snap b/test/__snapshots__/fixtures.test.ts.snap index 1af3a57..7a80e93 100644 --- a/test/__snapshots__/fixtures.test.ts.snap +++ b/test/__snapshots__/fixtures.test.ts.snap @@ -1,6 +1,6 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +// Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`fixtures > lint code blocks > should work as expected > code-blocks.md 1`] = ` +exports[`fixtures lint code blocks should work as expected: code-blocks.md 1`] = ` [ { "column": 1, @@ -104,7 +104,7 @@ exports[`fixtures > lint code blocks > should work as expected > code-blocks.md ] `; -exports[`fixtures > lint code blocks > should work as expected > code-blocks.md 2`] = ` +exports[`fixtures lint code blocks should work as expected: code-blocks.md 2`] = ` "# abc # abc @@ -159,7 +159,7 @@ import React from 'react' " `; -exports[`fixtures > lint code blocks > should work as expected > code-blocks.mdx 1`] = ` +exports[`fixtures lint code blocks should work as expected: code-blocks.mdx 1`] = ` [ { "column": 1, @@ -218,7 +218,7 @@ exports[`fixtures > lint code blocks > should work as expected > code-blocks.mdx ] `; -exports[`fixtures > lint code blocks > should work as expected > code-blocks.mdx 2`] = ` +exports[`fixtures lint code blocks should work as expected: code-blocks.mdx 2`] = ` "\`\`\`js let a @@ -231,9 +231,9 @@ export { c } " `; -exports[`fixtures > should match all snapshots > 287.mdx 1`] = `[]`; +exports[`fixtures should match all snapshots: 287.mdx 1`] = `[]`; -exports[`fixtures > should match all snapshots > 292.mdx 1`] = ` +exports[`fixtures should match all snapshots: 292.mdx 1`] = ` [ { "column": 9, @@ -270,7 +270,7 @@ exports[`fixtures > should match all snapshots > 292.mdx 1`] = ` ] `; -exports[`fixtures > should match all snapshots > 292.mdx 2`] = ` +exports[`fixtures should match all snapshots: 292.mdx 2`] = ` "# Header paragraph
content
@@ -285,13 +285,13 @@ paragraph
content
" `; -exports[`fixtures > should match all snapshots > 334.mdx 1`] = `[]`; +exports[`fixtures should match all snapshots: 334.mdx 1`] = `[]`; -exports[`fixtures > should match all snapshots > 336.mdx 1`] = `[]`; +exports[`fixtures should match all snapshots: 336.mdx 1`] = `[]`; -exports[`fixtures > should match all snapshots > 367.mdx 1`] = `[]`; +exports[`fixtures should match all snapshots: 367.mdx 1`] = `[]`; -exports[`fixtures > should match all snapshots > 371.mdx 1`] = ` +exports[`fixtures should match all snapshots: 371.mdx 1`] = ` [ { "column": 13, @@ -314,7 +314,7 @@ exports[`fixtures > should match all snapshots > 371.mdx 1`] = ` ] `; -exports[`fixtures > should match all snapshots > 371.mdx 2`] = ` +exports[`fixtures should match all snapshots: 371.mdx 2`] = ` "# Hello, World!
@@ -329,7 +329,7 @@ function foo() { " `; -exports[`fixtures > should match all snapshots > 380.mdx 1`] = ` +exports[`fixtures should match all snapshots: 380.mdx 1`] = ` [ { "column": 3, @@ -634,7 +634,7 @@ exports[`fixtures > should match all snapshots > 380.mdx 1`] = ` ] `; -exports[`fixtures > should match all snapshots > 380.mdx 2`] = ` +exports[`fixtures should match all snapshots: 380.mdx 2`] = ` "import { FormsModule } from '@angular/forms' import { Canvas, Meta, Story } from '@storybook/addon-docs' import { moduleMetadata } from '@storybook/angular' @@ -1049,7 +1049,7 @@ interface TabChangeEvent { " `; -exports[`fixtures > should match all snapshots > 391.mdx 1`] = ` +exports[`fixtures should match all snapshots: 391.mdx 1`] = ` [ { "column": 2, @@ -1065,9 +1065,9 @@ exports[`fixtures > should match all snapshots > 391.mdx 1`] = ` ] `; -exports[`fixtures > should match all snapshots > 391.mdx 2`] = `undefined`; +exports[`fixtures should match all snapshots: 391.mdx 2`] = `undefined`; -exports[`fixtures > should match all snapshots > 429.mdx 1`] = ` +exports[`fixtures should match all snapshots: 429.mdx 1`] = ` [ { "column": 17, @@ -1090,14 +1090,14 @@ exports[`fixtures > should match all snapshots > 429.mdx 1`] = ` ] `; -exports[`fixtures > should match all snapshots > 429.mdx 2`] = ` +exports[`fixtures should match all snapshots: 429.mdx 2`] = ` "