7.0.3 • Published 2 years ago

eslint-config-ringcentral-typescript v7.0.3

Weekly downloads
30
License
MIT
Repository
github
Last release
2 years ago

RingCentral TypeScript

A stricter and TypeScript-enabled version of https://github.com/ringcentral/ringcentral-javascript.

Installation

$ npm install eslint eslint-config-ringcentral-typescript --save-dev

Add this to scripts section of package.json:

{
  "scripts": {
      "lint": "eslint --cache --cache-location node_modules/.cache/eslint --fix ",
      "lint:all": "npm run lint 'src/**/*.ts' 'src/**/*.tsx'"
  }
}

You can add --quiet to suppress warnings, but that's not recommended. You can add DEBUG=eslint:cli-engine to output files that were linted.

:warning: Please note commas around globs: 'src/**/*.ts', this will prevent your OS to expand those globs.

Create .eslintrc:

{
  "extends": [
    "ringcentral-typescript"
  ]
}

Create .prettierrc (optional):

{
  "printWidth": 120
}

:warning: Keep in mind that anything you set in .prettierrc may be overridden by config specified in this repo.

You may use following trick in .eslintrc if you need to take control:

const prettierOptions = JSON.parse(require('fs').readFileSync('./.prettierrc').toString());

module.exports = {
  ...
  rules: {
    'prettier/prettier': ['warn', Object.assign({}, prettierOptions)]
  }
};

Create a .editorconfig (optional):

root = true

[*]
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false

[*.{js,jsx,ts,tsx}]
indent_size = 4

[*.{css,sass,scss,yml,json}]
indent_size = 2

[Makefile]
indent_style = tab

Suggested use

Works best when used together with Husky and Lint Staged:

$ npm install husky lint-staged --save-dev

Add this to scripts section of package.json:

{
  "scripts": {
      "lint:staged": "lint-staged"
  }
}

Create .huskyrc:

{
  "hooks": {
    "pre-commit": "npm run lint:staged"
  }
}

Create .lintstagedrc:

{
  "*.{js,jsx,ts,tsx}": [
    "npm run lint --",
    "git add"
  ]
}

Integration with JetBrains products (Idea, WebStorm, PhpStorm)

Due to a bug you need to manually add extensions to registry: click Help -> Find Action -> Registry, search for eslint.additional.file.extensions and add ts,tsx, see https://youtrack.jetbrains.com/issue/WEB-29829#focus=streamItem-27-3182764-0-0.

7.0.0

2 years ago

7.0.3

2 years ago

7.0.2

2 years ago

7.0.1

2 years ago

6.0.0

3 years ago

5.0.0

3 years ago

4.0.0

4 years ago

3.0.0

4 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.0

5 years ago