Skip to content

docs: show all articles in sidebar, and a missing truncate #8306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Programmers who work with tools like [ESLint](https://eslint.org) and [Prettier]
But what is an AST, why is it useful for these kinds of tools, and how does that interact with ESLint and TypeScript tooling?
Let's dig in!

<!--truncate-->

## What's an AST?

_Static analysis_ tools are those that look at code without running it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@ They were added as part of the [ECMAScript Modules (ESM)](https://nodejs.org/api
When writing TypeScript code with ESM, it can sometimes be desirable to import or export a type only in the type system.
Code may wish to refer to a _type_, but not actually import or export a corresponding _value_.

For that purpose, TypeScript 3.8 [added type-only imports and exports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) to the TypeScript language:
Type-only imports and exports are not emitted as runtime code when code is transpiled to JavaScript.
This brings up two questions:

- Why would you want to use these type-only imports and exports?
- How can you enforce a project use them whenever necessary?

Let's dig in!

<!--truncate-->

## Recap: Type-Only Imports and Exports

TypeScript 3.8 [added type-only imports and exports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) to the TypeScript language:

```ts
import type { SomeThing } from './some-module.js';
Expand All @@ -41,16 +53,6 @@ TypeScript 4.5 also added [inline type qualifiers](https://www.typescriptlang.or
import { type SomeType, SomeValue } from './some-module.js';
```

Type-only imports and exports are not emitted as runtime code when code is transpiled to JavaScript.
This brings up two questions:

- Why would you want to use these type-only imports and exports?
- How can you enforce a project use them whenever necessary?

Let's Dig In!

<!--truncate-->

## Benefits of Enforcing Type-only Imports/Exports

### Avoiding Unintentional Side Effects
Expand Down
3 changes: 3 additions & 0 deletions packages/website/docusaurusConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const beforeDefaultRemarkPlugins: MDXPlugin[] = [tabsPlugin];
const githubUrl = 'https://github.com/typescript-eslint/typescript-eslint';

const presetClassicOptions: PresetClassicOptions = {
blog: {
blogSidebarCount: 'ALL',
},
docs: {
id: 'rules-docs',
path: '../eslint-plugin/docs/rules',
Expand Down