Skip to content

Commit

Permalink
chore: more setup with linter/jest and ts
Browse files Browse the repository at this point in the history
  • Loading branch information
CynicalBusiness committed Mar 11, 2021
1 parent b09d404 commit c1223e3
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"project": "tsconfig.json",
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "import"],
"plugins": ["@typescript-eslint", "import", "jest"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
Expand Down Expand Up @@ -40,7 +40,8 @@
"files": ["**/*.test.ts"],
"env": {
"jest/globals": true
}
},
"extends": ["plugin:jest/recommended", "plugin:jest/style"]
}
]
}
3 changes: 2 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ before_script:
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- "tsconfig.build.tsbuildinfo"
- "node_modules/"

.base:
Expand All @@ -15,13 +16,13 @@ build:
extends: .base
stage: build
script:
- "yarn run eslint ./src"
- "yarn build"

test:
extends: .base
stage: test
script:
- "yarn lint"
- "yarn test"

# TODO automatically create tags from builds on master
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"license": "MIT",
"type": "module",
"scripts": {
"build": "tsc",
"lint": "eslint ./src",
"build": "tsc --build tsconfig.build.json",
"test": "jest"
},
"jest": {
Expand All @@ -20,6 +21,7 @@
"@typescript-eslint/parser": "^4.17.0",
"eslint": "^7.21.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.2.1",
"jest": "^26.6.3",
"ts-jest": "^26.5.3",
"typescript": "^4.2.3"
Expand Down
2 changes: 1 addition & 1 deletion src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
describe.only("todo", () => {
describe("todo", () => {
test.todo("hello world!");
});
5 changes: 5 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["src/**/*.ts"],
"exclude": ["**/*.test.ts"]
}
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

"declaration": true,
"strict": true,
"esModuleInterop": true
"esModuleInterop": true,
"incremental": true
},

"include": ["src/**/*.ts"],
"exclude": ["node_modules/", "**/*.test.ts"]
"exclude": ["node_modules/"]
}
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@
semver "^7.3.2"
tsutils "^3.17.1"

"@typescript-eslint/[email protected]":
"@typescript-eslint/[email protected]", "@typescript-eslint/experimental-utils@^4.0.1":
version "4.17.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.17.0.tgz#762c44aaa1a6a3c05b6d63a8648fb89b89f84c80"
integrity sha512-ZR2NIUbnIBj+LGqCFGQ9yk2EBQrpVVFOh9/Kd0Lm6gLpSAcCuLLe5lUCibKGCqyH9HPwYC0GIJce2O1i8VYmWA==
Expand Down Expand Up @@ -1562,6 +1562,13 @@ eslint-plugin-import@^2.22.1:
resolve "^1.17.0"
tsconfig-paths "^3.9.0"

eslint-plugin-jest@^24.2.1:
version "24.2.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.2.1.tgz#7e84f16a3ca6589b86be9732a93d71367a4ed627"
integrity sha512-s24ve8WUu3DLVidvlSzaqlOpTZre9lTkZTAO+a7X0WMtj8HraWTiTEkW3pbDT1xVxqEHMWSv+Kx7MyqR50nhBw==
dependencies:
"@typescript-eslint/experimental-utils" "^4.0.1"

eslint-scope@^5.0.0, eslint-scope@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
Expand Down

0 comments on commit c1223e3

Please sign in to comment.