-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up ESLint with @typescript-eslint packages (#118)
[@typescript-eslint](https://github.com/typescript-eslint/typescript-eslint) seems to be the way to go since it actually uses TypeScript under the hood. The alternative is Babel, which "parses and strips the type information, you still need the TypeScript compiler running if you want type checking." see [babel/babel-eslint#63](babel/babel-eslint#663 (comment)) [The future of TypeScript on ESLint (Jan 2019)](https://eslint.org/blog/2019/01/future-typescript-eslint) Closes #51
- Loading branch information
Showing
43 changed files
with
1,037 additions
and
490 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
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,11 @@ | ||
# Code generated by Prisma CLI and GraphQL Code Generator | ||
api/src/__generated__ | ||
|
||
# Test coverage reports generated by Jest | ||
coverage | ||
|
||
# Compiled JavaScript by 'tsc' cli command from TypeScript | ||
dist | ||
|
||
# NPM installed packages | ||
node_modules |
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,54 @@ | ||
module.exports = { | ||
root: true, | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['import'], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
// Disable all rules related to code formatting. Prettier handles formatting. | ||
// Prettier related configs should come last in the 'extends' Array. | ||
'plugin:import/recommended', | ||
// We could move the import/* settings below to a lerna package, and use it here: | ||
// 'plugin:typescript-eslint-import/recommended', | ||
'plugin:prettier/recommended', | ||
'prettier/@typescript-eslint', | ||
], | ||
rules: { | ||
'no-param-reassign': ['error'], | ||
|
||
// The code base was migrated from JavaScript recently. Let's chill a bit. | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/explicit-member-accessibility': 'off', | ||
'@typescript-eslint/no-empty-interface': 'warn', | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
|
||
// eslint-plugin-import | ||
// We can't alphabetize imports within groups, yet | ||
// https://github.com/benmosher/eslint-plugin-import/pull/1105 | ||
'import/no-extraneous-dependencies': [ | ||
'error', | ||
{ | ||
// Allow imports from devDependencies | ||
devDependencies: [ | ||
// In test files | ||
'**/*.test.{ts,tsx}', | ||
'**/*/__tests__/**/*.{ts,tsx}', | ||
// In test utilities files | ||
'**/*/utils/test/*.{ts,tsx}', | ||
// In configuration or setup files | ||
'**/*.{config,setup}.{js,ts}', | ||
], | ||
}, | ||
], | ||
'import/order': ['error'], | ||
}, | ||
settings: { | ||
'import/extensions': ['.ts', '.tsx'], | ||
'import/parsers': { | ||
'@typescript-eslint/parser': ['.ts', '.tsx'], | ||
}, | ||
// https://www.npmjs.com/package/eslint-import-resolver-typescript#configuration | ||
'import/resolver': { | ||
typescript: {}, | ||
}, | ||
}, | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,39 @@ | ||
{ | ||
"circleci.apiKey": "71b8fe885d9b5f6ff461fd86c8bfdd8acf2f4059" | ||
} | ||
"circleci.apiKey": "71b8fe885d9b5f6ff461fd86c8bfdd8acf2f4059", | ||
|
||
// ESLint + Prettier code formating | ||
//* | ||
"javascript.format.enable": false, | ||
"typescript.format.enable": false, | ||
// Disable formatOnSave for every language | ||
"editor.formatOnSave": false, | ||
// Enable per-language | ||
"[javascript]": { | ||
// We still use JavaScript for some configuration/setup files | ||
"editor.formatOnSave": true | ||
}, | ||
"[typescript]": { | ||
"editor.formatOnSave": true | ||
}, | ||
"[typescriptreact]": { | ||
"editor.formatOnSave": true | ||
}, | ||
// Prettier is run by ESLint as an autofixable rule, so we don't | ||
// need to run it separately: | ||
"eslint.autoFixOnSave": true, | ||
// Otherwise, we could use 'esbenp.prettier-vscode' extension. | ||
// Formats our code using prettier followed by eslint --fix: | ||
// "prettier.eslintIntegration": true, | ||
"eslint.validate": [ | ||
"javascript", | ||
{ | ||
"language": "typescript", | ||
"autoFix": true | ||
}, | ||
{ | ||
"language": "typescriptreact", | ||
"autoFix": true | ||
} | ||
], | ||
/**/ | ||
} |
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 was deleted.
Oops, something went wrong.
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,10 @@ | ||
// Precisamos desse script para configurar um arquivo de variáveis diferente. | ||
import path from 'path'; | ||
import dotenv from 'dotenv'; | ||
|
||
const testEnvFile = path.join(__dirname, './.env.test'); | ||
const result = dotenv.config({ path: testEnvFile }); | ||
|
||
if (result.error) { | ||
throw result.error; | ||
} |
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 was deleted.
Oops, something went wrong.
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.