Skip to content

Commit

Permalink
Merge pull request #1 from lauriharpf/add-typescript-eslint
Browse files Browse the repository at this point in the history
Add typescript-eslint
  • Loading branch information
lauriharpf committed May 17, 2021
2 parents d264b93 + 84be7a2 commit d23cb8e
Show file tree
Hide file tree
Showing 10 changed files with 1,995 additions and 85 deletions.
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# don't ever lint node_modules
node_modules
# don't lint build output
build
# don't lint nyc coverage output
coverage
# don't lint the eslint config (https://stackoverflow.com/a/60840108/843984)
.eslintrc.js
31 changes: 31 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["./tsconfig.json"],
ecmaVersion: 2020,
sourceType: "module",
tsconfigRootDir: __dirname,
},
plugins: ["jest"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
],
env: { node: true },
overrides: [
{
files: ["*.test.ts", "test/**"],
plugins: ["jest"],
rules: {
// Turn off unbound method rule but *only* for test files (https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/unbound-method.md)
"@typescript-eslint/unbound-method": "off",
"jest/unbound-method": "error",
},
},
],
rules: {
"@typescript-eslint/unbound-method": "error",
},
};
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ query Posts {

6. `CTRL-C` stops the server

Tests can be run with `npm test` (`npm test -- --coverage` to report code coverage)
### Other commands

- `npm test` to run tests
- `npm test -- --coverage` to run tests and collect code coverage
- `npm run lint` to lint the project

## Template contents

Expand All @@ -33,6 +37,7 @@ Tests can be run with `npm test` (`npm test -- --coverage` to report code covera
- Example resolvers and [Apollo REST Data Source](https://www.npmjs.com/package/apollo-datasource-rest)s (posts, users)
- Test infrastructure ([ts-jest](https://github.com/kulshekhar/ts-jest), [apollo-server-testing](https://www.apollographql.com/docs/apollo-server/testing/testing/) and [nock](https://www.npmjs.com/package/nock)) and example tests
- [ts-node-dev](https://www.npmjs.com/package/ts-node-dev) for development (restarts app when code changes)
- [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md) with [type-aware rules](https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/TYPED_LINTING.md)
- Github: Dependabot dependency updates

## Customizing for your project
Expand Down

0 comments on commit d23cb8e

Please sign in to comment.