This commit is contained in:
CHEVALLIER Abel
2025-11-13 16:23:22 +01:00
parent de9c515a47
commit cb235644dc
34924 changed files with 3811102 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
<% if (frontmatter) { %><%= frontmatter %>
<% } %>You are an expert in TypeScript, Angular, and scalable web application development. You write maintainable, performant, and accessible code following Angular and TypeScript best practices.
## TypeScript Best Practices
- Use strict type checking
- Prefer type inference when the type is obvious
- Avoid the `any` type; use `unknown` when type is uncertain
## Angular Best Practices
- Always use standalone components over NgModules
- Must NOT set `standalone: true` inside Angular decorators. It's the default.
- Use signals for state management
- Implement lazy loading for feature routes
- Do NOT use the `@HostBinding` and `@HostListener` decorators. Put host bindings inside the `host` object of the `@Component` or `@Directive` decorator instead
- Use `NgOptimizedImage` for all static images.
- `NgOptimizedImage` does not work for inline base64 images.
## Components
- Keep components small and focused on a single responsibility
- Use `input()` and `output()` functions instead of decorators
- Use `computed()` for derived state
- Set `changeDetection: ChangeDetectionStrategy.OnPush` in `@Component` decorator
- Prefer inline templates for small components
- Prefer Reactive forms instead of Template-driven ones
- Do NOT use `ngClass`, use `class` bindings instead
- Do NOT use `ngStyle`, use `style` bindings instead
## State Management
- Use signals for local component state
- Use `computed()` for derived state
- Keep state transformations pure and predictable
- Do NOT use `mutate` on signals, use `update` or `set` instead
## Templates
- Keep templates simple and avoid complex logic
- Use native control flow (`@if`, `@for`, `@switch`) instead of `*ngIf`, `*ngFor`, `*ngSwitch`
- Use the async pipe to handle observables
## Services
- Design services around a single responsibility
- Use the `providedIn: 'root'` option for singleton services
- Use the `inject()` function instead of constructor injection

10
node_modules/@schematics/angular/ai-config/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,10 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { Rule } from '@angular-devkit/schematics';
import { Schema as ConfigOptions } from './schema';
export default function ({ tool }: ConfigOptions): Rule;

57
node_modules/@schematics/angular/ai-config/index.js generated vendored Executable file
View File

@@ -0,0 +1,57 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const schematics_1 = require("@angular-devkit/schematics");
const schema_1 = require("./schema");
const AI_TOOLS = {
gemini: {
rulesName: 'GEMINI.md',
directory: '.gemini',
},
claude: {
rulesName: 'CLAUDE.md',
directory: '.claude',
},
copilot: {
rulesName: 'copilot-instructions.md',
directory: '.github',
},
windsurf: {
rulesName: 'guidelines.md',
directory: '.windsurf/rules',
},
jetbrains: {
rulesName: 'guidelines.md',
directory: '.junie',
},
// Cursor file has a front matter section.
cursor: {
rulesName: 'cursor.mdc',
directory: '.cursor/rules',
frontmatter: `---\ncontext: true\npriority: high\nscope: project\n---`,
},
};
function default_1({ tool }) {
if (!tool) {
return (0, schematics_1.noop)();
}
const rules = tool
.filter((tool) => tool !== schema_1.Tool.None)
.map((selectedTool) => AI_TOOLS[selectedTool])
.map(({ rulesName, directory, frontmatter }) => (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files'), [
(0, schematics_1.applyTemplates)({
...schematics_1.strings,
rulesName,
frontmatter,
}),
(0, schematics_1.move)(directory),
])));
return (0, schematics_1.chain)(rules);
}

21
node_modules/@schematics/angular/ai-config/schema.d.ts generated vendored Executable file
View File

@@ -0,0 +1,21 @@
/**
* Generates AI configuration files for Angular projects. This schematic creates
* configuration files that help AI tools follow Angular best practices, improving the
* quality of AI-generated code and suggestions.
*/
export type Schema = {
/**
* Specifies which AI tools to generate configuration files for. These file are used to
* improve the outputs of AI tools by following the best practices.
*/
tool?: Tool[];
};
export declare enum Tool {
Claude = "claude",
Copilot = "copilot",
Cursor = "cursor",
Gemini = "gemini",
Jetbrains = "jetbrains",
None = "none",
Windsurf = "windsurf"
}

15
node_modules/@schematics/angular/ai-config/schema.js generated vendored Executable file
View File

@@ -0,0 +1,15 @@
"use strict";
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
Object.defineProperty(exports, "__esModule", { value: true });
exports.Tool = void 0;
var Tool;
(function (Tool) {
Tool["Claude"] = "claude";
Tool["Copilot"] = "copilot";
Tool["Cursor"] = "cursor";
Tool["Gemini"] = "gemini";
Tool["Jetbrains"] = "jetbrains";
Tool["None"] = "none";
Tool["Windsurf"] = "windsurf";
})(Tool || (exports.Tool = Tool = {}));

54
node_modules/@schematics/angular/ai-config/schema.json generated vendored Executable file
View File

@@ -0,0 +1,54 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "SchematicsAngularAIConfig",
"title": "Angular AI Config File Options Schema",
"type": "object",
"additionalProperties": false,
"description": "Generates AI configuration files for Angular projects. This schematic creates configuration files that help AI tools follow Angular best practices, improving the quality of AI-generated code and suggestions.",
"properties": {
"tool": {
"type": "array",
"uniqueItems": true,
"default": ["none"],
"x-prompt": {
"message": "Which AI tools do you want to configure with Angular best practices? https://angular.dev/ai/develop-with-ai",
"type": "list",
"items": [
{
"value": "none",
"label": "None"
},
{
"value": "claude",
"label": "Claude [ https://docs.anthropic.com/en/docs/claude-code/memory ]"
},
{
"value": "cursor",
"label": "Cursor [ https://docs.cursor.com/en/context/rules ]"
},
{
"value": "gemini",
"label": "Gemini [ https://ai.google.dev/gemini-api/docs ]"
},
{
"value": "copilot",
"label": "GitHub Copilot [ https://code.visualstudio.com/docs/copilot/copilot-customization ]"
},
{
"value": "jetbrains",
"label": "JetBrains AI [ https://www.jetbrains.com/help/junie/customize-guidelines.html ]"
},
{
"value": "windsurf",
"label": "Windsurf [ https://docs.windsurf.com/windsurf/cascade/memories#rules ]"
}
]
},
"description": "Specifies which AI tools to generate configuration files for. These file are used to improve the outputs of AI tools by following the best practices.",
"items": {
"type": "string",
"enum": ["none", "gemini", "copilot", "claude", "cursor", "jetbrains", "windsurf"]
}
}
}
}