0.2.8 • Published 4 years ago

@digital-natives/eslint-config-digitalnatives-typescript-react v0.2.8

Weekly downloads
9
License
MIT
Repository
github
Last release
4 years ago

Digital Natives ESLint and Prettier Config with React

Usage

  1. Install the dependencies with
npx install-peerdeps --dev @digital-natives/eslint-config-digitalnatives-typescript-react

If you use yarn, run

npm info @digital-natives/eslint-config-digitalnatives-typescript-react@latest peerDependencies

then run yarn add --dev <dependency>@<version> for each listed peer dependency.

  1. Create a .eslintrc file in the root directory and add
{
  "extends": "@digital-natives/digitalnatives-typescript-react",
  "parserOptions": {
    "project": "./tsconfig.json"
  }
}

Add these scripts in the package.json file

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

VSCode configuration

  1. Install ESLint package
  2. Add these to your VSCode settings file
 "editor.formatOnSave": true,
 "[javascript]": {
   "editor.formatOnSave": false
 },
 "[javascriptreact]": {
   "editor.formatOnSave": false
 },
 "[typescript]": {
   "editor.formatOnSave": false
 },
 "[typescriptreact]": {
   "editor.formatOnSave": false
 },
 "editor.codeActionsOnSave": {
   "source.fixAll": true
 },
 "prettier.disableLanguages": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact"
  ],