Skip to content

Commit

Permalink
Merge branch 'main' into custom_rules_cleanup_expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed Apr 20, 2023
2 parents 6a4fa11 + f57eff2 commit a06186f
Show file tree
Hide file tree
Showing 66 changed files with 534 additions and 157 deletions.
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Expand Up @@ -68,6 +68,13 @@ body:
Please copy-paste the actual ESLint output. You can use Markdown in this field.
validations:
required: true
- type: input
attributes:
label: Link to Minimal Reproducible Example
description: 'Link to a [playground](https://eslint.org/play), [StackBlitz](https://stackblitz.com), or GitHub repo with a minimal reproduction of the problem. **A minimal reproduction is required** so that others can help debug your issue. If a report is vague (e.g. just a generic error message) and has no reproduction, it may be auto-closed.'
placeholder: 'https://stackblitz.com/abcd1234'
validations:
required: true
- type: checkboxes
attributes:
label: Participation
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/add-to-triage.yml
Expand Up @@ -10,7 +10,7 @@ jobs:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v0.4.1
- uses: actions/add-to-project@v0.5.0
with:
project-url: https://github.com/orgs/eslint/projects/3
github-token: ${{ secrets.PROJECT_BOT_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -45,7 +45,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [19.x, 18.x, 17.x, 16.x, 14.x, 12.x, "12.22.0"]
node: [20.x, 19.x, 18.x, 17.x, 16.x, 14.x, 12.x, "12.22.0"]
include:
- os: windows-latest
node: "lts/*"
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,20 @@
v8.38.0 - April 7, 2023

* [`59ed060`](https://github.com/eslint/eslint/commit/59ed06041d4670781956221086ea0fca6683788d) chore: upgrade @eslint/js@8.38.0 (#17069) (Milos Djermanovic)
* [`88c0898`](https://github.com/eslint/eslint/commit/88c08984ec259ac22d839397c06beec8ef213120) chore: package.json update for @eslint/js release (ESLint Jenkins)
* [`7162d34`](https://github.com/eslint/eslint/commit/7162d34df9a66c817c3bd4aafd3a03d226b58dd5) docs: Mention new config system is complete (#17068) (Nicholas C. Zakas)
* [`a1d561d`](https://github.com/eslint/eslint/commit/a1d561d18ed653b56bddbfb1bab1ebe957293563) feat: Move getDeclaredVariables and getAncestors to SourceCode (#17059) (Nicholas C. Zakas)
* [`0fd6bb2`](https://github.com/eslint/eslint/commit/0fd6bb213ad2de77543c936eda21501653182e52) docs: Update README (GitHub Actions Bot)
* [`c83531c`](https://github.com/eslint/eslint/commit/c83531c1a6026675f36aa9e33fef14458043974a) docs: Update/remove external links, eg. point to `eslint-community` (#17061) (Pelle Wessman)
* [`cf682d2`](https://github.com/eslint/eslint/commit/cf682d249f04a6a304407d5b9ddbbc4a9714dd62) refactor: simplify new-parens rule schema (#17060) (MHO)
* [`a3aa6f5`](https://github.com/eslint/eslint/commit/a3aa6f5f146534ed7999ebf8930c524a4871ec0b) docs: Clarify `no-div-regex` rule docs (#17051) (Francesco Trotta)
* [`0dde022`](https://github.com/eslint/eslint/commit/0dde02211268394bcbc2b0beef55ea2409b6f55d) ci: bump actions/add-to-project from 0.4.1 to 0.5.0 (#17055) (dependabot[bot])
* [`b0f11cf`](https://github.com/eslint/eslint/commit/b0f11cf977a4180bf7c3042e7faeaaa067ffafd0) docs: Update README (GitHub Actions Bot)
* [`da8d52a`](https://github.com/eslint/eslint/commit/da8d52a9d4edd9b2016cd4a15cd78f1ddadf20c7) docs: Update the second object instance for the "no-new" rule (#17020) (Ahmadou Waly NDIAYE)
* [`518130a`](https://github.com/eslint/eslint/commit/518130ae79a16d7bf4d752c211ae88152cc5a6f0) docs: switch language based on current path (#16687) (Percy Ma)
* [`24206c4`](https://github.com/eslint/eslint/commit/24206c49a138d4390f815ae122ee12f564bc604b) docs: Update README (GitHub Actions Bot)
* [`1c1ece2`](https://github.com/eslint/eslint/commit/1c1ece26d1da61e523b83dda25353ec9379eb6c9) fix: do not report on `RegExp(...args)` in `require-unicode-regexp` (#17037) (Francesco Trotta)

v8.37.0 - March 28, 2023

* [`c67f299`](https://github.com/eslint/eslint/commit/c67f2992a743de4765bb6f11c12622e3651324b9) chore: upgrade @eslint/js@8.37.0 (#17033) (Milos Djermanovic)
Expand Down
10 changes: 0 additions & 10 deletions README.md
Expand Up @@ -244,20 +244,10 @@ The people who review and fix bugs and help triage issues.
Bryan Mishkin
</a>
</td><td align="center" valign="top" width="11%">
<a href="https://github.com/btmills">
<img src="https://github.com/btmills.png?s=75" width="75" height="75"><br />
Brandon Mills
</a>
</td><td align="center" valign="top" width="11%">
<a href="https://github.com/fasttime">
<img src="https://github.com/fasttime.png?s=75" width="75" height="75"><br />
Francesco Trotta
</a>
</td><td align="center" valign="top" width="11%">
<a href="https://github.com/yeonjuan">
<img src="https://github.com/yeonjuan.png?s=75" width="75" height="75"><br />
YeonJuan
</a>
</td></tr></tbody></table>

### Website Team
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
@@ -1,7 +1,7 @@
{
"name": "docs-eslint",
"private": true,
"version": "8.37.0",
"version": "8.38.0",
"description": "",
"main": "index.js",
"keywords": [],
Expand Down
2 changes: 1 addition & 1 deletion docs/src/_data/rules.json
Expand Up @@ -721,7 +721,7 @@
},
{
"name": "no-div-regex",
"description": "Disallow division operators explicitly at the beginning of regular expressions",
"description": "Disallow equal signs explicitly at the beginning of regular expressions",
"recommended": false,
"fixable": true,
"hasSuggestions": false
Expand Down
2 changes: 1 addition & 1 deletion docs/src/_data/rules_meta.json
Expand Up @@ -873,7 +873,7 @@
"no-div-regex": {
"type": "suggestion",
"docs": {
"description": "Disallow division operators explicitly at the beginning of regular expressions",
"description": "Disallow equal signs explicitly at the beginning of regular expressions",
"recommended": false,
"url": "https://eslint.org/docs/rules/no-div-regex"
},
Expand Down
3 changes: 2 additions & 1 deletion docs/src/extend/code-path-analysis.md
Expand Up @@ -259,7 +259,8 @@ Please use a map of information instead.
```js
function hasCb(node, context) {
if (node.type.indexOf("Function") !== -1) {
return context.getDeclaredVariables(node).some(function(v) {
const sourceCode = context.getSourceCode();
return sourceCode.getDeclaredVariables(node).some(function(v) {
return v.type === "Parameter" && v.name === "cb";
});
}
Expand Down
9 changes: 4 additions & 5 deletions docs/src/extend/custom-rules.md
Expand Up @@ -131,10 +131,9 @@ The `context` object has the following properties:
* `parserOptions`: The parser options configured for this run (more details [here](../use/configure/language-options#specifying-parser-options)).

Additionally, the `context` object has the following methods:

* `getAncestors()`: Returns an array of the ancestors of the currently-traversed node, starting at the root of the AST and continuing through the direct parent of the current node. This array does not include the currently-traversed node itself.
* `getCwd()`: Returns the `cwd` option passed to the [Linter](../integrate/nodejs-api#linter). It is a path to a directory that should be considered the current working directory.
* `getDeclaredVariables(node)`: Returns a list of [variables](./scope-manager-interface#variable-interface) declared by the given node. This information can be used to track references to variables.
* `getAncestors()` - (**Deprecated:** Use `SourceCode#getAncestors(node)` instead.) Returns an array of the ancestors of the currently-traversed node, starting at the root of the AST and continuing through the direct parent of the current node. This array does not include the currently-traversed node itself.
* `getCwd()` - Returns the `cwd` option passed to the [Linter](../integrate/nodejs-api#linter). It is a path to a directory that should be considered the current working directory.
* `getDeclaredVariables(node)` - (**Deprecated:** Use `SourceCode#getDeclaredVariables(node)` instead.) Returns a list of [variables](./scope-manager-interface#variable-interface) declared by the given node. This information can be used to track references to variables.
* If the node is a `VariableDeclaration`, all variables declared in the declaration are returned.
* If the node is a `VariableDeclarator`, all variables declared in the declarator are returned.
* If the node is a `FunctionDeclaration` or `FunctionExpression`, the variable for the function name is returned, in addition to variables for the function parameters.
Expand All @@ -146,7 +145,7 @@ Additionally, the `context` object has the following methods:
* Otherwise, if the node does not declare any variables, an empty array is returned.
* `getFilename()`: Returns the filename associated with the source.
* `getPhysicalFilename()`: When linting a file, it returns the full path of the file on disk without any code block information. When linting text, it returns the value passed to `—stdin-filename` or `<text>` if not specified.
* `getScope()`: (**Deprecated:** Use `SourceCode.getScope(node)` instead.) Returns the [scope](./scope-manager-interface#scope-interface) of the currently-traversed node. This information can be used to track references to variables.
* `getScope()`: (**Deprecated:** Use `SourceCode#getScope(node)` instead.) Returns the [scope](./scope-manager-interface#scope-interface) of the currently-traversed node. This information can be used to track references to variables.
* `getSourceCode()`: Returns a `SourceCode` object that you can use to work with the source that was passed to ESLint (see [Accessing the Source Code](#accessing-the-source-code)).
* `markVariableAsUsed(name)`: Marks a variable with the given name in the current scope as used. This affects the [no-unused-vars](../rules/no-unused-vars) rule. Returns `true` if a variable with the given name was found and marked as used, otherwise `false`.
* `report(descriptor)`. Reports a problem in the code (see the [dedicated section](#reporting-problems)).
Expand Down
2 changes: 1 addition & 1 deletion docs/src/extend/plugins.md
Expand Up @@ -183,7 +183,7 @@ ESLint plugins should be linted too! It's suggested to lint your plugin with the

* [eslint](https://www.npmjs.com/package/eslint)
* [eslint-plugin-eslint-plugin](https://www.npmjs.com/package/eslint-plugin-eslint-plugin)
* [eslint-plugin-node](https://www.npmjs.com/package/eslint-plugin-node)
* [eslint-plugin-n](https://www.npmjs.com/package/eslint-plugin-n)

## Share Plugins

Expand Down
6 changes: 3 additions & 3 deletions docs/src/maintain/manage-issues.md
Expand Up @@ -30,7 +30,7 @@ The first goal when evaluating an issue is to determine which category the issue

## Triaging Process

All of ESLint's issues, across all GitHub repositories, are managed on our [Triage Project](https://github.com/orgs/eslint/projects/2). Please use the Triage project instead of the issues list when reviewing issues to determine what to work on. The Triage project has several columns:
All of ESLint's issues, across all GitHub repositories, are managed on our [Triage Project](https://github.com/orgs/eslint/projects/3). Please use the Triage project instead of the issues list when reviewing issues to determine what to work on. The Triage project has several columns:

* **Needs Triage**: Issues that have not yet been reviewed by anyone
* **Triaging**: Issues that someone has reviewed but has not been able to fully triage yet
Expand Down Expand Up @@ -120,8 +120,8 @@ Consensus is reached on issues when there are at least three team members who be

If consensus cannot be reached on an issue, or an issue's progress has been stalled and it's not clear if the issue should be closed, then you can refer the issue to the TSC for resolution. To do so, add the "tsc agenda" label to the issue and add a comment including the following information:

1. A one-paragraph summary of the discussion to this point.
2. The question you would like the TSC to answer.
1. A one-paragraph summary of the discussion to this point. This should begin with "TSC Summary:".
2. The question you would like the TSC to answer. This should begin with "TSC Question:".

The issue will be discussed at the next TSC meeting and the resolution will be posted back to the issue.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/callback-return.md
Expand Up @@ -9,7 +9,7 @@ further_reading:
---


This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node).
This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n).

The callback pattern is at the heart of most I/O and event-driven programming
in JavaScript.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/global-require.md
Expand Up @@ -4,7 +4,7 @@ rule_type: suggestion
---


This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node).
This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n).

In Node.js, module dependencies are included using the `require()` function, such as:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/handle-callback-err.md
Expand Up @@ -7,7 +7,7 @@ further_reading:
---


This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node).
This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n).

In Node.js, a common pattern for dealing with asynchronous behavior is called the callback pattern.
This pattern expects an `Error` object or `null` as the first argument of the callback.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-buffer-constructor.md
Expand Up @@ -8,7 +8,7 @@ further_reading:
---


This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node).
This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n).

In Node.js, the behavior of the `Buffer` constructor is different depending on the type of its argument. Passing an argument from user input to `Buffer()` without validating its type can lead to security vulnerabilities such as remote memory disclosure and denial of service. As a result, the `Buffer` constructor has been deprecated and should not be used. Use the producer methods `Buffer.from`, `Buffer.alloc`, and `Buffer.allocUnsafe` instead.

Expand Down
4 changes: 2 additions & 2 deletions docs/src/rules/no-div-regex.md
Expand Up @@ -8,15 +8,15 @@ related_rules:



Require regex literals to escape division operators.
Characters `/=` at the beginning of a regular expression literal can be confused with a division assignment operator.

```js
function bar() { return /=foo/; }
```

## Rule Details

This is used to disambiguate the division operator to not confuse users.
This rule forbids equal signs (`=`) after the slash (`/`) at the beginning of a regular expression literal, because the characters `/=` can be confused with a division assignment operator.

Examples of **incorrect** code for this rule:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-mixed-requires.md
Expand Up @@ -4,7 +4,7 @@ rule_type: suggestion
---


This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node).
This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n).

In the Node.js community it is often customary to separate initializations with calls to `require` modules from other variable declarations, sometimes also grouping them by the type of module. This rule helps you enforce this convention.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-new-require.md
Expand Up @@ -4,7 +4,7 @@ rule_type: suggestion
---


This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node).
This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n).

The `require` function is used to include modules that exist in separate files, such as:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-path-concat.md
Expand Up @@ -4,7 +4,7 @@ rule_type: suggestion
---


This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node).
This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n).

In Node.js, the `__dirname` and `__filename` global variables contain the directory path and the file path of the currently executing script file, respectively. Sometimes, developers try to use these variables to create paths to other files, such as:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-process-env.md
Expand Up @@ -7,7 +7,7 @@ further_reading:
---


This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node).
This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n).

The `process.env` object in Node.js is used to store deployment/configuration parameters. Littering it through out a project could lead to maintenance issues as it's another kind of global dependency. As such, it could lead to merge conflicts in a multi-user setup and deployment issues in a multi-server setup. Instead, one of the best practices is to define all those parameters in a single configuration/settings file which could be accessed throughout the project.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-process-exit.md
Expand Up @@ -4,7 +4,7 @@ rule_type: suggestion
---


This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node).
This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n).

The `process.exit()` method in Node.js is used to immediately stop the Node.js process and exit. This is a dangerous operation because it can occur in any method at any point in time, potentially stopping a Node.js application completely when an error occurs. For example:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-restricted-modules.md
Expand Up @@ -4,7 +4,7 @@ rule_type: suggestion
---


This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node).
This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n).

A module in Node.js is a simple or complex functionality organized in a JavaScript file which can be reused throughout the Node.js
application. The keyword `require` is used in Node.js/CommonJS to import modules into an application. This way you can have dynamic loading where the loaded module name isn't predefined /static, or where you conditionally load a module only if it's "truly required".
Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-sync.md
Expand Up @@ -4,7 +4,7 @@ rule_type: suggestion
---


This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node).
This rule was **deprecated** in ESLint v7.0.0. Please use the corresponding rule in [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n).

In Node.js, most I/O is done through asynchronous methods. However, there are often synchronous versions of the asynchronous methods. For example, `fs.exists()` and `fs.existsSync()`. In some contexts, using synchronous operations is okay (if, as with ESLint, you are writing a command line utility). However, in other contexts the use of synchronous operations is considered a bad practice that should be avoided. For example, if you are running a high-travel web server on Node.js, you should consider carefully if you want to allow any synchronous operations that could lock up the server.

Expand Down

0 comments on commit a06186f

Please sign in to comment.