0.1.0 • Published 9 months ago

@chax-at/eslint-config v0.1.0

Weekly downloads
2
License
ISC
Repository
github
Last release
9 months ago

chax-at/eslint-config

Base eslint config for typescript projects

Installation

npm install @chax-at/eslint-config --save-dev

Peer dependencies

default ts project:

npm install eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser --save-dev

react ts project:

npm install eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-react eslint-plugin-react-hooks --save-dev

Usage

Add the config to the extends rule section of your .eslintrc

{
  "extends": [
    "@chax-at/eslint-config"
  ]
}

Example config

default ts project:

{
  "env": {
    "browser": true,
    "es6": true,
    "mocha": true,
    "node": true
  },
  "extends": [
    "@chax-at/eslint-config"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true,
      "legacyDecorators": true,
      "modules": true
    },
    "ecmaVersion": 6,
    "project": "./tsconfig.json",
    "sourceType": "module",
    "tsconfigRootDir": "./"
  },
  "plugins": [
    "@typescript-eslint",
    "mocha"
  ]
}

react project:

{
  "env": {
    "browser": true,
    "es6": true,
    "mocha": false
  },
  "extends": [
    "@chax-at/eslint-config/react"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true,
      "legacyDecorators": true,
      "modules": true
    },
    "ecmaVersion": 6,
    "project": "./tsconfig.json",
    "sourceType": "module",
    "tsconfigRootDir": "./"
  },
  "plugins": [
    "@typescript-eslint",
    "mocha",
    "react",
    "react-hooks"
  ],
  "settings": {
    "react": {
      "version": "detect"
    }
  },
  "overrides": [
    {
      "files": [
        "**/*.spec.ts",
        "**/*.spec.tsx"
      ],
      "env": {
        "mocha": true
      }
    }
  ]
}

Developers

To test changes locally:

  • run npm link in the cloned eslint-config project directory
  • run npm link @chax-at/eslint-config in the project you want to test your config
  • make sure you rerun the above command after an npm install
  • run npm unlink @chax-at/eslint-config after you are done
0.1.0

9 months ago

0.0.9

2 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.5

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago