-
Notifications
You must be signed in to change notification settings - Fork 100
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
Added usage and base configuration FAQs #348
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e41ab5e
Added usage and base configuration FAQs
JoshuaKGoldberg 91a8c01
Added little wink message
JoshuaKGoldberg f968c2d
Indeed, mentioned 880
c00a845
Update docs/FAQs.md
0bb864a
Update docs/FAQs.md
ef3d251
Moved zalgo down just a little bit
401b30f
There is no god
09cff32
Step one: tslint-to-eslint-config
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 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 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Frequently Asked Questions | ||
|
||
## Should I Migrate from TSLint to ESLint? | ||
|
||
**Yes**. | ||
|
||
[TSLint is deprecated](https://medium.com/palantir/tslint-in-2019-1a144c2317a9) and will [only receive patches](https://github.com/palantir/tslint/issues/4534) for security vulnerabilities and breaking TypeScript changes. | ||
Even if it still works on your project, it will become less useful over time as TypeScript evolves. | ||
|
||
## Should I Use `tslint-to-eslint-config`? | ||
|
||
`tslint-to-eslint-config` is recommended for use if you require near-identical behavior in transitioning from TSLint to ESLint. | ||
This is most reasonable when your project is large enough that fixing for different linter rules would be a significant time investment. | ||
|
||
However, after -or even better, _before_- you're migrated to ESLint, we recommend you take this opportunity to re-evaluate your core lint rules. | ||
TSLint's recommendations were solidified several core TypeScript versions ago and don't always reflect the latest and greatest standards and lint rules. | ||
|
||
Our recommended TSLint-to-ESLint configuration migration approach is: | ||
|
||
1. Switch your configuration to extend from [typescript-eslint's `recommended` and `recommend-requiring-type-checking` rulesets](https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md) | ||
2. [Disable complaints on a line-, file-, or rule basis](https://eslint.org/docs/user-guide/configuring) for any rules you do not want to enable and/or are now giving complaints | ||
3. Add any [community plugins](https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md#plugins) relevant to your project, then repeat step 2 | ||
|
||
> 😉 Consider filing granular tickets to track investigating re-enabling disabled lint rules to make sure the work doesn't get forgotten. | ||
|
||
## Should I Use Prettier? | ||
|
||
**Yes**. | ||
JoshuaKGoldberg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Formatting responsibilities, such as indentation and line wrapping, are exceedingly difficult to get implement in **linters**, and as such are practically impossible to get correct in them. | ||
JoshuaKGoldberg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
**Formatters** such as [Prettier](https://prettier.io) do a [much better job](https://prettier.io/docs/en/why-prettier.html) of formatting your code. | ||
|
||
The maintenance teams at both TSLint and typescript-eslint recommend using a formatter such as Prettier to format your code instead of a linter. | ||
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. 👍 |
||
|
||
> 🙏 [eslint-plugin-prettier](https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md#usage-with-prettier) is an excellent ESLint plugin that disables formatting rules from your configuration. | ||
> Please use it. 🙏 |
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export const faqs = `/* | ||
👋 Hi! This file was autogenerated by tslint-to-eslint-config. | ||
https://github.com/typescript-eslint/tslint-to-eslint-config | ||
|
||
It represents the closest reasonable ESLint configuration to this | ||
project's original TSLint configuration. | ||
|
||
We recommend eventually switching this configuration to extend from | ||
the recommended rulesets in typescript-eslint. | ||
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md | ||
|
||
Happy linting! 💖 | ||
*/ | ||
`; |
This file contains 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,7 +1,12 @@ | ||
import { EOL } from "os"; | ||
|
||
import { faqs } from "./faqs"; | ||
import { withKeysSorted } from "./withKeysSorted"; | ||
|
||
export const formatJsOutput = (configuration: any) => { | ||
return `module.exports = ${JSON.stringify(withKeysSorted(configuration), undefined, 4)};${EOL}`; | ||
return `${faqs}module.exports = ${JSON.stringify( | ||
withKeysSorted(configuration), | ||
undefined, | ||
4, | ||
)};${EOL}`; | ||
}; |
This file contains 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,7 +1,8 @@ | ||
import { EOL } from "os"; | ||
|
||
import { faqs } from "./faqs"; | ||
import { withKeysSorted } from "./withKeysSorted"; | ||
|
||
export const formatJsonOutput = (configuration: any) => { | ||
return `${JSON.stringify(withKeysSorted(configuration), undefined, 4)}${EOL}`; | ||
return `${faqs}${JSON.stringify(withKeysSorted(configuration), undefined, 4)}${EOL}`; | ||
}; |
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.
maybe the first step in this ordered list should be actually using
tslint-to-eslint-config
?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.
Haha I was actually in the headspace of not doing that, since I've been just starting from scratch... but I can see how that would be a confusing recommendation. Plus a lot of the folks I've talked to consider starting from scratch a much more time-intensive, collaborative process than switching minimally... will edit!