Files
zitadel/console/eslint.config.mjs
T

111 lines
3.3 KiB
JavaScript

import js from "@eslint/js";
import angularPlugin from "@angular-eslint/eslint-plugin";
import angularTemplatePlugin from "@angular-eslint/eslint-plugin-template";
import angularTemplateParser from "@angular-eslint/template-parser";
import tsPlugin from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import importPlugin from "eslint-plugin-import";
import prettierConfig from "eslint-config-prettier/flat";
import globals from "globals";
export default [
{
ignores: [
"projects/**/*",
"dist/**",
"node_modules/**",
".angular/**",
"src/app/proto/generated/**",
],
},
js.configs.recommended,
{
files: ["**/*.{js,mjs,cjs}"],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
},
{
files: ["**/*.ts"],
plugins: {
"@typescript-eslint": tsPlugin,
"@angular-eslint": angularPlugin,
import: importPlugin,
},
languageOptions: {
parser: tsParser,
parserOptions: {
project: ["tsconfig.json", "e2e/tsconfig.json"],
createDefaultProgram: true,
},
},
processor: angularTemplatePlugin.processors["extract-inline-html"],
settings: {
"import/resolver": {
typescript: true,
},
},
rules: {
...tsPlugin.configs.recommended.rules,
...importPlugin.configs.recommended.rules,
// Proto imports are generated at build time and don't exist during lint
"import/no-unresolved": "off",
"no-unused-vars": "off",
"no-undef": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_" },
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-unsafe-function-type": "off",
"@typescript-eslint/no-wrapper-object-types": "off",
"@typescript-eslint/no-empty-object-type": "off",
"no-case-declarations": "off",
...angularPlugin.configs.recommended.rules,
// Disable rules added in angular-eslint 21.x that weren't in the original 18.x config
"@angular-eslint/prefer-inject": "off",
"@angular-eslint/prefer-standalone": "off",
"@angular-eslint/no-conflicting-lifecycle": "off",
"@angular-eslint/no-host-metadata-property": "off",
"@angular-eslint/component-selector": [
"error",
{
prefix: "cnsl",
style: "kebab-case",
type: "element",
},
],
"@angular-eslint/directive-selector": [
"error",
{
prefix: "cnsl",
style: "camelCase",
type: "attribute",
},
],
},
},
{
files: ["**/*.html"],
plugins: {
"@angular-eslint/template": angularTemplatePlugin,
},
languageOptions: {
parser: angularTemplateParser,
},
rules: {
...angularTemplatePlugin.configs.recommended.rules,
// Disable rules added in angular-eslint 21.x that weren't in the original 18.x config
"@angular-eslint/template/prefer-control-flow": "off",
"@angular-eslint/template/eqeqeq": "off",
},
},
prettierConfig,
];