lint: Add documentation lint check for JavaScript spelling.

This commit is contained in:
Tim Abbott 2016-07-12 19:22:21 -07:00
parent 8257701dc9
commit 2338421c6d
5 changed files with 18 additions and 14 deletions

View File

@ -39,7 +39,7 @@ All notable changes to the Zulip server are documented in this file.
- Migrated development environment setup scripts to tools/setup/. - Migrated development environment setup scripts to tools/setup/.
- Expanded test coverage for several areas of the product. - Expanded test coverage for several areas of the product.
- Simplified the API for writing new webhook integrations. - Simplified the API for writing new webhook integrations.
- Removed most of the remaining javascript global variables. - Removed most of the remaining JavaScript global variables.
### 1.3.12 - 2016-05-10 ### 1.3.12 - 2016-05-10
- CVE-2016-4426: Bot API keys were accessible to other users in the same realm. - CVE-2016-4426: Bot API keys were accessible to other users in the same realm.

View File

@ -23,7 +23,7 @@ The Vagrant setup process runs this for you.
`lint-all` runs many lint checks in parallel, including `lint-all` runs many lint checks in parallel, including
- Javascript ([JSLint](http://www.jslint.com/)) - JavaScript ([JSLint](http://www.jslint.com/))
> `tools/jslint/check-all.js` contains a pretty fine-grained set of > `tools/jslint/check-all.js` contains a pretty fine-grained set of
> JSLint options, rule exceptions, and allowed global variables. If > JSLint options, rule exceptions, and allowed global variables. If
@ -119,9 +119,9 @@ string, use the `id` function, as it will simplify future code changes.
In most contexts in JavaScript where a string is needed, you can pass a In most contexts in JavaScript where a string is needed, you can pass a
number without any explicit conversion. number without any explicit conversion.
### Javascript var ### JavaScript var
Always declare Javascript variables using `var`: Always declare JavaScript variables using `var`:
var x = ...; var x = ...;
@ -129,12 +129,12 @@ In a function, `var` is necessary or else `x` will be a global variable.
For variables declared at global scope, this has no effect, but we do it For variables declared at global scope, this has no effect, but we do it
for consistency. for consistency.
Javascript has function scope only, not block scope. This means that a JavaScript has function scope only, not block scope. This means that a
`var` declaration inside a `for` or `if` acts the same as a `var` `var` declaration inside a `for` or `if` acts the same as a `var`
declaration at the beginning of the surrounding `function`. To avoid declaration at the beginning of the surrounding `function`. To avoid
confusion, declare all variables at the top of a function. confusion, declare all variables at the top of a function.
### Javascript `for (i in myArray)` ### JavaScript `for (i in myArray)`
Don't use it: Don't use it:
[[1]](http://stackoverflow.com/questions/500504/javascript-for-in-with-arrays), [[1]](http://stackoverflow.com/questions/500504/javascript-for-in-with-arrays),
@ -229,7 +229,7 @@ Whitespace guidelines:
used for inline dictionaries, put no space before it and at least used for inline dictionaries, put no space before it and at least
one space after. Only use more than one space for alignment. one space after. Only use more than one space for alignment.
### Javascript ### JavaScript
Don't use `==` and `!=` because these operators perform type coercions, Don't use `==` and `!=` because these operators perform type coercions,
which can mask bugs. Always use `===` and `!==`. which can mask bugs. Always use `===` and `!==`.

View File

@ -46,17 +46,17 @@ templating systems.
---------------------------------------- ----------------------------------------
### Javascript and other static assets ### JavaScript and other static assets
* `static/js/` Zulip's own javascript. * `static/js/` Zulip's own JavaScript.
* `static/styles/` Zulip's own CSS. * `static/styles/` Zulip's own CSS.
* `static/images/` Zulip's images. * `static/images/` Zulip's images.
* `static/third/` Third-party javascript and CSS that has been vendored. * `static/third/` Third-party JavaScript and CSS that has been vendored.
* `node_modules/` Third-party javascript installed via `npm`. * `node_modules/` Third-party JavaScript installed via `npm`.
* `assets/` For assets not to be served to the web (e.g. the system to * `assets/` For assets not to be served to the web (e.g. the system to
generate our favicons). generate our favicons).

View File

@ -150,7 +150,7 @@ While the Zulip server has a great codebase compared to most projects
of its size, it takes work to keep it that way. of its size, it takes work to keep it that way.
* [Migrate most web routes to REST API](https://github.com/zulip/zulip/issues/611) * [Migrate most web routes to REST API](https://github.com/zulip/zulip/issues/611)
* [Finish purging global variables from the Zulip javascript](https://github.com/zulip/zulip/issues/610) * [Finish purging global variables from the Zulip JavaScript](https://github.com/zulip/zulip/issues/610)
* [Finish deprecating and remove the pre-REST Zulip /send_message API](https://github.com/zulip/zulip/issues/730) * [Finish deprecating and remove the pre-REST Zulip /send_message API](https://github.com/zulip/zulip/issues/730)
* [Split Tornado subsystem into a separate Django app](https://github.com/zulip/zulip/issues/729) * [Split Tornado subsystem into a separate Django app](https://github.com/zulip/zulip/issues/729)
* [Clean up clutter in the root of the zulip.git repository](https://github.com/zulip/zulip/issues/707) * [Clean up clutter in the root of the zulip.git repository](https://github.com/zulip/zulip/issues/707)
@ -186,7 +186,7 @@ of its size, it takes work to keep it that way.
* [Overhaul new contributor documentation](https://github.com/zulip/zulip/issues/677) * [Overhaul new contributor documentation](https://github.com/zulip/zulip/issues/677)
* [Replace closure-compiler with a faster minifier toolchain](https://github.com/zulip/zulip/issues/693) * [Replace closure-compiler with a faster minifier toolchain](https://github.com/zulip/zulip/issues/693)
* [Add support for building frontend features in React](https://github.com/zulip/zulip/issues/694) * [Add support for building frontend features in React](https://github.com/zulip/zulip/issues/694)
* [Use a javascript bundler like webpack](https://github.com/zulip/zulip/issues/695) * [Use a JavaScript bundler like webpack](https://github.com/zulip/zulip/issues/695)
## Documentation ## Documentation

View File

@ -294,7 +294,11 @@ html_rules = whitespace_rules + [
'description': "`placeholder` value should be translatable."}, 'description': "`placeholder` value should be translatable."},
] ]
json_rules = [] # just fix newlines at ends of files json_rules = [] # just fix newlines at ends of files
markdown_rules = markdown_whitespace_rules markdown_rules = markdown_whitespace_rules + [
{'pattern': ' [jJ]avascript',
'exclude': set(['README.dev.md']), # temporary exclusion to avoid merge conflicts
'description': "javascript should be spelled JavaScript"},
]
txt_rules = whitespace_rules txt_rules = whitespace_rules
def check_custom_checks_py(): def check_custom_checks_py():