|
| 1 | +# eslint-config-plain-typescript |
| 2 | + |
| 3 | +Plain config without any rules that makes ESLint working with typescript |
| 4 | + |
| 5 | +## How to use. |
| 6 | +- Install it as a dependency. |
| 7 | +``` |
| 8 | + yarn add eslint-config-plain-typescript |
| 9 | +``` |
| 10 | +- Make sure you have `typescript` and `tsconfig.json` in root of the project |
| 11 | + |
| 12 | +- Add in your `.eslintrc` extension like that: |
| 13 | +``` |
| 14 | +"extends": ["plain-typescript"] |
| 15 | +``` |
| 16 | + |
| 17 | +- After that your ESLint will start to parse all Typescript code. |
| 18 | + |
| 19 | +## How to extend. |
| 20 | + |
| 21 | +There is some rules that are not compatible with `js` so when you use them it's nice |
| 22 | +to put the inside of the `override` object in your `.eslintrc` config like that. |
| 23 | +```json5 |
| 24 | +{ |
| 25 | + "extends": ["airbnb", "plain-typescript"], |
| 26 | + "overrides": { |
| 27 | + files: ["**/*.ts", "**/*.tsx"], |
| 28 | + "rules": { // These are rules that should apply to ts/tsx files only |
| 29 | + "@typescript-eslint/no-unused-vars": "error" |
| 30 | + } |
| 31 | + }, |
| 32 | + "rules": { // These are rules that go for both and are proven to not be conflicting |
| 33 | + "no-unused-vars": "error" |
| 34 | + } |
| 35 | +} |
| 36 | +``` |
| 37 | + |
| 38 | +Also please refer to the `typescript` [recommended config](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/recommended.json) for more info about available rules and rules that are incompatible. |
| 39 | + |
| 40 | +## Note |
| 41 | + |
| 42 | +Not 100% sure, but put it after all the other configs that you may import. |
| 43 | +The only configs that you should export after is `prettier` related stuff, others should go before this one I assume. |
| 44 | + |
| 45 | +## Depends on. |
| 46 | +There three suckers gonna be installed along the way with installation. |
| 47 | +``` |
| 48 | + "dependencies": { |
| 49 | + "babel-eslint": "10.0.1", |
| 50 | + "@typescript-eslint/parser": "^1.4.2", |
| 51 | + "@typescript-eslint/eslint-plugin": "1.4.2" |
| 52 | + } |
| 53 | +``` |
| 54 | + |
| 55 | +These two suckers should be installed separatly as `devDependencies`: |
| 56 | +``` |
| 57 | + "peerDependencies": { |
| 58 | + "eslint": ">=5.15", |
| 59 | + "typescript": "^>=3" |
| 60 | + } |
| 61 | +``` |
0 commit comments