diff --git a/.eslintrc.json b/.eslintrc.json index d511d71..48e4234 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,11 +1,17 @@ { - "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "standard" + ], "parser": "@typescript-eslint/parser", "plugins": ["@typescript-eslint"], "env": { "node": true }, "parserOptions": { "ecmaVersion": 5, - "sourceType": "module" + "sourceType": "module", + "project": "./tsconfig.json" }, "rules": { "no-console": "warn", diff --git a/README.md b/README.md index e0fcaac..e022ce3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # Learn TypeScript Linting -This repository is for the Matterhorn post [Learn TypeScript Linting](). +This repository is for the Matterhorn Mountain Top post series Learn TypeScript Linting. + +Check out part 1 on [TypeScript & ESLint](https://blog.matterhorn.dev/posts/learn-typescript-linting-part-1/) and part 2 on [Standard and Prettier Integration](https://blog.matterhorn.dev/posts/learn-typescript-linting-part-2/) diff --git a/package.json b/package.json index f08bd63..d6b7652 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "compile": "tsc -p tsconfig.json", "start": "node lib/index.js", - "lint": "eslint 'src/**/*.ts'" + "lint": "eslint src/**/*.ts" }, "keywords": [ "typescript", "eslint", "standardjs", "prettier", "linting" ], "repository": { @@ -18,6 +18,11 @@ "@typescript-eslint/eslint-plugin": "^1.7.0", "@typescript-eslint/parser": "^1.7.0", "eslint": "^5.16.0", + "eslint-config-standard": "^12.0.0", + "eslint-plugin-import": "^2.17.2", + "eslint-plugin-node": "^9.0.0", + "eslint-plugin-promise": "^4.1.1", + "eslint-plugin-standard": "^4.0.0", "typescript": "^3.4.5" } } diff --git a/src/bar.ts b/src/bar.ts index 03af893..515b581 100644 --- a/src/bar.ts +++ b/src/bar.ts @@ -1,5 +1,5 @@ import { CustomType } from './foo' export function bar (a: CustomType, b: CustomType[]): CustomType { - return b.reduce((c, v): CustomType => c+=v, a) -} \ No newline at end of file + return b.reduce((c, v): CustomType => c + v, a) +} diff --git a/src/foo.ts b/src/foo.ts index a1e8d4c..3773dc7 100644 --- a/src/foo.ts +++ b/src/foo.ts @@ -1,6 +1,6 @@ export type CustomType = number -export function foo(x: CustomType, y: CustomType): string { +export function foo (x: CustomType, y: CustomType): string { const z = x ** y return `${x} ** ${y} = ${z}` -} \ No newline at end of file +} diff --git a/src/index.ts b/src/index.ts index 5373bdc..b4b2dd7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,4 +7,4 @@ const x: CustomType = 2 const y: CustomType = 8 console.log(foo(x, y)) -console.log(bar(a, b)) \ No newline at end of file +console.log(bar(a, b))