11import stylistic from '@stylistic/eslint-plugin' ;
2- import { defineConfig } from 'eslint/config' ;
2+ import { defineConfig } from 'eslint/config' ;
33import grafanaEslintConfig from '@grafana/eslint-config/flat.js' ;
44import react from 'eslint-plugin-react' ;
55import jest from 'eslint-plugin-jest' ;
@@ -8,136 +8,138 @@ import deprecation from 'eslint-plugin-deprecation';
88import prettier from 'eslint-config-prettier' ;
99import unusedImports from "eslint-plugin-unused-imports" ;
1010import * as emotionPlugin from '@emotion/eslint-plugin' ;
11- import { fixupPluginRules } from "@eslint/compat" ;
11+ import { fixupPluginRules } from "@eslint/compat" ;
1212import importPlugin from 'eslint-plugin-import' ;
1313
1414export default defineConfig ( [
15- grafanaEslintConfig ,
16- prettier ,
17- {
18- ignores : [
19- '**/node_modules/**' ,
20- '**/dist/**' ,
21- '**/build/**' ,
22- '**/coverage/**' ,
23- '**/.yarn/**' ,
24- '**/.cache/**' ,
25- '**/.config/**' ,
26- '**/vendor/**' ,
27- '**/pkg/**' ,
28- '**/plugins/**' ,
29- '**/bin/**' ,
30- '**/*.min.js' ,
31- '**/packages/**' ,
32- '.prettierrc.js' ,
33- 'webpack.config.ts' ,
34- 'jest.config.js' ,
35- 'jest-setup.js' ,
36- ] ,
37- } ,
38- {
39- files : [ '**/*.{ts,tsx,js,jsx}' ] ,
40- plugins : {
41- 'react' : react ,
42- 'jest' : jest ,
43- 'lodash' : lodash ,
44- 'deprecation' : deprecation ,
45- 'unused-imports' : unusedImports ,
46- '@emotion' : fixupPluginRules ( emotionPlugin ) ,
47- 'import' : importPlugin ,
48- '@stylistic' : stylistic ,
49- } ,
50- languageOptions : {
51- parserOptions : {
52- ecmaVersion : 'latest' ,
53- sourceType : 'module' ,
54- ecmaFeatures : {
55- jsx : true ,
56- } ,
57- project : './tsconfig.json' ,
58- } ,
59- globals : {
60- // Browser globals
61- window : 'readonly' ,
62- document : 'readonly' ,
63- navigator : 'readonly' ,
64- console : 'readonly' ,
65- // Node globals
66- process : 'readonly' ,
67- __dirname : 'readonly' ,
68- __filename : 'readonly' ,
69- module : 'readonly' ,
70- require : 'readonly' ,
71- } ,
15+ grafanaEslintConfig ,
16+ prettier ,
17+ {
18+ ignores : [
19+ '**/node_modules/**' ,
20+ '**/dist/**' ,
21+ '**/build/**' ,
22+ '**/coverage/**' ,
23+ '**/.yarn/**' ,
24+ '**/.cache/**' ,
25+ '**/.config/**' ,
26+ '**/vendor/**' ,
27+ '**/pkg/**' ,
28+ '**/plugins/**' ,
29+ '**/bin/**' ,
30+ '**/*.min.js' ,
31+ '**/packages/**' ,
32+ '.prettierrc.js' ,
33+ 'webpack.config.ts' ,
34+ 'jest.config.js' ,
35+ 'jest-setup.js' ,
36+ ] ,
37+ } ,
38+ {
39+ files : [ '**/*.{ts,tsx,js,jsx}' ] ,
40+ plugins : {
41+ 'react' : react ,
42+ 'jest' : jest ,
43+ 'lodash' : lodash ,
44+ 'deprecation' : deprecation ,
45+ 'unused-imports' : unusedImports ,
46+ '@emotion' : fixupPluginRules ( emotionPlugin ) ,
47+ 'import' : importPlugin ,
48+ '@stylistic' : stylistic ,
49+ } ,
50+ languageOptions : {
51+ parserOptions : {
52+ ecmaVersion : 'latest' ,
53+ sourceType : 'module' ,
54+ ecmaFeatures : {
55+ jsx : true ,
7256 } ,
57+ project : './tsconfig.json' ,
58+ } ,
59+ globals : {
60+ // Browser globals
61+ window : 'readonly' ,
62+ document : 'readonly' ,
63+ navigator : 'readonly' ,
64+ console : 'readonly' ,
65+ // Node globals
66+ process : 'readonly' ,
67+ __dirname : 'readonly' ,
68+ __filename : 'readonly' ,
69+ module : 'readonly' ,
70+ require : 'readonly' ,
71+ } ,
72+ } ,
7373
7474
75- rules : {
76- 'react-hooks/rules-of-hooks' : 'error' ,
77- 'react-hooks/exhaustive-deps' : 'warn' ,
78- '@typescript-eslint/no-explicit-any' : 'warn' ,
79- "unused-imports/no-unused-imports" : "error" ,
80- '@typescript-eslint/no-unused-vars' : [ 'warn' , {
81- argsIgnorePattern : '^_' ,
82- varsIgnorePattern : '^_'
83- } ] ,
84- 'no-console' : [ 'warn' , { allow : [ 'warn' , 'error' ] } ] ,
85- "react/prop-types" : "off" ,
86- "@emotion/jsx-import" : "error" ,
87- "object-curly-spacing" : [ 2 , "always" ] ,
88- "lodash/import-scope" : [ 2 , "member" ] ,
89- "jest/no-focused-tests" : "error" ,
90- "@typescript-eslint/array-type" : 0 ,
91- "no-useless-escape" : 0 ,
92- "no-prototype-builtins" : 0 ,
93- '@stylistic/indent' : [ 'error' , 2 , {
94- 'SwitchCase' : 1 ,
95- 'FunctionDeclaration' : { 'parameters' : 'first' } ,
96- 'FunctionExpression' : { 'parameters' : 'first' } ,
97- 'CallExpression' : { 'arguments' : 1 } ,
98- 'ObjectExpression' : 'first' ,
99- 'ignoredNodes' : [
100- 'TSTypeAnnotation *' ,
101- ] ,
102- } ] ,
103- '@stylistic/jsx-max-props-per-line' : [ 'error' , {
104- maximum : 1 ,
105- when : 'multiline'
106- } ] ,
107- '@stylistic/jsx-first-prop-new-line' : [ 'error' , 'multiline-multiprop' ] ,
108- '@stylistic/jsx-closing-bracket-location' : [ 'error' , 'tag-aligned' ] ,
109- "import/order" : [
110- "error" ,
75+ rules : {
76+ 'react-hooks/rules-of-hooks' : 'error' ,
77+ 'react-hooks/exhaustive-deps' : 'warn' ,
78+ '@typescript-eslint/no-explicit-any' : 'warn' ,
79+ "unused-imports/no-unused-imports" : "error" ,
80+ '@typescript-eslint/no-unused-vars' : [ 'warn' , {
81+ argsIgnorePattern : '^_' ,
82+ varsIgnorePattern : '^_'
83+ } ] ,
84+ 'no-console' : [ 'warn' , { allow : [ 'warn' , 'error' ] } ] ,
85+ "react/prop-types" : "off" ,
86+ "@emotion/jsx-import" : "error" ,
87+ "object-curly-spacing" : [ 2 , "always" ] ,
88+ "lodash/import-scope" : [ 2 , "member" ] ,
89+ "jest/no-focused-tests" : "error" ,
90+ "@typescript-eslint/array-type" : 0 ,
91+ "no-useless-escape" : 0 ,
92+ "no-prototype-builtins" : 0 ,
93+ '@stylistic/indent' : [ 'error' , 2 , {
94+ 'SwitchCase' : 1 ,
95+ 'FunctionDeclaration' : { 'parameters' : 'first' } ,
96+ 'FunctionExpression' : { 'parameters' : 'first' } ,
97+ 'CallExpression' : { 'arguments' : 1 } ,
98+ 'ObjectExpression' : 'first' ,
99+ 'ignoredNodes' : [
100+ 'TSTypeAnnotation *' ,
101+ ] ,
102+ } ] ,
103+ '@stylistic/jsx-max-props-per-line' : [ 'error' , {
104+ maximum : 1 ,
105+ when : 'multiline'
106+ } ] ,
107+ '@stylistic/jsx-first-prop-new-line' : [ 'error' , 'multiline-multiprop' ] ,
108+ '@stylistic/jsx-closing-bracket-location' : [ 'error' , 'tag-aligned' ] ,
109+ "import/order" : [
110+ "error" ,
111+ {
112+ "groups" : [ [ "builtin" , "external" ] , "internal" , "parent" , "sibling" , "index" ] ,
113+ 'pathGroups' : [
111114 {
112- "groups" : [ [ "builtin" , "external" ] , "internal" , "parent" , "sibling" , "index" ] ,
113- 'pathGroups' : [
114- {
115- pattern : '@grafana/**' ,
116- group : 'external' ,
117- position : 'after'
118- }
119- ] ,
120- 'pathGroupsExcludedImportTypes' : [ 'react' , 'react-dom' ] ,
121- "newlines-between" : "always" ,
122- "alphabetize" : { "order" : "asc" }
115+ pattern : '@grafana/**' ,
116+ group : 'external' ,
117+ position : 'after'
123118 }
124119 ] ,
120+ 'pathGroupsExcludedImportTypes' : [ 'react' , 'react-dom' ] ,
121+ "newlines-between" : "always" ,
122+ "alphabetize" : { "order" : "asc" }
123+ }
124+ ] ,
125+ 'react/jsx-tag-spacing' : [ 'error' , { beforeSelfClosing : 'always' } ] ,
126+ 'jsx-quotes' : [ 'error' , 'prefer-single' ] ,
127+ quotes : [ 'error' , 'single' , { avoidEscape : true } ] ,
125128
126- // Use typescript's no-redeclare for compatibility with overrides
127- "no-redeclare" : "off" ,
128- "@typescript-eslint/no-redeclare" : [ "error" ]
129- } ,
130- } ,
129+ // Use typescript's no-redeclare for compatibility with overrides
130+ "no-redeclare" : "off" ,
131+ "@typescript-eslint/no-redeclare" : [ "error" ]
132+ } ,
133+ } ,
131134
132- {
133- files : [ '**/*.test.{ts,tsx,js,jsx}' , '**/__tests__/**' ] ,
134- plugins : {
135- jest,
136- } ,
137- rules : {
138- ...jest . configs . recommended . rules ,
139- '@typescript-eslint/no-explicit-any' : 'off' ,
140- } ,
141- } ,
142- ]
143- ) ;
135+ {
136+ files : [ '**/*.test.{ts,tsx,js,jsx}' , '**/__tests__/**' ] ,
137+ plugins : {
138+ jest,
139+ } ,
140+ rules : {
141+ ...jest . configs . recommended . rules ,
142+ '@typescript-eslint/no-explicit-any' : 'off' ,
143+ } ,
144+ } ,
145+ ] ) ;
0 commit comments