Skip to content

Commit

Permalink
Merge branch 'main' into invalid-update
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Oct 1, 2023
2 parents 5dafa01 + 4a6d841 commit 94cc251
Show file tree
Hide file tree
Showing 560 changed files with 37,716 additions and 18,681 deletions.
2 changes: 2 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
"transpiling",
"triaging",
"trpc",
"tsconfigrootdir",
"tsconfigs",
"tseslint",
"tsvfs",
Expand All @@ -133,6 +134,7 @@
"unfixable",
"unoptimized",
"unprefixed",
"upcasting",
"upsert",
"warnonunsupportedtypescriptversion",
"Zacher"
Expand Down
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ module.exports = {
'deprecation/deprecation': 'error',

// TODO(#7138): Investigate enabling these soon ✨
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',

// TODO(#7130): Investigate changing these in or removing these from presets
Expand Down Expand Up @@ -122,6 +121,8 @@ module.exports = {
null: 'never',
},
],
'logical-assignment-operators': 'error',
'no-else-return': 'error',
'no-mixed-operators': 'error',
'no-console': 'error',
'no-process-exit': 'error',
Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/06-bug-report-other.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ body:
- ast-spec
- eslint-plugin-tslint
- parser
- rule-tester
- scope-manager
- typescript-estree
- utils
Expand Down Expand Up @@ -118,6 +119,7 @@ body:
| -------------------------------------- | ------- |
| `@typescript-eslint/eslint-plugin` | `X.Y.Z` |
| `@typescript-eslint/parser` | `X.Y.Z` |
| `@typescript-eslint/rule-tester` | `X.Y.Z` |
| `@typescript-eslint/scope-manager` | `X.Y.Z` |
| `@typescript-eslint/typescript-estree` | `X.Y.Z` |
| `@typescript-eslint/type-utils` | `X.Y.Z` |
Expand Down
42 changes: 30 additions & 12 deletions .github/actions/prepare-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,43 @@ runs:
node-version: ${{ inputs.node-version }}
registry-url: ${{ inputs.registry-url }}

- name: Get yarn cache directory path
# Yarn 3 caching strategy which follows taken from https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a

- name: Expose yarn config as "$GITHUB_OUTPUT"
id: yarn-config
shell: bash
id: yarn-cache-dir-path
run: echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_ENV
run: |
echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache
# Yarn rotates the downloaded cache archives, @see https://github.com/actions/setup-node/issues/325
# Yarn cache is also reusable between arch and os.
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-download-cache
with:
path: |
${{ env.yarn_cache_dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }}
key: yarn-download-cache-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
yarn-download-cache-
# Invalidated on yarn.lock changes
- name: Restore yarn install state
id: yarn-install-state-cache
uses: actions/cache@v3
with:
path: .yarn/ci-cache/
key: ${{ runner.os }}-yarn-install-state-cache-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}

# if the cache was hit - this will run in <1s
- name: Install dependencies
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
yarn --ignore-engines --frozen-lockfile --ignore-scripts
yarn install --immutable --inline-builds
yarn check-clean-workspace-after-install
yarn patch-package
env:
# CI optimizations. Overrides yarnrc.yml options (or their defaults) in the CI action.
YARN_ENABLE_GLOBAL_CACHE: 'false' # Use local cache folder to keep downloaded archives
YARN_NM_MODE: 'hardlinks-local' # Hardlinks-(local|global) reduces io / node_modules size
YARN_INSTALL_STATE_PATH: .yarn/ci-cache/install-state.gz # Very small speedup when lock does not change
# Other environment variables
HUSKY: '0' # By default do not run HUSKY install
5 changes: 2 additions & 3 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'@nx/cli',
'@nrwl/devkit',
'@nx/devkit',
'@nrwl/jest',
'@nx/jest',
'@nx/jest',
'@nrwl/nx-cloud',
'nx-cloud',
Expand Down Expand Up @@ -74,9 +74,8 @@
groupName: 'babel',
},
{
extends: ['monorepo:jest'],
matchPackageNames: ['ts-jest', 'pretty-format'],
matchPackagePrefixes: ['@types/jest', 'jest-', '@jest/'],
matchPackagePrefixes: ['@types/jest', 'jest', '@jest'],
groupName: 'jest',
},
],
Expand Down
93 changes: 61 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ on:
push:
branches:
- main
- v6
pull_request:
branches:
- '**'
merge_group:

env:
PRIMARY_NODE_VERSION: 20
PRIMARY_NODE_VERSION: '>=20.6.1'
# 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 @@ -56,6 +55,22 @@ jobs:
- name: Build
uses: ./.github/actions/prepare-build

generate_configs:
name: Lint
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install
uses: ./.github/actions/prepare-install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
- run: yarn generate-configs
- run: git status --porcelain
- if: failure()
run: echo "Outdated result detected from yarn generate-configs. Please check in any file changes."

lint_without_build:
name: Lint
needs: [install]
Expand Down Expand Up @@ -193,9 +208,39 @@ jobs:
# Sadly 1 day is the minimum
retention-days: 1

unit_tests_tsserver:
name: Run Unit Tests with Experimental TSServer
needs: [build]
runs-on: ubuntu-latest
strategy:
matrix:
package:
[
'eslint-plugin',
'eslint-plugin-internal',
'eslint-plugin-tslint',
'typescript-estree',
]
env:
COLLECT_COVERAGE: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Install
uses: ./.github/actions/prepare-install
with:
node-version: 18
- name: Build
uses: ./.github/actions/prepare-build
- name: Run unit tests for ${{ matrix.package }}
run: npx nx test ${{ matrix.package }} --coverage=false
env:
CI: true
TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER: true

website_tests:
# The NETLIFY_TOKEN secret will not be available on forks
if: github.repository_owner == 'typescript-eslint'
permissions:
contents: read # to fetch code (actions/checkout)

Expand All @@ -216,21 +261,32 @@ jobs:
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}

- name: Build website
if: github.repository != 'typescript-eslint/typescript-eslint' || github.ref != 'refs/heads/main'
run: NX_VERBOSE_LOGGING=true yarn nx build website

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

- name: Wait for Netlify deployment
if: github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main'
uses: ./.github/actions/wait-for-netlify
id: waitForDeployment
with:
netlify_token: ${{ secrets.NETLIFY_TOKEN }}

- name: Run Playwright tests against the Netlify deployment
if: github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main'
run: yarn playwright test --reporter=list
working-directory: packages/website
env:
PLAYWRIGHT_TEST_BASE_URL: ${{ steps.waitForDeployment.outputs.url }}

- name: Run Playwright tests against local deployment
if: github.repository != 'typescript-eslint/typescript-eslint' || github.ref != 'refs/heads/main'
run: yarn playwright test --reporter=list
working-directory: packages/website

- if: always()
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -284,30 +340,3 @@ jobs:
run: npx lerna publish --loglevel=verbose --canary --exact --force-publish --yes
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

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:
- name: Checkout
uses: actions/checkout@v3
- name: Install
uses: ./.github/actions/prepare-install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
- name: Build
uses: ./.github/actions/prepare-build

# Fetch all history for all tags and branches in this job because lerna needs it
- run: |
git fetch --prune --unshallow
- name: Publish all packages to npm
run: npx lerna publish premajor --loglevel=verbose --canary --exact --force-publish --yes --dist-tag rc-v6
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
13 changes: 8 additions & 5 deletions .github/workflows/nx-migrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,26 @@ jobs:
# Revert renovate's changes to package.json and yarn.lock so that it is a clean migrate from the status quo
git checkout HEAD~1 -- package.json yarn.lock
yarn --ignore-scripts
YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn
npx nx migrate @nx/workspace@$NX_VERSION
yarn nx migrate @nx/workspace@$NX_VERSION
# Sometimes Nx can require config formatting changes after a migrate command
yarn --ignore-scripts
npx nx format
YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn
yarn nx format
# migrations.json may or may not exist after running nx migrate
if [ -f migrations.json ]; then
# This will also invoke yarn automatically
npx nx migrate --run-migrations=migrations.json
yarn nx migrate --run-migrations=migrations.json
# After we have run its migrations, we no longer need the migrations.json file
rm migrations.json
fi
# Run the special nx repair command to ensure config matches latest and greatest
yarn nx repair
# Ensure all the changed files are formatted appropriately
yarn format
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/pr-review-requested.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
jobs:
pr_review_requested:
runs-on: ubuntu-latest
steps:
- uses: actions-ecosystem/action-remove-labels@v1
with:
labels: 'awaiting response'
- if: failure()
run: |
echo "Don't worry if the previous step failed."
echo "See https://github.com/actions-ecosystem/action-remove-labels/issues/221."
name: PR Review Requested

on:
pull_request_target:
types:
- review_requested

permissions:
pull-requests: write
5 changes: 4 additions & 1 deletion .github/workflows/prettier-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
persist-credentials: false

- name: Check if prettier was changed as part of the latest commit on the PR
id: prettier-package-check
Expand All @@ -33,7 +36,7 @@ jobs:
# We cannot use secrets.GITHUB_TOKEN for this because it is not permitted to kick off subsequent actions worfklow runs, so we use a PAT instead
GITHUB_TOKEN: ${{ secrets.JAMES_HENRY_GITHUB_TOKEN }}
run: |
yarn --ignore-scripts
yarn --mode skip-build
yarn format
# Commit all the changes to the PR (see note on not being able to use secrets.GITHUB_TOKEN for this)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/semantic-pr-titles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
eslint-plugin-internal
eslint-plugin-tslint
parser
rule-tester
scope-manager
type-utils
types
Expand Down
3 changes: 2 additions & 1 deletion .markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"summary",
"sup",
"TabItem",
"Tabs"
"Tabs",
"TypeScriptOverlap"
]
},
// MD034/no-bare-urls - Bare URL used
Expand Down
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ packages/eslint-plugin/tests/fixtures/indent/
# prettier errors on this case because it's semantically valid
packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts

# prettier doesn't yet support `using` declaration
packages/ast-spec/src/declaration/VariableDeclaration/fixtures/await-using-multiple-declarations/fixture.ts
packages/ast-spec/src/declaration/VariableDeclaration/fixtures/await-using-with-value/fixture.ts
packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-multiple-declarations/fixture.ts
packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/fixture.ts
packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/fixture.ts

# prettier doesn't yet support `const` modifiers for type parameters
packages/ast-spec/src/special/TSTypeParameter/fixtures

Expand All @@ -22,6 +29,7 @@ CHANGELOG.md

packages/website/.docusaurus
packages/website/build
packages/website/playwright-report

# see the file header in eslint-base.test.js for more info
packages/rule-tester/tests/eslint-base

0 comments on commit 94cc251

Please sign in to comment.