Skip to content

Commit

Permalink
fix: Add configs to ts templates (#295)
Browse files Browse the repository at this point in the history
Recreation of this PR: #294

- added ".vscode" to .gitignore and .dockerignore files
- added .editorconfig files to templates if missing
- added or updated .eslintrc
- updated package.json with eslint packages
- removed duplicate option in ts-bootstrap-cheerio-crawler/tsconfig.json
- non-null assertion fix in main.ts in ts-start and ts-start-bun
templates
- change typescript-eslint version according to
#294 (comment)

The issue of redundant config options
(#294 (comment))
is not included.
  • Loading branch information
MatousMarik authored Sep 24, 2024
1 parent 0c0fe99 commit 63baf52
Show file tree
Hide file tree
Showing 39 changed files with 204 additions and 13 deletions.
1 change: 1 addition & 0 deletions templates/ts-bootstrap-cheerio-crawler/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# configurations
.idea
.vscode

# crawlee and apify storage folders
storage
Expand Down
18 changes: 17 additions & 1 deletion templates/ts-bootstrap-cheerio-crawler/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
{
"root": true,
"extends": "@apify/eslint-config-ts"
"env": {
"browser": true,
"es2020": true,
"node": true
},
"extends": [
"@apify/eslint-config-ts"
],
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": 2020
},
"ignorePatterns": [
"node_modules",
"dist",
"**/*.d.ts"
]
}
1 change: 1 addition & 0 deletions templates/ts-bootstrap-cheerio-crawler/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

.DS_Store
.idea
.vscode
dist
node_modules
storage
4 changes: 2 additions & 2 deletions templates/ts-bootstrap-cheerio-crawler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"devDependencies": {
"@apify/eslint-config-ts": "^0.3.0",
"@apify/tsconfig": "^0.1.0",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint": "^8.50.0",
"tsx": "^4.6.2",
"typescript": "^5.3.3"
Expand Down
1 change: 0 additions & 1 deletion templates/ts-bootstrap-cheerio-crawler/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "@apify/tsconfig",
"compilerOptions": {
"moduleResolution": "Node",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"target": "ES2022",
Expand Down
1 change: 1 addition & 0 deletions templates/ts-crawlee-cheerio/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# configurations
.idea
.vscode

# crawlee and apify storage folders
apify_storage
Expand Down
1 change: 1 addition & 0 deletions templates/ts-crawlee-cheerio/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

.DS_Store
.idea
.vscode
dist
node_modules
apify_storage
Expand Down
4 changes: 2 additions & 2 deletions templates/ts-crawlee-cheerio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"devDependencies": {
"@apify/eslint-config-ts": "^0.3.0",
"@apify/tsconfig": "^0.1.0",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint": "^8.50.0",
"tsx": "^4.6.2",
"typescript": "^5.3.3"
Expand Down
1 change: 1 addition & 0 deletions templates/ts-crawlee-playwright-chrome/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# configurations
.idea
.vscode

# crawlee and apify storage folders
apify_storage
Expand Down
1 change: 1 addition & 0 deletions templates/ts-crawlee-playwright-chrome/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

.DS_Store
.idea
.vscode
dist
node_modules
apify_storage
Expand Down
4 changes: 2 additions & 2 deletions templates/ts-crawlee-playwright-chrome/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"devDependencies": {
"@apify/eslint-config-ts": "^0.3.0",
"@apify/tsconfig": "^0.1.0",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint": "^8.50.0",
"tsx": "^4.6.2",
"typescript": "^5.3.3"
Expand Down
1 change: 1 addition & 0 deletions templates/ts-crawlee-puppeteer-chrome/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# configurations
.idea
.vscode

# crawlee and apify storage folders
apify_storage
Expand Down
1 change: 1 addition & 0 deletions templates/ts-crawlee-puppeteer-chrome/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

.DS_Store
.idea
.vscode
dist
node_modules
apify_storage
Expand Down
4 changes: 2 additions & 2 deletions templates/ts-crawlee-puppeteer-chrome/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"devDependencies": {
"@apify/eslint-config-ts": "^0.3.0",
"@apify/tsconfig": "^0.1.0",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint": "^8.50.0",
"tsx": "^4.6.2",
"typescript": "^5.3.3"
Expand Down
1 change: 1 addition & 0 deletions templates/ts-empty/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# configurations
.idea
.vscode

# crawlee and apify storage folders
apify_storage
Expand Down
9 changes: 9 additions & 0 deletions templates/ts-empty/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
20 changes: 20 additions & 0 deletions templates/ts-empty/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"root": true,
"env": {
"browser": true,
"es2020": true,
"node": true
},
"extends": [
"@apify/eslint-config-ts"
],
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": 2020
},
"ignorePatterns": [
"node_modules",
"dist",
"**/*.d.ts"
]
}
4 changes: 4 additions & 0 deletions templates/ts-empty/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file tells Git which files shouldn't be added to source control

.idea
.vscode
storage
apify_storage
crawlee_storage
Expand Down
4 changes: 4 additions & 0 deletions templates/ts-empty/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
"crawlee": "^3.5.4"
},
"devDependencies": {
"@apify/eslint-config-ts": "^0.3.0",
"@apify/tsconfig": "^0.1.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint": "^8.50.0",
"tsx": "^4.6.2",
"typescript": "^5.3.3"
},
Expand Down
1 change: 1 addition & 0 deletions templates/ts-playwright-test-runner/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# configurations
.idea
.vscode

# crawlee and apify storage folders
apify_storage
Expand Down
9 changes: 9 additions & 0 deletions templates/ts-playwright-test-runner/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
4 changes: 4 additions & 0 deletions templates/ts-playwright-test-runner/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file tells Git which files shouldn't be added to source control

.idea
.vscode
storage
node_modules
dist
Expand Down
1 change: 1 addition & 0 deletions templates/ts-standby/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# configurations
.idea
.vscode

# crawlee and apify storage folders
apify_storage
Expand Down
9 changes: 9 additions & 0 deletions templates/ts-standby/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
20 changes: 20 additions & 0 deletions templates/ts-standby/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"root": true,
"env": {
"browser": true,
"es2020": true,
"node": true
},
"extends": [
"@apify/eslint-config-ts"
],
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": 2020
},
"ignorePatterns": [
"node_modules",
"dist",
"**/*.d.ts"
]
}
4 changes: 4 additions & 0 deletions templates/ts-standby/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file tells Git which files shouldn't be added to source control

.idea
.vscode
storage
apify_storage
crawlee_storage
Expand Down
4 changes: 4 additions & 0 deletions templates/ts-standby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
"apify": "^3.1.10"
},
"devDependencies": {
"@apify/eslint-config-ts": "^0.3.0",
"@apify/tsconfig": "^0.1.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint": "^8.50.0",
"tsx": "^4.6.2",
"typescript": "^5.3.3"
},
Expand Down
1 change: 1 addition & 0 deletions templates/ts-start-bun/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# configurations
.idea
.vscode

# crawlee and apify storage folders
apify_storage
Expand Down
9 changes: 9 additions & 0 deletions templates/ts-start-bun/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
20 changes: 20 additions & 0 deletions templates/ts-start-bun/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"root": true,
"env": {
"browser": true,
"es2020": true,
"node": true
},
"extends": [
"@apify/eslint-config-ts"
],
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": 2020
},
"ignorePatterns": [
"node_modules",
"dist",
"**/*.d.ts"
]
}
4 changes: 4 additions & 0 deletions templates/ts-start-bun/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file tells Git which files shouldn't be added to source control

.idea
.vscode
storage
apify_storage
crawlee_storage
Expand Down
8 changes: 7 additions & 1 deletion templates/ts-start-bun/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
"cheerio": "^1.0.0-rc.12"
},
"devDependencies": {
"@apify/tsconfig": "^0.1.0"
"@apify/eslint-config-ts": "^0.3.0",
"@apify/tsconfig": "^0.1.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint": "^8.50.0",
"tsx": "^4.6.2",
"typescript": "^5.3.3"
},
"scripts": {
"start": "bun src/main.ts",
Expand Down
2 changes: 1 addition & 1 deletion templates/ts-start-bun/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const $ = cheerio.load(response.data);
const headings: { level: string, text: string }[] = [];
$("h1, h2, h3, h4, h5, h6").each((_i, element) => {
const headingObject = {
level: $(element).prop("tagName").toLowerCase(),
level: $(element).prop("tagName")!.toLowerCase(),
text: $(element).text(),
};
console.log("Extracted heading", headingObject);
Expand Down
1 change: 1 addition & 0 deletions templates/ts-start/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# configurations
.idea
.vscode

# crawlee and apify storage folders
apify_storage
Expand Down
9 changes: 9 additions & 0 deletions templates/ts-start/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
20 changes: 20 additions & 0 deletions templates/ts-start/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"root": true,
"env": {
"browser": true,
"es2020": true,
"node": true
},
"extends": [
"@apify/eslint-config-ts"
],
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": 2020
},
"ignorePatterns": [
"node_modules",
"dist",
"**/*.d.ts"
]
}
4 changes: 4 additions & 0 deletions templates/ts-start/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file tells Git which files shouldn't be added to source control

.idea
.vscode
storage
apify_storage
crawlee_storage
Expand Down
Loading

0 comments on commit 63baf52

Please sign in to comment.