-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
docs: draft of new typescript-eslint website #3147
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
Closed
Closed
Changes from all commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
e7e80a2
docs: generate simple documentation page
armano2 bacfc85
chore: add netlify config
armano2 e4e3a18
fix: update netlify config
armano2 17f3ef4
fix: remove netlify.toml
armano2 9bb88e5
fix: add sponsors to start page and update page
armano2 d80ce4a
fix: correct few minor issues
armano2 21a47b0
docs: style improvements on homepage
armano2 b0c94cc
docs: add missing dark mode logo
armano2 6102904
docs: use svg files for github icon
armano2 ba2f030
docs: update homepage and fix hero styles
armano2 695744d
docs: add note about eslint core rules
armano2 b89d9ff
docs: fix styles for dark theme
armano2 84c88b1
docs: add tslint migration guide
armano2 160d08d
docs: update docs
armano2 05aa9b2
docs: update links
armano2 c335534
docs: add dynamic github url for testing
armano2 bdf68dd
docs: wip editor
armano2 2772d85
docs: create basic repl
armano2 68f35db
fix: add missing package
armano2 ad76d50
fix: add missing typescript
armano2 242e431
fix: correct build for ssr
armano2 fbcfc41
fix: correct build for ssr and loading all rules
armano2 75fc69d
fix: add support for quickfix
armano2 567285d
fix: refactor update markers
armano2 35c7c3b
fix: setup workspaces and migrate code to typescript
armano2 241dd18
fix: correct build when in monorepo
armano2 55fad3d
fix: reduce number of files that has to be loaded
armano2 cbe134e
fix: yarn lock after depencency update
armano2 718de5e
Merge branch 'fix/yarn-lock'
armano2 af58a83
Merge remote-tracking branch 'origin/master' into docs-page
armano2 960fabf
fix: implement saving/restoring configuration
armano2 131e80c
docs: fix saving and restoring query params
armano2 382cce1
fix: optimize build size
armano2 940e5be
fix: disable double build on netlify
armano2 e6e8a8d
docs: add basic styles to playground
armano2 caba2c8
fix: add some imports and simplify code
armano2 012ce87
feat: refactor codebase to use sandbox
armano2 dc30446
fix: correct issue with typescript
armano2 3fbcd9d
fix: update playground to support options selector
armano2 ec08000
fix: replace text field with dropdown
armano2 b325278
chore: drop no longer needed files
armano2 153110b
build: correct issue with build
armano2 770f197
fix: correct code review
armano2 22933ee
fix: correct linting issues
armano2 36a1e61
chore: fix one more code review
armano2 eb6d737
fix: correct markdown lint issues
armano2 b0f3b00
test: update eslint doc validation
armano2 245bc6d
test: add missing spelling issues
armano2 0692feb
Merge remote-tracking branch 'refs/remotes/origin/master'
armano2 93208c2
chore: update info about tslint
armano2 b6da4e1
chore: add multi new line within notes
armano2 57d6b14
chore: fix linting issue
armano2 5dc55b3
chore: fix linting issue
armano2 a531c48
Merge branch 'master' into docs-page
armano2 fe35835
docs(website): add missing types and update TSLINT.md
armano2 7ac0fd9
docs(website): add ast viewer to repl
armano2 0989f05
docs(website): fix small issue with updating layout
armano2 8948138
docs(website): add basic interactivity to ast viewer
armano2 89e5a48
docs(website): correct few color issues
armano2 c4ef5bb
docs(website): fix issue with filtering values
armano2 1885bac
docs(website): fix new issue with services
armano2 0d99112
docs(website): add handling of fatal messages
armano2 9e8bdfe
docs(website): correct jsx handling
armano2 ff01d81
docs(website): remove unnecessary eslint disable
armano2 efe2661
docs(website): fix history manipulation and loading state
armano2 93a184d
docs(website): implement simple mouse hover highlight
armano2 f2202b0
docs(website): reset decoration on error
armano2 09c2dab
docs(website): improve ast viewer
armano2 58e4343
docs(website): minor style fix
armano2 035b82c
docs(website): improve performance
armano2 b532dff
Merge remote-tracking branch 'origin/master' into docs-page
armano2 c9467c4
chore(website): update docusaurus
armano2 c1a1150
Merge branch 'master'
armano2 bcc0808
docs(website): update
armano2 277283e
docs(website): update homepage
armano2 d3c4cf6
docs(website): enable formating of jsx and css and add simple modal
armano2 e49f3b7
docs(website): update docusaurus to 2.0.0-alpha.72
armano2 69fa84b
docs(website): add ability to pick typescript version in repl
armano2 38c0014
docs(website): fix ssr build
armano2 6b893bd
docs(website): ensure that default typescript version is correctly se…
armano2 c8bc133
Merge remote-tracking branch 'refs/remotes/origin/master'
armano2 2abb092
docs(website): correct issue with reloading page after ts version change
armano2 6286b12
docs(website): correct minor warnings and enable spelling checks
armano2 b192a43
Merge branch 'master' into HEAD
armano2 34e7463
docs: update website
armano2 4759724
chore: bump @babel to 7.16.x and update tests
armano2 c51339f
Merge branch 'fix-babel-7_16-tests' into docs-page
armano2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
# Getting Started | ||
--- | ||
title: Getting Started | ||
sidebar_label: Getting Started | ||
slug: / | ||
--- | ||
|
||
Approaching a monorepo project like this can be pretty daunting and hard to navigate for a new user. | ||
|
||
The goal of these docs are to give you a quick overview of the project and all of its the pieces, as well as provide guides to help you get setup. | ||
|
||
The docs are broken down into the following categories: | ||
|
||
## [I want to lint my TypeScript codebase.](./linting/README.md) | ||
- [I want to lint my TypeScript codebase.](./linting/README.md) | ||
|
||
## [(TODO) I want to write an ESLint plugin in TypeScript.](./plugin-development/README.md) | ||
- [(TODO) I want to write an ESLint plugin in TypeScript.](./plugin-development/README.md) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,8 @@ | ||
# Troubleshooting / FAQ | ||
|
||
## Table of Contents | ||
|
||
- [I am using a rule from ESLint core, and it doesn't work correctly with TypeScript code](#i-am-using-a-rule-from-eslint-core-and-it-doesnt-work-correctly-with-typescript-code) | ||
- [I get errors telling me "The file must be included in at least one of the projects provided"](#i-get-errors-telling-me-the-file-must-be-included-in-at-least-one-of-the-projects-provided) | ||
- [I use a framework (like Vue) that requires custom file extensions, and I get errors like "You should add `parserOptions.extraFileExtensions` to your config"](#i-use-a-framework-like-vue-that-requires-custom-file-extensions-and-i-get-errors-like-you-should-add-parseroptionsextrafileextensions-to-your-config) | ||
- [One of my lint rules isn't working correctly on a pure JavaScript file](#one-of-my-lint-rules-isnt-working-correctly-on-a-pure-javascript-file) | ||
- [TypeScript should be installed locally](#typescript-should-be-installed-locally) | ||
- [How can I ban `<specific language feature>`?](#how-can-i-ban-specific-language-feature) | ||
- [Why don't I see TypeScript errors in my ESLint output?](#why-dont-i-see-typescript-errors-in-my-eslint-output) | ||
- [I get errors from the `no-undef` rule about global variables not being defined, even though there are no TypeScript errors](#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors) | ||
- [How do I check to see what versions are installed?](#how-do-i-check-to-see-what-versions-are-installed) | ||
- [My linting feels really slow](#my-linting-feels-really-slow) | ||
|
||
--- | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
Comment on lines
-18
to
-20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto - removing these breaks makes it much harder to read this in the github renderer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we want to focus on documentation on github or on website? |
||
id: troubleshooting | ||
title: Troubleshooting | ||
sidebar_label: Troubleshooting | ||
--- | ||
|
||
## I am using a rule from ESLint core, and it doesn't work correctly with TypeScript code | ||
|
||
|
@@ -38,16 +23,8 @@ If you don't find an existing extension rule, or the extension rule doesn't work | |
|
||
We release a new version our tooling every week. **_Please_** ensure that you [check our the latest list of "extension" rules](../../../packages/eslint-plugin/README.md#extension-rules) **_before_** filing an issue. | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
--- | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
## I get errors telling me "The file must be included in at least one of the projects provided" | ||
|
||
This error means that the file that's being linted is not included in any of the tsconfig files you provided us. A lot of the time this happens when users have test files or similar that are not included. | ||
|
@@ -56,16 +33,8 @@ There are a couple of solutions to this, depending on what you want to achieve. | |
|
||
See our docs on [type aware linting](./TYPED_LINTING.md#i-get-errors-telling-me-the-file-must-be-included-in-at-least-one-of-the-projects-provided) for solutions to this. | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
--- | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
## I use a framework (like Vue) that requires custom file extensions, and I get errors like "You should add `parserOptions.extraFileExtensions` to your config" | ||
|
||
You can use `parserOptions.extraFileExtensions` to specify an array of non-TypeScript extensions to allow, for example: | ||
|
@@ -78,47 +47,23 @@ You can use `parserOptions.extraFileExtensions` to specify an array of non-TypeS | |
}, | ||
``` | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
--- | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
## One of my lint rules isn't working correctly on a pure JavaScript file | ||
|
||
This is to be expected - ESLint rules do not check file extensions on purpose, as it causes issues in environments that use non-standard extensions (for example, a `.vue` and a `.md` file can both contain TypeScript code to be linted). | ||
|
||
If you have some pure JavaScript code that you do not want to apply certain lint rules to, then you can use [ESLint's `overrides` configuration](https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns) to turn off certain rules, or even change the parser based on glob patterns. | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
--- | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
## TypeScript should be installed locally | ||
|
||
Make sure that you have installed TypeScript locally i.e. by using `npm install typescript`, not `npm install -g typescript`, | ||
or by using `yarn add typescript`, not `yarn global add typescript`. See https://github.com/typescript-eslint/typescript-eslint/issues/2041 for more information. | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
--- | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
## How can I ban `<specific language feature>`? | ||
|
||
ESLint core contains the rule [`no-restricted-syntax`](https://eslint.org/docs/rules/no-restricted-syntax). This generic rule allows you to specify a [selector](https://eslint.org/docs/developer-guide/selectors) for the code you want to ban, along with a custom error message. | ||
|
@@ -154,16 +99,8 @@ For example, you can ban enums (or some variation of) using one of the following | |
} | ||
``` | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
--- | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
## Why don't I see TypeScript errors in my ESLint output? | ||
|
||
TypeScript's compiler (or whatever your build chain may be) is specifically designed and built to validate the correctness of your codebase. | ||
|
@@ -173,16 +110,8 @@ Instead, our tooling exists to **_augment_** TypeScript's built in checks with l | |
|
||
[1] - TypeScript computes type information lazily, so us asking for the errors it would produce from the compiler would take an _additional_ ~100ms per file. This doesn't sound like a lot, but depending on the size of your codebase, it can easily add up to between several seconds to several minutes to a lint run. | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
--- | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
## I get errors from the `no-undef` rule about global variables not being defined, even though there are no TypeScript errors | ||
|
||
The `no-undef` lint rule does not use TypeScript to determine the global variables that exist - instead, it relies upon ESLint's configuration. | ||
|
@@ -206,16 +135,8 @@ Note, that for a mixed project including JavaScript and TypeScript, the `no-unde | |
|
||
If you choose to leave on the ESLint `no-undef` lint rule, you can [manually define the set of allowed `globals` in your ESLint config](https://eslint.org/docs/user-guide/configuring/language-options#specifying-globals), and/or you can use one of the [pre-defined environment (`env`) configurations](https://eslint.org/docs/user-guide/configuring/language-options#specifying-environments). | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
--- | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
## How do I check to see what versions are installed? | ||
|
||
If you have multiple versions of our tooling, it can cause various bugs for you. This is because ESLint may load a different version each run depending on how you run it - leading to inconsistent lint results. | ||
|
@@ -225,24 +146,16 @@ Installing our tooling in the root of your project does not mean that only one v | |
You can check what versions are installed in your project using the following commands: | ||
|
||
```bash | ||
$ npm list @typescript-eslint/eslint-plugin @typescript-eslint/parser | ||
$ yarn list @typescript-eslint/eslint-plugin @typescript-eslint/parser | ||
npm list @typescript-eslint/eslint-plugin @typescript-eslint/parser | ||
yarn list @typescript-eslint/eslint-plugin @typescript-eslint/parser | ||
``` | ||
|
||
If you see more than one version installed, then you will have to either use [yarn resolutions](https://classic.yarnpkg.com/en/docs/selective-version-resolutions/) to force a single version, or you will have to downgrade your root versions to match the dependency versions. | ||
|
||
**The best course of action in this case is to wait until your dependency releases a new version with support for our latest versions.** | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
--- | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
## My linting feels really slow | ||
|
||
As mentioned in the [type-aware linting doc](./TYPED_LINTING.md), if you're using type-aware linting, your lint times should be roughly the same as your build times. | ||
|
@@ -263,8 +176,8 @@ This plugin surfaces prettier formatting problems at lint time, helping to ensur | |
|
||
Instead of using this plugin, we recommend using prettier's `--list-different` flag to detect if a file has not been correctly formatted. For example, our CI is setup to run the following command automatically, which blocks diffs that have not been formatted: | ||
|
||
```bash | ||
$ yarn prettier --list-different \"./**/*.{ts,js,json,md}\" | ||
```bash npm2yarn | ||
npm run prettier --list-different \"./**/*.{ts,js,json,md}\" | ||
``` | ||
|
||
### `eslint-plugin-import` | ||
|
@@ -292,7 +205,3 @@ The following rules do not have equivalent checks in TypeScript, so we recommend | |
This rule helps ensure your codebase follows a consistent indentation pattern. However this involves a _lot_ of computations across every single token in a file. Across a large codebase, these can add up, and severely impact performance. | ||
|
||
We recommend not using this rule, and instead using a tool like [`prettier`](https://www.npmjs.com/package/prettier) to enforce a standardized formatting. | ||
|
||
<br /> | ||
<br /> | ||
<br /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getting rid of the TOC kinda ruins the experience for the repo.
I think we probably want to keep it if we can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to focus on website or github documetation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the FAQ is one of the few things that needs to be easy to read on both.
Other things I think it's okay to have some weirdness on github - as long as it's not too over the top.