diff --git a/.github/workflows/node-pretest.yml b/.github/workflows/node-pretest.yml index 48c68f5955..cea4567406 100644 --- a/.github/workflows/node-pretest.yml +++ b/.github/workflows/node-pretest.yml @@ -2,6 +2,9 @@ name: 'Tests: pretest/posttest' on: [pull_request, push] +permissions: + contents: read + jobs: pretest: runs-on: ubuntu-latest @@ -18,7 +21,7 @@ jobs: working-directory: "packages/${{ matrix.package }}" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - uses: ljharb/actions/node/install@main name: 'nvm install lts/* && npm install' with: diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 6fc77ea08d..af1b557d11 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -2,6 +2,9 @@ name: 'Tests: node.js' on: [pull_request, push] +permissions: + contents: read + jobs: matrix: runs-on: ubuntu-latest @@ -39,7 +42,7 @@ jobs: working-directory: "packages/${{ matrix.package }}" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - uses: ljharb/actions/node/install@main name: 'nvm install ${{ matrix.node-version }} && npm install' with: @@ -50,7 +53,7 @@ jobs: - run: node -pe "require('eslint/package.json').version" name: 'eslint version' - run: npm run travis - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v5 react: needs: [matrix] @@ -74,7 +77,7 @@ jobs: working-directory: "packages/${{ matrix.package }}" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - uses: ljharb/actions/node/install@main name: 'nvm install ${{ matrix.node-version }} && npm install' with: @@ -87,7 +90,7 @@ jobs: - run: npm install --no-save "eslint-plugin-react-hooks@${{ matrix.react-hooks }}" if: ${{ matrix.react-hooks > 0}} - run: npm run travis - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v5 prepublish-base: name: 'prepublish tests (base config)' @@ -106,7 +109,7 @@ jobs: working-directory: "packages/${{ matrix.package }}" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - uses: ljharb/actions/node/install@main name: 'nvm install lts/* && npm install' with: @@ -139,7 +142,7 @@ jobs: working-directory: "packages/${{ matrix.package }}" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - uses: ljharb/actions/node/install@main name: 'nvm install lts/* && npm install' with: diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml index 027aed0797..fff3ba2d33 100644 --- a/.github/workflows/rebase.yml +++ b/.github/workflows/rebase.yml @@ -2,14 +2,20 @@ name: Automatic Rebase on: [pull_request_target] +permissions: + contents: read + jobs: _: + permissions: + contents: write # for ljharb/rebase to push code to rebase + pull-requests: read # for ljharb/rebase to get info about PR name: "Automatic Rebase" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - uses: ljharb/rebase@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/require-allow-edits.yml b/.github/workflows/require-allow-edits.yml index 549d7b4823..eb3631b9e3 100644 --- a/.github/workflows/require-allow-edits.yml +++ b/.github/workflows/require-allow-edits.yml @@ -2,8 +2,13 @@ name: Require “Allow Edits” on: [pull_request_target] +permissions: + contents: read + jobs: _: + permissions: + pull-requests: read # for ljharb/require-allow-edits to check 'allow edits' on PR name: "Require “Allow Edits”" runs-on: ubuntu-latest diff --git a/README.md b/README.md index 9a325a355b..bd91faf2ea 100644 --- a/README.md +++ b/README.md @@ -2133,8 +2133,8 @@ Other Style Guides ```javascript // bad const foo = maybe1 > maybe2 - ? "bar" - : value1 > value2 ? "baz" : null; + ? 'bar' + : value1 > value2 ? 'baz' : null; // split into 2 separated ternary expressions const maybeNull = value1 > value2 ? 'baz' : null; diff --git a/package.json b/package.json index a78bc250d4..afe129da02 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "A mostly reasonable approach to JavaScript.", "scripts": { "preinstall": "npm run install:config && npm run install:config:base", - "postinstall": "rm -rf node_modules/markdownlint-cli/node_modules/markdownlint", + "postinstall": "rimraf node_modules/markdownlint-cli/node_modules/markdownlint", "install:config": "cd packages/eslint-config-airbnb && npm prune && npm install", "install:config:base": "cd packages/eslint-config-airbnb-base && npm prune && npm install", "lint": "markdownlint --config linters/.markdownlint.json README.md */README.md", @@ -41,6 +41,7 @@ "homepage": "https://github.com/airbnb/javascript", "devDependencies": { "markdownlint": "^0.29.0", - "markdownlint-cli": "^0.35.0" + "markdownlint-cli": "^0.35.0", + "rimraf": "^6.0.1" } } diff --git a/packages/eslint-config-airbnb-base/README.md b/packages/eslint-config-airbnb-base/README.md index 6ddc34dac1..79052b256a 100644 --- a/packages/eslint-config-airbnb-base/README.md +++ b/packages/eslint-config-airbnb-base/README.md @@ -62,6 +62,16 @@ Our default export contains all of our ESLint rules, including ECMAScript 6+. It 2. Add `"extends": "airbnb-base"` to your .eslintrc. +> **Note**: ESLint only lints `.js` files by default. + + If your project uses `.jsx` (or `.tsx` with TypeScript), you need to pass extensions to the CLI: + + ```sh + eslint . --ext .js, .jsx, .mjs + ``` + + Without this, JSX-related rules will not apply to `.jsx` files. + ### eslint-config-airbnb-base/legacy Lints ES5 and below. Requires `eslint` and `eslint-plugin-import`. diff --git a/packages/eslint-config-airbnb-base/rules/imports.js b/packages/eslint-config-airbnb-base/rules/imports.js index d36e4908fa..b9453924dc 100644 --- a/packages/eslint-config-airbnb-base/rules/imports.js +++ b/packages/eslint-config-airbnb-base/rules/imports.js @@ -279,5 +279,9 @@ module.exports = { // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/no-empty-named-blocks.md // TODO, semver-minor: enable 'import/no-empty-named-blocks': 'off', + + // https://github.com/import-js/eslint-plugin-import/blob/3a99e4c8d3bfd2cd466353d11784eb06dad9b166/docs/rules/enforce-node-protocol-usage.md + // TODO, semver-major: enable + 'import/enforce-node-protocol-usage': ['off', 'never'], }, }; diff --git a/packages/eslint-config-airbnb-base/rules/style.js b/packages/eslint-config-airbnb-base/rules/style.js index 2e7f6fed44..ad38834d88 100644 --- a/packages/eslint-config-airbnb-base/rules/style.js +++ b/packages/eslint-config-airbnb-base/rules/style.js @@ -345,7 +345,7 @@ module.exports = { }, { selector: 'ForOfStatement', - message: 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.', + message: 'iterators/generators require regenerator-runtime in older browsers/engines, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.', }, { selector: 'LabeledStatement', @@ -510,7 +510,7 @@ module.exports = { markers: ['=', '!', '/'], // space here to support sprockets directives, slash for TS /// comments }, block: { - exceptions: ['-', '+'], + exceptions: ['-', '+', '*'], markers: ['=', '!', ':', '::'], // space here to support sprockets directives and flow comment types balanced: true, } diff --git a/packages/eslint-config-airbnb/README.md b/packages/eslint-config-airbnb/README.md index 3b3f43196d..e18088143a 100644 --- a/packages/eslint-config-airbnb/README.md +++ b/packages/eslint-config-airbnb/README.md @@ -58,6 +58,15 @@ If you don't need React, see [eslint-config-airbnb-base](https://npmjs.com/eslin 2. Add `"extends": "airbnb"` to your `.eslintrc` +> **Note**: ESLint only lints `.js` files by default. + If your project uses `.jsx` (or `.tsx` with TypeScript), you need to pass extensions to the CLI: + + ```sh + eslint . --ext .js, .jsx, .mjs + ``` + + Without this, JSX-related rules will not apply to `.jsx` files. + ### eslint-config-airbnb/hooks This entry point enables the linting rules for React hooks (requires v16.8+). To use, add `"extends": ["airbnb", "airbnb/hooks"]` to your `.eslintrc`. diff --git a/react/README.md b/react/README.md index a590a19672..f61602d161 100644 --- a/react/README.md +++ b/react/README.md @@ -350,7 +350,7 @@ This style guide is mostly based on the standards that are currently prevalent i Me waving hello ``` - - Use only valid, non-abstract [ARIA roles](https://www.w3.org/TR/wai-aria/#usage_intro). eslint: [`jsx-a11y/aria-role`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md) + - Use only valid, non-abstract [ARIA roles](https://www.w3.org/TR/wai-aria/#usage). eslint: [`jsx-a11y/aria-role`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md) ```jsx // bad - not an ARIA role