Ai
6 Star 5 Fork 2

Tencent/tdesign-miniprogram

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
.eslintrc.js 2.69 KB
一键复制 编辑 原始数据 按行查看 历史
Y. 提交于 2025-09-17 14:26 +08:00 . chore: adjust the project structure (#3915)
const compileTimeConfiguration = require('./script/config.js');
// 配置小程序内全局函数,避免报错
const globals = {
require: true,
Page: true,
wx: true,
App: true,
getApp: true,
getCurrentPages: true,
Component: true,
getRegExp: true,
Behavior: true,
};
// 配置编译时配置,避免报错
Object.keys(compileTimeConfiguration).forEach((key) => {
globals[key] = true;
});
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
impliedStrict: true,
},
},
env: {
browser: true,
node: true,
es6: true,
jest: true,
},
// 启用默认核心规则
extends: ['eslint-config-airbnb-base', 'eslint-config-prettier'],
plugins: ['@typescript-eslint', 'prettier', 'import'],
// add your custom rules here
rules: {
'import/order': [
'error',
{
groups: [
'builtin', // Built-in types are first
'external', // Then the index file
'internal',
],
},
],
// 非开发模式禁用debugger
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
// 允许调用首字母大写的函数时没有 new 操作符
'new-cap': 'off',
// 在工具库中允许变量以下划线开头
'no-underscore-dangle': 'off',
// 在工具库中允许参数重新赋值
'no-param-reassign': 'off',
'number-leading-zero': 'off',
// 在类属性和方法上关闭需要显式的可访问性修饰符
'@typescript-eslint/explicit-member-accessibility': 'off',
eqeqeq: [
'error',
'always',
{
null: 'ignore',
},
],
'import/no-unresolved': 0,
'import/no-named-as-default': 0,
'import/extensions': 0,
'import/export': 0,
'import/no-cycle': 0,
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
},
],
'import/no-dynamic-require': 0,
'object-shorthand': 0,
'no-shadow': 0,
'no-unused-expressions': 0,
'no-unused-vars': 0,
'@typescript-eslint/no-unused-vars': 2,
'consistent-return': 0,
'no-return-assign': 0,
'func-names': 0,
'class-methods-use-this': 0,
'no-console': [
2,
{
allow: ['warn', 'error'],
},
],
'no-undef': 0,
'no-proto': 0,
},
globals,
overrides: [
{
files: ['script/**'],
rules: {
// node 环境下支持 require
'@typescript-eslint/no-require-imports': 'off',
'no-console': 0,
},
},
{
files: ['packages/tdesign-miniprogram/example/**', '**/_example/**'],
rules: {
'no-console': 0,
},
},
],
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_Tencent/tdesign-miniprogram.git
git@gitee.com:mirrors_Tencent/tdesign-miniprogram.git
mirrors_Tencent
tdesign-miniprogram
tdesign-miniprogram
develop

搜索帮助