Skip to content

Commit e6e4e05

Browse files
committed
First Commit :)
0 parents  commit e6e4e05

File tree

8 files changed

+1918
-0
lines changed

8 files changed

+1918
-0
lines changed

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Environment variables
2+
.env
3+
4+
# Dependency directories
5+
node_modules/
6+
7+
# Build output
8+
build/
9+
10+
# Logs
11+
logs/
12+
*.log
13+
14+
.DS_Store

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
# nodejs-typescript-eslint-starter
3+
4+
Starter template for nodejs with typescript and eslint 9
5+
6+
## Getting Started
7+
8+
1. Clone the repository
9+
2. Run `pnpm install` to install dependencies
10+
3. Run `pnpm run dev` to start the development server
11+
12+
## Features
13+
14+
- TypeScript
15+
- ESLint9 with TypeScript support
16+
- Winston for logging
17+
- Import sorting and grouping
18+
- Import aliase for `@/` directory which points to `src/`
19+
20+
## Notes
21+
22+
- This project uses `pnpm` as the package manager
23+
- The `dev` script runs the TypeScript compiler in watch mode
24+
- The `build` script compiles the TypeScript code to JavaScript
25+
- The `lint` script runs ESLint on the TypeScript code
26+
- The `lint:fix` script runs ESLint on the TypeScript code and fixes any issues

eslint.config.mjs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import eslint from "@eslint/js";
2+
import tsParser from "@typescript-eslint/parser";
3+
import { flatConfigs } from "eslint-plugin-import-x";
4+
import { config, configs as tsConfigs } from "typescript-eslint";
5+
6+
const ESLintConfig = config(
7+
eslint.configs.recommended,
8+
...tsConfigs.recommended,
9+
flatConfigs.recommended,
10+
flatConfigs.typescript,
11+
{
12+
ignores: ["node_modules", "build"],
13+
languageOptions: {
14+
parser: tsParser,
15+
ecmaVersion: 2024,
16+
sourceType: "module",
17+
18+
parserOptions: {
19+
project: "./tsconfig.json",
20+
21+
ecmaFeatures: {
22+
arrowFunctions: true,
23+
},
24+
},
25+
},
26+
rules: {
27+
// Warning for unused variables
28+
"@typescript-eslint/no-unused-vars": "warn",
29+
// Prefer const over let
30+
"prefer-const": "warn",
31+
// Prefer arrow functions
32+
"func-style": ["warn", "expression"],
33+
// Consistent usage of type over interface
34+
"@typescript-eslint/consistent-type-definitions": ["warn", "type"],
35+
// Module import sorting and grouping
36+
"import-x/order": [
37+
"warn",
38+
{
39+
groups: ["builtin", "external", "internal"],
40+
pathGroups: [
41+
{
42+
pattern: "@app/**",
43+
group: "internal",
44+
position: "before",
45+
},
46+
],
47+
pathGroupsExcludedImportTypes: ["@app/**"],
48+
"newlines-between": "always",
49+
alphabetize: {
50+
order: "asc",
51+
caseInsensitive: true,
52+
},
53+
},
54+
],
55+
// Additional rules for TypeScript and Node.js
56+
"@typescript-eslint/no-explicit-any": "warn",
57+
"@typescript-eslint/no-inferrable-types": "warn",
58+
"no-console": "warn",
59+
"no-unused-expressions": "warn",
60+
},
61+
}
62+
);
63+
64+
export default ESLintConfig;

package.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "nodejs-typescript-eslint-starter",
3+
"version": "1.0.0",
4+
"description": "Starter template for nodejs with typescript and eslint 9",
5+
"keywords": [
6+
"nodejs",
7+
"typescript",
8+
"eslint",
9+
"winston",
10+
"logger",
11+
"eslint-9",
12+
"production"
13+
],
14+
"homepage": "https://github.com/XronTrix10/nodejs-typescript-eslint-starter#readme",
15+
"bugs": {
16+
"url": "https://github.com/XronTrix10/nodejs-typescript-eslint-starter/issues"
17+
},
18+
"repository": {
19+
"type": "git",
20+
"url": "git+https://github.com/XronTrix10/nodejs-typescript-eslint-starter.git"
21+
},
22+
"license": "ISC",
23+
"author": "Xron Trix",
24+
"type": "commonjs",
25+
"main": "src/index.ts",
26+
"scripts": {
27+
"dev": "tsc-watch --onSuccess \"node build/index.js\"",
28+
"build": "tsc",
29+
"start": "node build/index.js",
30+
"lint": "eslint src/**/*.ts",
31+
"lint:fix": "eslint src/**/*.ts --fix"
32+
},
33+
"devDependencies": {
34+
"@eslint/js": "^9.24.0",
35+
"@types/module-alias": "^2.0.4",
36+
"@types/node": "^22.14.0",
37+
"@typescript-eslint/parser": "^8.29.1",
38+
"eslint": "^9.24.0",
39+
"eslint-import-resolver-typescript": "^4.3.2",
40+
"eslint-plugin-import-x": "^4.10.2",
41+
"tsc-watch": "^6.2.1",
42+
"typescript": "^5.8.3",
43+
"typescript-eslint": "^8.29.1"
44+
},
45+
"dependencies": {
46+
"module-alias": "^2.2.3",
47+
"winston": "^3.17.0"
48+
},
49+
"_moduleAliases": {
50+
"@": "./build"
51+
}
52+
}

0 commit comments

Comments
 (0)