2023-06-22 12:14:02 +08:00
|
|
|
const { builtinModules } = require('node:module');
|
|
|
|
|
2020-05-28 21:20:39 +08:00
|
|
|
module.exports = {
|
|
|
|
root: true,
|
|
|
|
env: {
|
|
|
|
browser: true,
|
|
|
|
node: true,
|
|
|
|
es6: true,
|
|
|
|
},
|
2023-06-22 12:14:02 +08:00
|
|
|
|
2020-07-19 14:47:24 +08:00
|
|
|
extends: [
|
2023-06-22 12:14:02 +08:00
|
|
|
'eslint:recommended',
|
|
|
|
'plugin:@typescript-eslint/recommended',
|
|
|
|
'prettier',
|
2020-07-19 14:47:24 +08:00
|
|
|
],
|
2023-06-22 12:14:02 +08:00
|
|
|
plugins: ['import'],
|
|
|
|
parser: '@typescript-eslint/parser',
|
|
|
|
parserOptions: {
|
|
|
|
sourceType: 'module',
|
|
|
|
ecmaFeatures: {
|
|
|
|
jsx: true,
|
|
|
|
},
|
|
|
|
},
|
2020-05-28 21:20:39 +08:00
|
|
|
rules: {
|
2023-06-22 12:14:02 +08:00
|
|
|
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,
|
|
|
|
},
|
|
|
|
],
|
2020-05-28 21:20:39 +08:00
|
|
|
},
|
|
|
|
};
|