{
    "root": true,
    "extends": [
        "plugin:@mattermost/react"
    ],
    "plugins": [
        "formatjs",
        "no-only-tests"
    ],
    "settings": {
        "import/resolver": {
            "webpack": {
                "config": "webpack.config.base.js"
            }
        }
    },
    "rules": {
        "header/header": [
            2,
            "line",
            [
                " Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.",
                " See LICENSE.txt for license information."
            ]
        ],
        "import/no-commonjs": 2,
        "no-process-env": 0,
        "no-var": 2,
        "react/no-find-dom-node": 2,
        "no-underscore-dangle": ["warn"],
        "@mattermost/use-external-link": 0,
        "import/order": [
            2,
            {
                "newlines-between": "always",
                "groups": [
                    "builtin",
                    "external",
                    "internal",
                    "sibling",
                    "parent",
                    "index"
                ],
                "pathGroups": [
                    {
                        "pattern": "@mattermost/**",
                        "group": "external",
                        "position": "after"
                    },
                    {
                        "pattern": "@(app|common|main|renderer){,/**}",
                        "group": "internal",
                        "position": "before"
                    },
                    {
                        "pattern": "types{,/**}",
                        "group": "internal",
                        "position": "after"
                    }
                ],
                "alphabetize": {
                    "order": "asc",
                    "caseInsensitive": true
                },
                "distinctGroup": true,
                "pathGroupsExcludedImportTypes": ["builtin"]
            }
        ]
    },
    "overrides": [
        {
            "files": [
                "scripts/**/*",
                "src/main/preload/**/*",
                "src/renderer/**/*"
            ],
            "rules": {
                "no-console": 0
            }
        },
        {
            "files": [
                "scripts/**/*",
                "babel.config.js",
                "webpack.config.*.js"
            ],
            "rules": {
                "import/no-commonjs": 0
            }
        },
        {
            "files": [
                "e2e/**/*",
                "src/**/*.test.js"
            ],
            "env": {
                "jest": true
            },
            "rules": {
                "no-unused-expressions": 0, //TODO: rework tests to use correct notation
                "func-names": 0,
                "global-require": 0,
                "new-cap": 0,
                "prefer-arrow-callback": 0,
                "no-import-assign": 0,
                "no-only-tests/no-only-tests": 1,
                "import/no-commonjs": 0
            }
        },
        {
            "files": [
                "webpack.config.renderer.js",
                "e2e/specs/startup/app.test.js",
                "e2e/specs/settings.test.js",
                "e2e/modules/utils.js",
                "e2e/modules/environment.js",
                "CHANGELOG.md",
                "webpack.config.base.js",
                "babel.config.js",
                "README.md",
                "scripts/check_build_config.js",
                "LICENSE.txt",
                "src/main/contextMenu.ts",
                "src/main/badge.ts",
                "src/common/config/index.ts",
                "src/common/config/buildConfig.ts",
                "src/common/config/pastDefaultPreferences.ts",
                "src/common/config/upgradePreferences.ts",
                "src/common/config/RegistryConfig.ts",
                "src/common/config/defaultPreferences.ts",
                "src/common/JsonFileManager.ts",
                "src/main/certificateStore.ts",
                "src/main/allowProtocolDialog.ts",
                "src/main/AutoLauncher.ts",
                "src/main/menus/tray.ts",
                "src/main/CriticalErrorHandler.ts",
                "src/main/utils.ts",
                "src/main/menus/app.ts",
                "src/renderer/components/RemoveServerModal.tsx",
                "src/renderer/components/MainPage.tsx",
                "src/renderer/components/AutoSaveIndicator.tsx",
                "src/renderer/components/TabBar.tsx",
                "src/renderer/components/DestructiveConfirmModal.tsx",
                "src/renderer/components/ErrorView.tsx",
                "src/renderer/components/SettingsPage.tsx",
                "src/renderer/components/NewServerModal.tsx",
                "src/renderer/settings.tsx",
                "src/renderer/index.tsx"
            ],
            "rules": {
                "header/header": [
                    2,
                    "line",
                    [
                        " Copyright (c) 2015-2016 Yuya Ochiai",
                        " Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.",
                        " See LICENSE.txt for license information."
                    ]
                ]
            }
        }
    ]
}
