Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix/rest-param-using-…
Browse files Browse the repository at this point in the history
…mapped-type-over-union-constraint

# Conflicts:
#	src/compiler/checker.ts
  • Loading branch information
Andarist committed Mar 16, 2023
2 parents ce8483c + 7f292bf commit 29d4bb9
Show file tree
Hide file tree
Showing 6,331 changed files with 247,903 additions and 1,006,583 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
17 changes: 11 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"es6": true
},
"plugins": [
"@typescript-eslint", "no-null", "import", "eslint-plugin-local"
"@typescript-eslint", "no-null", "import", "eslint-plugin-local", "simple-import-sort"
],
"ignorePatterns": [
"**/node_modules/**",
Expand All @@ -25,11 +25,8 @@
"/coverage/**"
],
"rules": {
"sort-imports": ["error", {
"ignoreCase": true,
"ignoreDeclarationSort": true,
"allowSeparatedGroups": true
}],
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",

"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "error",
Expand Down Expand Up @@ -180,6 +177,14 @@
{ "name": "exports" }
]
}
},
{
// These files contain imports in a specific order that are generally unsafe to modify.
"files": ["**/_namespaces/**"],
"rules": {
"simple-import-sort/imports": "off",
"simple-import-sort/exports": "off"
}
}
]
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.js linguist-language=TypeScript
**/*.json linguist-language=jsonc
* -text
4 changes: 2 additions & 2 deletions .github/fabricbot.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{
"name": "addReply",
"parameters": {
"comment": "Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @mjbvz, and @minestarks for you. Feel free to loop in other consumers/maintainers if necessary"
"comment": "Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @mjbvz, @zkat, and @joj for you. Feel free to loop in other consumers/maintainers if necessary"
}
}
],
Expand Down Expand Up @@ -487,7 +487,7 @@
{
"name": "addReply",
"parameters": {
"comment": "Thanks for the PR! It looks like you've changed 'preProcess.ts' in some way. Please ensure that any changes here don't break consumers with unique project systems such as Visual Studio. Pinging @sheetalkamat and @minestarks so they are aware of the changes."
"comment": "Thanks for the PR! It looks like you've changed 'preProcess.ts' in some way. Please ensure that any changes here don't break consumers with unique project systems such as Visual Studio. Pinging @sheetalkamat, @zkat, and @joj so they are aware of the changes."
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/accept-baselines-fix-lints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
run: |
git config user.email "typescriptbot@microsoft.com"
git config user.name "TypeScript Bot"
npm install
git rm -r --quiet tests/baselines/reference :^tests/baselines/reference/docker :^tests/baselines/reference/user
npm ci
git rm -r --quiet tests/baselines/reference
npx hereby runtests-parallel --ci --fix || true
npx hereby baseline-accept
git add ./src
Expand Down
88 changes: 50 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ jobs:
- run: npm ci

- name: Tests
run: npm run test -- --bundle=${{ matrix.bundle }}
# run tests, but lint separately
run: npm run test -- --no-lint --bundle=${{ matrix.bundle }}

lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -91,65 +92,76 @@ jobs:

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: "*"
check-latest: true
- run: |
corepack enable npm
npm --version
- run: npm ci

- run: npx hereby lkg
- run: |
npm pack
mv typescript*.tgz typescript.tgz
echo "PACKAGE=$PWD/typescript.tgz" >> $GITHUB_ENV
echo "package=$PWD/typescript.tgz" >> "$GITHUB_OUTPUT"
id: pack
- name: Smoke test
run: |
cd "$(mktemp -d)"
npm init --yes
npm install $PACKAGE tslib
npm install ${{ steps.pack.outputs.package }}
echo "Testing tsc..."
npx tsc --version
echo "Testing tsserver..."
echo '{"seq": 1, "command": "status"}' | npx tsserver
cat > smoke.js << 'EOF'
console.log(`Testing ${process.argv[2]}...`);
const { __importDefault, __importStar } = require("tslib");
const ts = require(process.argv[2]);
// See: https://github.com/microsoft/TypeScript/pull/51474#issuecomment-1310871623
const fns = [
[() => ts.version, true],
[() => ts.default.version, false],
[() => __importDefault(ts).version, false],
[() => __importDefault(ts).default.version, true],
[() => __importStar(ts).version, true],
[() => __importStar(ts).default.version, true],
];
for (const [fn, shouldSucceed] of fns) {
let success = false;
try {
success = !!fn();
}
catch {}
const status = success ? "succeeded" : "failed";
if (success === shouldSucceed) {
console.log(`${fn.toString()} ${status} as expected.`);
}
else {
console.log(`${fn.toString()} unexpectedly ${status}.`);
process.exitCode = 1;
}
}
console.log("ok");
EOF
node ./smoke.js typescript
node ./smoke.js typescript/lib/tsserverlibrary
node $GITHUB_WORKSPACE/scripts/checkModuleFormat.mjs typescript
node $GITHUB_WORKSPACE/scripts/checkModuleFormat.mjs typescript/lib/tsserverlibrary
package-size:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'

steps:
- uses: actions/checkout@v3
with:
path: pr

- uses: actions/checkout@v3
with:
path: base
ref: ${{ github.base_ref }}

- uses: actions/setup-node@v3
with:
node-version: "*"
check-latest: true
- run: |
corepack enable npm
npm --version
- run: npm ci
working-directory: ./pr

- run: npm ci
working-directory: ./base

- run: npx hereby lkg
working-directory: ./pr

- run: npx hereby lkg
working-directory: ./base

- run: |
echo "See $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID for more info."
node ./pr/scripts/checkPackageSize.mjs ./base ./pr >> $GITHUB_STEP_SUMMARY
misc:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/new-release-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ jobs:

steps:
- uses: actions/setup-node@v3
- run: |
corepack enable npm
npm --version
- uses: actions/checkout@v3
with:
fetch-depth: 5
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
with:
# Use NODE_AUTH_TOKEN environment variable to authenticate to this registry.
registry-url: https://registry.npmjs.org/
- run: |
corepack enable npm
npm --version
- name: Setup and publish nightly
run: |
npm whoami
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release-branch-artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: |
corepack enable npm
npm --version
- name: npm install and test
run: |
npm ci
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This workflow uses actions that are not certified by GitHub. They are provided
# by a third-party and are governed by separate terms of service, privacy
# policy, and support documentation.

name: Scorecard supply-chain security
on:
# For Branch-Protection check. Only the default branch is supported. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
branch_protection_rule:
# To guarantee Maintained check is occasionally updated. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
schedule:
- cron: '19 15 * * 4'
push:
branches: [ "main" ]

# Declare default permissions as read only.
permissions: read-all

jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Needed to publish results and get a badge (see publish_results below).
id-token: write

steps:
- name: "Checkout code"
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6
with:
results_file: results.sarif
results_format: sarif

# Publish results to OpenSSF REST API for easy access by consumers
# Allows the repository to include the Scorecard badge.
# See https://github.com/ossf/scorecard-action#publishing-results.
publish_results: true

# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@807578363a7869ca324a79039e6db9c843e0e100 # v2.1.27
with:
sarif_file: results.sarif
3 changes: 3 additions & 0 deletions .github/workflows/set-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.client_payload.branch_name }}
- run: |
corepack enable npm
npm --version
# notably, this is essentially the same script as `new-release-branch.yaml` (with fewer inputs), but it assumes the branch already exists
# do note that executing the transform below will prevent the `configurePrerelease` script from running on the source, as it makes the
# `version` identifier no longer match the regex it uses
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/update-package-lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,23 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16
- run: |
corepack enable npm
npm --version
- name: Configure git and update package-lock.json
- name: Update package-lock.json and push
run: |
git config user.email "typescriptbot@microsoft.com"
git config user.name "TypeScript Bot"
rm package-lock.json
npm install --package-lock-only --ignore-scripts # This is a no-op if package-lock.json is present.
npm install
git add -f package-lock.json
if git commit -m "Update package-lock.json"; then
if git diff --exit-code --name-only package-lock.json; then
echo "No change."
else
npm test
npx hereby lkg
git config user.email "typescriptbot@microsoft.com"
git config user.name "TypeScript Bot"
git commit -m "Update package-lock.json"
git push
fi
26 changes: 2 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ node_modules/
.node_modules/
built/*
tests/cases/rwc/*
tests/cases/test262/*
tests/cases/perf/*
!tests/cases/webharness/compilerToString.js
test-args.txt
Expand All @@ -14,7 +13,6 @@ tests/baselines/local.old/*
tests/services/baselines/local/*
tests/baselines/prototyping/local/*
tests/baselines/rwc/*
tests/baselines/test262/*
tests/baselines/reference/projectOutput/*
tests/baselines/local/projectOutput/*
tests/baselines/reference/testresults.tap
Expand All @@ -34,7 +32,6 @@ tests/webTestServer.js.map
tests/webhost/*.d.ts
tests/webhost/webtsc.js
tests/cases/**/*.js
!tests/cases/docker/*.js/
tests/cases/**/*.js.map
*.config
scripts/eslint/built/
Expand All @@ -59,29 +56,10 @@ internal/
yarn.lock
yarn-error.log
.parallelperf.*
tests/cases/user/*/package-lock.json
tests/cases/user/*/node_modules/
tests/cases/user/*/**/*.js
tests/cases/user/*/**/*.js.map
tests/cases/user/*/**/*.d.ts
!tests/cases/user/zone.js/
!tests/cases/user/bignumber.js/
!tests/cases/user/discord.js/
tests/baselines/reference/dt
.failed-tests
TEST-results.xml
package-lock.json
tests/cases/user/npm/npm
tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter
tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter
tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter
tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter
tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
tests/cases/user/create-react-app/create-react-app
tests/cases/user/fp-ts/fp-ts
tests/cases/user/webpack/webpack
tests/cases/user/puppeteer/puppeteer
tests/cases/user/axios-src/axios-src
tests/cases/user/prettier/prettier
.eslintcache
*v8.log
*v8.log
lib/
6 changes: 6 additions & 0 deletions .vscode/launch.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
"env": {
"NODE_ENV": "testing"
},
"outFiles": [
"${workspaceFolder}/built/**/*.js",
"${workspaceFolder}/built/**/*.mjs",
"${workspaceFolder}/built/**/*.cjs",
"!**/node_modules/**"
],
"sourceMaps": true,
"smartStep": true,
"preLaunchTask": "npm: build:tests",
Expand Down
Loading

0 comments on commit 29d4bb9

Please sign in to comment.