mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-17 14:14:26 +01:00
144 lines
3.8 KiB
JavaScript
144 lines
3.8 KiB
JavaScript
const eslint = require('@eslint/js');
|
|
const typescript = require('@typescript-eslint/eslint-plugin');
|
|
const typescriptParser = require('@typescript-eslint/parser');
|
|
const importPlugin = require('eslint-plugin-import');
|
|
const prettier = require('eslint-plugin-prettier');
|
|
const react = require('eslint-plugin-react');
|
|
const reactHooks = require('eslint-plugin-react-hooks');
|
|
|
|
module.exports = [
|
|
{
|
|
ignores: ['**/node_modules/**', '**/dist/**', '**/out/**', '**/coverage/**', '**/.vite/**'],
|
|
},
|
|
// Configuration for Node.js files
|
|
{
|
|
files: ['**/*.{js,cjs,ts,mts}'],
|
|
languageOptions: {
|
|
globals: {
|
|
module: 'readonly',
|
|
require: 'readonly',
|
|
process: 'readonly',
|
|
__dirname: 'readonly',
|
|
__filename: 'readonly',
|
|
},
|
|
},
|
|
},
|
|
// Base configuration for all files
|
|
{
|
|
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
plugins: {
|
|
'@typescript-eslint': typescript,
|
|
react,
|
|
'react-hooks': reactHooks,
|
|
import: importPlugin,
|
|
prettier,
|
|
},
|
|
languageOptions: {
|
|
parser: typescriptParser,
|
|
parserOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
},
|
|
},
|
|
settings: {
|
|
react: {
|
|
version: 'detect',
|
|
},
|
|
},
|
|
rules: {
|
|
...eslint.configs.recommended.rules,
|
|
...typescript.configs.recommended.rules,
|
|
...react.configs.recommended.rules,
|
|
...reactHooks.configs.recommended.rules,
|
|
'prettier/prettier': 'error',
|
|
'react/react-in-jsx-scope': 'off',
|
|
'@typescript-eslint/explicit-module-boundary-types': 'error',
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
'import/order': [
|
|
'error',
|
|
{
|
|
groups: ['builtin', 'external', 'internal', ['parent', 'sibling']],
|
|
pathGroups: [
|
|
{
|
|
pattern: 'react',
|
|
group: 'external',
|
|
position: 'before',
|
|
},
|
|
],
|
|
pathGroupsExcludedImportTypes: ['react'],
|
|
'newlines-between': 'always',
|
|
alphabetize: {
|
|
order: 'asc',
|
|
caseInsensitive: true,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
// Browser-specific configuration
|
|
{
|
|
files: ['src/**/*.{ts,tsx}'],
|
|
languageOptions: {
|
|
globals: {
|
|
window: 'readonly',
|
|
document: 'readonly',
|
|
navigator: 'readonly',
|
|
console: 'readonly',
|
|
setTimeout: 'readonly',
|
|
setInterval: 'readonly',
|
|
clearTimeout: 'readonly',
|
|
clearInterval: 'readonly',
|
|
requestAnimationFrame: 'readonly',
|
|
localStorage: 'readonly',
|
|
HTMLDivElement: 'readonly',
|
|
HTMLTextAreaElement: 'readonly',
|
|
HTMLFormElement: 'readonly',
|
|
HTMLInputElement: 'readonly',
|
|
MutationObserver: 'readonly',
|
|
IntersectionObserver: 'readonly',
|
|
Blob: 'readonly',
|
|
SVGSVGElement: 'readonly',
|
|
},
|
|
},
|
|
},
|
|
// Electron main process configuration
|
|
{
|
|
files: ['electron/**/*.ts'],
|
|
languageOptions: {
|
|
globals: {
|
|
__dirname: 'readonly',
|
|
process: 'readonly',
|
|
console: 'readonly',
|
|
},
|
|
},
|
|
},
|
|
// UI components (shadcn/ui) - more relaxed rules
|
|
{
|
|
files: ['src/components/ui/**/*.{ts,tsx}'],
|
|
rules: {
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'react/prop-types': 'off',
|
|
},
|
|
},
|
|
// Test configuration
|
|
{
|
|
files: ['**/*.test.{ts,tsx}', 'src/test/**/*.{ts,tsx}'],
|
|
languageOptions: {
|
|
globals: {
|
|
console: 'readonly',
|
|
jest: 'readonly',
|
|
},
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/no-namespace': 'off',
|
|
'@typescript-eslint/no-empty-interface': 'off',
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
},
|
|
},
|
|
];
|