Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into no-prototype-builtins…
Browse files Browse the repository at this point in the history
…-fix
  • Loading branch information
yonran committed Oct 26, 2023
2 parents 586feee + 3aec1c5 commit 9938110
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 22 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install Packages
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [20.x, 19.x, 18.x, 17.x, 16.x, 14.x, 12.x, "12.22.0"]
node: [21.x, 20.x, 19.x, 18.x, 17.x, 16.x, 14.x, 12.x, "12.22.0"]
include:
- os: windows-latest
node: "lts/*"
Expand All @@ -54,7 +54,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install Packages
Expand All @@ -69,7 +69,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '16'
- name: Install Packages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-readme.yml
Expand Up @@ -14,7 +14,7 @@ jobs:
token: ${{ secrets.WORKFLOW_PUSH_BOT_TOKEN }}

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4

- name: Install npm packages
run: npm install
Expand Down
2 changes: 1 addition & 1 deletion docs/src/_includes/components/rule-categories.macro.html
Expand Up @@ -21,7 +21,7 @@
<div class="rule-category">
<span class="rule-category__icon">💡 <span class="visually-hidden">hasSuggestions</span></span>
<p class="rule-category__description">
Some problems reported by this rule are manually fixable by editor <a href="../extend/custom-rules#providing-suggestions">suggestions</a>
Some problems reported by this rule are manually fixable by editor <a href="../use/core-concepts#rule-suggestions">suggestions</a>
</p>
</div>
{%- endif -%}
Expand Down
17 changes: 17 additions & 0 deletions docs/src/use/core-concepts.md
Expand Up @@ -23,6 +23,23 @@ ESLint contains hundreds of built-in rules that you can use. You can also create

For more information, refer to [Rules](../rules/).

### Rule Fixes

Rules may optionally provide fixes for violations that they find. Fixes safely correct the violation without changing application logic.

Fixes may be applied automatically with the [`--fix` command line option](https://eslint.org/docs/latest/use/command-line-interface#--fix) and via editor extensions.

Rules that may provide fixes are marked with 🔧 in [Rules](../rules/).

### Rule Suggestions

Rules may optionally provide suggestions in addition to or instead of providing fixes. Suggestions differ from fixes in two ways:

1. Suggestions may change application logic and so cannot be automatically applied.
1. Suggestions cannot be applied through the ESLint CLI and are only available through editor integrations.

Rules that may provide suggestions are marked with 💡 in [Rules](../rules/).

## Configuration Files

An ESLint configuration file is a place where you put the configuration for ESLint in your project. You can include built-in rules, how you want them enforced, plugins with custom rules, shareable configurations, which files you want rules to apply to, and more.
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-object-constructor.js
Expand Up @@ -35,10 +35,10 @@ const NODE_TYPES_BY_KEYWORD = {
};

/*
* Before an opening parenthesis, `>` (for JSX), and postfix `++` and `--` always trigger ASI;
* Before an opening parenthesis, postfix `++` and `--` always trigger ASI;
* the tokens `:`, `;`, `{` and `=>` don't expect a semicolon, as that would count as an empty statement.
*/
const PUNCTUATORS = new Set([":", ";", ">", "{", "=>", "++", "--"]);
const PUNCTUATORS = new Set([":", ";", "{", "=>", "++", "--"]);

/*
* Statements that can contain an `ExpressionStatement` after a closing parenthesis.
Expand Down
28 changes: 14 additions & 14 deletions tests/lib/rules/no-object-constructor.js
Expand Up @@ -168,6 +168,20 @@ ruleTester.run("no-object-constructor", rule, {
var foo = { bar: baz }
Object()
`
},
{
code: `
<foo />
Object()
`,
parserOptions: { ecmaFeatures: { jsx: true } }
},
{
code: `
<foo></foo>
Object()
`,
parserOptions: { ecmaFeatures: { jsx: true } }
}
].map(props => ({
...props,
Expand Down Expand Up @@ -296,20 +310,6 @@ ruleTester.run("no-object-constructor", rule, {
Object()
`
},
{
code: `
<foo />
Object()
`,
parserOptions: { ecmaFeatures: { jsx: true } }
},
{
code: `
<foo></foo>
Object()
`,
parserOptions: { ecmaFeatures: { jsx: true } }
},
{
code: `
const foo = bar
Expand Down

0 comments on commit 9938110

Please sign in to comment.