1234567891011121314151617181920212223242526272829303132 |
- module.exports = {
- root: true,
- parser: '@typescript-eslint/parser',
- extends: [
- 'plugin:@typescript-eslint/recommended',
- // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
- 'prettier/@typescript-eslint',
- // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
- // 此行必须在最后
- 'plugin:prettier/recommended'
- ],
- env: {
- es6: true,
- node: true
- },
- parserOptions: {
- // 支持最新 JavaScript
- ecmaVersion: 2018,
- sourceType: 'module'
- },
- rules: {
- // 缩进
- 'indent': ['error', 4, { SwitchCase: 1 }], // 缩进控制4空格
- 'max-len': ['error', 120], // 每行字符不超过120
- 'no-mixed-spaces-and-tabs': 'error', // 禁止使用空格和tab混合缩进
- // 语句
- 'curly': ["error", "multi-line"], // if、else if、else、for、while强制使用大括号,但允许在单行中省略大括号。
- 'semi': ['error', 'always'], //不得省略语句结束的分号
- '@typescript-eslint/no-unused-vars': 'off', // 取消未使用变量检查
- '@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }] // public访问不需加访问修饰符
- }
- };
|