Keycloak

Форк
0
/
.eslintrc.cjs 
113 строк · 3.6 Кб
1
/** @type {import("eslint").Linter.Config } */
2
module.exports = {
3
  root: true,
4
  ignorePatterns: [
5
    "node_modules",
6
    "dist",
7
    "target",
8
    "keycloak-theme",
9
    "server",
10
    // Keycloak JS follows a completely different and outdated style, so we'll exclude it for now.
11
    // TODO: Eventually align the code-style for Keycloak JS.
12
    "libs/keycloak-js",
13
  ],
14
  parserOptions: {
15
    tsconfigRootDir: __dirname,
16
    project: "./tsconfig.eslint.json",
17
    extraFileExtensions: [".mjs"],
18
  },
19
  env: {
20
    node: true,
21
  },
22
  plugins: ["lodash"],
23
  extends: [
24
    "eslint:recommended",
25
    "plugin:import/recommended",
26
    "plugin:import/typescript",
27
    "plugin:react/recommended",
28
    "plugin:react/jsx-runtime",
29
    "plugin:react-hooks/recommended",
30
    "plugin:@typescript-eslint/base",
31
    "plugin:@typescript-eslint/eslint-recommended",
32
    "plugin:prettier/recommended",
33
  ],
34
  settings: {
35
    react: {
36
      version: "detect",
37
    },
38
    "import/resolver": {
39
      typescript: true,
40
      node: true,
41
    },
42
  },
43
  rules: {
44
    // Prefer using `includes()` to check if values exist over `indexOf() === -1`, as it's a more appropriate API for this.
45
    "@typescript-eslint/prefer-includes": "error",
46
    // Prefer using an optional chain expression, as it's more concise and easier to read.
47
    "@typescript-eslint/prefer-optional-chain": "error",
48
    "no-unused-vars": "off",
49
    "@typescript-eslint/no-empty-function": "error",
50
    "@typescript-eslint/no-unnecessary-condition": "warn",
51
    "@typescript-eslint/no-unused-vars": "error",
52
    "lodash/import-scope": ["error", "member"],
53
    // react/prop-types cannot handle generic props, so we need to disable it.
54
    // https://github.com/yannickcr/eslint-plugin-react/issues/2777#issuecomment-814968432
55
    "react/prop-types": "off",
56
    // Prevent fragments from being added that have only a single child.
57
    "react/jsx-no-useless-fragment": "error",
58
    // Ban nesting components, as this will cause unintended re-mounting of components.
59
    // TODO: All issues should be fixed and this rule should be set to "error".
60
    "react/no-unstable-nested-components": ["warn", { allowAsProps: true }],
61
    "prefer-arrow-callback": "error",
62
    "prettier/prettier": [
63
      "error",
64
      {
65
        endOfLine: "auto",
66
      },
67
    ],
68
    // Prevent default imports from React, named imports should be used instead.
69
    "no-restricted-imports": [
70
      "error",
71
      {
72
        paths: [
73
          {
74
            name: "react",
75
            importNames: ["default"],
76
          },
77
        ],
78
      },
79
    ],
80
    // Prefer using the `#private` syntax for private class members, we want to keep this consistent and use the same syntax.
81
    "no-restricted-syntax": [
82
      "error",
83
      {
84
        selector:
85
          ':matches(PropertyDefinition, MethodDefinition)[accessibility="private"]',
86
        message: "Use #private instead",
87
      },
88
    ],
89
  },
90
  overrides: [
91
    {
92
      files: ["*.test.*"],
93
      rules: {
94
        // For tests it can make sense to pass empty functions as mocks.
95
        "@typescript-eslint/no-empty-function": "off",
96
      },
97
    },
98
    {
99
      files: ["**/cypress/**/*"],
100
      extends: ["plugin:cypress/recommended", "plugin:mocha/recommended"],
101
      // TODO: Set these rules to "error" when issues have been resolved.
102
      rules: {
103
        "cypress/no-unnecessary-waiting": "warn",
104
        "cypress/unsafe-to-chain-command": "warn",
105
        "mocha/max-top-level-suites": "off",
106
        "mocha/no-exclusive-tests": "error",
107
        "mocha/no-identical-title": "off",
108
        "mocha/no-mocha-arrows": "off",
109
        "mocha/no-setup-in-describe": "off",
110
      },
111
    },
112
  ],
113
};
114

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.