cse-website/eslint.config.mjs

88 lines
2 KiB
JavaScript

import tsParser from '@typescript-eslint/parser';
import astroParser from 'astro-eslint-parser';
import astroPlugin from 'eslint-plugin-astro';
import importsPlugin from 'eslint-plugin-import';
export default [
{
// Apply to all files
files: ['**/*'],
ignores: [
'node_modules/**/*',
'dist/**/*',
'**/src/components/ui/**',
'**/components/ui/**',
],
plugins: {
import: importsPlugin,
},
rules: {
'import/order': [
'error',
{
groups: [
['builtin', 'external'],
['internal', 'parent', 'sibling', 'index'],
],
pathGroups: [
{
pattern: 'react',
group: 'builtin',
position: 'before',
},
{
pattern: 'next/**',
group: 'builtin',
position: 'before',
},
{
pattern: '@/**',
group: 'internal',
position: 'after',
},
],
pathGroupsExcludedImportTypes: ['builtin'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
},
},
{
// Apply specifically to Astro files
files: ['**/*.astro'],
plugins: {
astro: astroPlugin,
},
languageOptions: {
parser: astroParser,
parserOptions: {
parser: tsParser,
extraFileExtensions: ['.astro'],
sourceType: 'module',
},
globals: {
Astro: 'readonly',
Fragment: 'readonly',
},
},
rules: {
// Astro recommended rules
'astro/no-conflict-set-directives': 'error',
'astro/no-unused-define-vars-in-style': 'error',
},
},
{
// Apply to TypeScript files
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tsParser,
parserOptions: {
sourceType: 'module',
},
},
},
];