Skip to content

Commit

Permalink
Merge pull request #5886 from typescript-eslint/v6
Browse files Browse the repository at this point in the history
chore: v6.0.0
  • Loading branch information
JoshuaKGoldberg committed Jul 10, 2023
2 parents cba0d11 + 3201f78 commit ca1abb5
Show file tree
Hide file tree
Showing 3,506 changed files with 90,161 additions and 29,350 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
11 changes: 9 additions & 2 deletions .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 Expand Up @@ -119,7 +127,6 @@
"trpc",
"tsconfigs",
"tseslint",
"tsutils",
"tsvfs",
"typedef",
"typedefs",
Expand Down
13 changes: 6 additions & 7 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ __snapshots__
.docusaurus
build

packages/eslint-plugin-tslint/tests

packages/website/**/*.js
packages/website/**/*.d.ts
packages/website-eslint/**/*.js
packages/website-eslint/**/*.d.ts

# Files copied as part of the build
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
97 changes: 71 additions & 26 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-check
/** @type {import('./packages/utils/src/ts-eslint/Linter').Linter.Config} */
module.exports = {
root: true,
plugins: [
Expand All @@ -12,21 +14,21 @@ module.exports = {
'unicorn',
],
env: {
es6: true,
es2020: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:eslint-plugin/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
// TODO: consider enabling strict-type-checked
],
parserOptions: {
sourceType: 'module',
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
Expand All @@ -51,6 +53,14 @@ module.exports = {
// make sure we're not leveraging any deprecated APIs
'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
'@typescript-eslint/no-confusing-void-expression': 'off',
'@typescript-eslint/prefer-string-starts-ends-with': 'off',

//
// our plugin :D
//
Expand All @@ -65,25 +75,18 @@ module.exports = {
minimumDescriptionLength: 5,
},
],
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/consistent-type-imports': [
'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': [
'@typescript-eslint/explicit-function-return-type': [
'error',
{ allow: ['arrowFunctions'] },
{ allowIIFEs: true },
],
'@typescript-eslint/no-explicit-any': 'error',
'@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',
{
Expand All @@ -95,7 +98,7 @@ module.exports = {
},
],
'@typescript-eslint/no-unused-vars': [
'warn',
'error',
{ varsIgnorePattern: '^_', argsIgnorePattern: '^_' },
],

Expand Down Expand Up @@ -123,7 +126,7 @@ module.exports = {
'no-console': 'error',
'no-process-exit': 'error',
'no-fallthrough': [
'warn',
'error',
{ commentPattern: '.*intentional fallthrough.*' },
],

Expand Down Expand Up @@ -157,6 +160,7 @@ module.exports = {
'eslint-disable-line',
'eslint-disable-next-line',
'eslint-enable',
'global',
],
},
],
Expand Down Expand Up @@ -205,6 +209,18 @@ module.exports = {
'unicorn/no-typeof-undefined': 'error',
},
overrides: [
{
files: ['*.js'],
extends: ['plugin:@typescript-eslint/disable-type-checked'],
rules: {
// turn off other type-aware rules
'deprecation/deprecation': 'off',
'@typescript-eslint/internal/no-poorly-typed-ts-props': 'off',

// turn off rules that don't apply to JS code
'@typescript-eslint/explicit-function-return-type': 'off',
},
},
// all test files
{
files: [
Expand All @@ -213,30 +229,33 @@ 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,
},
rules: {
'@typescript-eslint/no-empty-function': [
'error',
{ allow: ['arrowFunctions'] },
],
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@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 @@ -315,7 +334,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 All @@ -342,25 +366,39 @@ module.exports = {
'@typescript-eslint/sort-type-constituents': 'error',
},
},
{
files: ['./packages/ast-spec/**/*.ts'],
rules: {
'no-restricted-imports': [
'error',
{
name: '@typescript-eslint/typescript-estree',
message:
'To prevent nx build errors, all `typescript-estree` imports should be done via `packages/ast-spec/tests/util/parsers/typescript-estree-import.ts`.',
},
],
},
},
{
files: ['rollup.config.ts'],
rules: {
'import/no-default-export': 'off',
},
},
{
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
'react-hooks/exhaustive-deps': 'warn', // TODO: enable it later
},
settings: {
react: {
Expand All @@ -376,5 +414,12 @@ module.exports = {
'no-console': 'off',
},
},
{
files: ['./packages/website-eslint/src/mock/**/*.js', '*.d.ts'],
rules: {
// mocks and declaration files have to mirror their original package
'import/no-default-export': 'off',
},
},
],
};
22 changes: 18 additions & 4 deletions .github/actions/prepare-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,27 @@ runs:
id: build-cache
with:
path: '**/dist/**'
key: ${{ runner.os }}-build-${{ github.ref }}
key: ${{ runner.os }}-build-${{ github.ref }}-${{ github.run_id }}
# We don't want to share builds across runs even for the same branch
# because each commit can have different build artifacts and we don't
# want to accidentally share artifacts and poison the build output
restore-keys: |
${{ runner.os }}-build-
${{ runner.os }}-build-${{ github.ref }}-${{ github.run_id }}
# If the cache was hit, then we still run the types build because we generate source files
- name: Build AST Spec
if: steps['build-cache'].outputs.cache-hit == 'true'
shell: bash
run: |
npx nx run types:build
env:
SKIP_AST_SPEC_REBUILD: true

# if the cache was hit - this will run in <1s
- name: Build
if: steps['build-cache'].outputs.cache-hit != 'true'
shell: bash
# Website will be built by the Netlify GitHub App
run: |
npx nx run-many --target=build --parallel --exclude website
npx nx run-many --target=build --parallel --exclude=website --exclude=website-eslint
env:
SKIP_AST_SPEC_REBUILD: true
20 changes: 2 additions & 18 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
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:
Expand All @@ -20,17 +20,6 @@
'@nrwl/nx-cloud',
'nx-cloud',
'@nrwl/tao',
'@nx/tao',
// TODO - once we bump pass the major, we can remove these. Currently renovate is creating broken, immortal PRs
'@rollup/plugin-babel',
'@rollup/plugin-commonjs',
'@rollup/plugin-json',
'@rollup/plugin-node-resolve',
'@rollup/plugin-replace',
'@rollup/plugin-terser',
'@rollup/pluginutils',
'rollup-plugin-terser',
'rollup',
],
ignorePaths: [
// integration test package.json's should never be updated as they're purposely fixed tests
Expand Down Expand Up @@ -90,11 +79,6 @@
matchPackagePrefixes: ['@types/jest', 'jest-', '@jest/'],
groupName: 'jest',
},
{
matchPackagePrefixes: ['@rollup', 'rollup-'],
matchPackageNames: ['rollup'],
groupName: 'rollup',
},
],
postUpdateOptions: [
// run yarn dedupe to cleanup the lockfile after updates
Expand Down
21 changes: 19 additions & 2 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 @@ -95,6 +95,21 @@ jobs:
- name: Run Check
run: yarn ${{ matrix.lint-task }}

stylelint:
name: Stylelint
needs: [install]
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 }}
- name: Run stylelint check
run: yarn stylelint
working-directory: packages/website

integration_tests:
name: Run integration tests on primary Node.js version
needs: [build]
Expand All @@ -121,14 +136,16 @@ 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',
'eslint-plugin',
'eslint-plugin-internal',
'eslint-plugin-tslint',
'parser',
'repo-tools',
'rule-schema-to-typescript-types',
'scope-manager',
'type-utils',
'typescript-estree',
Expand Down

0 comments on commit ca1abb5

Please sign in to comment.