Skip to content
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

Move samples and template from TSLint to ESLint #561

Merged
merged 15 commits into from Nov 25, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 20 additions & 4 deletions docs/development-environment/linting-and-code-style.md
@@ -1,14 +1,30 @@
# Linting and Code Style

FoalTS comes up with a pre configuration for the linter [TSLint](https://palantir.github.io/tslint/).
FoalTS comes up with a pre configuration for the linter [ESLint](https://eslint.org/) with [typescript-eslint](https://typescript-eslint.io/).

> *TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors. It is widely supported across modern editors & build systems and can be customized with your own lint rules, configurations, and formatters.*
> *ESLint is an open source project originally created by Nicholas C. Zakas in June 2013. Its goal is to provide a pluggable linting utility for JavaScript..*
>
> Source: https://palantir.github.io/tslint/
> Source: https://eslint.org/

This configuration is stored in the json file `tslint.json`.
> * `@typescript-eslint/parser` - An ESLint-specific parser which leverages `typescript-estree` and is designed to be used as a replacement for ESLint's default parser, `espree`.
> * `@typescript-eslint/eslint-plugin` - An ESLint-specific plugin which, when used in conjunction with `@typescript-eslint/parser`, allows for TypeScript-specific linting rules to run.
>
> Source: https://typescript-eslint.io

Previously, FoalTS used TSLint, but it has since been [deprecated](https://medium.com/palantir/tslint-in-2019-1a144c2317a9).

> In order to avoid bifurcating the linting tool space for TypeScript, we therefore plan to deprecate TSLint and focus our efforts instead on improving ESLint’s TypeScript support.
>
> Source: https://medium.com/palantir/tslint-in-2019-1a144c2317a9

This configuration is stored in the js file `.eslintrc.js`.

You can run the linting with this command:
```sh
npm run lint
```

And if the linting issues can be fixed, you can also fix them with this command:
fer22f marked this conversation as resolved.
Show resolved Hide resolved
```sh
npm run lint:fix
```