1.0.11 • Published 2 years ago

eslint-config-trondal-ts v1.0.11

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago
  • Package for common eslint rules.

Installation

  1. npm install trondal-eslint-config --save-dev
  2. Setup eslintConfig (could be .eslintrc, .eslint.json, package.json etc), example:
"eslintConfig": {
    "extends": [
        "eslint-config-trondal"
    ],
    "parserOptions": {
        "project": "./tsconfig.json" // point to  *your tsconfig
    }
    "rules": {}
}

Explanation

RuleDescription
eslint-config-airbnbStandard main config
eslint-plugin-import, eslint-plugin-jsx-a11y, eslint-plugin-react, eslint-plugin-react-hooksDependencies of eslint-config-airbnb
eslint-config-prettierRemove rules that conflicts with prettier
eslint-plugin-jestJest(testing) rules

Usage

npm install 'eslint-config-toll'

Overrride in your project

In package.json, .eslintrc.json or whatever file you use for eslint configuration, add the rules to the "rules" section. For instance if I want to allow non-closing components (<div></div>), I add this to package.json:

"eslintConfig": {
    "extends": [
        "eslint-config-trondal"
    ],
    "parserOptions": {
        "project": "./tsconfig.json"
    }
    "rules": {
        "react/self-closing-comp": 0 // override default 1
    }
},

Override global rules.

If you want to change the rules "globally", it should be done in this repo, and can be set in the "rules" section of index.js.