2 Star 12 Fork 1

Jason / uni-router

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
.eslintrc.cjs 3.47 KB
一键复制 编辑 原始数据 按行查看 历史
xinjie 提交于 2023-09-28 11:49 . release: v1.2.0
const { builtinModules } = require('node:module')
const { defineConfig } = require('eslint-define-config')
module.exports = defineConfig({
root: true,
extends: [
'eslint:recommended',
'plugin:node/recommended',
'plugin:@typescript-eslint/recommended'
],
overrides: [],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2021
},
plugins: ['@typescript-eslint', 'import'],
rules: {
// 使用强等于除了null
eqeqeq: ['warn', 'always', { null: 'never' }],
// 禁用debugger
'no-debugger': ['error'],
// 禁止出现空语句块,允许空的 catch 子句
'no-empty': ['warn', { allowEmptyCatch: true }],
// 禁用 process.exit()
'no-process-exit': 'off',
//要求使用 const 声明那些声明后不再被修改的变量
'prefer-const': [
'warn',
{
destructuring: 'all'
}
],
'node/no-missing-require': [
'error',
{
// for try-catching yarn pnp
allowModules: ['pnpapi', 'vite'],
tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts']
}
],
camelcase: ['error', { properties: 'never' }],
'no-constant-condition': ['error', { checkLoops: false }],
'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'],
'no-return-await': 'error',
'no-var': 'error',
'prefer-arrow-callback': ['error', { allowNamedFunctions: false, allowUnboundThis: true }],
'object-shorthand': ['error', 'always', { ignoreConstructors: false, avoidQuotes: true }],
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'error',
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': 'error',
// best-practice
'array-callback-return': 'error',
'block-scoped-var': 'error',
'no-alert': 'warn',
'no-case-declarations': 'error',
'no-multi-str': 'error',
'no-with': 'error',
'no-void': 'error',
'node/no-extraneous-import': 'off',
'node/no-extraneous-require': [
'error',
{
allowModules: ['vite']
}
],
'node/no-deprecated-api': 'off',
'node/no-unpublished-import': 'off',
'node/no-unpublished-require': 'off',
'node/no-unsupported-features/es-syntax': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off', // TODO: we should turn this on in a new PR
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off', // maybe we should turn this on in a new PR
'@typescript-eslint/no-extra-semi': 'off', // conflicts with prettier
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off', // maybe we should turn this on in a new PR
'@typescript-eslint/no-unused-vars': 'off', // maybe we should turn this on in a new PR
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/consistent-type-imports': ['error', { prefer: '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
}
],
'node/no-missing-import': 'off'
}
})
JavaScript
1
https://gitee.com/wen-jason/uni-router.git
git@gitee.com:wen-jason/uni-router.git
wen-jason
uni-router
uni-router
main

搜索帮助