|
| 1 | +import jsdoc from 'eslint-plugin-jsdoc'; |
| 2 | +import reactHooksPlugin from 'eslint-plugin-react-hooks'; |
| 3 | +import reactPlugin from 'eslint-plugin-react'; |
| 4 | +import tsPlugin from '@typescript-eslint/eslint-plugin'; |
| 5 | +import typescriptParser from '@typescript-eslint/parser'; |
| 6 | +import prettierConfig from 'eslint-config-prettier'; |
| 7 | +import stylistic from '@stylistic/eslint-plugin'; |
| 8 | + |
| 9 | +export default [ |
| 10 | + reactHooksPlugin.configs.flat.recommended, |
| 11 | + reactPlugin.configs.flat.recommended, |
| 12 | + prettierConfig, |
| 13 | + { |
| 14 | + name: '@grafana/eslint-config', |
| 15 | + settings: { |
| 16 | + react: { |
| 17 | + version: 'detect', |
| 18 | + }, |
| 19 | + }, |
| 20 | + plugins: { |
| 21 | + jsdoc, |
| 22 | + '@typescript-eslint': tsPlugin, |
| 23 | + '@stylistic': stylistic, |
| 24 | + }, |
| 25 | + languageOptions: { |
| 26 | + parser: typescriptParser, |
| 27 | + ecmaVersion: 2019, |
| 28 | + sourceType: 'module', |
| 29 | + parserOptions: { |
| 30 | + ecmaFeatures: { |
| 31 | + jsx: true, |
| 32 | + }, |
| 33 | + }, |
| 34 | + }, |
| 35 | + rules: { |
| 36 | + curly: 'error', |
| 37 | + 'dot-notation': 'off', |
| 38 | + 'eol-last': 'error', |
| 39 | + eqeqeq: ['error', 'always', { null: 'ignore' }], |
| 40 | + 'guard-for-in': 'off', |
| 41 | + 'jsdoc/check-alignment': 'error', |
| 42 | + 'new-parens': 'error', |
| 43 | + 'no-array-constructor': 'error', |
| 44 | + 'no-bitwise': 'off', |
| 45 | + 'no-caller': 'error', |
| 46 | + 'no-cond-assign': 'error', |
| 47 | + 'no-console': ['error', { allow: ['error', 'log', 'warn', 'info'] }], |
| 48 | + 'no-debugger': 'error', |
| 49 | + 'no-empty': 'off', |
| 50 | + 'no-eval': 'error', |
| 51 | + 'no-fallthrough': 'off', |
| 52 | + 'no-new-wrappers': 'error', |
| 53 | + 'no-redeclare': 'error', |
| 54 | + 'no-restricted-imports': ['error', 'moment'], |
| 55 | + 'no-shadow': 'off', |
| 56 | + 'no-unused-expressions': 'off', |
| 57 | + 'no-unused-labels': 'error', |
| 58 | + 'no-var': 'error', |
| 59 | + radix: 'error', |
| 60 | + 'sort-keys': 'off', |
| 61 | + 'spaced-comment': ['off', 'always'], |
| 62 | + 'use-isnan': 'error', |
| 63 | + 'no-duplicate-imports': 'error', |
| 64 | + '@typescript-eslint/no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true }], |
| 65 | + '@typescript-eslint/array-type': ['error', { default: 'array-simple' }], |
| 66 | + '@typescript-eslint/naming-convention': [ |
| 67 | + 'error', |
| 68 | + { |
| 69 | + selector: 'interface', |
| 70 | + format: ['PascalCase'], |
| 71 | + custom: { |
| 72 | + regex: '^I[A-Z]', |
| 73 | + match: false, |
| 74 | + }, |
| 75 | + }, |
| 76 | + ], |
| 77 | + '@typescript-eslint/consistent-type-assertions': 'error', |
| 78 | + '@typescript-eslint/no-inferrable-types': 'error', |
| 79 | + '@typescript-eslint/no-namespace': ['error', { allowDeclarations: false }], |
| 80 | + '@typescript-eslint/no-unused-vars': 'off', |
| 81 | + '@typescript-eslint/no-use-before-define': 'off', |
| 82 | + '@typescript-eslint/triple-slash-reference': 'error', |
| 83 | + '@stylistic/type-annotation-spacing': [ |
| 84 | + 'error', |
| 85 | + { |
| 86 | + after: true, |
| 87 | + before: false, |
| 88 | + overrides: { |
| 89 | + arrow: 'ignore', |
| 90 | + }, |
| 91 | + }, |
| 92 | + ], |
| 93 | + '@stylistic/arrow-spacing': ['error', { after: true, before: true }], |
| 94 | + 'react-hooks/exhaustive-deps': 'error', |
| 95 | + }, |
| 96 | + }, |
| 97 | +]; |
0 commit comments