2020-02-07 19:40:04 -06:00
|
|
|
{
|
|
|
|
"extends": ["@grafana/eslint-config"],
|
2020-08-11 10:52:44 -05:00
|
|
|
"root": true,
|
2022-09-23 08:02:16 -05:00
|
|
|
"plugins": ["@emotion", "lodash", "jest", "import", "jsx-a11y"],
|
2022-04-22 08:33:13 -05:00
|
|
|
"settings": {
|
|
|
|
"import/internal-regex": "^(app/)|(@grafana)",
|
|
|
|
"import/external-module-folders": ["node_modules", ".yarn"]
|
|
|
|
},
|
2021-01-19 04:06:27 -06:00
|
|
|
"rules": {
|
2021-04-01 07:15:23 -05:00
|
|
|
"react/prop-types": "off",
|
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",
|
|
|
|
"alphabetize": { "order": "asc" }
|
|
|
|
}
|
2022-08-05 07:44:52 -05:00
|
|
|
],
|
2022-09-19 04:49:35 -05:00
|
|
|
"no-restricted-imports": [
|
|
|
|
"warn",
|
|
|
|
{
|
|
|
|
"paths": [
|
|
|
|
{
|
|
|
|
"name": "react-redux",
|
|
|
|
"importNames": ["useDispatch", "useSelector"],
|
|
|
|
"message": "Please import from app/types instead."
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
2022-08-05 07:44:52 -05:00
|
|
|
|
|
|
|
// Use typescript's no-redeclare for compatibility with overrides
|
|
|
|
"no-redeclare": "off",
|
2022-09-23 08:02:16 -05:00
|
|
|
"@typescript-eslint/no-redeclare": ["error"],
|
|
|
|
|
|
|
|
|
|
|
|
// these are all the rules listed in the strict preset
|
|
|
|
// we should fix them one by one and mark them as errors
|
|
|
|
// once they're all fixed, we can remove them all and instead extend the strict preset
|
|
|
|
// with "extends": ["plugin:jsx-a11y/strict"]
|
|
|
|
"jsx-a11y/alt-text": "off",
|
2022-09-23 08:18:23 -05:00
|
|
|
"jsx-a11y/anchor-has-content": "error",
|
2022-09-23 08:02:16 -05:00
|
|
|
"jsx-a11y/anchor-is-valid": "off",
|
2022-09-23 08:18:23 -05:00
|
|
|
"jsx-a11y/aria-activedescendant-has-tabindex": "error",
|
|
|
|
"jsx-a11y/aria-props": "error",
|
|
|
|
"jsx-a11y/aria-proptypes": "error",
|
2022-09-27 03:55:16 -05:00
|
|
|
"jsx-a11y/aria-role": "error",
|
2022-09-23 08:18:23 -05:00
|
|
|
"jsx-a11y/aria-unsupported-elements": "error",
|
|
|
|
"jsx-a11y/autocomplete-valid": "error",
|
2022-09-23 08:02:16 -05:00
|
|
|
"jsx-a11y/click-events-have-key-events": "off",
|
2022-09-23 08:18:23 -05:00
|
|
|
"jsx-a11y/heading-has-content": "error",
|
|
|
|
"jsx-a11y/html-has-lang": "error",
|
2022-09-23 08:02:16 -05:00
|
|
|
"jsx-a11y/iframe-has-title": "off",
|
2022-09-27 09:26:32 -05:00
|
|
|
"jsx-a11y/img-redundant-alt": "error",
|
2022-09-23 08:02:16 -05:00
|
|
|
"jsx-a11y/interactive-supports-focus": [
|
|
|
|
"off",
|
|
|
|
{
|
|
|
|
"tabbable": [
|
|
|
|
"button",
|
|
|
|
"checkbox",
|
|
|
|
"link",
|
|
|
|
"progressbar",
|
|
|
|
"searchbox",
|
|
|
|
"slider",
|
|
|
|
"spinbutton",
|
|
|
|
"switch",
|
|
|
|
"textbox"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"jsx-a11y/label-has-associated-control": "off",
|
2022-09-23 08:18:23 -05:00
|
|
|
"jsx-a11y/media-has-caption": "error",
|
2022-09-23 08:02:16 -05:00
|
|
|
"jsx-a11y/mouse-events-have-key-events": "off",
|
2022-09-23 08:18:23 -05:00
|
|
|
"jsx-a11y/no-access-key": "error",
|
2022-09-23 08:02:16 -05:00
|
|
|
"jsx-a11y/no-autofocus": "off",
|
2022-09-23 08:18:23 -05:00
|
|
|
"jsx-a11y/no-distracting-elements": "error",
|
|
|
|
"jsx-a11y/no-interactive-element-to-noninteractive-role": "error",
|
2022-09-23 08:02:16 -05:00
|
|
|
"jsx-a11y/no-noninteractive-element-interactions": [
|
|
|
|
"off",
|
|
|
|
{
|
|
|
|
"body": ["onError", "onLoad"],
|
|
|
|
"iframe": ["onError", "onLoad"],
|
|
|
|
"img": ["onError", "onLoad"]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"jsx-a11y/no-noninteractive-element-to-interactive-role": "off",
|
|
|
|
"jsx-a11y/no-noninteractive-tabindex": "off",
|
2022-09-23 08:18:23 -05:00
|
|
|
"jsx-a11y/no-redundant-roles": "error",
|
2022-09-23 08:02:16 -05:00
|
|
|
"jsx-a11y/no-static-element-interactions": "off",
|
2022-09-27 10:17:26 -05:00
|
|
|
"jsx-a11y/role-has-required-aria-props": "error",
|
2022-09-27 09:42:46 -05:00
|
|
|
"jsx-a11y/role-supports-aria-props": "error",
|
2022-09-23 08:18:23 -05:00
|
|
|
"jsx-a11y/scope": "error",
|
2022-09-27 09:18:24 -05:00
|
|
|
"jsx-a11y/tabindex-no-positive": "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",
|
2021-01-19 04:06:27 -06:00
|
|
|
"react-hooks/exhaustive-deps": "off"
|
2020-08-11 10:52:44 -05:00
|
|
|
}
|
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",
|
|
|
|
"react/react-in-jsx-scope": "off"
|
|
|
|
}
|
2022-08-05 07:44:52 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"files": ["public/dashboards/scripted*.js"],
|
|
|
|
"rules": {
|
|
|
|
"no-redeclare": "error",
|
|
|
|
"@typescript-eslint/no-redeclare": "off"
|
|
|
|
}
|
2020-08-11 10:52:44 -05:00
|
|
|
}
|
|
|
|
]
|
2020-02-07 19:40:04 -06:00
|
|
|
}
|