[eslint] Replace prefer-readonly-keyword with @typescript-eslint/array-type.

We had our own homegrown ESLint rule that was trying to enforce some
consistency around `ReadonlyArray<T>` vs. `readonly T[]`, but that was
fairly limited and still allowed for `Array<T>` vs `T[]` with no shared
discipline.

We now use the `@typescript-eslint/array-type` rule instead and enforce
that for simple types the `T[]` (and `readonly T[]`) syntax is used,
while for complex types the `Array<A & B>` (and `ReadonlyArray<A & B>`)
syntax is used.

Bug: none
Change-Id: I8933869f98577d4afc4141c5736fccb2159924a6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6257990
Commit-Queue: Benedikt Meurer <[email protected]>
Auto-Submit: Benedikt Meurer <[email protected]>
Reviewed-by: Nikolay Vitkov <[email protected]>
Commit-Queue: Nikolay Vitkov <[email protected]>
diff --git a/eslint.config.mjs b/eslint.config.mjs
index f0d5d39..848142d 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -12,13 +12,13 @@
 import mochaPlugin from 'eslint-plugin-mocha';
 import rulesdirPlugin from 'eslint-plugin-rulesdir';
 import globals from 'globals';
-import { join } from 'path';
+import {join} from 'path';
 
 rulesdirPlugin.RULES_DIR = join(
-  import.meta.dirname,
-  'scripts',
-  'eslint_rules',
-  'lib',
+    import.meta.dirname,
+    'scripts',
+    'eslint_rules',
+    'lib',
 );
 
 /**
@@ -302,15 +302,21 @@
       parserOptions: {
         allowAutomaticSingleRunInference: true,
         project: join(
-          import.meta.dirname,
-          'config',
-          'typescript',
-          'tsconfig.eslint.json',
-        ),
+            import.meta.dirname,
+            'config',
+            'typescript',
+            'tsconfig.eslint.json',
+            ),
       },
     },
 
     rules: {
+      '@typescript-eslint/array-type': [
+        'error',
+        {
+          default: 'array-simple',
+        },
+      ],
       '@typescript-eslint/no-explicit-any': [
         'error',
         {
@@ -487,7 +493,6 @@
       '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
 
       'rulesdir/no-underscored-properties': 'error',
-      'rulesdir/prefer-readonly-keyword': 'error',
       'rulesdir/inline-type-imports': 'error',
 
       'rulesdir/enforce-default-import-name': [
@@ -495,12 +500,12 @@
         {
           // Enforce that any import of models/trace/trace.js names the import Trace.
           modulePath: join(
-            import.meta.dirname,
-            'front_end',
-            'models',
-            'trace',
-            'trace.js',
-          ),
+              import.meta.dirname,
+              'front_end',
+              'models',
+              'trace',
+              'trace.js',
+              ),
           importName: 'Trace',
         },
       ],