Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Commit

Permalink
chore: Changes to support static frontmatter in docs (#933)
Browse files Browse the repository at this point in the history
* chore: Changes to support static frontmatter in docs

* fix lint error

* Reformatted docs

* Updated with latest docs copy
  • Loading branch information
nzakas committed Apr 22, 2022
1 parent fcc5af3 commit acfcb9c
Show file tree
Hide file tree
Showing 371 changed files with 643 additions and 1,758 deletions.
3 changes: 2 additions & 1 deletion _11ty/filters/index.js
Expand Up @@ -3,5 +3,6 @@
module.exports = {
dateFormat: require("./date-format"),
numberOfWords: require("./number-of-words"),
xmlEscape: require("./xml-escape")
xmlEscape: require("./xml-escape"),
regexMatch: require("./regex-match")
};
5 changes: 5 additions & 0 deletions _11ty/filters/regex-match.js
@@ -0,0 +1,5 @@
"use strict";

module.exports = function regexMatch(text, regex) {
return new RegExp(regex, "u").test(text);
};
7 changes: 7 additions & 0 deletions _layouts/doc.liquid
Expand Up @@ -16,6 +16,13 @@
{% include ad %}
</div>
{% endif %}

{% comment %}Versioned pages didn't have title in front matter{% endcomment %}
{% assign versioned = page.url | regexMatch: "\/docs/\d" %}
{% unless versioned %}
<h1>{{ title }}</h1>
{% endunless %}

{{ content
| replace: '<p>Examples of <strong>incorrect</strong> code', '<p class="incorrect icon">Examples of <strong>incorrect</strong> code'
| replace: '<p>Example of <strong>incorrect</strong> code', '<p class="incorrect icon">Example of <strong>incorrect</strong> code'
Expand Down
3 changes: 0 additions & 3 deletions docs/about/index.md
Expand Up @@ -4,9 +4,6 @@ layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/about/index.md

---
<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. -->

# About

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.

Expand Down
21 changes: 13 additions & 8 deletions docs/developer-guide/README.md
@@ -1,4 +1,9 @@
# Developer Guide
---
title: Developer Guide
layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/README.md

---

This guide is intended for those who wish to:

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

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

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

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.

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

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.

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

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.

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

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.

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

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.

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

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

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

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.

Expand Down
99 changes: 0 additions & 99 deletions docs/developer-guide/architecture.md

This file was deleted.

8 changes: 2 additions & 6 deletions docs/developer-guide/architecture/index.md
@@ -1,21 +1,17 @@
---
title: Architecture
layout: doc
edit_link: https://github.com/eslint/eslint/edit/master/docs/developer-guide/architecture.md
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/architecture/index.md

---
<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. -->

# Architecture

<center><img alt="dependency graph" src="dependency.svg"></center>

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

* `bin/eslint.js` - this is the file that actually gets executed with the command line utility. It's a dumb wrapper that does nothing more than bootstrap ESLint, passing the command line arguments to `cli`. This is intentionally small so as not to require heavy testing.
* `lib/api.js` - this is the entry point of `require("eslint")`. This file exposes an object that contains public classes `Linter`, `CLIEngine`, `RuleTester`, and `SourceCode`.
* `lib/api.js` - this is the entry point of `require("eslint")`. This file exposes an object that contains public classes `Linter`, `ESLint`, `RuleTester`, and `SourceCode`.
* `lib/cli.js` - this is the heart of the ESLint CLI. It takes an array of arguments and then uses `eslint` to execute the commands. By keeping this as a separate utility, it allows others to effectively call ESLint from within another Node.js program as if it were done on the command line. The main call is `cli.execute()`. This is also the part that does all the file reading, directory traversing, input, and output.
* `lib/init/` - this module contains `--init` functionality that set up a configuration file for end users.
* `lib/cli-engine/` - this module is `CLIEngine` class that finds source code files and configuration files then does code verifying with the `Linter` class. This includes the loading logic of configuration files, parsers, plugins, and formatters.
* `lib/linter/` - this module is the core `Linter` class that does code verifying based on configuration options. This file does no file I/O and does not interact with the `console` at all. For other Node.js programs that have JavaScript text to verify, they would be able to use this interface directly.
* `lib/rule-tester/` - this module is `RuleTester` class that is a wrapper around Mocha so that rules can be unit tested. This class lets us write consistently formatted tests for each rule that is implemented and be confident that each of the rules work. The RuleTester interface was modeled after Mocha and works with Mocha's global testing methods. RuleTester can also be modified to work with other testing frameworks.
Expand Down
3 changes: 0 additions & 3 deletions docs/developer-guide/code-conventions.md
Expand Up @@ -4,9 +4,6 @@ layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/code-conventions.md

---
<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. -->

# Code Conventions

Code conventions for ESLint are determined by
[eslint-config-eslint](https://www.npmjs.com/package/eslint-config-eslint).
Expand Down
3 changes: 0 additions & 3 deletions docs/developer-guide/code-path-analysis.md
Expand Up @@ -4,9 +4,6 @@ layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/code-path-analysis.md

---
<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. -->

# Code Path Analysis Details

ESLint's rules can use code paths.
The code path is execution routes of programs.
Expand Down
9 changes: 8 additions & 1 deletion docs/developer-guide/code-path-analysis/README.md
@@ -1 +1,8 @@
[Code Path Analysis Details](../code-path-analysis.md)
---
title: Code Path Analysis Details
layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/code-path-analysis/README.md

---

[Code Path Analysis Details](../code-path-analysis)
3 changes: 1 addition & 2 deletions docs/developer-guide/code-path-analysis/index.md
@@ -1,9 +1,8 @@
---
title: Documentation
title: Code Path Analysis Details
layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/code-path-analysis/README.md

---
<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. -->

[Code Path Analysis Details](../code-path-analysis)
17 changes: 11 additions & 6 deletions docs/developer-guide/contributing/README.md
@@ -1,4 +1,9 @@
# Contributing
---
title: Contributing
layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/README.md

---

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.

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

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.

## Proposing a [New Rule](new-rules.md)
## Proposing a [New Rule](new-rules)

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.

## Proposing a [Rule Change](rule-changes.md)
## Proposing a [Rule Change](rule-changes)

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

## Requesting a [Change](changes.md)
## Requesting a [Change](changes)

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

## Reporting a security vulnerability

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

## [Working on Issues](working-on-issues.md)
## [Working on Issues](working-on-issues)

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

## Submitting a [Pull Request](pull-requests.md)
## Submitting a [Pull Request](pull-requests)

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

Expand Down
3 changes: 0 additions & 3 deletions docs/developer-guide/contributing/changes.md
Expand Up @@ -4,9 +4,6 @@ layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/changes.md

---
<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. -->

# Change Requests

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:

Expand Down
3 changes: 0 additions & 3 deletions docs/developer-guide/contributing/index.md
Expand Up @@ -4,9 +4,6 @@ layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/README.md

---
<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. -->

# Contributing

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.

Expand Down
3 changes: 0 additions & 3 deletions docs/developer-guide/contributing/new-rules.md
Expand Up @@ -4,9 +4,6 @@ layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/new-rules.md

---
<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. -->

# New Rules

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.

Expand Down
3 changes: 0 additions & 3 deletions docs/developer-guide/contributing/pull-requests.md
Expand Up @@ -4,9 +4,6 @@ layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/pull-requests.md

---
<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. -->

# Pull Requests

If you want to contribute to an ESLint repo, please use a GitHub pull request. This is the fastest way for us to evaluate your code and to merge it into the code base. Please don't file an issue with snippets of code. Doing so means that we need to manually merge the changes in and update any appropriate tests. That decreases the likelihood that your code is going to get included in a timely manner. Please use pull requests.

Expand Down
3 changes: 0 additions & 3 deletions docs/developer-guide/contributing/reporting-bugs.md
Expand Up @@ -4,9 +4,6 @@ layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/reporting-bugs.md

---
<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. -->

# Reporting Bugs

If you think you've found a bug in ESLint, please [create a new issue](https://github.com/eslint/eslint/issues/new/choose) or a [pull request](/docs/developer-guide/contributing/pull-requests) on GitHub.

Expand Down
3 changes: 0 additions & 3 deletions docs/developer-guide/contributing/rule-changes.md
Expand Up @@ -4,9 +4,6 @@ layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/rule-changes.md

---
<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. -->

# Rule Changes

Occasionally, a core ESLint rule needs to be changed. This is not necessarily a bug, but rather, an enhancement that makes a rule more configurable. In those situations, we will consider making changes to rules.

Expand Down
3 changes: 0 additions & 3 deletions docs/developer-guide/contributing/working-on-issues.md
Expand Up @@ -4,9 +4,6 @@ layout: doc
edit_link: https://github.com/eslint/eslint/edit/main/docs/src/developer-guide/contributing/working-on-issues.md

---
<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. -->

# Working on Issues

Our public [issues tracker](https://github.com/eslint/eslint/issues) lists all of the things we plan on doing as well as suggestions from the community. Before starting to work on an issue, be sure you read through the rest of this page.

Expand Down

0 comments on commit acfcb9c

Please sign in to comment.