diff --git a/cshare-app/eslint.config.js b/cshare-app/eslint.config.js new file mode 100644 index 0000000..04102c9 --- /dev/null +++ b/cshare-app/eslint.config.js @@ -0,0 +1,44 @@ +import js from '@eslint/js' +import globals from 'globals' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' +import { defineConfig, globalIgnores } from 'eslint/config' + +export default defineConfig([ + globalIgnores(['dist']), + { + files: ['**/*.{js,jsx}'], + ignores: ['**/*.test.{js,jsx}'], + extends: [ + js.configs.recommended, + reactHooks.configs.flat.recommended, + reactRefresh.configs.vite, + ], + languageOptions: { + globals: globals.browser, + parserOptions: { ecmaFeatures: { jsx: true } }, + }, + }, + { + files: ['**/*.test.{js,jsx}', 'src/test/**/*.{js,jsx}'], + extends: [js.configs.recommended], + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + ...globals.es2021, + // Vitest globals (mirrors what vitest injects with globals: true) + describe: 'readonly', + it: 'readonly', + test: 'readonly', + expect: 'readonly', + vi: 'readonly', + beforeEach: 'readonly', + afterEach: 'readonly', + beforeAll: 'readonly', + afterAll: 'readonly', + }, + parserOptions: { ecmaFeatures: { jsx: true } }, + }, + }, +])