1+ import js from '@eslint/js' ;
2+
3+ export default [
4+ js . configs . recommended ,
5+ // Configuration files (webpack, babel, etc.)
6+ {
7+ files : [ '*.config.js' , '.eslintrc.js' , '.lintstagedrc.js' , '.prettierrc.js' , 'babel.config.js' , 'jest.config.js' , 'web-ext-config.js' , 'webpack.config.js' ] ,
8+ ignores : [ 'node_modules/**' ] ,
9+ languageOptions : {
10+ ecmaVersion : 2020 ,
11+ sourceType : 'commonjs' ,
12+ globals : {
13+ module : 'readonly' ,
14+ require : 'readonly' ,
15+ __dirname : 'readonly' ,
16+ __filename : 'readonly' ,
17+ process : 'readonly'
18+ }
19+ } ,
20+ rules : {
21+ 'no-console' : 'off'
22+ }
23+ } ,
24+ // Static extension files (background.js, content-script.js)
25+ {
26+ files : [ 'static/**/*.js' ] ,
27+ ignores : [ 'node_modules/**' ] ,
28+ languageOptions : {
29+ ecmaVersion : 2020 ,
30+ sourceType : 'script' ,
31+ globals : {
32+ chrome : 'readonly' ,
33+ window : 'readonly' ,
34+ document : 'readonly' ,
35+ console : 'readonly' ,
36+ setTimeout : 'readonly' ,
37+ setInterval : 'readonly' ,
38+ clearTimeout : 'readonly' ,
39+ clearInterval : 'readonly' ,
40+ MutationObserver : 'readonly'
41+ }
42+ } ,
43+ rules : {
44+ 'no-console' : 'off' ,
45+ 'no-unused-expressions' : [ 'error' , { allowTaggedTemplates : true } ]
46+ }
47+ } ,
48+ // React source files
49+ {
50+ files : [ 'src/**/*.js' , 'src/**/*.jsx' ] ,
51+ ignores : [ 'dist/**' , 'node_modules/**' , 'web-ext-artifacts/**' ] ,
52+ languageOptions : {
53+ ecmaVersion : 2020 ,
54+ sourceType : 'module' ,
55+ parserOptions : {
56+ ecmaFeatures : {
57+ jsx : true
58+ }
59+ } ,
60+ globals : {
61+ chrome : 'readonly' ,
62+ window : 'readonly' ,
63+ document : 'readonly' ,
64+ console : 'readonly'
65+ }
66+ } ,
67+ rules : {
68+ 'no-console' : 'off' ,
69+ 'no-continue' : 'off' ,
70+ 'no-param-reassign' : 'off' ,
71+ 'no-underscore-dangle' : 'off' ,
72+ 'no-unused-vars' : [ 'error' , {
73+ argsIgnorePattern : '^_' ,
74+ varsIgnorePattern : '^(React|.*Component|.*List|.*Field|.*Content|App|Root|Topics|Websites)$'
75+ } ] ,
76+ 'max-len' : [ 'error' , { code : 140 } ] , // Relaxed for JSX
77+ 'no-undef' : 'error'
78+ }
79+ } ,
80+ // Test files
81+ {
82+ files : [ 'src/**/*.test.js' , 'src/**/*.test.jsx' , 'src/test-setup.js' ] ,
83+ languageOptions : {
84+ ecmaVersion : 2020 ,
85+ sourceType : 'module' ,
86+ parserOptions : {
87+ ecmaFeatures : {
88+ jsx : true
89+ }
90+ } ,
91+ globals : {
92+ jest : 'readonly' ,
93+ beforeEach : 'readonly' ,
94+ afterEach : 'readonly' ,
95+ describe : 'readonly' ,
96+ it : 'readonly' ,
97+ expect : 'readonly' ,
98+ global : 'writable' ,
99+ chrome : 'readonly'
100+ }
101+ } ,
102+ rules : {
103+ 'no-console' : 'off' ,
104+ 'no-unused-vars' : [ 'error' , {
105+ argsIgnorePattern : '^_' ,
106+ varsIgnorePattern : '^React$|^App$' // Allow unused React and component imports
107+ } ] ,
108+ 'max-len' : [ 'error' , { code : 140 } ]
109+ }
110+ }
111+ ] ;
0 commit comments