Skip to content

Commit

Permalink
chore: enable isolatedDeclarations
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Jan 11, 2025
1 parent 88b3a28 commit 23496b2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/configs/javascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { isInEditor } from '../env'
import { configJs, pluginSxzz, pluginUnusedImports } from '../plugins'
import type { Config } from '../types'

export const restrictedSyntaxJs = [
export const restrictedSyntaxJs: string[] = [
'ForInStatement',
'LabeledStatement',
'WithStatement',
Expand Down
2 changes: 1 addition & 1 deletion src/configs/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { parserVue, pluginVue, tseslint } from '../plugins'
import { typescriptCore } from './typescript'
import type { Linter } from 'eslint'

export function getVueVersion() {
export function getVueVersion(): number {
const pkg = getPackageInfoSync('vue', { paths: [process.cwd()] })
if (
pkg &&
Expand Down
8 changes: 4 additions & 4 deletions src/env.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import process from 'node:process'
import { isPackageExists } from 'local-pkg'

export const isInEditor = !!(
export const isInEditor: boolean = !!(
(process.env.VSCODE_PID ||
process.env.VSCODE_CWD ||
process.env.JETBRAINS_IDE ||
process.env.VIM) &&
!process.env.CI
)
export const hasTypeScript = isPackageExists('typescript')
export const hasVue =
export const hasTypeScript: boolean = isPackageExists('typescript')
export const hasVue: boolean =
isPackageExists('vue') ||
isPackageExists('nuxt') ||
isPackageExists('vitepress') ||
isPackageExists('@slidev/cli')
export const hasUnocss =
export const hasUnocss: boolean =
isPackageExists('unocss') ||
isPackageExists('@unocss/webpack') ||
isPackageExists('@unocss/nuxt')
6 changes: 3 additions & 3 deletions src/globs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const GLOB_VUE = '**/*.vue'
export const GLOB_YAML = '**/*.y?(a)ml'
export const GLOB_HTML = '**/*.htm?(l)'

export const GLOB_ALL_SRC = [
export const GLOB_ALL_SRC: string[] = [
GLOB_SRC,
GLOB_STYLE,
GLOB_JSON,
Expand All @@ -34,13 +34,13 @@ export const GLOB_ALL_SRC = [

export const GLOB_NODE_MODULES = '**/node_modules' as const
export const GLOB_DIST = '**/dist' as const
export const GLOB_LOCKFILE = [
export const GLOB_LOCKFILE: string[] = [
'**/package-lock.json',
'**/yarn.lock',
'**/pnpm-lock.yaml',
'**/bun.lockb',
]
export const GLOB_EXCLUDE = [
export const GLOB_EXCLUDE: string[] = [
GLOB_NODE_MODULES,
GLOB_DIST,
...GLOB_LOCKFILE,
Expand Down
3 changes: 2 additions & 1 deletion src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ export * as parserYml from 'yaml-eslint-parser'
export * as parserJsonc from 'jsonc-eslint-parser'

import _configCommand from 'eslint-plugin-command/config'
export const configCommand = interopDefault(_configCommand)
export const configCommand: typeof _configCommand =
interopDefault(_configCommand)
10 changes: 7 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{
"compilerOptions": {
"target": "esnext",
"lib": ["es2022"],
"module": "esnext",
"lib": ["es2023"],
"moduleDetection": "force",
"module": "preserve",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"types": ["node"],
"strict": true,
"noUnusedLocals": true,
"declaration": true,
"noEmit": true,
"isolatedDeclarations": true,
"esModuleInterop": true,
"isolatedModules": true,
"verbatimModuleSyntax": true,
"skipLibCheck": true
},
"include": ["src"]
Expand Down

0 comments on commit 23496b2

Please sign in to comment.