1.1.6 • Published 2 years ago

eslint-config-peggy v1.1.6

Weekly downloads
1
License
ISC
Repository
github
Last release
2 years ago

eslint-config-peggy

a shareable eslint config package for front-end/back-end projects using TypeScript

Installation

Install eslint-config-peggy and ESlint:

npm install -D eslint eslint-config-peggy

Then, add eslint-config-peggy to the "extends" array in your .eslintrc.* file.

{
  "extends": [
    "some-other-config-you-use",
    "peggy"
  ]
}

note:

this package also includes the eslint settings for: Prettier, which does a great job at handling code formatting. To make the most of it, you may also want to install prettier in you project as a dev-dependency.

npm install -D prettier

Usage

Add 2 more scripts in your package.json

  "scripts": {
    ...
    "lint": "eslint . --ext .js,.ts,.jsx,.tsx",
    "lint:fix": "eslint . --ext .js,.ts,.jsx,.tsx --fix"
    ...
  },

to check code issues, run npm run lint

to fix issues, run npm run lint:fix

for more details about ESlint usage, see: https://eslint.org

if you are using VSCode, and want to auto fix the format issues whenever a file is saved, create a settings.json file in the .vscode folder under the root of your project. in your settings.json file, add:

{
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true 
  }
}

this will tell VSCode to run ESlint's automatic fix command: (eslint --fix) when you save a file.