Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ca1abb5

Browse files
Merge pull request typescript-eslint#5886 from typescript-eslint/v6
chore: v6.0.0
2 parents cba0d11 + 3201f78 commit ca1abb5

File tree

3,506 files changed

+90161
-29350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,506 files changed

+90161
-29350
lines changed

.cspell.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
{
2-
"version": "0.1",
2+
"version": "0.2",
33
"language": "en",
4+
"enableFiletypes": [
5+
"markdown",
6+
"mdx",
7+
"typescript",
8+
"typescriptreact",
9+
"javascript",
10+
"javascriptreact"
11+
],
412
"ignorePaths": [
513
".cspell.json",
614
".github/workflows/**",
@@ -119,7 +127,6 @@
119127
"trpc",
120128
"tsconfigs",
121129
"tseslint",
122-
"tsutils",
123130
"tsvfs",
124131
"typedef",
125132
"typedefs",

.eslintignore

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ __snapshots__
77
.docusaurus
88
build
99

10-
packages/eslint-plugin-tslint/tests
11-
12-
packages/website/**/*.js
13-
packages/website/**/*.d.ts
14-
packages/website-eslint/**/*.js
15-
packages/website-eslint/**/*.d.ts
16-
1710
# Files copied as part of the build
1811
packages/types/src/generated/**/*.ts
12+
13+
# Playground types downloaded from the web
14+
packages/website/src/vendor
15+
16+
# see the file header in eslint-base.test.js for more info
17+
packages/rule-tester/tests/eslint-base

.eslintrc.js

Lines changed: 71 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// @ts-check
2+
/** @type {import('./packages/utils/src/ts-eslint/Linter').Linter.Config} */
13
module.exports = {
24
root: true,
35
plugins: [
@@ -12,21 +14,21 @@ module.exports = {
1214
'unicorn',
1315
],
1416
env: {
15-
es6: true,
17+
es2020: true,
1618
node: true,
1719
},
1820
extends: [
1921
'eslint:recommended',
2022
'plugin:eslint-plugin/recommended',
21-
'plugin:@typescript-eslint/recommended',
22-
'plugin:@typescript-eslint/recommended-requiring-type-checking',
23+
'plugin:@typescript-eslint/recommended-type-checked',
24+
'plugin:@typescript-eslint/stylistic-type-checked',
25+
// TODO: consider enabling strict-type-checked
2326
],
2427
parserOptions: {
2528
sourceType: 'module',
2629
project: [
2730
'./tsconfig.eslint.json',
2831
'./packages/*/tsconfig.json',
29-
'./tests/integration/tsconfig.json',
3032
/**
3133
* We are currently in the process of transitioning to nx's out of the box structure and
3234
* so need to manually specify converted packages' tsconfig.build.json and tsconfig.spec.json
@@ -51,6 +53,14 @@ module.exports = {
5153
// make sure we're not leveraging any deprecated APIs
5254
'deprecation/deprecation': 'error',
5355

56+
// TODO(#7138): Investigate enabling these soon ✨
57+
'@typescript-eslint/consistent-indexed-object-style': 'off',
58+
'@typescript-eslint/prefer-nullish-coalescing': 'off',
59+
60+
// TODO(#7130): Investigate changing these in or removing these from presets
61+
'@typescript-eslint/no-confusing-void-expression': 'off',
62+
'@typescript-eslint/prefer-string-starts-ends-with': 'off',
63+
5464
//
5565
// our plugin :D
5666
//
@@ -65,25 +75,18 @@ module.exports = {
6575
minimumDescriptionLength: 5,
6676
},
6777
],
68-
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
6978
'@typescript-eslint/consistent-type-imports': [
7079
'error',
7180
{ prefer: 'type-imports', disallowTypeAnnotations: true },
7281
],
73-
'@typescript-eslint/explicit-function-return-type': 'error',
74-
'@typescript-eslint/explicit-module-boundary-types': 'off',
75-
'@typescript-eslint/no-empty-function': [
82+
'@typescript-eslint/explicit-function-return-type': [
7683
'error',
77-
{ allow: ['arrowFunctions'] },
84+
{ allowIIFEs: true },
7885
],
7986
'@typescript-eslint/no-explicit-any': 'error',
8087
'@typescript-eslint/no-non-null-assertion': 'off',
8188
'@typescript-eslint/no-var-requires': 'off',
82-
'@typescript-eslint/prefer-for-of': 'error',
83-
'@typescript-eslint/prefer-nullish-coalescing': 'error',
84-
'@typescript-eslint/prefer-optional-chain': 'error',
8589
'@typescript-eslint/unbound-method': 'off',
86-
'@typescript-eslint/prefer-as-const': 'error',
8790
'@typescript-eslint/restrict-template-expressions': [
8891
'error',
8992
{
@@ -95,7 +98,7 @@ module.exports = {
9598
},
9699
],
97100
'@typescript-eslint/no-unused-vars': [
98-
'warn',
101+
'error',
99102
{ varsIgnorePattern: '^_', argsIgnorePattern: '^_' },
100103
],
101104

@@ -123,7 +126,7 @@ module.exports = {
123126
'no-console': 'error',
124127
'no-process-exit': 'error',
125128
'no-fallthrough': [
126-
'warn',
129+
'error',
127130
{ commentPattern: '.*intentional fallthrough.*' },
128131
],
129132

@@ -157,6 +160,7 @@ module.exports = {
157160
'eslint-disable-line',
158161
'eslint-disable-next-line',
159162
'eslint-enable',
163+
'global',
160164
],
161165
},
162166
],
@@ -205,6 +209,18 @@ module.exports = {
205209
'unicorn/no-typeof-undefined': 'error',
206210
},
207211
overrides: [
212+
{
213+
files: ['*.js'],
214+
extends: ['plugin:@typescript-eslint/disable-type-checked'],
215+
rules: {
216+
// turn off other type-aware rules
217+
'deprecation/deprecation': 'off',
218+
'@typescript-eslint/internal/no-poorly-typed-ts-props': 'off',
219+
220+
// turn off rules that don't apply to JS code
221+
'@typescript-eslint/explicit-function-return-type': 'off',
222+
},
223+
},
208224
// all test files
209225
{
210226
files: [
@@ -213,30 +229,33 @@ module.exports = {
213229
'./packages/*/tests/**/spec.ts',
214230
'./packages/*/tests/**/test.ts',
215231
'./packages/parser/tests/**/*.ts',
216-
'./tests/integration/**/*.test.ts',
217-
'./tests/integration/integration-test-base.ts',
218-
'./tests/integration/pack-packages.ts',
232+
'./packages/integration-tests/tools/integration-test-base.ts',
233+
'./packages/integration-tests/tools/pack-packages.ts',
219234
],
220235
env: {
221236
'jest/globals': true,
222237
},
223238
rules: {
239+
'@typescript-eslint/no-empty-function': [
240+
'error',
241+
{ allow: ['arrowFunctions'] },
242+
],
224243
'@typescript-eslint/no-unsafe-assignment': 'off',
225244
'@typescript-eslint/no-unsafe-call': 'off',
226245
'@typescript-eslint/no-unsafe-member-access': 'off',
227246
'@typescript-eslint/no-unsafe-return': 'off',
228247
'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
229-
'jest/no-disabled-tests': 'warn',
248+
'jest/no-disabled-tests': 'error',
230249
'jest/no-focused-tests': 'error',
231250
'jest/no-alias-methods': 'error',
232251
'jest/no-identical-title': 'error',
233252
'jest/no-jasmine-globals': 'error',
234253
'jest/no-test-prefixes': 'error',
235254
'jest/no-done-callback': 'error',
236255
'jest/no-test-return-statement': 'error',
237-
'jest/prefer-to-be': 'warn',
238-
'jest/prefer-to-contain': 'warn',
239-
'jest/prefer-to-have-length': 'warn',
256+
'jest/prefer-to-be': 'error',
257+
'jest/prefer-to-contain': 'error',
258+
'jest/prefer-to-have-length': 'error',
240259
'jest/prefer-spy-on': 'error',
241260
'jest/valid-expect': 'error',
242261
'jest/no-deprecated-functions': 'error',
@@ -315,7 +334,12 @@ module.exports = {
315334
},
316335
// tools and tests
317336
{
318-
files: ['**/tools/**/*.ts', '**/tests/**/*.ts'],
337+
files: [
338+
'**/tools/**/*.*t*',
339+
'**/tests/**/*.ts',
340+
'./packages/repo-tools/**/*.*t*',
341+
'./packages/integration-tests/**/*.*t*',
342+
],
319343
rules: {
320344
// allow console logs in tools and tests
321345
'no-console': 'off',
@@ -342,25 +366,39 @@ module.exports = {
342366
'@typescript-eslint/sort-type-constituents': 'error',
343367
},
344368
},
369+
{
370+
files: ['./packages/ast-spec/**/*.ts'],
371+
rules: {
372+
'no-restricted-imports': [
373+
'error',
374+
{
375+
name: '@typescript-eslint/typescript-estree',
376+
message:
377+
'To prevent nx build errors, all `typescript-estree` imports should be done via `packages/ast-spec/tests/util/parsers/typescript-estree-import.ts`.',
378+
},
379+
],
380+
},
381+
},
345382
{
346383
files: ['rollup.config.ts'],
347384
rules: {
348385
'import/no-default-export': 'off',
349386
},
350387
},
351388
{
352-
files: ['./packages/website/'],
389+
files: ['./packages/website/**/*.{ts,tsx,mts,cts,js,jsx}'],
353390
extends: [
354391
'plugin:jsx-a11y/recommended',
355392
'plugin:react/recommended',
356393
'plugin:react-hooks/recommended',
357394
],
358395
plugins: ['jsx-a11y', 'react', 'react-hooks'],
359396
rules: {
397+
'@typescript-eslint/internal/prefer-ast-types-enum': 'off',
398+
'import/no-default-export': 'off',
360399
'react/jsx-no-target-blank': 'off',
361400
'react/no-unescaped-entities': 'off',
362-
'@typescript-eslint/internal/prefer-ast-types-enum': 'off',
363-
'react-hooks/exhaustive-deps': 'off', // TODO: enable it later
401+
'react-hooks/exhaustive-deps': 'warn', // TODO: enable it later
364402
},
365403
settings: {
366404
react: {
@@ -376,5 +414,12 @@ module.exports = {
376414
'no-console': 'off',
377415
},
378416
},
417+
{
418+
files: ['./packages/website-eslint/src/mock/**/*.js', '*.d.ts'],
419+
rules: {
420+
// mocks and declaration files have to mirror their original package
421+
'import/no-default-export': 'off',
422+
},
423+
},
379424
],
380425
};

.github/actions/prepare-build/action.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,27 @@ runs:
1010
id: build-cache
1111
with:
1212
path: '**/dist/**'
13-
key: ${{ runner.os }}-build-${{ github.ref }}
13+
key: ${{ runner.os }}-build-${{ github.ref }}-${{ github.run_id }}
14+
# We don't want to share builds across runs even for the same branch
15+
# because each commit can have different build artifacts and we don't
16+
# want to accidentally share artifacts and poison the build output
1417
restore-keys: |
15-
${{ runner.os }}-build-
18+
${{ runner.os }}-build-${{ github.ref }}-${{ github.run_id }}
19+
20+
# If the cache was hit, then we still run the types build because we generate source files
21+
- name: Build AST Spec
22+
if: steps['build-cache'].outputs.cache-hit == 'true'
23+
shell: bash
24+
run: |
25+
npx nx run types:build
26+
env:
27+
SKIP_AST_SPEC_REBUILD: true
1628

17-
# if the cache was hit - this will run in <1s
1829
- name: Build
30+
if: steps['build-cache'].outputs.cache-hit != 'true'
1931
shell: bash
2032
# Website will be built by the Netlify GitHub App
2133
run: |
22-
npx nx run-many --target=build --parallel --exclude website
34+
npx nx run-many --target=build --parallel --exclude=website --exclude=website-eslint
35+
env:
36+
SKIP_AST_SPEC_REBUILD: true

.github/renovate.json5

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
enabledManagers: ['github-actions', 'npm'],
33
ignoreDeps: [
4+
// AJV is out-of-date, but it's intentionally synced with ESLint - https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/package.json#L70
5+
'ajv',
46
// globby is ESM so we can't go any higher right now
57
'globby',
6-
// this dep now uses package.json exports - we will be removing it next major
7-
'eslint-scope',
88
// this dep is now ESM only
99
'execa',
1010
// Some kind of weird caching issue:
@@ -20,17 +20,6 @@
2020
'@nrwl/nx-cloud',
2121
'nx-cloud',
2222
'@nrwl/tao',
23-
'@nx/tao',
24-
// TODO - once we bump pass the major, we can remove these. Currently renovate is creating broken, immortal PRs
25-
'@rollup/plugin-babel',
26-
'@rollup/plugin-commonjs',
27-
'@rollup/plugin-json',
28-
'@rollup/plugin-node-resolve',
29-
'@rollup/plugin-replace',
30-
'@rollup/plugin-terser',
31-
'@rollup/pluginutils',
32-
'rollup-plugin-terser',
33-
'rollup',
3423
],
3524
ignorePaths: [
3625
// integration test package.json's should never be updated as they're purposely fixed tests
@@ -90,11 +79,6 @@
9079
matchPackagePrefixes: ['@types/jest', 'jest-', '@jest/'],
9180
groupName: 'jest',
9281
},
93-
{
94-
matchPackagePrefixes: ['@rollup', 'rollup-'],
95-
matchPackageNames: ['rollup'],
96-
groupName: 'rollup',
97-
},
9882
],
9983
postUpdateOptions: [
10084
// run yarn dedupe to cleanup the lockfile after updates

.github/workflows/ci.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
merge_group:
1212

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

@@ -95,6 +95,21 @@ jobs:
9595
- name: Run Check
9696
run: yarn ${{ matrix.lint-task }}
9797

98+
stylelint:
99+
name: Stylelint
100+
needs: [install]
101+
runs-on: ubuntu-latest
102+
steps:
103+
- name: Checkout
104+
uses: actions/checkout@v3
105+
- name: Install
106+
uses: ./.github/actions/prepare-install
107+
with:
108+
node-version: ${{ env.PRIMARY_NODE_VERSION }}
109+
- name: Run stylelint check
110+
run: yarn stylelint
111+
working-directory: packages/website
112+
98113
integration_tests:
99114
name: Run integration tests on primary Node.js version
100115
needs: [build]
@@ -121,14 +136,16 @@ jobs:
121136
strategy:
122137
matrix:
123138
# just run on the oldest and latest supported versions and assume the intermediate versions are good
124-
node-version: [14, 18]
139+
node-version: [16, 20]
125140
package:
126141
[
127142
'ast-spec',
128143
'eslint-plugin',
129144
'eslint-plugin-internal',
130145
'eslint-plugin-tslint',
131146
'parser',
147+
'repo-tools',
148+
'rule-schema-to-typescript-types',
132149
'scope-manager',
133150
'type-utils',
134151
'typescript-estree',

0 commit comments

Comments
 (0)