(
@@ -232,7 +232,7 @@ declare class SourceCodeBase extends TokenStore {
getAllComments(): TSESTree.Comment[];
/**
* Converts a (line, column) pair into a range index.
- * @param loc A line/column location
+ * @param location A line/column location
* @returns The range index of the location in the file.
*/
getIndexFromLoc(location: TSESTree.Position): number;
diff --git a/packages/website/docusaurus.config.mts b/packages/website/docusaurus.config.mts
index 369a6fd7210b..bda78fa8f505 100644
--- a/packages/website/docusaurus.config.mts
+++ b/packages/website/docusaurus.config.mts
@@ -342,6 +342,28 @@ const config: Config = {
rules: rulesMeta,
},
plugins: [
+ ...['ast-spec', 'type-utils'].map(packageName => [
+ 'docusaurus-plugin-typedoc',
+ {
+ entryPoints: [`../${packageName}/src/index.ts`],
+ enumMembersFormat: 'table',
+ exclude: '**/*.d.ts',
+ excludeExternals: true,
+ groupOrder: ['Functions', 'Variables', '*'],
+ hidePageTitle: true,
+ id: `typedoc-generated-${packageName}`,
+ indexFormat: 'table',
+ out: `../../docs/packages/${packageName}/generated`,
+ outputFileStrategy: 'modules',
+ parametersFormat: 'table',
+ plugin: [require.resolve('./tools/typedoc-plugin-no-inherit-fork.mjs')],
+ propertiesFormat: 'table',
+ readme: 'none',
+ tsconfig: `../${packageName}/tsconfig.json`,
+ typeDeclarationFormat: 'table',
+ useCodeBlocks: true,
+ },
+ ]),
require.resolve('./webpack.plugin'),
['@docusaurus/plugin-content-docs', pluginContentDocsOptions],
['@docusaurus/plugin-pwa', pluginPwaOptions],
diff --git a/packages/website/package.json b/packages/website/package.json
index e76f72e7fa1a..a8dc59380571 100644
--- a/packages/website/package.json
+++ b/packages/website/package.json
@@ -27,6 +27,7 @@
"@typescript-eslint/website-eslint": "7.17.0",
"@uiw/react-shields": "2.0.1",
"clsx": "^2.1.0",
+ "docusaurus-plugin-typedoc": "^1.0.1",
"eslint": "*",
"json5": "^2.2.3",
"konamimojisplosion": "^0.5.2",
@@ -37,6 +38,8 @@
"react-dom": "^18.2.0",
"react-resizable-panels": "^0.0.63",
"semver": "^7.6.0",
+ "typedoc": "^0.25.13",
+ "typedoc-plugin-markdown": "^4.0.3",
"typescript": "*"
},
"resolutions": {
diff --git a/packages/website/sidebars/sidebar.base.js b/packages/website/sidebars/sidebar.base.js
index 8655d2c29834..c3fcffdd97ad 100644
--- a/packages/website/sidebars/sidebar.base.js
+++ b/packages/website/sidebars/sidebar.base.js
@@ -106,7 +106,16 @@ module.exports = {
'packages/rule-tester',
'packages/scope-manager',
'packages/type-utils',
- 'packages/typescript-estree',
+ {
+ collapsible: false,
+ items: ['packages/typescript-estree/ast-spec'],
+ label: 'typescript-estree',
+ link: {
+ id: 'packages/typescript-estree',
+ type: 'doc',
+ },
+ type: 'category',
+ },
'packages/typescript-eslint',
'packages/utils',
],
diff --git a/packages/website/tools/generate-website-dts.ts b/packages/website/tools/generate-website-dts.ts
index 48b7d6fa1dc3..4806d5e2b750 100644
--- a/packages/website/tools/generate-website-dts.ts
+++ b/packages/website/tools/generate-website-dts.ts
@@ -33,7 +33,7 @@ async function getFileAndStoreLocally(
const config = await prettier.resolveConfig(path);
- let contents = await response.text();
+ let contents = (await response.text()) as string;
contents = [...banner, '', editFunc(contents)].join('\n');
contents = await prettier.format(contents, {
parser: 'typescript',
diff --git a/packages/website/tools/typedoc-plugin-no-inherit-fork.mjs b/packages/website/tools/typedoc-plugin-no-inherit-fork.mjs
new file mode 100644
index 000000000000..a174b28fdef8
--- /dev/null
+++ b/packages/website/tools/typedoc-plugin-no-inherit-fork.mjs
@@ -0,0 +1,186 @@
+/* eslint-disable @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-plus-operands */
+// Internal fork of https://github.com/jonchardy/typedoc-plugin-no-inherit,
+// pending https://github.com/jonchardy/typedoc-plugin-no-inherit/issues/34
+// https://github.com/jonchardy/typedoc-plugin-no-inherit/tree/c799761733e31198107db87d33aea0e673a996c3
+
+import {
+ Converter,
+ DeclarationReflection,
+ Reflection,
+ ReflectionKind,
+} from 'typedoc';
+
+export function load(app) {
+ new NoInheritPlugin().initialize(app);
+}
+
+/**
+ * A handler that deals with inherited reflections.
+ */
+class NoInheritPlugin {
+ /**
+ * Create a new NoInheritPlugin instance.
+ */
+ initialize(app) {
+ app.converter.on(Converter.EVENT_BEGIN, this.onBegin.bind(this));
+ app.converter.on(
+ Converter.EVENT_CREATE_DECLARATION,
+ this.onDeclaration.bind(this),
+ null,
+ -1100,
+ ); // after ImplementsPlugin
+ app.converter.on(
+ Converter.EVENT_RESOLVE_BEGIN,
+ this.onBeginResolve.bind(this),
+ );
+ this.logger = app.logger;
+ }
+
+ /**
+ * Triggered when the converter begins converting a project.
+ *
+ * @param context The context object describing the current state the converter is in.
+ */
+ onBegin() {
+ this.noInherit = [];
+ this.inheritedReflections = [];
+ }
+
+ /**
+ * Triggered when the converter has created a declaration or signature reflection.
+ *
+ * Builds the list of classes/interfaces that don't inherit docs and
+ * the list of reflections that are inherited that could end up being removed.
+ *
+ * @param context The context object describing the current state the converter is in.
+ * @param reflection The reflection that is currently processed.
+ * @param node The node that is currently processed if available.
+ */
+ onDeclaration(context, reflection) {
+ if (reflection instanceof DeclarationReflection) {
+ // class or interface that won't inherit docs
+ if (
+ reflection.kindOf(ReflectionKind.ClassOrInterface)
+ // Fork: always add reflections, regardless of a @noInheritDoc tag
+ // &&
+ // reflection.comment &&
+ // reflection.comment.getTag('@noInheritDoc')
+ ) {
+ this.noInherit.push(reflection);
+ // Fork: we don't use the @noInheritDoc tag
+ // reflection.comment.removeTags('@noInheritDoc');
+ }
+ // class or interface member inherited from a super
+ if (
+ reflection.inheritedFrom &&
+ reflection.parent &&
+ reflection.parent.kindOf(ReflectionKind.ClassOrInterface) &&
+ (!reflection.overwrites ||
+ (reflection.overwrites &&
+ reflection.overwrites !== reflection.inheritedFrom))
+ ) {
+ this.inheritedReflections.push(reflection);
+ }
+ }
+ }
+
+ /**
+ * Triggered when the converter begins resolving a project.
+ *
+ * Goes over the list of inherited reflections and removes any that are down the hierarchy
+ * from a class that doesn't inherit docs.
+ *
+ * @param context The context object describing the current state the converter is in.
+ */
+ onBeginResolve(context) {
+ if (this.noInherit) {
+ const project = context.project;
+ const removals = [];
+
+ this.inheritedReflections.forEach(reflection => {
+ // Look through the inheritance chain for a reflection that is flagged as noInherit for this reflection
+ if (this.isNoInheritRecursive(context, reflection, 0)) {
+ removals.push(reflection);
+ }
+ });
+
+ removals.forEach(removal => {
+ project.removeReflection(removal);
+ });
+ }
+ }
+
+ /**
+ * Checks whether some DeclarationReflection is in the noInherit list.
+ * @param search The DeclarationReflection to search for in the list.
+ */
+ isNoInherit(search) {
+ if (
+ this.noInherit.find(no => no.id === search.id && no.name === search.name)
+ ) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Checks whether some Reflection is in the inheritedReflections list.
+ * @param search The Reflection to search for in the list.
+ */
+ isInherited(search) {
+ if (
+ this.inheritedReflections.find(
+ inh => inh.id === search.id && inh.name === search.name,
+ )
+ ) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Checks whether some reflection's inheritance chain is broken by a class or interface that doesn't inherit docs.
+ * @param context The context object describing the current state the converter is in.
+ * @param current The current reflection being evaluated for non-inheritance.
+ * @param depth The current recursion depth, used for stopping on excessively long inheritance chains.
+ */
+ isNoInheritRecursive(context, current, depth) {
+ if (depth > 20) {
+ this.logger.warn(
+ `Found inheritance chain with depth > 20, stopping no inherit check: ${current.getFullName()}`,
+ );
+ return false; // stop if we've recursed more than 20 times
+ }
+
+ // As we move up the chain, check if the reflection parent is in the noInherit list
+ const parent = current.parent;
+ if (!parent) {
+ return false;
+ }
+ if (
+ this.isNoInherit(parent) &&
+ (depth === 0 || this.isInherited(current))
+ ) {
+ return true;
+ }
+
+ const checkExtended = type => {
+ const extended = type?.reflection;
+ if (extended instanceof Reflection) {
+ const upLevel = extended.getChildByName(current.name);
+ if (upLevel && this.isNoInheritRecursive(context, upLevel, depth + 1)) {
+ return true;
+ }
+ }
+ return false;
+ };
+
+ if (parent.extendedTypes) {
+ if (parent.extendedTypes.some(checkExtended)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/yarn.lock b/yarn.lock
index f6a564172d7e..807ad6de5d76 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6529,6 +6529,13 @@ __metadata:
languageName: node
linkType: hard
+"ansi-sequence-parser@npm:^1.1.0":
+ version: 1.1.1
+ resolution: "ansi-sequence-parser@npm:1.1.1"
+ checksum: ead5b15c596e8e85ca02951a844366c6776769dcc9fd1bd3a0db11bb21364554822c6a439877fb599e7e1ffa0b5f039f1e5501423950457f3dcb2f480c30b188
+ languageName: node
+ linkType: hard
+
"ansi-styles@npm:^3.2.1":
version: 3.2.1
resolution: "ansi-styles@npm:3.2.1"
@@ -9047,6 +9054,15 @@ __metadata:
languageName: node
linkType: hard
+"docusaurus-plugin-typedoc@npm:^1.0.1":
+ version: 1.0.1
+ resolution: "docusaurus-plugin-typedoc@npm:1.0.1"
+ peerDependencies:
+ typedoc-plugin-markdown: ">=4.0.0"
+ checksum: 0a1f0720f3b62d37cc7cacfa8100769e8354785215b84f33951f38d65951a04d7a3b719089717a1d5dbd653f029931a7e624908334519f16fa60798a5d8224ca
+ languageName: node
+ linkType: hard
+
"dom-converter@npm:^0.2.0":
version: 0.2.0
resolution: "dom-converter@npm:0.2.0"
@@ -13842,6 +13858,13 @@ __metadata:
languageName: node
linkType: hard
+"lunr@npm:^2.3.9":
+ version: 2.3.9
+ resolution: "lunr@npm:2.3.9"
+ checksum: 176719e24fcce7d3cf1baccce9dd5633cd8bdc1f41ebe6a180112e5ee99d80373fe2454f5d4624d437e5a8319698ca6837b9950566e15d2cae5f2a543a3db4b8
+ languageName: node
+ linkType: hard
+
"lz-string@npm:^1.5.0":
version: 1.5.0
resolution: "lz-string@npm:1.5.0"
@@ -13983,6 +14006,15 @@ __metadata:
languageName: node
linkType: hard
+"marked@npm:^4.3.0":
+ version: 4.3.0
+ resolution: "marked@npm:4.3.0"
+ bin:
+ marked: bin/marked.js
+ checksum: 0db6817893952c3ec710eb9ceafb8468bf5ae38cb0f92b7b083baa13d70b19774674be04db5b817681fa7c5c6a088f61300815e4dd75a59696f4716ad69f6260
+ languageName: node
+ linkType: hard
+
"marked@npm:^5.1.2":
version: 5.1.2
resolution: "marked@npm:5.1.2"
@@ -14972,7 +15004,7 @@ __metadata:
languageName: node
linkType: hard
-"minimatch@npm:^9.0.4, minimatch@npm:~9.0.4":
+"minimatch@npm:^9.0.3, minimatch@npm:^9.0.4, minimatch@npm:~9.0.4":
version: 9.0.4
resolution: "minimatch@npm:9.0.4"
dependencies:
@@ -18051,6 +18083,18 @@ __metadata:
languageName: node
linkType: hard
+"shiki@npm:^0.14.7":
+ version: 0.14.7
+ resolution: "shiki@npm:0.14.7"
+ dependencies:
+ ansi-sequence-parser: ^1.1.0
+ jsonc-parser: ^3.2.0
+ vscode-oniguruma: ^1.7.0
+ vscode-textmate: ^8.0.0
+ checksum: 2aec3b3519df977c4391df9e1825cb496e9a4d7e11395f05a0da77e4fa2f7c3d9d6e6ee94029ac699533017f2b25637ee68f6d39f05f311535c2704d0329b520
+ languageName: node
+ linkType: hard
+
"side-channel@npm:^1.0.4, side-channel@npm:^1.0.6":
version: 1.0.6
resolution: "side-channel@npm:1.0.6"
@@ -19404,6 +19448,31 @@ __metadata:
languageName: node
linkType: hard
+"typedoc-plugin-markdown@npm:^4.0.3":
+ version: 4.0.3
+ resolution: "typedoc-plugin-markdown@npm:4.0.3"
+ peerDependencies:
+ typedoc: 0.25.x
+ checksum: 46239ad6da69721626dc255c0dca9fd7600bf49a78ff7ee319fa600bdac4f405af2a6f549302b0b10439b6fb77710260a6a60ba57fd25d6388f5c081b44a173c
+ languageName: node
+ linkType: hard
+
+"typedoc@npm:^0.25.13":
+ version: 0.25.13
+ resolution: "typedoc@npm:0.25.13"
+ dependencies:
+ lunr: ^2.3.9
+ marked: ^4.3.0
+ minimatch: ^9.0.3
+ shiki: ^0.14.7
+ peerDependencies:
+ typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x
+ bin:
+ typedoc: bin/typedoc
+ checksum: 703d1f48137300b0ef3df1998a25ae745db3ca0b126f8dd1f7262918f11243a94d24dfc916cdba2baeb5a7d85d5a94faac811caf7f4fa6b7d07144dc02f7639f
+ languageName: node
+ linkType: hard
+
"typescript-eslint@workspace:^, typescript-eslint@workspace:packages/typescript-eslint":
version: 0.0.0-use.local
resolution: "typescript-eslint@workspace:packages/typescript-eslint"
@@ -19866,6 +19935,20 @@ __metadata:
languageName: node
linkType: hard
+"vscode-oniguruma@npm:^1.7.0":
+ version: 1.7.0
+ resolution: "vscode-oniguruma@npm:1.7.0"
+ checksum: 53519d91d90593e6fb080260892e87d447e9b200c4964d766772b5053f5699066539d92100f77f1302c91e8fc5d9c772fbe40fe4c90f3d411a96d5a9b1e63f42
+ languageName: node
+ linkType: hard
+
+"vscode-textmate@npm:^8.0.0":
+ version: 8.0.0
+ resolution: "vscode-textmate@npm:8.0.0"
+ checksum: 127780dfea89559d70b8326df6ec344cfd701312dd7f3f591a718693812b7852c30b6715e3cfc8b3200a4e2515b4c96f0843c0eacc0a3020969b5de262c2a4bb
+ languageName: node
+ linkType: hard
+
"vscode-uri@npm:^3.0.8":
version: 3.0.8
resolution: "vscode-uri@npm:3.0.8"
@@ -20112,6 +20195,7 @@ __metadata:
clsx: ^2.1.0
copy-webpack-plugin: ^12.0.0
cross-fetch: "*"
+ docusaurus-plugin-typedoc: ^1.0.1
eslint: "*"
history: ^4.9.0
json5: ^2.2.3
@@ -20133,6 +20217,8 @@ __metadata:
stylelint-config-standard: ^36.0.0
stylelint-order: ^6.0.4
tsx: "*"
+ typedoc: ^0.25.13
+ typedoc-plugin-markdown: ^4.0.3
typescript: "*"
unified: ^11.0.4
vfile: ^6.0.1
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy