Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
e7e80a2bacfc85e4e3a1817f3ef49bb88e5d80ce4a21a47b0b0c94cc6102904ba2f030695744db89d9ff84c88b1160d08d05aa9b2c335534bdf68dd2772d8568f35dbad76d50242e431fbcfc4175fc69d567285d35c7c3b241dd1855fad3dcbe134e718de5eaf58a83960fabf131e80c382cce1940e5bee6e8a8dcaba2c8012ce87dc304463fbcd9dec08000b325278153110b770f19722933ee36a1e61eb6d737b0f3b00245bc6d0692feb93208c2b6da4e157d6b145dc55b3a531c48fe358357ac0fd90989f05894813889e5a48c4ef5bb1885bac0d991129e8bdfeff01d81efe266193a184df2202b009c2dab58e4343035b82cb532dffc9467c4c1a1150bcc0808277283ed3c4cf6e49f3b769fa84b38c00146b893bdc8bc1332abb0926286b12b192a4334e74634759724c51339fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,15 @@ | ||
| --- | ||
| 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) | ||
| -[(TODO) I want to write an ESLint plugin in TypeScript.](./plugin-development/README.md) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,8 @@ | ||
Comment on lines -3 to -15 Member 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. getting rid of the TOC kinda ruins the experience for the repo. CollaboratorAuthor 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 website or github documetation? Member 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. I think that the FAQ is one of the few things thatneeds 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. | ||
| --- | ||
Comment on lines -18 to -20 Member 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 CollaboratorAuthor 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. | ||
| --- | ||
| ## 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. | ||
| --- | ||
| ## 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 | ||
| }, | ||
| ``` | ||
| --- | ||
| ## 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. | ||
| --- | ||
| ## 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. | ||
| --- | ||
| ## 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 | ||
| } | ||
| ``` | ||
| --- | ||
| ## 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. | ||
| --- | ||
| ## 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). | ||
| --- | ||
| ## 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 | ||
| ``` | ||
| 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.** | ||
| --- | ||
| ## 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 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. | ||
Uh oh!
There was an error while loading.Please reload this page.