Administration/eslint.config.mjs

68 lines
2 KiB
JavaScript
Raw Normal View History

2025-03-06 00:31:20 +01:00
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import htmlEslint from '@html-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
2025-02-02 15:48:46 +01:00
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
export default [
{
2025-03-06 00:31:20 +01:00
ignores: ['src/app/core/server'],
2025-02-02 15:48:46 +01:00
},
2025-03-06 00:31:20 +01:00
...compat.extends('eslint:recommended', 'plugin:@typescript-eslint/strict'),
2025-02-02 15:48:46 +01:00
{
plugins: {
2025-03-06 00:31:20 +01:00
'simple-import-sort': simpleImportSort,
'@typescript-eslint': typescriptEslint,
'@html-eslint': htmlEslint,
2025-02-02 15:48:46 +01:00
},
languageOptions: {
globals: {
...globals.browser,
},
parser: tsParser,
2025-03-06 00:31:20 +01:00
ecmaVersion: 'latest',
sourceType: 'module',
2025-02-02 15:48:46 +01:00
},
rules: {
2025-03-06 00:31:20 +01:00
indent: ['error', 4],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
semi: ['error', 'always'],
strict: 'error',
'array-bracket-newline': 'error',
yoda: 'error',
'@typescript-eslint/array-type': [
'error',
2025-02-02 15:48:46 +01:00
{
2025-03-06 00:31:20 +01:00
default: 'generic',
2025-02-02 15:48:46 +01:00
},
],
2025-03-06 00:31:20 +01:00
'@typescript-eslint/ban-tslint-comment': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-extraneous-class': 'off',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'no-mixed-spaces-and-tabs': 'off',
'@html-eslint/no-inline-styles': 'error'
2025-02-02 15:48:46 +01:00
},
},
2025-03-06 00:31:20 +01:00
];