Commit Graph

5 Commits

Author SHA1 Message Date
Paul O’Shannessy ecb34de574 Upgrade ESLint, fix code 2015-08-10 17:04:29 -07:00
Benjamin Woodruff 30cce21ae6 Load custom eslint rules as plugin, w/o --rulesdir
This allows us to load the eslint rules without requiring command-line
arguments, which avoids breaking editors with eslint plugins.

https://github.com/eslint/eslint/issues/2180#issuecomment-87722150
2015-06-04 17:04:45 -07:00
Benjamin Woodruff c91fd8ac14 Check warning/invariant calls have good messages
The `warning` implementation checked that the message is long enough to
be useful. See commit f5038829d for more information.

It makes more sense to move this into a lint rule, and also to apply it
for both `warning` and `invariant`. We can safely remove stuff from the
`warning` implementation as we replace the function internally anyways.

https://github.com/facebook/react/pull/4021#issuecomment-108694976
@spicyj
2015-06-04 14:19:22 -07:00
Benjamin Woodruff aecc48d877 Fix wording of warning-and-invariant-args linter
The wording for an incorrect number of arguments based on counting %s
substitutions. The previous wording was backwards and a bit yoda-like
leading to possible ambiguity.
2015-06-04 10:51:15 -07:00
Benjamin Woodruff 17e7046754 Add custom eslint rule for warning and invariant
See #2869

Checks that the *second* argument of warning and invariant are a literal
string, or a concatination of literal strings, and that the number of
arguments is correct based on the number of %s substrings.

This commit also fixes a few places where the existing code had broken
error messages!

The rule itself is pretty straightforward, although adding the tests
ended up being a bit painful, as eslint-tester depends on mocha, and
therefore needs to be run in a separate grunt task.
2015-06-03 17:19:32 -07:00