js 代码检查放宽

This commit is contained in:
tangly1024.com
2024-11-14 11:24:22 +08:00
parent 4d4f4fb1f2
commit 4375066378
4 changed files with 34 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ module.exports = {
},
ecmaVersion: 12,
sourceType: 'module',
project: './tsconfig.json' // 指定 tsconfig.json 的路径
project: './tsconfig.eslint.json' // 指向新的 ESLint 配置文件
},
plugins: [
'react',
@@ -42,6 +42,26 @@ module.exports = {
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], // 确保未使用的变量报错
'@typescript-eslint/explicit-function-return-type': 'off' // 关闭强制函数返回类型声明
},
overrides: [
{
files: ['.eslintrc.js'],
parser: null // 避免对 `.eslintrc.js` 文件使用 TypeScript 解析器
},
{
files: ['**/*.js'], // Match all .js files 对js的代码规范检查不那么严格
rules: {
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-floating-promises': 'off'
}
}
],
globals: {
React: true
}

View File

@@ -27,6 +27,7 @@ const isTenantAdminRoute = createRouteMatcher([
* @param ev
* @returns
*/
// eslint-disable-next-line @typescript-eslint/require-await, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
const noAuthMiddleware = async (req: any, ev: any) => {
// 如果没有配置 Clerk 相关环境变量,返回一个默认响应或者继续处理请求
return NextResponse.next()

4
tsconfig.eslint.json Normal file
View File

@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"include": [".eslintrc.js", "**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"]
}

View File

@@ -24,6 +24,13 @@
"isolatedModules": true,
"jsx": "preserve"
},
"include": ["next-env.d.ts", "**/*.js", "**/*.ts", "**/*.tsx", "**/*.jsx"],
"include": [
"next-env.d.ts",
"**/*.js",
"**/*.ts",
"**/*.tsx",
"**/*.jsx",
".eslintrc.js"
],
"exclude": ["node_modules"]
}