Skip to content

doanhathanh/nodejs-test

Repository files navigation

SETUP ESLINT

  1. Install eslint
npm install --save-dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
  1. Create .eslintignore file
touch .eslintignore

Enter:

node_modules
dist
  1. Create .eslintrc file
touch .eslintrc

Enter:

{
  "root": true,
  "parser": "@typescript-eslint/parser",
  "plugins": [
    "@typescript-eslint"
  ],
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended"
  ], 
  "rules": { 
    "no-useless-escape": "off",
    "@typescript-eslint/no-empty-function": [
      "error", { 
        "allow": ["arrowFunctions", "constructors"] 
      }
    ],
    "@typescript-eslint/ban-types": ["error",
      {
          "types": {
              "Object": false,
              "object": false,
              "Function": false
          },
          "extendDefaults": true
      }
    ]
  }
}
  1. Add line (2) into package.json
1."scripts": {
2.  "check": "eslint src --fix --ext .ts",
3.}
  1. Run eslint
npm run check

SETUP PRETTIER

  1. Install prettier
npm install --save-dev prettier
npm install --save-dev eslint-config-prettier eslint-plugin-prettier
  1. Create .prettierrc file
touch .prettierrc

Enter:

{
  "semi": true,
  "trailingComma": "none",
  "singleQuote": true,
  "printWidth": 120
}
  1. modify .eslintrc file
{
  "plugins": [
    "prettier" <-- add this line
  ],
  "extends": [
    "prettier" <-- add this line
  ], 
  "rules": { 
    "prettier/prettier": 2, <-- add this line
  }
}
  1. Run eslint
npm run check

RUN

  1. npm install
  2. npm run webpack
  3. Open new terminal and run command
npm start

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published