@@ -4,6 +4,7 @@ import { defineConfig } from 'eslint/config';
44import importPlugin from 'eslint-plugin-import' ;
55import prettierRecommended from 'eslint-plugin-prettier/recommended' ;
66import unusedImports from 'eslint-plugin-unused-imports' ;
7+ import globals from 'globals' ;
78
89export default defineConfig ( [
910 js . configs . recommended ,
@@ -52,8 +53,30 @@ export default defineConfig([
5253 } ,
5354 } ,
5455
56+ // globals
5557 {
56- files : [ '**/*.{js,mjs}' ] ,
58+ files : [ 'test/**/*.js' ] ,
59+ languageOptions : { globals : { ...globals . mocha } } ,
60+ } ,
61+
62+ {
63+ files : [ 'src/**/*.{js,cjs}' , 'test/**/*.js' ] ,
64+ languageOptions : { globals : { ...globals . browser } } ,
65+ } ,
66+
67+ {
68+ files : [
69+ 'src/server/**/*.js' ,
70+ 'src/react-native/**/*.js' ,
71+ 'test/**/server.*.js' ,
72+ 'scripts/**/*.js' ,
73+ ] ,
74+ languageOptions : { globals : { ...globals . node } } ,
75+ } ,
76+
77+ // sources
78+ {
79+ files : [ '**/*.js' ] ,
5780 languageOptions : {
5881 sourceType : 'module' ,
5982 parser : babelParser ,
@@ -64,26 +87,22 @@ export default defineConfig([
6487 rules : {
6588 strict : [ 'error' , 'safe' ] ,
6689 'no-prototype-builtins' : 'off' ,
67- 'no-undef' : 'off' ,
6890 } ,
6991 } ,
7092
93+ // cjs
7194 {
7295 files : [ '**/*.cjs' ] ,
73- languageOptions : {
74- sourceType : 'commonjs' ,
75- } ,
76- rules : {
77- strict : 'off' ,
78- } ,
96+ languageOptions : { sourceType : 'commonjs' } ,
97+ rules : { strict : 'off' } ,
7998 } ,
8099
100+ // scripts
81101 {
82- files : [ 'scripts/**/*.{js,mjs,cjs}' ] ,
83- rules : {
84- 'no-console' : 'off' ,
85- } ,
102+ files : [ 'scripts/**/*.{js,cjs}' ] ,
103+ rules : { 'no-console' : 'off' } ,
86104 } ,
105+
87106 {
88107 ignores : [ 'dist' , 'examples' , 'node_modules' , 'vendor' , 'coverage' ] ,
89108 } ,
0 commit comments