refactor: lint

This commit is contained in:
Kevin Deng
2025-11-26 17:12:35 +08:00
parent 620450b5ba
commit 5279b2eb69
33 changed files with 2271 additions and 449 deletions

View File

@@ -1,67 +1,11 @@
// @ts-check
import { builtinModules } from 'node:module'
import tseslint from 'typescript-eslint'
import importX from 'eslint-plugin-import-x'
import eslint from '@eslint/js'
import eslintConfigPrettier from 'eslint-config-prettier'
import { sxzz } from '@sxzz/eslint-config'
export default tseslint.config(
eslint.configs.recommended,
export default sxzz(
{},
{
files: ['**/*.js', '**/*.ts', '**/*.tsx'],
extends: [...tseslint.configs.recommended],
plugins: {
import: importX,
},
languageOptions: {
parserOptions: {
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
eqeqeq: ['warn', 'always', { null: 'never' }],
'no-debugger': ['error'],
'no-empty': ['warn', { allowEmptyCatch: true }],
'prefer-const': [
'warn',
{
destructuring: 'all',
},
],
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
],
'import/no-nodejs-modules': [
'error',
{ allow: builtinModules.map((mod) => `node:${mod}`) },
],
'import/no-duplicates': 'error',
'import/order': 'error',
'sort-imports': [
'error',
{
ignoreCase: false,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
allowSeparatedGroups: false,
},
],
'import/no-default-export': 'off',
'unicorn/filename-case': 'off',
},
},
eslintConfigPrettier,
{
ignores: ['**/dist/', '**/coverage/'],
},
)