-
Notifications
You must be signed in to change notification settings - Fork 922
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: upgrade eslint and fix lint and type errors (#1600)
- Loading branch information
Showing
179 changed files
with
2,193 additions
and
2,715 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
import { getDirname, path } from 'vuepress/utils' | ||
|
||
const __dirname = getDirname(import.meta.url) | ||
const DIRNAME = getDirname(import.meta.url) | ||
|
||
export const fooPlugin = { | ||
name: 'test-plugin', | ||
clientConfigFile: path.resolve( | ||
__dirname, | ||
'./nonDefaultExportClientConfig.js', | ||
), | ||
clientConfigFile: path.resolve(DIRNAME, './nonDefaultExportClientConfig.js'), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,24 @@ | ||
import type { Page, Theme } from 'vuepress/core' | ||
import type { Theme } from 'vuepress/core' | ||
import { getDirname, path } from 'vuepress/utils' | ||
|
||
const __dirname = getDirname(import.meta.url) | ||
const DIRNAME = getDirname(import.meta.url) | ||
|
||
export const e2eTheme = (): Theme => { | ||
return { | ||
name: '@vuepress/theme-e2e', | ||
export const e2eTheme = (): Theme => ({ | ||
name: '@vuepress/theme-e2e', | ||
|
||
alias: { | ||
// ... | ||
}, | ||
alias: { | ||
// ... | ||
}, | ||
|
||
define: { | ||
// ... | ||
}, | ||
define: { | ||
// ... | ||
}, | ||
|
||
clientConfigFile: path.resolve(__dirname, '../client/config.ts'), | ||
clientConfigFile: path.resolve(DIRNAME, '../client/config.ts'), | ||
|
||
extendsPage: (page: Page) => { | ||
// ... | ||
}, | ||
extendsPage: () => { | ||
// ... | ||
}, | ||
|
||
plugins: [], | ||
} | ||
} | ||
plugins: [], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
declare const str: string | ||
export default str | ||
declare const STR: string | ||
export default STR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
import { fs, getDirname, path } from 'vuepress/utils' | ||
|
||
const __dirname = getDirname(import.meta.url) | ||
const DIRNAME = getDirname(import.meta.url) | ||
|
||
const resolveSourceMarkdownPath = (...args: string[]): string => | ||
path.resolve(__dirname, '../docs', ...args) | ||
path.resolve(DIRNAME, '../docs', ...args) | ||
|
||
export const readSourceMarkdown = async (filePath: string): Promise<string> => { | ||
return fs.readFile(resolveSourceMarkdownPath(filePath), 'utf-8') | ||
} | ||
export const readSourceMarkdown = async (filePath: string): Promise<string> => | ||
fs.readFile(resolveSourceMarkdownPath(filePath), 'utf-8') | ||
|
||
export const writeSourceMarkdown = async ( | ||
filePath: string, | ||
content: string, | ||
): Promise<void> => { | ||
return fs.writeFile(resolveSourceMarkdownPath(filePath), content) | ||
} | ||
): Promise<void> => fs.writeFile(resolveSourceMarkdownPath(filePath), content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import fs from 'node:fs' | ||
import path from 'node:path' | ||
import { fileURLToPath } from 'node:url' | ||
import { vuepress } from 'eslint-config-vuepress' | ||
|
||
const ROOT = path.resolve(fileURLToPath(import.meta.url), '..') | ||
const E2E_DIR = path.resolve(ROOT, 'e2e') | ||
const PACKAGES_DIRS = fs | ||
.readdirSync(path.resolve(ROOT, 'packages')) | ||
.map((item) => `./packages/${item}`) | ||
|
||
export default vuepress( | ||
{ | ||
imports: { | ||
packageDir: [ROOT, E2E_DIR, ...PACKAGES_DIRS], | ||
}, | ||
typescript: { | ||
overrides: { | ||
'@typescript-eslint/no-dynamic-delete': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'no-underscore-dangle': [ | ||
'warn', | ||
{ allow: ['_context', '_pageChunk', '_registeredComponents'] }, | ||
], | ||
}, | ||
}, | ||
vue: { | ||
overrides: { | ||
'no-useless-assignment': 'off', // TODO: false positive in vue sfc | ||
}, | ||
}, | ||
}, | ||
{ | ||
files: ['**/tests/**'], | ||
rules: { | ||
'import/no-unresolved': 'off', | ||
'no-console': 'off', | ||
'prefer-template': 'off', | ||
}, | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.