Skip to content

Commit

Permalink
Merge branch 'v6'
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Jun 16, 2023
2 parents e5a7c9a + da95d62 commit 788c620
Show file tree
Hide file tree
Showing 513 changed files with 24,812 additions and 4,633 deletions.
10 changes: 9 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"version": "0.1",
"version": "0.2",
"language": "en",
"enableFiletypes": [
"markdown",
"mdx",
"typescript",
"typescriptreact",
"javascript",
"javascriptreact"
],
"ignorePaths": [
".cspell.json",
".github/workflows/**",
Expand Down
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ packages/types/src/generated/**/*.ts

# Playground types downloaded from the web
packages/website/src/vendor

# see the file header in eslint-base.test.js for more info
packages/rule-tester/tests/eslint-base
3 changes: 2 additions & 1 deletion .github/DISCUSSION_TEMPLATE/rfcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ body:
- attributes:
label: Before you submit your RFC, please confirm the following. If any of these required steps are not taken, we may not be able to review your RFC. Help us to help you!
options:
- label: I have [read the discussions guidelines](https://typescript-eslint.io/contributing/discussions) and per those guidelines, this fits a discussion category, _not_ a help request or standard issue.
required: true
- label: I have [searched for related discussions](https://github.com/typescript-eslint/typescript-eslint/discussions) and [searched for related issues](https://github.com/typescript-eslint/typescript-eslint/issues) and found none that match my proposal.
required: true
- label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed.
required: true
id: required-checks
type: checkboxes
labels: ['rfc']
title: Your Title Here
25 changes: 25 additions & 0 deletions .github/DISCUSSION_TEMPLATE/technical-discussions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
body:
- attributes:
label: Body
value: |
Body of the technical discussion...
id: body
type: textarea
- attributes:
label: Additional Info
value: |
Any additional info...
id: additional
type: textarea
- attributes:
label: Before you submit your discussion, please confirm the following. If any of these required steps are not taken, we may not be able to review your RFC. Help us to help you!
options:
- label: I have [read the discussions guidelines](https://typescript-eslint.io/contributing/discussions) and per those guidelines, this fits a discussion category, _not_ a help request or standard issue.
required: true
- label: I have [searched for related discussions](https://github.com/typescript-eslint/typescript-eslint/discussions) and [searched for related issues](https://github.com/typescript-eslint/typescript-eslint/issues) and found none that match my proposal.
required: true
- label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed.
required: true
id: required-checks
type: checkboxes
title: Your Title Here
15 changes: 15 additions & 0 deletions .github/actions/wait-for-netlify/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Wait for the Netlify deployment for the current commit to be ready
description: Wait for the Netlify deployment for the current commit to be ready

inputs:
netlify_token:
description: The value of secrets.NETLIFY_TOKEN
required: true
max_timeout:
description: The maximum length of time to keep retrying the Netlify api
retry_interval:
description: How long to wait between retries of the Netlify api

runs:
using: node16
main: index.js
108 changes: 108 additions & 0 deletions .github/actions/wait-for-netlify/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
const core = require('@actions/core');
const github = require('@actions/github');

const NETLIFY_SITE_ID = '128d21c7-b2fe-45ad-b141-9878fcf5de3a'; // https://app.netlify.com/sites/typescript-eslint/overview
const NETLIFY_TOKEN = core.getInput('netlify_token', { required: true });
const MAX_TIMEOUT = core.getInput('max_timeout') || 300000; // 5 minutes
const RETRY_INTERVAL = core.getInput('retry_interval') || 5000; // 5 seconds

const COMMIT_SHA =
github.context.eventName === 'pull_request'
? github.context.payload.pull_request.head.sha
: github.context.sha;
const BRANCH =
github.context.eventName === 'pull_request'
? github.context.payload.pull_request.head.ref
: github.context.ref_name;

if (!COMMIT_SHA || !BRANCH) {
core.setFailed(
`Could not determine the full commit SHA and branch from the GitHub context: ${JSON.stringify(
github.context,
null,
2,
)}`,
);
}

async function run() {
const { NetlifyAPI } = await import('netlify'); // ESM only, cannot be used with `require`
const client = new NetlifyAPI(NETLIFY_TOKEN);

async function getReadyDeploymentForCommitRef() {
console.log(
`Checking if deployment for commit "${COMMIT_SHA}" on branch "${BRANCH}" has state "ready"...`,
);
const deployments = await client.listSiteDeploys({
site_id: NETLIFY_SITE_ID,
branch: BRANCH,
});
console.log(
`Found ${deployments.length} deployments for this branch "${BRANCH}"`,
);
const deploymentForCommit = deployments.find(
deployment => deployment.commit_ref === COMMIT_SHA,
);
if (!deploymentForCommit) {
console.log(
`No deployment found yet for commit "${COMMIT_SHA}" on branch "${BRANCH}"`,
);
return null;
}
if (deploymentForCommit.state !== 'ready') {
console.log(
`Resolve deployment for commit "${COMMIT_SHA}" on branch "${BRANCH}", but it is not ready yet. State: ${deploymentForCommit.state}`,
);
return null;
}
return deploymentForCommit;
}

async function waitUntilReadyDeployment() {
const maxTimeout = new Promise((_, reject) => {
const id = setTimeout(() => {
clearTimeout(id);
reject(
new Error(
`Error: Timed out in ${MAX_TIMEOUT}ms, based on the configured MAX_TIMEOUT.`,
),
);
}, MAX_TIMEOUT);
});

const isReady = new Promise(async (resolve, reject) => {
const checkReady = async () => {
try {
const readyDeployment = await getReadyDeploymentForCommitRef();
if (readyDeployment) {
return resolve({ readyDeployment });
}
console.log(
`Deployment is not ready yet. Retrying in ${RETRY_INTERVAL}ms based on the configured RETRY_INTERVAL...`,
);
setTimeout(checkReady, RETRY_INTERVAL);
} catch (err) {
return reject(err);
}
};
checkReady();
});

return Promise.race([isReady, maxTimeout]);
}

waitUntilReadyDeployment()
.then(({ readyDeployment }) => {
console.log(
`Resolved "ready" deployment with ID: ${readyDeployment.id}, URL: ${readyDeployment.deploy_ssl_url}`,
);
core.setOutput('deploy_id', readyDeployment.id);
core.setOutput('url', readyDeployment.deploy_ssl_url);
process.exit(0);
})
.catch(error => {
core.setFailed(error.message);
});
}

run();
8 changes: 6 additions & 2 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
{
enabledManagers: ['github-actions', 'npm'],
ignoreDeps: [
// AJV is out-of-date, but it's intentionally synced with ESLint - https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/package.json#L70
'ajv',
// globby is ESM so we can't go any higher right now
'globby',
// this dep now uses package.json exports - we will be removing it next major
'eslint-scope',
// this dep is now ESM only
'execa',
// Some kind of weird caching issue:
// https://github.com/typescript-eslint/typescript-eslint/issues/6230
'ts-node',
// the nx packages get updated using the nx migrate CLI
'@nrwl/cli',
'@nx/cli',
'@nrwl/devkit',
'@nx/devkit',
'@nrwl/jest',
'@nx/jest',
'@nrwl/nx-cloud',
'nx-cloud',
'@nrwl/tao',
],
ignorePaths: [
Expand Down
97 changes: 39 additions & 58 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
merge_group:

env:
PRIMARY_NODE_VERSION: 18
PRIMARY_NODE_VERSION: 20
# Only set the read-write token if we are on the main branch
NX_CLOUD_ACCESS_TOKEN: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && secrets.NX_CLOUD_ACCESS_TOKEN || '' }}

Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
strategy:
matrix:
# just run on the oldest and latest supported versions and assume the intermediate versions are good
node-version: [14, 18]
node-version: [16, 20]
package:
[
'ast-spec',
Expand All @@ -145,6 +145,7 @@ jobs:
'eslint-plugin-tslint',
'parser',
'repo-tools',
'rule-schema-to-typescript-types',
'scope-manager',
'type-utils',
'typescript-estree',
Expand Down Expand Up @@ -192,71 +193,47 @@ jobs:
# Sadly 1 day is the minimum
retention-days: 1

website_build:
name: Build Website
needs: [install, build]
website_tests:
permissions:
contents: read # to fetch code (actions/checkout)

name: Website tests
# We technically do not need to wait for build within the pipeline any more because the build we care about is happening within Netlify, however,
# it is highly likely that if the CI one fails, the Netlify one will as well, so in order to not waste unncessary Github Actions minutes/resources,
# we do still keep this requirement here.
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Install
uses: ./.github/actions/prepare-install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
- name: Build Base
uses: ./.github/actions/prepare-build

- name: Build Website
shell: bash
run: |
npx nx run-many --target=build --projects=website-eslint,website
## TODO - re-enable once we fix them
# https://github.com/typescript-eslint/typescript-eslint/issues/6508
# website_tests:
# permissions:
# contents: read # to fetch code (actions/checkout)

# name: Website tests
# # We technically do not need to wait for build within the pipeline any more because the build we care about is happening within Netlify, however,
# # it is highly likely that if the CI one fails, the Netlify one will as well, so in order to not waste unncessary Github Actions minutes/resources,
# # we do still keep this requirement here.
# needs: [website_build]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 2

# - name: Install
# uses: ./.github/actions/prepare-install
# with:
# node-version: ${{ env.PRIMARY_NODE_VERSION }}

# - name: Install Playwright Browsers
# run: npx playwright install --with-deps

# - name: Wait for Netlify deployment
# uses: probablyup/wait-for-netlify-action@v3.4.0
# id: waitForDeployment
# with:
# site_id: '128d21c7-b2fe-45ad-b141-9878fcf5de3a'
# max_timeout: 300 # 5 minutes
# env:
# NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }}

# - name: Run Playwright tests against the Netlify deployment
# run: yarn playwright test --reporter=list
# working-directory: packages/website
# env:
# PLAYWRIGHT_TEST_BASE_URL: ${{ steps.waitForDeployment.outputs.url }}

# - if: always()
# uses: actions/upload-artifact@v3
# with:
# name: playwright-report
# path: packages/website/playwright-report
- name: Install Playwright Browsers
run: npx playwright install --with-deps

- name: Wait for Netlify deployment
uses: ./.github/actions/wait-for-netlify
id: waitForDeployment
with:
netlify_token: ${{ secrets.NETLIFY_TOKEN }}

- name: Run Playwright tests against the Netlify deployment
run: yarn playwright test --reporter=list
working-directory: packages/website
env:
PLAYWRIGHT_TEST_BASE_URL: ${{ steps.waitForDeployment.outputs.url }}

- if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: packages/website/playwright-report

upload_coverage:
name: Upload Codecov Coverage
Expand All @@ -282,6 +259,8 @@ jobs:
publish_canary_version:
name: Publish the latest code as a canary version
runs-on: ubuntu-latest
permissions:
id-token: write
needs: [integration_tests, lint_with_build, lint_without_build, unit_tests]
if: github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main'
steps:
Expand All @@ -307,6 +286,8 @@ jobs:
publish_canary_version_v6:
name: Publish the next major version code as a canary version
runs-on: ubuntu-latest
permissions:
id-token: write
needs: [integration_tests, lint_with_build, lint_without_build, unit_tests]
if: github.ref == 'refs/heads/v6'
steps:
Expand Down
Loading

0 comments on commit 788c620

Please sign in to comment.