Add prettier-ci npm script (#3132)
This commit is contained in:
Родитель
7f5cb6753f
Коммит
60b3776909
|
@ -13,6 +13,7 @@ LICENSE
|
|||
/locale/
|
||||
/node_modules/
|
||||
/tests/fixtures/
|
||||
/coverage/
|
||||
|
||||
# white-list files we want to process
|
||||
!*.js
|
||||
|
|
|
@ -15,6 +15,12 @@
|
|||
"options": {
|
||||
"parser": "babel"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": "*.md",
|
||||
"options": {
|
||||
"proseWrap": "preserve"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ script:
|
|||
- npm run lint
|
||||
# run integration tests using an addons-linter binary in a production-like environment
|
||||
- npm run test-integration:production
|
||||
- npm run prettier-ci
|
||||
notifications:
|
||||
slack:
|
||||
if: branch = master
|
||||
|
|
|
@ -151,6 +151,7 @@ Dependencies are automatically kept up-to-date using [renovatebot](https://renov
|
|||
| npm run test-coverage-once | Runs the tests once with coverage |
|
||||
| npm run test-integration-linter | Runs our integration test-suite |
|
||||
| npm run prettier | Automatically format the whole code-base with Prettier |
|
||||
| npm run prettier-ci | Run [Prettier][] and fail if some code has been changed without being formatted |
|
||||
| npm run prettier-dev | Automatically compare and format modified source files against the master branch |
|
||||
|
||||
### Building
|
||||
|
@ -221,3 +222,4 @@ After merging the PR, [create a new release][new release] with the same tag name
|
|||
|
||||
[new release]: https://github.com/mozilla/addons-linter/releases/new
|
||||
[semver]: http://semver.org/
|
||||
[prettier]: https://prettier.io/
|
||||
|
|
|
@ -6,26 +6,26 @@ Rules are sorted by severity.
|
|||
|
||||
## JavaScript
|
||||
|
||||
| Message code | Severity | Description |
|
||||
| -------------------------- | -------- | -------------------------------------------------------------------------------------- |
|
||||
| `KNOWN_LIBRARY` | notice | This is version of a JS library is known and generally accepted. |
|
||||
| `OPENDIALOG_NONLIT_URI` | notice | openDialog called with non-literal parameter. |
|
||||
| `EVENT_LISTENER_FOURTH` | notice | `addEventListener` called with truthy fourth argument. |
|
||||
| `UNEXPECTED_GLOGAL_ARG` | warning | Unexpected global passed as an argument. |
|
||||
| `NO_IMPLIED_EVAL` | warning | disallow the use of `eval()`-like methods. |
|
||||
| `OPENDIALOG_REMOTE_URI` | warning | openDialog called with non-local URI. |
|
||||
| `NO_DOCUMENT_WRITE` | warning | Use of `document.write` strongly discouraged. |
|
||||
| `JS_SYNTAX_ERROR` | warning | JavaScript compile-time error. |
|
||||
| `UNADVISED_LIBRARY` | warning | This version of a JS library is not recommended. |
|
||||
| `DEPRECATED_API` | warning | API is deprecated. |
|
||||
| `STORAGE_SYNC` | warning | Temporary IDs can cause issues with `storage.sync`. |
|
||||
| `STORAGE_MANAGED` | warning | Temporary IDs can cause issues with `storage.managed`. |
|
||||
| `IDENTITY_GETREDIRECTURL` | warning | Temporary IDs can cause issues with `identity.getRedirectURL`. |
|
||||
| `RUNTIME_ONMESSAGEEXTERNAL`| warning | Temporary IDs can cause issues with `runtime.onMessageExternal`. |
|
||||
| `RUNTIME_ONCONNECTEXTERNAL`| warning | Temporary IDs can cause issues with `runtime.onConnectExternal`. |
|
||||
| `BANNED_LIBRARY` | error | This version of a JS library is banned for security reasons. |
|
||||
| `INCOMPATIBLE_API` | warning | API not compatible with `applications.gecko.strict_min_version` |
|
||||
| `ANDROID_INCOMPATIBLE_API` | warning | API not compatible with Firefox for Android at `applications.gecko.strict_min_version` |
|
||||
| Message code | Severity | Description |
|
||||
| --------------------------- | -------- | -------------------------------------------------------------------------------------- |
|
||||
| `KNOWN_LIBRARY` | notice | This is version of a JS library is known and generally accepted. |
|
||||
| `OPENDIALOG_NONLIT_URI` | notice | openDialog called with non-literal parameter. |
|
||||
| `EVENT_LISTENER_FOURTH` | notice | `addEventListener` called with truthy fourth argument. |
|
||||
| `UNEXPECTED_GLOGAL_ARG` | warning | Unexpected global passed as an argument. |
|
||||
| `NO_IMPLIED_EVAL` | warning | disallow the use of `eval()`-like methods. |
|
||||
| `OPENDIALOG_REMOTE_URI` | warning | openDialog called with non-local URI. |
|
||||
| `NO_DOCUMENT_WRITE` | warning | Use of `document.write` strongly discouraged. |
|
||||
| `JS_SYNTAX_ERROR` | warning | JavaScript compile-time error. |
|
||||
| `UNADVISED_LIBRARY` | warning | This version of a JS library is not recommended. |
|
||||
| `DEPRECATED_API` | warning | API is deprecated. |
|
||||
| `STORAGE_SYNC` | warning | Temporary IDs can cause issues with `storage.sync`. |
|
||||
| `STORAGE_MANAGED` | warning | Temporary IDs can cause issues with `storage.managed`. |
|
||||
| `IDENTITY_GETREDIRECTURL` | warning | Temporary IDs can cause issues with `identity.getRedirectURL`. |
|
||||
| `RUNTIME_ONMESSAGEEXTERNAL` | warning | Temporary IDs can cause issues with `runtime.onMessageExternal`. |
|
||||
| `RUNTIME_ONCONNECTEXTERNAL` | warning | Temporary IDs can cause issues with `runtime.onConnectExternal`. |
|
||||
| `BANNED_LIBRARY` | error | This version of a JS library is banned for security reasons. |
|
||||
| `INCOMPATIBLE_API` | warning | API not compatible with `applications.gecko.strict_min_version` |
|
||||
| `ANDROID_INCOMPATIBLE_API` | warning | API not compatible with Firefox for Android at `applications.gecko.strict_min_version` |
|
||||
|
||||
## Markup
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"test-integration:production": "node tests/integration/run-as-production-env.js test-integration tests/integration/addons-linter",
|
||||
"lint": "npm run eslint",
|
||||
"prettier": "prettier --write '**'",
|
||||
"prettier-ci": "prettier --list-different '**' || (echo '\n\nThis failure means you did not run `npm run prettier-dev` before committing\n\n' && exit 1)",
|
||||
"prettier-dev": "pretty-quick --branch master",
|
||||
"publish-rules": "scripts/build-rules && cp node_modules/gfm.css/gfm.css docs/html/gfm.css && scripts/publish-rules",
|
||||
"gen-contributing-toc": "doctoc CONTRIBUTING.md"
|
||||
|
|
Загрузка…
Ссылка в новой задаче