about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/editors/code/eslint.config.mts
blob: 3520593eef28584c7d619ebb438bfea27b6b33ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import eslintConfigPrettier from "eslint-config-prettier";
import stylistic from "@stylistic/eslint-plugin";
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import stylisticJs from "@stylistic/eslint-plugin-js";
import { type FlatESLintConfig } from "eslint-define-config";

const config: FlatESLintConfig[] = [
    eslintConfigPrettier,
    eslint.configs.recommended,
    stylisticJs.configs["disable-legacy"],
    ...tseslint.configs.recommended,
    stylistic.configs.customize({
        indent: 4,
        quotes: "double",
        semi: true,
        braceStyle: "1tbs",
        arrowParens: true,
    }),
    {
        rules: {
            "no-console": "warn",
            "@typescript-eslint/no-unused-vars": [
                "error",
                {
                    args: "all",
                    argsIgnorePattern: "^_",
                    caughtErrors: "all",
                    caughtErrorsIgnorePattern: "^_",
                    destructuredArrayIgnorePattern: "^_",
                    varsIgnorePattern: "^_",
                    ignoreRestSiblings: true,
                },
            ],
            // the following stylistic lints conflict with prettier
            "@stylistic/operator-linebreak": "off",
            "@stylistic/indent-binary-ops": "off",
            "@stylistic/indent": "off",
            "@stylistic/brace-style": "off",
            "@stylistic/quotes": "off",
        },
    },
    {
        ignores: ["out/", ".vscode-test/", "node_modules/"],
    },
];

export default config;