|
| 1 | +module.exports = { |
| 2 | + extends: ['plugin:prettier/recommended'], |
| 3 | + plugins: ['import'], |
| 4 | + globals: { |
| 5 | + require: true, |
| 6 | + Page: true, |
| 7 | + wx: true, |
| 8 | + App: true, |
| 9 | + getApp: true, |
| 10 | + getCurrentPages: true, |
| 11 | + Component: true, |
| 12 | + getRegExp: true, |
| 13 | + Behavior: true, |
| 14 | + }, |
| 15 | + rules: {}, |
| 16 | + overrides: [ |
| 17 | + { |
| 18 | + files: ['script/**'], |
| 19 | + rules: { |
| 20 | + // node 环境下支持 require |
| 21 | + '@typescript-eslint/no-require-imports': 'off', |
| 22 | + }, |
| 23 | + }, |
| 24 | + { |
| 25 | + files: ['example/**'], |
| 26 | + rules: { |
| 27 | + 'no-console': 0, |
| 28 | + }, |
| 29 | + }, |
| 30 | + ], |
| 31 | +}; |
| 32 | + |
| 33 | +// 配置小程序内全局函数,避免报错 |
| 34 | +// const globals = { |
| 35 | +// require: true, |
| 36 | +// Page: true, |
| 37 | +// wx: true, |
| 38 | +// App: true, |
| 39 | +// getApp: true, |
| 40 | +// getCurrentPages: true, |
| 41 | +// Component: true, |
| 42 | +// getRegExp: true, |
| 43 | +// Behavior: true, |
| 44 | +// }; |
| 45 | + |
| 46 | +// module.exports = { |
| 47 | +// parser: '@typescript-eslint/parser', |
| 48 | +// parserOptions: { |
| 49 | +// ecmaVersion: 2018, |
| 50 | +// sourceType: 'module', |
| 51 | +// ecmaFeatures: { |
| 52 | +// impliedStrict: true, |
| 53 | +// }, |
| 54 | +// }, |
| 55 | +// env: { |
| 56 | +// browser: true, |
| 57 | +// node: true, |
| 58 | +// es6: true, |
| 59 | +// jest: true, |
| 60 | +// }, |
| 61 | +// // 启用默认核心规则 |
| 62 | +// extends: ['eslint-config-airbnb-base', 'eslint-config-prettier'], |
| 63 | +// plugins: ['@typescript-eslint', 'prettier', 'import'], |
| 64 | +// // add your custom rules here |
| 65 | +// rules: { |
| 66 | +// // 非开发模式禁用debugger |
| 67 | +// 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn', |
| 68 | +// // 允许调用首字母大写的函数时没有 new 操作符 |
| 69 | +// 'new-cap': 'off', |
| 70 | +// // 在工具库中允许变量以下划线开头 |
| 71 | +// 'no-underscore-dangle': 'off', |
| 72 | +// // 在工具库中允许参数重新赋值 |
| 73 | +// 'no-param-reassign': 'off', |
| 74 | +// 'number-leading-zero': 'off', |
| 75 | +// // 在类属性和方法上关闭需要显式的可访问性修饰符 |
| 76 | +// '@typescript-eslint/explicit-member-accessibility': 'off', |
| 77 | +// eqeqeq: [ |
| 78 | +// 'error', |
| 79 | +// 'always', |
| 80 | +// { |
| 81 | +// null: 'ignore', |
| 82 | +// }, |
| 83 | +// ], |
| 84 | +// 'import/no-unresolved': 0, |
| 85 | +// 'import/no-named-as-default': 0, |
| 86 | +// 'import/extensions': 0, |
| 87 | +// 'import/export': 0, |
| 88 | +// 'import/no-cycle': 0, |
| 89 | +// 'import/no-extraneous-dependencies': [ |
| 90 | +// 'error', |
| 91 | +// { |
| 92 | +// devDependencies: true, |
| 93 | +// }, |
| 94 | +// ], |
| 95 | +// 'import/no-dynamic-require': 0, |
| 96 | +// 'object-shorthand': 0, |
| 97 | +// 'no-shadow': 0, |
| 98 | +// 'no-unused-expressions': 0, |
| 99 | +// 'no-unused-vars': 0, |
| 100 | +// '@typescript-eslint/no-unused-vars': 2, |
| 101 | +// 'consistent-return': 0, |
| 102 | +// 'no-return-assign': 0, |
| 103 | +// 'func-names': 0, |
| 104 | +// 'class-methods-use-this': 0, |
| 105 | +// 'no-console': [ |
| 106 | +// 2, |
| 107 | +// { |
| 108 | +// allow: ['warn', 'error'], |
| 109 | +// }, |
| 110 | +// ], |
| 111 | +// 'no-undef': 0, |
| 112 | +// 'no-proto': 0, |
| 113 | +// }, |
| 114 | +// // globals, |
| 115 | +// overrides: [ |
| 116 | +// { |
| 117 | +// files: ['script/**'], |
| 118 | +// rules: { |
| 119 | +// // node 环境下支持 require |
| 120 | +// '@typescript-eslint/no-require-imports': 'off', |
| 121 | +// }, |
| 122 | +// }, |
| 123 | +// { |
| 124 | +// files: ['example/**'], |
| 125 | +// rules: { |
| 126 | +// 'no-console': 0, |
| 127 | +// }, |
| 128 | +// }, |
| 129 | +// ], |
| 130 | +// }; |
0 commit comments