mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2026-03-21 19:13:10 +00:00
- 将长参数列表拆分为多行以提高可读性 - 标准化函数调用中的逗号使用 - 统一对象和数组的换行格式 - 更新 ESLint 配置中的 ECMA 版本至 2020,以支持 ES2020 语法(包括 Optional Chaining) - 优化代码缩进和对齐方式 - 确保所有文件中的代码风格一致性
92 lines
1.7 KiB
JavaScript
92 lines
1.7 KiB
JavaScript
const { defineConfig, globalIgnores } = require('eslint/config')
|
|
|
|
const html = require('eslint-plugin-html')
|
|
const globals = require('globals')
|
|
const tsParser = require('@typescript-eslint/parser')
|
|
const js = require('@eslint/js')
|
|
|
|
const { FlatCompat } = require('@eslint/eslintrc')
|
|
|
|
const compat = new FlatCompat({
|
|
baseDirectory: __dirname,
|
|
recommendedConfig: js.configs.recommended,
|
|
allConfig: js.configs.all,
|
|
})
|
|
|
|
module.exports = defineConfig([
|
|
{
|
|
languageOptions: {
|
|
ecmaVersion: 2020,
|
|
sourceType: 'module',
|
|
parserOptions: {
|
|
parser: 'babel-eslint',
|
|
},
|
|
globals: {
|
|
...globals.browser,
|
|
...globals.node,
|
|
},
|
|
},
|
|
|
|
plugins: {
|
|
html,
|
|
},
|
|
|
|
extends: compat.extends('plugin:prettier/recommended'),
|
|
|
|
rules: {
|
|
'prettier/prettier': [
|
|
'error',
|
|
{
|
|
endOfLine: 'auto',
|
|
},
|
|
],
|
|
|
|
indent: [
|
|
'error',
|
|
2,
|
|
{
|
|
SwitchCase: 1,
|
|
},
|
|
],
|
|
|
|
'space-infix-ops': [
|
|
'error',
|
|
{
|
|
int32Hint: false,
|
|
},
|
|
],
|
|
|
|
'key-spacing': [
|
|
2,
|
|
{
|
|
beforeColon: false,
|
|
afterColon: true,
|
|
},
|
|
],
|
|
|
|
'no-octal': 2,
|
|
'no-redeclare': 2,
|
|
'comma-spacing': 2,
|
|
'no-new-object': 2,
|
|
'arrow-spacing': 2,
|
|
|
|
quotes: [
|
|
2,
|
|
'single',
|
|
{
|
|
avoidEscape: true,
|
|
allowTemplateLiterals: true,
|
|
},
|
|
],
|
|
},
|
|
},
|
|
globalIgnores(['**/public/']),
|
|
{
|
|
files: ['**/*.ts'],
|
|
languageOptions: {
|
|
parser: tsParser,
|
|
},
|
|
extends: compat.extends('plugin:@typescript-eslint/recommended'),
|
|
},
|
|
])
|