-
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #561 from fer22f/move-generated-samples-to-eslint
Move samples and template from TSLint to ESLint
- Loading branch information
Showing
49 changed files
with
3,627 additions
and
451 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: | ||
```sh | ||
npm run lint:fix | ||
``` |
Binary file not shown.
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
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
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
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
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,47 @@ | ||
module.exports = { | ||
env: { | ||
'browser': true, | ||
'es6': true, | ||
'node': true | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:@typescript-eslint/recommended-requiring-type-checking', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module' | ||
}, | ||
plugins: [ | ||
'@typescript-eslint' | ||
], | ||
rules: { | ||
'@typescript-eslint/array-type': 'error', | ||
'@typescript-eslint/explicit-member-accessibility': [ | ||
'error', { 'accessibility': 'no-public' } | ||
], | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/no-empty-function': 'off', | ||
'@typescript-eslint/no-empty-interface': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'@typescript-eslint/quotes': ['error', 'single'], | ||
'arrow-parens': ['error', 'as-needed'], | ||
'max-classes-per-file': 'off', | ||
'no-console': 'off', | ||
'no-duplicate-imports': 'error', | ||
'no-empty': 'off', | ||
'no-shadow': 'off', | ||
'comma-dangle': 'off', | ||
'sort-keys': 'off', | ||
'@typescript-eslint/no-unused-vars': ['error', { 'args': 'none' }], | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/require-await': 'off' | ||
}, | ||
ignorePatterns: [ | ||
'src/migrations/*.ts' | ||
] | ||
}; |
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
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
Oops, something went wrong.