Skip to content

Commit db28f2c

Browse files
nzakasmdjermanovicbtmills
authored
chore: Add static frontmatter to docs (#15782)
* chore: Add static frontmatter to docs * cleanup architecture docs location * Update rule ID check for docs * Update lint check * Update Makefile.js Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> * Cleanup based on feedback * Fix Makefile.js gensite * Revert "Fix Makefile.js gensite" This reverts commit 822dc55. * Update docs/src/pages/index.md Co-authored-by: Brandon Mills <btmills@users.noreply.github.com> * Remove extra file and resources sections Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>
1 parent c2407e8 commit db28f2c

File tree

357 files changed

+2995
-924
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

357 files changed

+2995
-924
lines changed

Makefile.js

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -660,9 +660,7 @@ target.gensite = function(prereleaseVersion) {
660660
sourcePath = path.join("lib/rules", sourceBaseName),
661661
ruleName = path.basename(filename, ".md"),
662662
filePath = path.posix.join("docs", path.relative("tmp", filename));
663-
let text = cat(filename),
664-
ruleType = "",
665-
title;
663+
let text = cat(filename);
666664

667665
process.stdout.write(`> Updating files (Steps 4-9): ${i}/${length} - ${filePath + " ".repeat(30)}\r`);
668666

@@ -675,40 +673,12 @@ target.gensite = function(prereleaseVersion) {
675673
const isFixable = rule && rule.meta.fixable;
676674
const hasSuggestions = rule && rule.meta.hasSuggestions;
677675

678-
// Incorporate the special portion into the documentation content
679-
const textSplit = text.split("\n");
680-
const ruleHeading = textSplit[0];
681-
const ruleDocsContent = textSplit.slice(1).join("\n");
676+
text = text.replace("<!--FIXABLE-->", isFixable ? FIXABLE_TEXT : "")
677+
.replace("<!--SUGGESTIONS-->", hasSuggestions ? HAS_SUGGESTIONS_TEXT : "")
678+
.replace("<!--RECOMMENDED-->", isRecommended ? RECOMMENDED_TEXT : "");
682679

683-
text = `${ruleHeading}${isRecommended ? RECOMMENDED_TEXT : ""}${isFixable ? FIXABLE_TEXT : ""}${hasSuggestions ? HAS_SUGGESTIONS_TEXT : ""}\n${ruleDocsContent}`;
684-
title = `${ruleName} - Rules`;
685-
686-
if (rule && rule.meta) {
687-
ruleType = `rule_type: ${rule.meta.type}`;
688-
}
689-
} else {
690-
691-
// extract the title from the file itself
692-
title = text.match(/#([^#].+)\n/u);
693-
if (title) {
694-
title = title[1].trim();
695-
} else {
696-
title = "Documentation";
697-
}
698680
}
699681

700-
text = [
701-
"---",
702-
`title: ${title}`,
703-
"layout: doc",
704-
`edit_link: https://github.com/eslint/eslint/edit/main/${filePath.replace("docs/", "docs/src/")}`,
705-
ruleType,
706-
"---",
707-
"<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. -->",
708-
"",
709-
text
710-
].join("\n");
711-
712682
// 6. Remove .md extension for relative links and change README to empty string
713683
text = text.replace(/\((?!https?:\/\/)([^)]*?)\.md(.*?)\)/gu, "($1$2)").replace("README.html", "");
714684

@@ -816,7 +786,7 @@ target.checkRuleFiles = function() {
816786
* @todo Will remove this check when the main heading is automatically generated from rule metadata.
817787
*/
818788
function hasIdInTitle(id) {
819-
return new RegExp(`^# ${id}`, "u").test(docText);
789+
return new RegExp(`title: ${id}`, "u").test(docText);
820790
}
821791

822792
/**

docs/src/about/index.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# About
1+
---
2+
title: About
3+
layout: doc
4+
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/about/index.md
5+
6+
---
27

38
ESLint is an open source JavaScript linting utility originally created by Nicholas C. Zakas in June 2013. Code [linting][] is a type of static analysis that is frequently used to find problematic patterns or code that doesn't adhere to certain style guidelines. There are code linters for most programming languages, and compilers sometimes incorporate linting into the compilation process.
49

docs/src/developer-guide/README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# Developer Guide
1+
---
2+
title: Developer Guide
3+
layout: doc
4+
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/README.md
5+
6+
---
27

38
This guide is intended for those who wish to:
49

@@ -14,31 +19,31 @@ In order to work with ESLint as a developer, it's recommended that:
1419

1520
If that sounds like you, then continue reading to get started.
1621

17-
## Section 1: Get the [Source Code](source-code.md)
22+
## Section 1: Get the [Source Code](source-code)
1823

1924
Before you can get started, you'll need to get a copy of the ESLint source code. This section explains how to do that and a little about the source code structure.
2025

21-
## Section 2: Set up a [Development Environment](development-environment.md)
26+
## Section 2: Set up a [Development Environment](development-environment)
2227

2328
Developing for ESLint is a bit different than running it on the command line. This section shows you how to set up a development environment and get you ready to write code.
2429

25-
## Section 3: Run the [Unit Tests](unit-tests.md)
30+
## Section 3: Run the [Unit Tests](unit-tests)
2631

2732
There are a lot of unit tests included with ESLint to make sure that we're keeping on top of code quality. This section explains how to run the unit tests.
2833

29-
## Section 4: [Working with Rules](working-with-rules.md)
34+
## Section 4: [Working with Rules](working-with-rules)
3035

3136
You're finally ready to start working with rules. You may want to fix an existing rule or create a new one. This section explains how to do all of that.
3237

33-
## Section 5: [Working with Plugins](working-with-plugins.md)
38+
## Section 5: [Working with Plugins](working-with-plugins)
3439

3540
You've developed library-specific rules for ESLint and you want to share them with the community. You can publish an ESLint plugin on npm.
3641

37-
## Section 6: [Working with Custom Parsers](working-with-custom-parsers.md)
42+
## Section 6: [Working with Custom Parsers](working-with-custom-parsers)
3843

3944
If you aren't going to use the default parser of ESLint, this section explains about using custom parsers.
4045

41-
## Section 7: [Node.js API](nodejs-api.md)
46+
## Section 7: [Node.js API](nodejs-api)
4247

4348
If you're interested in writing a tool that uses ESLint, then you can use the Node.js API to get programmatic access to functionality.
4449

docs/src/developer-guide/architecture.md renamed to docs/src/developer-guide/architecture/index.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
# Architecture
1+
---
2+
title: Architecture
3+
layout: doc
4+
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/architecture/index.md
25

3-
<center><img alt="dependency graph" src="./architecture/dependency.svg"></center>
6+
---
7+
8+
<center><img alt="dependency graph" src="dependency.svg"></center>
49

510
At a high level, there are a few key parts to ESLint:
611

docs/src/developer-guide/code-conventions.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# Code Conventions
1+
---
2+
title: Code Conventions
3+
layout: doc
4+
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/code-conventions.md
5+
6+
---
27

38
Code conventions for ESLint are determined by
49
[eslint-config-eslint](https://www.npmjs.com/package/eslint-config-eslint).

docs/src/developer-guide/code-path-analysis.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# Code Path Analysis Details
1+
---
2+
title: Code Path Analysis Details
3+
layout: doc
4+
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/code-path-analysis.md
5+
6+
---
27

38
ESLint's rules can use code paths.
49
The code path is execution routes of programs.
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
[Code Path Analysis Details](../code-path-analysis.md)
1+
---
2+
title: Code Path Analysis Details
3+
layout: doc
4+
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/code-path-analysis/README.md
5+
6+
---
7+
8+
[Code Path Analysis Details](../code-path-analysis)

docs/src/developer-guide/contributing/README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# Contributing
1+
---
2+
title: Contributing
3+
layout: doc
4+
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/README.md
5+
6+
---
27

38
One of the great things about open source projects is that anyone can contribute in any number of meaningful ways. ESLint couldn't exist without the help of the many contributors it's had since the project began, and we want you to feel like you can contribute and make a difference as well.
49

@@ -12,27 +17,27 @@ ESLint welcomes contributions from everyone and adheres to the [OpenJS Foundatio
1217

1318
Think you found a problem? We'd love to hear about it. This section explains how to submit a bug, the type of information we need to properly verify it, and the overall process.
1419

15-
## Proposing a [New Rule](new-rules.md)
20+
## Proposing a [New Rule](new-rules)
1621

1722
We get a lot of proposals for new rules in ESLint. This section explains how we determine which rules are accepted and what information you should provide to help us evaluate your proposal.
1823

19-
## Proposing a [Rule Change](rule-changes.md)
24+
## Proposing a [Rule Change](rule-changes)
2025

2126
Want to make a change to an existing rule? This section explains the process and how we evaluate such proposals.
2227

23-
## Requesting a [Change](changes.md)
28+
## Requesting a [Change](changes)
2429

2530
If you'd like to request a change other than a bug fix or new rule, this section explains that process.
2631

2732
## Reporting a security vulnerability
2833

2934
To report a security vulnerability in ESLint, please use our [HackerOne program](https://hackerone.com/eslint).
3035

31-
## [Working on Issues](working-on-issues.md)
36+
## [Working on Issues](working-on-issues)
3237

3338
Have some extra time and want to contribute? This section talks about the process of working on issues.
3439

35-
## Submitting a [Pull Request](pull-requests.md)
40+
## Submitting a [Pull Request](pull-requests)
3641

3742
We're always looking for contributions from the community. This section explains the requirements for pull requests and the process of contributing code.
3843

docs/src/developer-guide/contributing/changes.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# Change Requests
1+
---
2+
title: Change Requests
3+
layout: doc
4+
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/changes.md
5+
6+
---
27

38
If you'd like to request a change to ESLint, please [create a new issue](https://github.com/eslint/eslint/issues/new/choose) on GitHub. Be sure to include the following information:
49

docs/src/developer-guide/contributing/new-rules.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# New Rules
1+
---
2+
title: New Rules
3+
layout: doc
4+
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/new-rules.md
5+
6+
---
27

38
ESLint is all about rules. For most of the project's lifetime, we've had over 200 rules, and that list continues to grow. However, we can't just accept any proposed rule because all rules need to work cohesively together. As such, we have some guidelines around which rules can be part of the ESLint core and which are better off as custom rules and plugins.
49

@@ -39,4 +44,4 @@ The ESLint team doesn't implement new rules that are suggested by users because
3944

4045
## Alternative: Creating Your Own Rules
4146

42-
Remember that ESLint is completely pluggable, which means you can create your own rules and distribute them using plugins. We did this on purpose because we don't want to be the gatekeepers for all possible rules. Even if we don't accept a rule into the core, that doesn't mean you can't have the exact rule that you want. See the [working with rules](../working-with-rules.md) and [working with plugins](../working-with-plugins.md) documentation for more information.
47+
Remember that ESLint is completely pluggable, which means you can create your own rules and distribute them using plugins. We did this on purpose because we don't want to be the gatekeepers for all possible rules. Even if we don't accept a rule into the core, that doesn't mean you can't have the exact rule that you want. See the [working with rules](../working-with-rules) and [working with plugins](../working-with-plugins) documentation for more information.

0 commit comments

Comments
 (0)
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