Last active
October 16, 2018 16:02
-
-
Save oatmeaI/3fc59ae3471d0090b6e4bf36870c47ea to your computer and use it in GitHub Desktop.
Example Goodcheck Rules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rules: | |
- id: com.sideci.js.localstorage | |
pattern: | |
token: localStorage | |
glob: | |
- "**/*.js" | |
- "**/*.jsx" | |
- "**/*.ts" | |
- "**/*.tsx" | |
message: | | |
Be careful when using `localStorage`. | |
An exception may occur when accessing `localStorage` in Safari's private browsing mode. | |
When accessing `localStorage`, make sure to handle any possible exceptions. | |
fail: | | |
localStorage.setItem('abyssinian.issuesDescription.closed', 'true'); | |
justification: | |
- When exception handling is in place | |
- The code is not user-facing | |
- id: com.sideci.not-actcat | |
pattern: | |
regexp: actcat | |
case_sensitive: false | |
message: | |
Please do not use the name Actcat. | |
Actcat, Inc. has become Sider, Inc. | |
glob: | |
- "**/*.rb" | |
- "**/*.{js,jsx,ts,tsx}" | |
- "**/*.{yaml,yml}" | |
- "**/*.{erb,slim,html}" | |
- "**/*.md" | |
fail: | |
- Actcat, Inc. | |
- actcat | |
pass: | |
- Sider, Inc. | |
- id: com.sideci.npm.no-dev-dependencies | |
pattern: '"devDependencies"' | |
message: | |
Do no use `devDependencies` | |
Since we are using webpack, there is no reason to distinguish between modules to be installed during dev and production. | |
glob: | |
- "**/package.json" | |
fail: | |
- | | |
"devDependencies": { ... } | |
pass: | |
- devDependencies | |
- | | |
"dependencies": { ... } | |
- id: com.sideci.js.catch-rethrow | |
glob: | |
- "**/*.{js,jsx,ts,tsx}" | |
pattern: | |
token: "catch" | |
message: | | |
When using `try ... catch` or `Promise.prototype.catch()`, consider rethrowing the captured exception. | |
This way, the global exception handler catches the exception and notifies Bugsnag, etc. | |
If the exception does not get logged to Bugsnag, it may hinder the discovery of bugs and investigation of issues. | |
justification: | |
- Bugsnag is already being notified | |
fail: | |
- "try { ... } catch (err) { console.error(err) }" | |
- "fetch(url).then(...).catch(() => updateUI())" | |
- id: com.sideci.project_settings | |
pattern: | |
- プロジェクト設定 | |
- regexp: Project\sSettings | |
case_sensitive: false | |
message: | | |
Don't refer to "Repository Settings" as "Project Settings." | |
We should always use the term "Repository" to reduce user confusion. | |
fail: | |
- Project settings | |
pass: | |
- Repository Settings | |
- id: review.sider.html.target-blank | |
pattern: | |
- 'target="_blank"' | |
- "target='_blank'" | |
- 'target: "_blank"' | |
- "target: '_blank'" | |
glob: | |
- "**/*.{slim,erb,html,jsx,tsx}" | |
message: | | |
When using `target =" _ blank "` you should add `rel =" noopener "`. | |
It has a positive impact on security and performance. | |
See https://qiita.com/memolog/items/9913b0067e4e6883ed17 | |
fail: | |
- '<a href="..." target="_blank">...</a>' | |
- id: review.sider.typo.github | |
pattern: "Github" | |
glob: "**/*.{yml,yaml,rb,erb,slim,jb,js,jsx,ts,tsx,css,scss,md}" | |
message: "Typo: Github -> GitHub 😅" | |
fail: "Github" | |
pass: "GitHub" | |
justification: "Ignore 3rd-party identifier (e.g. X-Github-Media-Type)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment