2020-02-07 19:40:04 -06:00
{
2024-06-25 06:43:47 -05:00
"extends": ["@grafana/eslint-config", "plugin:react/jsx-runtime"],
2020-08-11 10:52:44 -05:00
"root": true,
2024-07-30 07:16:54 -05:00
"plugins": [
"@emotion",
"lodash",
"jest",
"import",
"jsx-a11y",
"@grafana",
"no-barrel-files",
// Included so betterer doesn't fail when processing all files,
// as other parts of the code use testing-library plugin
"testing-library",
],
2022-04-22 08:33:13 -05:00
"settings": {
"import/internal-regex": "^(app/)|(@grafana)",
2024-04-25 00:12:43 -05:00
"import/external-module-folders": ["node_modules", ".yarn"],
2022-04-22 08:33:13 -05:00
},
2021-01-19 04:06:27 -06:00
"rules": {
2023-08-01 05:44:25 -05:00
"@grafana/no-border-radius-literal": "error",
2024-04-29 07:12:36 -05:00
"@grafana/no-unreduced-motion": "error",
2021-04-01 07:15:23 -05:00
"react/prop-types": "off",
2022-11-02 07:05:32 -05:00
// 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"] }],
2021-04-21 02:38:00 -05:00
"@emotion/jsx-import": "error",
2022-02-11 08:59:30 -06:00
"lodash/import-scope": [2, "member"],
2022-04-22 08:33:13 -05:00
"jest/no-focused-tests": "error",
"import/order": [
"error",
{
"groups": [["builtin", "external"], "internal", "parent", "sibling", "index"],
"newlines-between": "always",
2024-04-25 00:12:43 -05:00
"alphabetize": { "order": "asc" },
},
2022-08-05 07:44:52 -05:00
],
2022-09-19 04:49:35 -05:00
"no-restricted-imports": [
2022-10-07 05:46:28 -05:00
"error",
2022-09-19 04:49:35 -05:00
{
"paths": [
{
"name": "react-redux",
"importNames": ["useDispatch", "useSelector"],
2024-04-25 00:12:43 -05:00
"message": "Please import from app/types instead.",
2022-10-07 05:46:28 -05:00
},
{
"name": "react-i18next",
"importNames": ["Trans", "t"],
2024-04-25 00:12:43 -05:00
"message": "Please import from app/core/internationalization instead",
2023-09-08 10:51:59 -05:00
},
2024-04-25 00:12:43 -05:00
],
},
2022-09-19 04:49:35 -05:00
],
2022-08-05 07:44:52 -05:00
// Use typescript's no-redeclare for compatibility with overrides
"no-redeclare": "off",
2024-04-25 00:12:43 -05:00
"@typescript-eslint/no-redeclare": ["error"],
2021-01-19 04:06:27 -06:00
},
2020-08-11 10:52:44 -05:00
"overrides": [
{
2021-03-25 06:42:14 -05:00
"files": ["packages/grafana-ui/src/components/uPlot/**/*.{ts,tsx}"],
2020-08-11 10:52:44 -05:00
"rules": {
"react-hooks/rules-of-hooks": "off",
2024-04-25 00:12:43 -05:00
"react-hooks/exhaustive-deps": "off",
},
2021-04-08 06:00:58 -05:00
},
{
"files": ["packages/grafana-ui/src/components/ThemeDemos/**/*.{ts,tsx}"],
"rules": {
"@emotion/jsx-import": "off",
"react/jsx-uses-react": "off",
2024-04-25 00:12:43 -05:00
"react/react-in-jsx-scope": "off",
},
2022-08-05 07:44:52 -05:00
},
{
"files": ["public/dashboards/scripted*.js"],
"rules": {
"no-redeclare": "error",
2024-04-25 00:12:43 -05:00
"@typescript-eslint/no-redeclare": "off",
},
2022-09-27 10:59:35 -05:00
},
{
2022-10-14 05:02:01 -05:00
"extends": ["plugin:jsx-a11y/recommended"],
2023-06-30 10:58:16 -05:00
"files": ["**/*.tsx"],
"excludedFiles": ["**/*.{spec,test}.tsx"],
2022-09-27 10:59:35 -05:00
"rules": {
2022-10-14 05:02:01 -05:00
// 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
2022-10-04 06:54:14 -05:00
"jsx-a11y/no-autofocus": [
"error",
{
2024-04-25 00:12:43 -05:00
"ignoreNonDOM": true,
},
2022-10-04 06:54:14 -05:00
],
2023-01-18 09:02:35 -06:00
"jsx-a11y/label-has-associated-control": [
"error",
{
"controlComponents": ["NumberInput"],
2024-04-25 00:12:43 -05:00
"depth": 2,
},
],
},
2023-07-20 02:34:19 -05:00
},
{
"files": [
2024-03-19 08:39:31 -05:00
"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}",
2024-01-31 03:00:59 -06:00
"public/app/plugins/datasource/grafana-postgresql-datasource/*.{ts,tsx}",
"public/app/plugins/datasource/grafana-postgresql-datasource/**/*.{ts,tsx}",
2024-01-16 06:46:15 -06:00
"public/app/plugins/datasource/grafana-pyroscope-datasource/*.{ts,tsx}",
"public/app/plugins/datasource/grafana-pyroscope-datasource/**/*.{ts,tsx}",
2023-09-22 07:00:40 -05:00
"public/app/plugins/datasource/grafana-testdata-datasource/*.{ts,tsx}",
2024-01-02 09:36:57 -06:00
"public/app/plugins/datasource/grafana-testdata-datasource/**/*.{ts,tsx}",
2024-03-19 08:39:31 -05:00
"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}",
2024-01-31 03:00:59 -06:00
"public/app/plugins/datasource/mysql/*.{ts,tsx}",
"public/app/plugins/datasource/mysql/**/*.{ts,tsx}",
2024-01-02 09:36:57 -06:00
"public/app/plugins/datasource/parca/*.{ts,tsx}",
2024-01-16 04:36:40 -06:00
"public/app/plugins/datasource/parca/**/*.{ts,tsx}",
"public/app/plugins/datasource/tempo/*.{ts,tsx}",
2024-02-01 06:46:32 -06:00
"public/app/plugins/datasource/tempo/**/*.{ts,tsx}",
"public/app/plugins/datasource/loki/*.{ts,tsx}",
2024-02-09 06:11:08 -06:00
"public/app/plugins/datasource/loki/**/*.{ts,tsx}",
"public/app/plugins/datasource/elasticsearch/*.{ts,tsx}",
2024-02-20 07:52:11 -06:00
"public/app/plugins/datasource/elasticsearch/**/*.{ts,tsx}",
"public/app/plugins/datasource/cloudwatch/*.{ts,tsx}",
2024-02-20 10:24:40 -06:00
"public/app/plugins/datasource/cloudwatch/**/*.{ts,tsx}",
"public/app/plugins/datasource/zipkin/*.{ts,tsx}",
2024-04-25 00:12:43 -05:00
"public/app/plugins/datasource/zipkin/**/*.{ts,tsx}",
2023-07-20 02:34:19 -05:00
],
2023-09-25 05:15:15 -05:00
"settings": {
"import/resolver": {
"node": {
2024-04-25 00:12:43 -05:00
"extensions": [".ts", ".tsx"],
},
},
2023-09-25 05:15:15 -05:00
},
2023-07-20 02:34:19 -05:00
"rules": {
2023-09-25 05:15:15 -05:00
"import/no-restricted-paths": [
2023-07-20 02:34:19 -05:00
"error",
{
2023-09-25 05:15:15 -05:00
"zones": [
2023-07-20 02:34:19 -05:00
{
2023-09-25 05:15:15 -05:00
"target": "./public/app/plugins",
2024-02-01 09:37:29 -06:00
"from": "./public",
"except": ["./app/plugins"],
2024-04-25 00:12:43 -05:00
"message": "Core plugins are not allowed to depend on Grafana core packages",
},
],
},
],
},
},
],
2020-02-07 19:40:04 -06:00
}