Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jun 1, 2022
1 parent 0ecce67 commit 08ac903
Show file tree
Hide file tree
Showing 24 changed files with 79 additions and 74 deletions.
2 changes: 1 addition & 1 deletion cypress/plugins/index.js
Expand Up @@ -15,7 +15,7 @@
/**
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line no-unused-vars

// eslint-disable-next-line @typescript-eslint/no-unused-vars
module.exports = (on, config) => {

Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -2,6 +2,9 @@
"version": "0.32.3",
"private": true,
"packageManager": "pnpm@7.1.7",
"engines": {
"node": ">=14.0.0"
},
"scripts": {
"build": "pnpm -r --filter=./packages/** run build",
"ci:publish": "zx scripts/publish.mjs",
Expand Down Expand Up @@ -70,8 +73,5 @@
"{packages,.vitepress,scripts}/**/*.{js,ts,vue,json}": [
"eslint --fix"
]
},
"engines": {
"node": ">=14.0.0"
}
}
2 changes: 0 additions & 2 deletions packages/client/builtin/Monaco.vue
Expand Up @@ -74,11 +74,9 @@ onMounted(() => {
'allow-top-navigation-by-user-activation',
].join(' '))
/* eslint-disable no-undef */
frame.src = __DEV__
? `${location.origin}${__SLIDEV_CLIENT_ROOT__}/iframes/monaco/index.html`
: `${import.meta.env.BASE_URL}iframes/monaco/index.html`
/* eslint-enable no-undef */
frame.style.backgroundColor = 'transparent'
Expand Down
2 changes: 1 addition & 1 deletion packages/client/builtin/RenderWhen.vue
Expand Up @@ -13,7 +13,7 @@ const { context } = props
const currentContext = inject(injectionSlideContext)
const shouldRender = computed(() => context instanceof Array ? context.some(contextMatch) : contextMatch(context))
const shouldRender = computed(() => Array.isArray(context) ? context.some(contextMatch) : contextMatch(context))
function contextMatch(context: Context) {
if (context === currentContext)
Expand Down
4 changes: 2 additions & 2 deletions packages/client/internals/Play.vue
Expand Up @@ -48,8 +48,8 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
:scale="slideScale"
@pointerdown="onClick"
>
<template #>
<SlidesShow context="slidesshow" />
<template #default>
<SlidesShow context="slide" />
</template>
<template #controls>
<div
Expand Down
4 changes: 2 additions & 2 deletions packages/client/internals/Presenter.vue
Expand Up @@ -52,7 +52,7 @@ const nextSlide = computed(() => {
}
})
// sync presenter cusor
// sync presenter cursor
onMounted(() => {
const slidesContainer = main.value!.querySelector('#slide-content')!
const mouse = reactive(useMouse())
Expand Down Expand Up @@ -102,7 +102,7 @@ onMounted(() => {
key="main"
class="h-full w-full"
>
<template #>
<template #default>
<SlidesShow context="presenter" />
</template>
</SlideContainer>
Expand Down
2 changes: 0 additions & 2 deletions packages/client/shim.d.ts
@@ -1,5 +1,3 @@
/* eslint-disable import/no-duplicates */

declare interface Window {
// extend the window
}
Expand Down
1 change: 0 additions & 1 deletion packages/create-app/index.js
@@ -1,6 +1,5 @@
#!/usr/bin/env node
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-var-requires */

// @ts-check
const fs = require('fs')
Expand Down
14 changes: 7 additions & 7 deletions packages/create-app/package.json
Expand Up @@ -2,19 +2,22 @@
"name": "create-slidev",
"version": "0.32.3",
"description": "Create starter template for Slidev",
"homepage": "https://sli.dev",
"bugs": "https://github.com/slidevjs/slidev/issues",
"license": "MIT",
"author": "antfu <anthonyfu117@hotmail.com>",
"license": "MIT",
"funding": "https://github.com/sponsors/antfu",
"homepage": "https://sli.dev",
"repository": {
"type": "git",
"url": "https://github.com/slidevjs/slidev"
},
"funding": "https://github.com/sponsors/antfu",
"bugs": "https://github.com/slidevjs/slidev/issues",
"main": "index.js",
"bin": {
"create-slidev": "index.js"
},
"engines": {
"node": ">=14.0.0"
},
"scripts": {
"build": "cp ../../demo/starter/slides.md template/slides.md",
"prepublishOnly": "npm run build"
Expand All @@ -24,8 +27,5 @@
"kolorist": "^1.5.1",
"minimist": "^1.2.6",
"prompts": "^2.4.2"
},
"engines": {
"node": ">=14.0.0"
}
}
1 change: 0 additions & 1 deletion packages/create-theme/index.js
@@ -1,6 +1,5 @@
#!/usr/bin/env node
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-var-requires */

// @ts-check
const fs = require('fs')
Expand Down
14 changes: 7 additions & 7 deletions packages/create-theme/package.json
Expand Up @@ -2,25 +2,25 @@
"name": "create-slidev-theme",
"version": "0.32.3",
"description": "Create starter theme template for Slidev",
"homepage": "https://sli.dev",
"bugs": "https://github.com/slidevjs/slidev/issues",
"license": "MIT",
"author": "antfu <anthonyfu117@hotmail.com>",
"license": "MIT",
"funding": "https://github.com/sponsors/antfu",
"homepage": "https://sli.dev",
"repository": {
"type": "git",
"url": "https://github.com/slidevjs/slidev"
},
"funding": "https://github.com/sponsors/antfu",
"bugs": "https://github.com/slidevjs/slidev/issues",
"main": "index.js",
"bin": {
"create-slidev-theme": "index.js"
},
"engines": {
"node": ">=14.0.0"
},
"dependencies": {
"kolorist": "^1.5.1",
"minimist": "^1.2.6",
"prompts": "^2.4.2"
},
"engines": {
"node": ">=14.0.0"
}
}
8 changes: 4 additions & 4 deletions packages/create-theme/template/package.json
Expand Up @@ -3,6 +3,10 @@
"slidev-theme",
"slidev"
],
"engines": {
"node": ">=14.0.0",
"slidev": ">=0.19.3"
},
"scripts": {
"build": "slidev build example.md",
"dev": "slidev example.md --open",
Expand All @@ -18,10 +22,6 @@
"devDependencies": {
"@slidev/cli": "^0.32.3"
},
"engines": {
"node": ">=14.0.0",
"slidev": ">=0.19.3"
},
"//": "Learn more: https://sli.dev/themes/write-a-theme.html",
"slidev": {
"colorSchema": "both",
Expand Down
32 changes: 16 additions & 16 deletions packages/parser/package.json
Expand Up @@ -2,39 +2,42 @@
"name": "@slidev/parser",
"version": "0.32.3",
"description": "Markdown parser for Slidev",
"homepage": "https://sli.dev",
"bugs": "https://github.com/slidevjs/slidev/issues",
"license": "MIT",
"author": "antfu <anthonyfu117@hotmail.com>",
"license": "MIT",
"funding": "https://github.com/sponsors/antfu",
"homepage": "https://sli.dev",
"repository": {
"type": "git",
"url": "https://github.com/slidevjs/slidev"
},
"funding": "https://github.com/sponsors/antfu",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"bugs": "https://github.com/slidevjs/slidev/issues",
"exports": {
".": {
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
"import": "./dist/index.mjs"
},
"./core": {
"import": "./dist/core.mjs",
"types": "./dist/core.d.ts",
"require": "./dist/core.js",
"types": "./dist/core.d.ts"
"import": "./dist/core.mjs"
},
"./fs": {
"import": "./dist/fs.mjs",
"types": "./fs.d.ts",
"require": "./dist/fs.js",
"types": "./fs.d.ts"
"import": "./dist/fs.mjs"
}
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist",
"*.d.ts"
],
"engines": {
"node": ">=14.0.0"
},
"scripts": {
"build": "rimraf dist && tsup src/index.ts src/core.ts src/fs.ts --format cjs,esm --dts --splitting --no-shims",
"dev": "nr build --watch",
Expand All @@ -43,8 +46,5 @@
"dependencies": {
"@slidev/types": "workspace:*",
"js-yaml": "^4.1.0"
},
"engines": {
"node": ">=14.0.0"
}
}
4 changes: 2 additions & 2 deletions packages/parser/src/config.ts
Expand Up @@ -50,10 +50,10 @@ export function resolveConfig(headmatter: any, themeMeta: SlidevThemeMeta = {})
config.aspectRatio = parseAspectRatio(config.aspectRatio)

if (themeColorSchema && config.colorSchema !== themeColorSchema)
// eslint-disable-next-line no-console

console.warn(`[slidev] Color schema "${config.colorSchema}" does not supported by the theme`)
if (themeHightlighter && config.highlighter !== themeHightlighter)
// eslint-disable-next-line no-console

console.warn(`[slidev] Syntax highlighter "${config.highlighter}" does not supported by the theme`)

return config
Expand Down
2 changes: 1 addition & 1 deletion packages/slidev/bin/slidev.js
@@ -1,6 +1,6 @@
#!/usr/bin/env node
'use strict'
/* eslint-disable @typescript-eslint/no-var-requires */

const path = require('path')
const resolveFrom = require('resolve-from')

Expand Down
6 changes: 3 additions & 3 deletions packages/slidev/node/addons.ts
Expand Up @@ -14,8 +14,8 @@ export function getPackageJson(root: string): Record<string, any> {

export async function getAddons(userRoot: string, config: SlidevConfig): Promise<string[]> {
const { slidev = {} } = await getPackageJson(userRoot)
const configAddons = config.addons instanceof Array ? config.addons : []
const addons = configAddons.concat(slidev?.addons instanceof Array ? slidev.addons : [])
const configAddons = Array.isArray(config.addons) ? config.addons : []
const addons = configAddons.concat(Array.isArray(slidev?.addons) ? slidev.addons : [])
return getRecursivePlugins(addons.map(resolvePluginName))
}

Expand All @@ -24,7 +24,7 @@ export async function getRecursivePlugins(addons: string[]): Promise<string[]> {
const { slidev = {}, engines = {} } = await getPackageJson(addon)
checkEngine(addon, engines)

let addons = slidev?.addons instanceof Array ? slidev.addons : []
let addons = Array.isArray(slidev?.addons) ? slidev.addons : []
if (addons.length > 0)
addons = await getRecursivePlugins(addons.map(resolvePluginName))
addons.push(addon)
Expand Down
1 change: 0 additions & 1 deletion packages/slidev/node/cli.ts
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
import path from 'path'
import net from 'net'
import os from 'os'
Expand Down
1 change: 0 additions & 1 deletion packages/slidev/node/options.ts
Expand Up @@ -128,7 +128,6 @@ export async function resolveOptions(
}
else {
if (!packageExists(theme)) {
// eslint-disable-next-line no-console
console.error(`Theme "${theme}" not found, have you installed it?`)
process.exit(1)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/slidev/node/plugins/markdown-it-katex.ts
Expand Up @@ -173,7 +173,7 @@ export default function math_plugin(md: any, options: KatexOptions) {
}
catch (error) {
if (options.throwOnError)
// eslint-disable-next-line no-console

console.warn(error)
return latex
}
Expand All @@ -190,7 +190,7 @@ export default function math_plugin(md: any, options: KatexOptions) {
}
catch (error) {
if (options.throwOnError)
// eslint-disable-next-line no-console

console.warn(error)
return latex
}
Expand Down
14 changes: 7 additions & 7 deletions packages/types/package.json
Expand Up @@ -2,15 +2,15 @@
"name": "@slidev/types",
"version": "0.32.3",
"description": "Shared types declerations for Slidev",
"homepage": "https://sli.dev",
"bugs": "https://github.com/slidevjs/slidev/issues",
"license": "MIT",
"author": "antfu <anthonyfu117@hotmail.com>",
"license": "MIT",
"funding": "https://github.com/sponsors/antfu",
"homepage": "https://sli.dev",
"repository": {
"type": "git",
"url": "https://github.com/slidevjs/slidev"
},
"funding": "https://github.com/sponsors/antfu",
"bugs": "https://github.com/slidevjs/slidev/issues",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "index.d.ts",
Expand All @@ -19,14 +19,14 @@
"client.d.ts",
"index.d.ts"
],
"engines": {
"node": ">=14.0.0"
},
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts --splitting",
"dev": "nr build --watch",
"prepublishOnly": "npm run build"
},
"engines": {
"node": ">=14.0.0"
},
"devDependencies": {
"tsup": "^5.12.7"
}
Expand Down
1 change: 0 additions & 1 deletion packages/types/src/config.ts
@@ -1,4 +1,3 @@
/* eslint-disable no-use-before-define */
import type { SlidevThemeConfig } from './types'

export interface SlidevConfig {
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/setups.ts
Expand Up @@ -32,6 +32,7 @@ export interface MonacoSetupReturn {
}
}

// eslint-disable-next-line @typescript-eslint/space-infix-ops
export type MermaidOptions = (typeof mermaid.initialize) extends (a: infer A) => any ? A : never

export interface NavOperations {
Expand Down
1 change: 0 additions & 1 deletion packages/types/src/types.ts
@@ -1,4 +1,3 @@
/* eslint-disable no-use-before-define */
import type { SlidevConfig } from './config'

export interface SlideInfoBase {
Expand Down

0 comments on commit 08ac903

Please sign in to comment.