mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-28 05:46:36 +08:00
d9663f91d6
前端接入 eslint-plugin-unused-imports,pnpm format 同步执行 eslint --fix; 后端将 gofmt 替换为 goimports,并修复 danger-zone 未使用导入。
46 lines
1.0 KiB
JavaScript
46 lines
1.0 KiB
JavaScript
import { dirname } from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
import { FlatCompat } from '@eslint/eslintrc';
|
|
import unusedImports from 'eslint-plugin-unused-imports';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = dirname(__filename);
|
|
|
|
const compat = new FlatCompat({
|
|
baseDirectory: __dirname,
|
|
});
|
|
|
|
const eslintConfig = [
|
|
...compat.extends('next/core-web-vitals', 'next/typescript'),
|
|
{
|
|
ignores: [
|
|
'node_modules/**',
|
|
'.next/**',
|
|
'out/**',
|
|
'build/**',
|
|
'next-env.d.ts',
|
|
],
|
|
},
|
|
{
|
|
plugins: {
|
|
'unused-imports': unusedImports,
|
|
},
|
|
rules: {
|
|
// Prefer unused-imports so unused imports can be auto-removed with --fix.
|
|
'@typescript-eslint/no-unused-vars': 'off',
|
|
'unused-imports/no-unused-imports': 'error',
|
|
'unused-imports/no-unused-vars': [
|
|
'warn',
|
|
{
|
|
vars: 'all',
|
|
varsIgnorePattern: '^_',
|
|
args: 'after-used',
|
|
argsIgnorePattern: '^_',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
];
|
|
|
|
export default eslintConfig;
|