From 32512f97421839d3da566cba291ca407e8ad27d4 Mon Sep 17 00:00:00 2001 From: Clinton Werth Date: Fri, 3 Jan 2025 12:49:20 -0600 Subject: [PATCH] add eslint config --- web-app/eslint.config.mjs | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 web-app/eslint.config.mjs diff --git a/web-app/eslint.config.mjs b/web-app/eslint.config.mjs new file mode 100644 index 000000000..6e0be869e --- /dev/null +++ b/web-app/eslint.config.mjs @@ -0,0 +1,53 @@ +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +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 [...compat.extends( + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@angular-eslint/recommended", +).map(config => ({ + ...config, + files: ["**/*.ts"], +})), { + files: ["**/*.ts"], + + languageOptions: { + ecmaVersion: 5, + sourceType: "script", + + parserOptions: { + project: ["tsconfig.app.json", "tsconfig.spec.json"], + createDefaultProgram: true, + }, + }, + + rules: { + "@angular-eslint/directive-selector": ["error", { + type: "attribute", + prefix: "app", + style: "camelCase", + }], + + "@angular-eslint/component-selector": ["error", { + type: "element", + prefix: "app", + style: "kebab-case", + }], + }, +}, ...compat.extends("plugin:@angular-eslint/template/recommended").map(config => ({ + ...config, + files: ["**/*.html"], +})), { + files: ["**/*.html"], + rules: {}, +}]; \ No newline at end of file