1.0.0 • Published 4 years ago

@digital-wafa/eslint-config v1.0.0

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

wafa prettier conifg

Eslint-config npm version

A shared eslint configuration to use in digital wafa projects


Installing

npm install @digital-wafa/eslint-config --save-dev

It highly recommend extending the base config if you are using create-react-app if you don't skip this config :

{
  "extends": ["react-app"]
}

Usage

Add this config to your .eslintrc :

{
  "extends": [
    "@digital-wafa/eslint-config"
  ],
  "rules": {
    /* custom rules */
  }
}

Other configs

This config also exposes a few other configs that I use often and pull in as needed.

You can use them standalone:

{
  "extends": [
    "@digital-wafa/eslint-config/<config-name>",
  ]
}

Or in combination with the base config (recommended)

{
  "extends": [
    "@digital-wafa/eslint-config",
    "@digital-wafa/eslint-config/<config-name>",
  ]
}

Example of highly customized config

{
  "extends": [
    "@digital-wafa/eslint-config",
    "@digital-wafa/eslint-config/react",
    "@digital-wafa/eslint-config/typescript"
  ],
  "rules": {
    /* custom rules */
  },
}

When working with TypeScript, you'll need to provide an overrides object for rules that should only target TypeScript files.

{
  /* your base config */
  "overrides": [
    {
      "files": [
        "**/*.ts?(x)"
      ],
      "rules": {
        /* custom rules */
      }
    }
  ]
}

You can add two scripts to your package.json to lint and/or fix:

{
  "scripts": {
    "lint": "eslint ./src/*",
    "lint:fix": "eslint ./src/* --fix"
  },
}

Tip: You can alternatively put this object in your package.json under the property "eslintConfig":. This makes one less file in your project.