chore: standardised the eslint config structure accross the project (#11814)

This commit is contained in:
Mridang Agarwalla
2026-03-12 11:02:52 +01:00
committed by GitHub
parent 621fd9bdec
commit 7cdee1703f
61 changed files with 1025 additions and 2011 deletions
-40
View File
@@ -1,40 +0,0 @@
module.exports = {
root: true,
ignorePatterns: ['projects/**/*'],
overrides: [
{
files: ['*.ts'],
parserOptions: {
project: ['tsconfig.json', 'e2e/tsconfig.json'],
createDefaultProgram: true,
tsconfigRootDir: __dirname,
},
extends: ['plugin:@angular-eslint/recommended', 'plugin:@angular-eslint/template/process-inline-templates'],
rules: {
'@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'],
extends: ['plugin:@angular-eslint/template/recommended'],
rules: {},
},
],
};
+110
View File
@@ -0,0 +1,110 @@
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,
];
+12 -9
View File
@@ -5,7 +5,7 @@
"ng": "ng",
"dev": "wait-on --verbose --interval 2000 --simultaneous 1 --timeout 30m ${ENVIRONMENT_JSON_URL} && node prebuild.development.js && ng serve --host=${DEVCONTAINER_LISTEN_HOST:-127.0.0.1}",
"build": "ng build --configuration production --base-href=/ui/console/",
"lint-check-ng": "ng lint",
"lint-check-ng": "eslint .",
"lint-check-prettier": "prettier --check src",
"lint-fix": "prettier --write src",
"generate": "pnpm exec buf generate ../proto --include-imports --include-wkt",
@@ -59,15 +59,14 @@
"zone.js": "~0.15.1"
},
"devDependencies": {
"@angular-eslint/builder": "18.3.0",
"@angular-eslint/eslint-plugin": "18.0.0",
"@angular-eslint/eslint-plugin-template": "18.0.0",
"@angular-eslint/schematics": "19.8.1",
"@angular-eslint/template-parser": "19.8.1",
"@angular-eslint/eslint-plugin": "21.3.0",
"@angular-eslint/eslint-plugin-template": "21.3.0",
"@angular-eslint/template-parser": "21.3.0",
"@angular/build": "^20.3.15",
"@angular/cli": "^20.3.15",
"@angular/compiler-cli": "^20.3.16",
"@angular/language-service": "^20.3.16",
"@eslint/js": "^10.0.0",
"@types/file-saver": "^2.0.7",
"@types/google-protobuf": "~3.15.12",
"@types/jasmine": "~5.1.15",
@@ -77,11 +76,15 @@
"@types/opentype.js": "^1.3.9",
"@types/qrcode": "^1.5.6",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^8.54.0",
"@typescript-eslint/parser": "^8.54.0",
"@typescript-eslint/eslint-plugin": "^8.57.0",
"@typescript-eslint/parser": "^8.57.0",
"@zitadel/client": "workspace:*",
"@zitadel/proto": "workspace:*",
"eslint": "^8.57.1",
"eslint": "^10.0.0",
"eslint-config-prettier": "^10.1.8",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.32.0",
"globals": "^17.0.0",
"jasmine-core": "~5.12.1",
"jasmine-spec-reporter": "~7.0.0",
"karma": "^6.4.4",
@@ -25,6 +25,8 @@ export class ScrollableDirective {
if (top === 0) {
this.scrollPosition.emit('top');
}
} catch (err) {}
} catch {
// scroll position detection may fail in some browsers
}
}
}
@@ -19,8 +19,6 @@ export class DisplayJsonDialogComponent {
@Inject(MAT_DIALOG_DATA) public data: any,
) {
this.event = data.event;
if ((data.event as Event) && data.event.payload) {
}
}
public closeDialog(): void {
@@ -235,6 +235,7 @@ export class IdpTableComponent implements OnInit, OnDestroy {
} else if (this.service instanceof ManagementService) {
return ['/org', 'idp', 'create'];
}
return undefined;
}
public routerLinkForRow(row: Provider.AsObject): any {
@@ -248,6 +248,7 @@ export class InputDirective implements MatFormFieldControl<any>, OnChanges, OnDe
this._previousNativeValue = this.value;
// Force setter to be called in case id was not specified.
// eslint-disable-next-line no-self-assign
this.id = this.id;
// On some versions of iOS the caret gets stuck in the wrong place when holding down the delete
@@ -48,7 +48,7 @@ export class DialogAddSMSProviderComponent {
});
this.smsProviders = data.smsProviders;
if (!!this.twilio) {
if (this.twilio) {
this.twilioForm.patchValue(this.twilio);
} else {
this.twilioForm.addControl('token', new FormControl('', requiredValidator));
@@ -61,7 +61,7 @@ export class NotificationSMSProviderComponent implements OnInit {
dialogRef.afterClosed().subscribe((req: AddSMSProviderTwilioRequest | UpdateSMSProviderTwilioRequest) => {
if (req) {
if (!!this.twilio) {
if (this.twilio) {
this.service
.updateSMSProviderTwilio(req as UpdateSMSProviderTwilioRequest)
.then(() => {
@@ -72,10 +72,9 @@ export class StatehandlerServiceImpl implements StatehandlerService, OnDestroy {
removeParam(key: string, sourceURL: string) {
var rtn = sourceURL.split('?')[0],
param,
params_arr = [],
queryString = sourceURL.indexOf('?') !== -1 ? sourceURL.split('?')[1] : '';
if (queryString !== '') {
params_arr = queryString.split('&');
var params_arr = queryString.split('&');
for (var i = params_arr.length - 1; i >= 0; i -= 1) {
param = params_arr[i].split('=')[0];
if (param === key) {
+1 -1
View File
@@ -72,7 +72,7 @@ export function getColor(toGen: string): string {
export function getMembershipColor(role: string): Color {
const hash = hashCode(role);
let color = COLORS[hash % COLORS.length];
let color: Color;
switch (role) {
case 'IAM_OWNER':