Skip to content

Commit

Permalink
Merge branch 'main' into fix/7221
Browse files Browse the repository at this point in the history
  • Loading branch information
auvred committed Jan 8, 2024
2 parents 35dcfc3 + 8450dbe commit 653b438
Show file tree
Hide file tree
Showing 89 changed files with 1,130 additions and 330 deletions.
38 changes: 27 additions & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = {
'eslint-plugin',
'import',
'jest',
'jsdoc',
'simple-import-sort',
'unicorn',
],
Expand All @@ -20,11 +21,17 @@ module.exports = {
extends: [
'eslint:recommended',
'plugin:eslint-plugin/recommended',
'plugin:jsdoc/recommended-typescript-error',
'plugin:@typescript-eslint/strict-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
],
parserOptions: {
sourceType: 'module',
allowAutomaticSingleRunInference: true,
cacheLifetime: {
// we pretty well never create/change tsconfig structure - so no need to ever evict the cache
// in the rare case that we do - just need to manually restart their IDE.
glob: 'Infinity',
},
project: [
'./tsconfig.eslint.json',
'./packages/*/tsconfig.json',
Expand All @@ -38,22 +45,13 @@ module.exports = {
'./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',

// TODO(#7338): Investigate enabling these soon ✨
'@typescript-eslint/no-dynamic-delete': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',

// TODO(#7130): Investigate changing these in or removing these from presets
Expand Down Expand Up @@ -141,6 +139,7 @@ module.exports = {
'error',
{ commentPattern: '.*intentional fallthrough.*' },
],
'one-var': ['error', 'never'],

//
// eslint-plugin-eslint-comment
Expand Down Expand Up @@ -216,7 +215,24 @@ module.exports = {
// enforce a sort order across the codebase
'simple-import-sort/imports': 'error',

'one-var': ['error', 'never'],
//
// eslint-plugin-jsdoc
//

// We often use @remarks or other ad-hoc tag names
'jsdoc/check-tag-names': 'off',
// https://github.com/gajus/eslint-plugin-jsdoc/issues/1169
'jsdoc/check-param-names': 'off',
// https://github.com/gajus/eslint-plugin-jsdoc/issues/1175
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-param': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/require-yields': 'off',
'jsdoc/tag-lines': 'off',

//
// eslint-plugin-unicorn
//

'unicorn/no-typeof-undefined': 'error',
},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ jobs:

- name: Publish all packages to npm with the canary tag
# NOTE: this needs to be npx, rather than yarn, to make sure the authenticated npm registry is used
run: npx nx release publish --tag canary
run: npx nx release publish --tag canary --verbose
env:
NX_CLOUD_DISTRIBUTED_EXECUTION: false
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
package-lock=false
provenance=true
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## 6.18.0 (2024-01-06)


### 🚀 Features

- **eslint-plugin:** [no-var-requires, no-require-imports] allow option ([#7710](https://github.com/typescript-eslint/typescript-eslint/pull/7710))
- **typescript-estree:** throw on invalid update expressions ([#7202](https://github.com/typescript-eslint/typescript-eslint/pull/7202))
- **typescript-estree:** throw error when CatchClause param contains initializer ([#8183](https://github.com/typescript-eslint/typescript-eslint/pull/8183))

### ❤️ Thank You

- auvred @auvred
- Joshua Chen

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

# [6.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0) (2024-01-01)


Expand Down
21 changes: 20 additions & 1 deletion docs/packages/Parser.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The following additional configuration options are available by specifying them

```ts
interface ParserOptions {
allowAutomaticSingleRunInference?: boolean;
cacheLifetime?: {
glob?: number | 'Infinity';
};
Expand All @@ -49,16 +50,32 @@ interface ParserOptions {
projectFolderIgnoreList?: string[];
tsconfigRootDir?: string;
warnOnUnsupportedTypeScriptVersion?: boolean;
EXPERIMENTAL_useProjectService?: boolean;
}
```

### `allowAutomaticSingleRunInference`

> Default `false`.
Whether to use common heuristics to infer whether ESLint is being used as part of a single run (as opposed to `--fix` mode or in a persistent session such as an editor extension).

When typescript-eslint handles TypeScript Program management behind the scenes for [linting with type information](../linting/Typed_Linting.mdx), this distinction is important for performance.
There is significant overhead to managing TypeScript "Watch" Programs needed for the long-running use-case.
Being able to assume the single run case allows typescript-eslint to faster immutable Programs instead.

:::tip
We've seen `allowAutomaticSingleRunInference` improve linting speed in CI by up to 10-20%.
Our plan is to [enable `allowAutomaticSingleRunInference` by default in an upcoming major version](https://github.com/typescript-eslint/typescript-eslint/issues/8121).
:::

### `cacheLifetime`

This option allows you to granularly control our internal cache expiry lengths.

You can specify the number of seconds as an integer number, or the string 'Infinity' if you never want the cache to expire.

By default cache entries will be evicted after 30 seconds, or will persist indefinitely if the parser infers that it is a single run.
By default cache entries will be evicted after 30 seconds, or will persist indefinitely if the parser infers that it is a single run (see [`allowAutomaticSingleRunInference`](#allowAutomaticSingleRunInference)).

### `ecmaFeatures`

Expand Down Expand Up @@ -267,6 +284,8 @@ Please only submit bug reports when using the officially supported version.

### `EXPERIMENTAL_useProjectService`

> Default `false`.
An experimental alternative to `parserOptions.project`.
This directs the parser to use a more seamless TypeScript API to generate type information for rules.
It will automatically detect the TSConfig for each file (like `project: true`), and will also allow type information to be computed for JavaScript files without the `allowJs` compiler option (unlike `project: true`).
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"lint": "npx nx run-many --target=lint --parallel",
"postinstall": "npx nx run repo-tools:postinstall-script",
"pre-commit": "yarn lint-staged",
"release": "tsx tools/release/release.ts",
"release": "tsx tools/release/release.mts",
"start": "npx nx run website:start",
"test": "npx nx run-many --target=test --parallel --exclude integration-tests --exclude website --exclude website-eslint",
"test-integration": "npx nx run integration-tests:test",
Expand Down Expand Up @@ -88,6 +88,7 @@
"eslint-plugin-eslint-plugin": "^5.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.2",
"eslint-plugin-jsdoc": "^46.9.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
Expand Down
17 changes: 17 additions & 0 deletions packages/ast-spec/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
## 6.18.0 (2024-01-06)


### 🚀 Features

- **typescript-estree:** throw on invalid update expressions

- **typescript-estree:** throw error when CatchClause param contains initializer


### ❤️ Thank You

- auvred
- Joshua Chen

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

# [6.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0) (2024-01-01)

**Note:** Version bump only for package @typescript-eslint/ast-spec
Expand Down
2 changes: 1 addition & 1 deletion packages/ast-spec/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/ast-spec",
"version": "6.17.0",
"version": "6.18.0",
"description": "Complete specification for the TypeScript-ESTree AST",
"private": true,
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ class F {
(<number>this.#a)++;
(this.#a satisfies number)++;
(this.#a as number)++;
this.#a!++;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 653b438

Please sign in to comment.