.eslintrc.js 2.6 KB
Newer Older
P
Peter Pan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/**
 * Copyright 2020 Baidu Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

17
module.exports = {
18 19 20 21 22
    env: {
        browser: true,
        es6: true,
        node: true
    },
23
    extends: ['plugin:prettier/recommended'],
24 25 26 27
    parserOptions: {
        ecmaVersion: 2018,
        sourceType: 'module'
    },
P
Peter Pan 已提交
28 29
    ignorePatterns: ['node_modules/', 'dist/', 'output/', 'license-header.js'],
    plugins: ['license-header'],
30
    rules: {
31
        'no-console': 'warn',
P
Peter Pan 已提交
32 33
        'sort-imports': 'error',
        'license-header/header': ['error', './license-header.js']
34 35 36
    },
    overrides: [
        {
37
            files: ['packages/cli/**/*', 'packages/mock/**/*', 'packages/demo/**/*', 'packages/server/**/*'],
38
            extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
39 40 41
            parser: '@typescript-eslint/parser',
            rules: {
                '@typescript-eslint/explicit-function-return-type': 'off',
P
Peter Pan 已提交
42
                '@typescript-eslint/explicit-module-boundary-types': 'off',
43 44 45 46
                '@typescript-eslint/no-explicit-any': 'error'
            }
        },
        {
47
            files: ['packages/core/**/*'],
48 49 50
            extends: [
                'plugin:@typescript-eslint/recommended',
                'plugin:react/recommended',
51
                'plugin:react-hooks/recommended',
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
                'plugin:prettier/recommended'
            ],
            parser: '@typescript-eslint/parser',
            parserOptions: {
                ecmaFeatures: {
                    jsx: true
                },
                ecmaVersion: 2018,
                sourceType: 'module'
            },
            settings: {
                react: {
                    version: 'detect'
                }
            },
            rules: {
                '@typescript-eslint/explicit-function-return-type': 'off',
P
Peter Pan 已提交
69
                '@typescript-eslint/explicit-module-boundary-types': 'off',
70 71
                '@typescript-eslint/no-explicit-any': 'error',
                'react/prop-types': 'off',
72
                'react/react-in-jsx-scope': 'off'
73 74 75
            }
        }
    ]
76
};