Revision 3b2c80b8ff3b48e2e051a1be8ef99f10bc79388c authored by Kyle Cunningham on 26 June 2024, 16:12:44 UTC, committed by grafana-delivery-bot[bot] on 24 July 2024, 13:18:17 UTC
* Fix image hover

* Prettier

* Fix height offset

(cherry picked from commit c575c06d63135939fe9dd7ecfd674971df054405)
1 parent 7f588ad
Raw File
.eslintrc
{
  "extends": ["@grafana/eslint-config"],
  "root": true,
  "plugins": ["@emotion", "lodash", "jest", "import", "jsx-a11y", "@grafana"],
  "settings": {
    "import/internal-regex": "^(app/)|(@grafana)",
    "import/external-module-folders": ["node_modules", ".yarn"]
  },
  "rules": {
    "@grafana/no-border-radius-literal": "error",
    "react/prop-types": "off",
    // need to ignore emotion's `css` prop, see https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md#rule-options
    "react/no-unknown-property": ["error", { "ignore": ["css"] }],
    "@emotion/jsx-import": "error",
    "lodash/import-scope": [2, "member"],
    "jest/no-focused-tests": "error",
    "import/order": [
      "error",
      {
        "groups": [["builtin", "external"], "internal", "parent", "sibling", "index"],
        "newlines-between": "always",
        "alphabetize": { "order": "asc" }
      }
    ],
    "no-restricted-imports": [
      "error",
      {
        "paths": [
          {
            "name": "react-redux",
            "importNames": ["useDispatch", "useSelector"],
            "message": "Please import from app/types instead."
          },
          {
            "name": "react-i18next",
            "importNames": ["Trans", "t"],
            "message": "Please import from app/core/internationalization instead"
          },
          {
            "name": "@grafana/e2e",
            "message": "@grafana/e2e is deprecated. Please import from ./e2e/utils instead"
          }
        ]
      }
    ],

    // Use typescript's no-redeclare for compatibility with overrides
    "no-redeclare": "off",
    "@typescript-eslint/no-redeclare": ["error"]
  },
  "overrides": [
    {
      "files": ["packages/grafana-ui/src/components/uPlot/**/*.{ts,tsx}"],
      "rules": {
        "react-hooks/rules-of-hooks": "off",
        "react-hooks/exhaustive-deps": "off"
      }
    },
    {
      "files": ["packages/grafana-ui/src/components/ThemeDemos/**/*.{ts,tsx}"],
      "rules": {
        "@emotion/jsx-import": "off",
        "react/jsx-uses-react": "off",
        "react/react-in-jsx-scope": "off"
      }
    },
    {
      "files": ["public/dashboards/scripted*.js"],
      "rules": {
        "no-redeclare": "error",
        "@typescript-eslint/no-redeclare": "off"
      }
    },
    {
      "extends": ["plugin:jsx-a11y/recommended"],
      "files": ["**/*.tsx"],
      "excludedFiles": ["**/*.{spec,test}.tsx"],
      "rules": {
        // rules marked "off" are those left in the recommended preset we need to fix
        // we should remove the corresponding line and fix them one by one
        // any marked "error" contain specific overrides we'll need to keep
        "jsx-a11y/no-autofocus": [
          "error",
          {
            "ignoreNonDOM": true
          }
        ],
        "jsx-a11y/label-has-associated-control": [
          "error",
          {
            "controlComponents": ["NumberInput"],
            "depth": 2
          }
        ]
      }
    },
    {
      "files": [
        "public/app/plugins/datasource/azuremonitor/*.{ts,tsx}",
        "public/app/plugins/datasource/azuremonitor/**/*.{ts,tsx}",
        "public/app/plugins/datasource/cloud-monitoring/*.{ts,tsx}",
        "public/app/plugins/datasource/cloud-monitoring/**/*.{ts,tsx}",
        "public/app/plugins/datasource/elasticsearch/*.{ts,tsx}",
        "public/app/plugins/datasource/elasticsearch/**/*.{ts,tsx}",
        "public/app/plugins/datasource/grafana-postgresql-datasource/*.{ts,tsx}",
        "public/app/plugins/datasource/grafana-postgresql-datasource/**/*.{ts,tsx}",
        "public/app/plugins/datasource/grafana-pyroscope-datasource/*.{ts,tsx}",
        "public/app/plugins/datasource/grafana-pyroscope-datasource/**/*.{ts,tsx}",
        "public/app/plugins/datasource/grafana-testdata-datasource/*.{ts,tsx}",
        "public/app/plugins/datasource/grafana-testdata-datasource/**/*.{ts,tsx}",
        "public/app/plugins/datasource/jaeger/*.{ts,tsx}",
        "public/app/plugins/datasource/jaeger/**/*.{ts,tsx}",
        "public/app/plugins/datasource/loki/*.{ts,tsx}",
        "public/app/plugins/datasource/loki/**/*.{ts,tsx}",
        "public/app/plugins/datasource/mysql/*.{ts,tsx}",
        "public/app/plugins/datasource/mysql/**/*.{ts,tsx}",
        "public/app/plugins/datasource/parca/*.{ts,tsx}",
        "public/app/plugins/datasource/parca/**/*.{ts,tsx}",
        "public/app/plugins/datasource/tempo/*.{ts,tsx}",
        "public/app/plugins/datasource/tempo/**/*.{ts,tsx}",
        "public/app/plugins/datasource/loki/*.{ts,tsx}",
        "public/app/plugins/datasource/loki/**/*.{ts,tsx}",
        "public/app/plugins/datasource/elasticsearch/*.{ts,tsx}",
        "public/app/plugins/datasource/elasticsearch/**/*.{ts,tsx}",
        "public/app/plugins/datasource/cloudwatch/*.{ts,tsx}",
        "public/app/plugins/datasource/cloudwatch/**/*.{ts,tsx}",
        "public/app/plugins/datasource/zipkin/*.{ts,tsx}",
        "public/app/plugins/datasource/zipkin/**/*.{ts,tsx}"
      ],
      "settings": {
        "import/resolver": {
          "node": {
            "extensions": [".ts", ".tsx"]
          }
        }
      },
      "rules": {
        "import/no-restricted-paths": [
          "error",
          {
            "zones": [
              {
                "target": "./public/app/plugins",
                "from": "./public",
                "except": ["./app/plugins"],
                "message": "Core plugins are not allowed to depend on Grafana core packages"
              }
            ]
          }
        ]
      }
    }
  ]
}
back to top