Skip to content

Commit

Permalink
Merge branch 'v6' into 6050-package-exports
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed Feb 21, 2023
2 parents 3cd115a + fc2df63 commit bee39d5
Show file tree
Hide file tree
Showing 486 changed files with 8,598 additions and 3,836 deletions.
24 changes: 11 additions & 13 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
**/node_modules
**/dist
**/jest.config.js
**/fixtures
**/coverage
**/__snapshots__
**/.docusaurus
**/build
packages/eslint-plugin-tslint/tests
node_modules
dist
jest.config.js
fixtures
coverage
__snapshots__
.docusaurus
build

# Files copied as part of the build
packages/types/src/generated/**/*.ts
packages/website-eslint/typings/eslint.d.ts

# TODO - enable linting for JS files (need to also add them to the project.json)
packages/website/**/*.js
packages/website/**/*.d.ts
# Playground types downloaded from the web
packages/website/src/vendor
163 changes: 84 additions & 79 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-check
/** @type {import('@typescript-eslint/utils').TSESLint.Linter.Config} */
module.exports = {
root: true,
plugins: [
Expand All @@ -11,18 +13,44 @@ module.exports = {
'simple-import-sort',
],
env: {
es6: true,
es2020: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:eslint-plugin/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-type-checked',
// TODO: consider enabling strict-type-checked and/or stylistic-type-checked
],
parserOptions: {
sourceType: 'module',
project: [
'./tsconfig.eslint.json',
'./packages/*/tsconfig.json',
/**
* We are currently in the process of transitioning to nx's out of the box structure and
* so need to manually specify converted packages' tsconfig.build.json and tsconfig.spec.json
* files here for now in addition to the tsconfig.json glob pattern.
*
* TODO(#4665): Clean this up once all packages have been transitioned.
*/
'./packages/scope-manager/tsconfig.build.json',
'./packages/scope-manager/tsconfig.spec.json',
],
allowAutomaticSingleRunInference: true,
tsconfigRootDir: __dirname,
warnOnUnsupportedTypeScriptVersion: false,
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: false,
cacheLifetime: {
// we pretty well never create/change tsconfig structure - so need to ever evict the cache
// in the rare case that we do - just need to manually restart their IDE.
glob: 'Infinity',
},
},
rules: {
// make sure we're not leveraging any deprecated APIs
'deprecation/deprecation': 'error',

//
// our plugin :D
//
Expand All @@ -42,6 +70,8 @@ module.exports = {
'error',
{ prefer: 'type-imports', disallowTypeAnnotations: true },
],
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-function': [
'error',
{ allow: ['arrowFunctions'] },
Expand All @@ -50,13 +80,33 @@ module.exports = {
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/restrict-template-expressions': [
'error',
{
allowNumber: true,
allowBoolean: true,
allowAny: true,
allowNullish: true,
allowRegExp: true,
},
],
'@typescript-eslint/no-unused-vars': [
'warn',
'error',
{ varsIgnorePattern: '^_', argsIgnorePattern: '^_' },
],

//
// Internal repo rules
//

'@typescript-eslint/internal/no-poorly-typed-ts-props': 'error',
'@typescript-eslint/internal/no-typescript-default-import': 'error',
'@typescript-eslint/internal/prefer-ast-types-enum': 'error',

//
// eslint-base
//
Expand All @@ -73,7 +123,7 @@ module.exports = {
'no-console': 'error',
'no-process-exit': 'error',
'no-fallthrough': [
'warn',
'error',
{ commentPattern: '.*intentional fallthrough.*' },
],

Expand Down Expand Up @@ -107,6 +157,7 @@ module.exports = {
'eslint-disable-line',
'eslint-disable-next-line',
'eslint-enable',
'global',
],
},
],
Expand Down Expand Up @@ -153,74 +204,16 @@ module.exports = {
'one-var': ['error', 'never'],
},
overrides: [
// only turn on type-aware linting for TS files
{
files: ['*.ts', '*.tsx'],
extends: [
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
parserOptions: {
project: [
'./tsconfig.eslint.json',
'./packages/*/tsconfig.json',
'./tests/integration/tsconfig.json',
/**
* We are currently in the process of transitioning to nx's out of the box structure and
* so need to manually specify converted packages' tsconfig.build.json and tsconfig.spec.json
* files here for now in addition to the tsconfig.json glob pattern.
*
* TODO(#4665): Clean this up once all packages have been transitioned.
*/
'./packages/scope-manager/tsconfig.build.json',
'./packages/scope-manager/tsconfig.spec.json',
],
allowAutomaticSingleRunInference: true,
tsconfigRootDir: __dirname,
warnOnUnsupportedTypeScriptVersion: false,
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: false,
cacheLifetime: {
// we pretty well never create/change tsconfig structure - so need to ever evict the cache
// in the rare case that we do - just need to manually restart their IDE.
glob: 'Infinity',
},
},
files: ['*.js'],
extends: ['plugin:@typescript-eslint/disable-type-checked'],
rules: {
// make sure we're not leveraging any deprecated APIs
'deprecation/deprecation': 'error',

//
// our plugin :D
//
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/restrict-template-expressions': [
'error',
{
allowNumber: true,
allowBoolean: true,
allowAny: true,
allowNullish: true,
allowRegExp: true,
},
],
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
// we don't use classes enough in our codebase to warrant the numerous false positive against the TS API types etc
'@typescript-eslint/unbound-method': 'off',

//
// Internal repo rules
//
// turn off other type-aware rules
'deprecation/deprecation': 'off',
'@typescript-eslint/internal/no-poorly-typed-ts-props': 'off',

'@typescript-eslint/internal/no-poorly-typed-ts-props': 'error',
'@typescript-eslint/internal/no-typescript-default-import': 'error',
'@typescript-eslint/internal/prefer-ast-types-enum': 'error',
},
},
{
files: ['*.js'],
parserOptions: {
project: null,
// turn off rules that don't apply to JS code
'@typescript-eslint/explicit-function-return-type': 'off',
},
},
// all test files
Expand All @@ -231,9 +224,8 @@ module.exports = {
'./packages/*/tests/**/spec.ts',
'./packages/*/tests/**/test.ts',
'./packages/parser/tests/**/*.ts',
'./tests/integration/**/*.test.ts',
'./tests/integration/integration-test-base.ts',
'./tests/integration/pack-packages.ts',
'./packages/integration-tests/tools/integration-test-base.ts',
'./packages/integration-tests/tools/pack-packages.ts',
],
env: {
'jest/globals': true,
Expand All @@ -244,17 +236,17 @@ module.exports = {
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'eslint-plugin/consistent-output': 'off', // Might eventually be removed from `eslint-plugin/recommended`: https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/issues/284
'jest/no-disabled-tests': 'warn',
'jest/no-disabled-tests': 'error',
'jest/no-focused-tests': 'error',
'jest/no-alias-methods': 'error',
'jest/no-identical-title': 'error',
'jest/no-jasmine-globals': 'error',
'jest/no-test-prefixes': 'error',
'jest/no-done-callback': 'error',
'jest/no-test-return-statement': 'error',
'jest/prefer-to-be': 'warn',
'jest/prefer-to-contain': 'warn',
'jest/prefer-to-have-length': 'warn',
'jest/prefer-to-be': 'error',
'jest/prefer-to-contain': 'error',
'jest/prefer-to-have-length': 'error',
'jest/prefer-spy-on': 'error',
'jest/valid-expect': 'error',
'jest/no-deprecated-functions': 'error',
Expand Down Expand Up @@ -333,7 +325,12 @@ module.exports = {
},
// tools and tests
{
files: ['**/tools/**/*.ts', '**/tests/**/*.ts'],
files: [
'**/tools/**/*.*t*',
'**/tests/**/*.ts',
'./packages/repo-tools/**/*.*t*',
'./packages/integration-tests/**/*.*t*',
],
rules: {
// allow console logs in tools and tests
'no-console': 'off',
Expand Down Expand Up @@ -367,17 +364,18 @@ module.exports = {
},
},
{
files: ['./packages/website/'],
files: ['./packages/website/**/*.{ts,tsx,mts,cts,js,jsx}'],
extends: [
'plugin:jsx-a11y/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
],
plugins: ['jsx-a11y', 'react', 'react-hooks'],
rules: {
'@typescript-eslint/internal/prefer-ast-types-enum': 'off',
'import/no-default-export': 'off',
'react/jsx-no-target-blank': 'off',
'react/no-unescaped-entities': 'off',
'@typescript-eslint/internal/prefer-ast-types-enum': 'off',
'react-hooks/exhaustive-deps': 'off', // TODO: enable it later
},
settings: {
Expand All @@ -394,5 +392,12 @@ module.exports = {
'no-console': 'off',
},
},
{
files: ['./packages/website-eslint/src/mock/**/*.js'],
rules: {
// mocks have to mirror their original
'import/no-default-export': 'off',
},
},
],
};
25 changes: 20 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:

env:
PRIMARY_NODE_VERSION: 18
# 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 || '' }}

defaults:
run:
Expand Down Expand Up @@ -179,26 +181,39 @@ jobs:
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
uses: ./.github/actions/prepare-build

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

- name: Run Playwright tests
- 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
Expand Down Expand Up @@ -256,7 +271,7 @@ jobs:
name: Publish the next major version code as a canary version
runs-on: ubuntu-latest
needs: [integration_tests, lint_with_build, lint_without_build, unit_tests]
if: github.ref == 'refs/heads/v${major}'
if: github.ref == 'refs/heads/v6'
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -273,6 +288,6 @@ jobs:
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-v${major}
run: npx lerna publish premajor --loglevel=verbose --canary --exact --force-publish --yes --dist-tag rc-v6
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 0 additions & 1 deletion .github/workflows/semantic-pr-titles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
eslint-plugin
eslint-plugin-internal
eslint-plugin-tslint
experimental-utils
parser
scope-manager
type-utils
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,15 @@ jspm_packages/
.idea
dist
_ts3.4
_ts4.2
*.tsbuildinfo
.watchmanconfig
.rollup.cache

# the downlevel-dts output folders
_ts3.4
_ts4.2

# Files copied as part of the build
packages/types/src/generated/**/*.ts

Expand Down

0 comments on commit bee39d5

Please sign in to comment.