GithubHelp home page GithubHelp logo

isabella232 / ringcentral-typescript Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ringcentral/ringcentral-typescript

0.0 0.0 0.0 49 KB

Stricter and typescript-enabled version of RingCentral's JS config for ESLint

JavaScript 91.71% TypeScript 8.29%

ringcentral-typescript's Introduction

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.

⚠️ 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
}

⚠️ 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.

ringcentral-typescript's People

Contributors

danbao avatar kirill-konshin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.