nodemon with ts-node not work on linux 1

nodemon with ts-node not work on linux

	"scripts": {
		"cleanup": "rimraf dist",
		"build": "tsc --pretty",
		"start": "node dist/server.js",
		"dev": "nodemon -w 'src/**/*.ts' -x ts-node --files -H -T server.ts",
		"format": "prettier ./src/**/*.{ts,spect.ts,test.ts} --write",
		"lint": "eslint ./src/**/*.{ts,spect.ts,test.ts} --fix",
		"lintfix": "npm run format && npm run lint",
		"test": "jest",
		"test:watch": "jest --watchAll"
	},

Here is what the above code is Doing:
1. `cleanup`: removes the `dist` folder
2. `build`: compiles the TypeScript code into JavaScript
3. `start`: starts the server
4. `dev`: starts the server in development mode
5. `format`: formats the code using Prettier
6. `lint`: lints the code using ESLint
7. `lintfix`: formats and lints the code
8. `test`: runs the tests
9. `test:watch`: runs the tests in watch mode

Now, let’s add the following code to the `.eslintrc.json` file:

“`json
{
“extends”: [
“eslint:recommended”,
“plugin:@typescript-eslint/recommended”,
“prettier/@typescript-eslint”,
“plugin:prettier/recommended”
],
“parser”: “@typescript-eslint/parser”,
“parserOptions”: {
“ecmaVersion”: 2018,
“sourceType”: “module”
},
“plugins”: [“@typescript-eslint”, “prettier”],
“rules”: {
“prettier/prettier”: “error”,
“@typescript-eslint/explicit-function-return-type”: “off”,
“@typescript-eslint/no-explicit-any”: “off”,
“@typescript-eslint/no-unused-vars”: “off”,
“@typescript-eslint/no-var-requires”: “off”
}
}
“`

Here’s what the above code is doing:
1. `extends`: extends the recommended ESLint rules
2. `parser`: specifies the parser
3. `parserOptions`: specifies the parser options
4. `plugins`: specifies the plugins
5. `rules`: specifies the rules

Now, let’s add the following code to the `.prettierrc` file:

“`json
{
“singleQuote”: true,
“trailingComma”: “es5”
}
“`

Here’s what the above code is doing:
1. `singleQuote`: specifies that single quotes should be used
2. `trailingComma`: specifies that trailing commas should be used

Now, let’s add the following code to the `.gitignore` file:

“`
dist/
node_modules/
“`

Here’s what the above code is doing:
1. `dist`: ignores the `dist` folder
2. `node_modules`: ignores the `node_modules` folder

Now, let’s add the following code to the `tsconfig.json` file:

“`json
{
“compilerOptions”: {
“target”: “es6”,
“module”: “commonjs”,
“outDir”: “dist”,
“strict”: true,
“esModuleInterop”: true,
“forceConsistentCasingInFileNames”: true
},
“include”: [“src/**/*.ts”],
“exclude”: [“node_modules”]
}
“`

Here’s what the above code is doing:
1. `compilerOptions`: specifies the compiler options

Similar Posts