diff --git a/README.md b/README.md index 0288171..fea9720 100644 --- a/README.md +++ b/README.md @@ -440,6 +440,56 @@ Do not leave console calls in your code > Reason: it just a noise for other developers. We always can find anything using history of version control system. +### Specify `TODO` | `FIXME` comment with task id or username + +> Reason: to not keep not evident and forgotten comments please specify a comment with a task id which is connected with a problem. If it's a light problem and you are going to solve it soon you can provide just your username. +
+ Read more + + --- + + TODO is a useful tool for developers. + There are a few cases when TODO comments could be added: + + * the developer is working on the task, and he noticed that part of his work is temporarily blocked (say, his particular task depends on API that not yet ready) + * the developer is working on the task and noticed that he would like to make one/few little improvements later in the scope of this task. However, the task is already done and could be sent for code-review to the boost a process. + * the developer detects some issue in the code and unable to fix it in the scope of his task, but he would like to improve the situation. + + **Do not leave anonymous TODO without the id**. Usually, anonymous TODO's live too long while it not linked to the issue tracking system. + Signed TODO's increases the factor of responsibility. When the developer signs TODO it like a short-term note for the author. But, it also a flag that author is responsible to resolve it ASAP. Finally, it makes such part of code clear for reviewers. + + --- + +
+ + +```javascript + +class UserService { + // BAD + getAllUsers() { + // TODO implement when backend is ready + } + + // GOOD + getAllUsers() { + // TODO [UIA-12345] implement when backend is ready + } + + // GOOD (if you know that you will do it no later than two weeks) + getAllUsers() { + // TODO (trump.wang) implement when backend is ready + } + + // GOOD (to add FIXME if you see some problem code) + badMethod() { + // FIXME [UIA-12345] rewrite this to a better structure + // ...bad code + } +} + +``` + ## Spaces and alignments ### Do not exceed 120 column width @@ -469,7 +519,6 @@ let foo = { ``` ### Set one space before function body curly bracket ```{```, do not set space after function name - ```javascript // BAD function isFooBar () { diff --git a/eslint-config-ringcentral/index.js b/eslint-config-ringcentral/index.js index be38a0c..15e547a 100644 --- a/eslint-config-ringcentral/index.js +++ b/eslint-config-ringcentral/index.js @@ -7,7 +7,6 @@ module.exports = { es6: true, mocha: true }, - extends: 'eslint:recommended', parser: 'babel-eslint', parserOptions: { ecmaFeatures: { @@ -16,7 +15,8 @@ module.exports = { }, sourceType: 'module' }, - plugins: ['react', 'import'], + plugins: ['react', 'import', 'ringcentral'], + extends: ['eslint:recommended', 'plugin:ringcentral/all'], globals: { chai: true, expect: true, diff --git a/eslint-config-ringcentral/package.json b/eslint-config-ringcentral/package.json index 383fcae..afbff48 100644 --- a/eslint-config-ringcentral/package.json +++ b/eslint-config-ringcentral/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-ringcentral", - "version": "0.3.1", + "version": "0.4.0", "description": "ESLint config for the RingCentral style guide", "main": "index.js", "scripts": { @@ -26,9 +26,16 @@ "url": "https://github.com/ringcentral/ringcentral-javascript/issues" }, "homepage": "https://github.com/ringcentral/ringcentral-javascript", + "devDependencies": { + "eslint": ">=4.1.1", + "eslint-plugin-import": "^2.7.0", + "eslint-plugin-react": "^7.1.0", + "eslint-plugin-ringcentral": "~1.0.5" + }, "peerDependencies": { "eslint": ">=4.1.1", "eslint-plugin-import": "^2.7.0", - "eslint-plugin-react": "^7.1.0" + "eslint-plugin-react": "^7.1.0", + "eslint-plugin-ringcentral": "~1.0.5" } }