114 Commits

Author SHA1 Message Date
Thomas Marek
a43c16e330 Explain why not to prefix methods with underscores 2016-08-29 18:19:22 -04:00
Mitsuru Ogawa
d20f33f660 Add link for Japanese translation 2016-08-09 19:06:43 +09:00
Joe Lencioni
52a2da4182 Add curlies around ref function body
The example we have here uses an implicit return, which is forbidden
when assigning. This triggers the no-return-assign rule.

Fixes #980
2016-08-02 09:09:12 -07:00
Zane Mountcastle
75c961a43f Change 'Brazilian' to 'Portuguese' 2016-08-01 10:41:15 +08:00
Joe Lencioni
4dbb2af7da Improve React HOC example
I decided that `WrappedComponent` is clearer than `Component` here, so I
made the switch. I also realized that `WrappedComponent.name` might
still be undefined, so I added a fallback value of "Component".
2016-07-27 09:54:00 -07:00
Joe Lencioni
1917968acb Add missing closing paren in HOC guideline
As pointed out by eagle-eyed @pepakriz.
2016-07-27 09:53:42 -07:00
Joe Lencioni
4c8f78921f Add guideline for displayName in higher-order components
This guideline will help us keep our higher-order components consistent
and easy to understand.

Fixes #968.
2016-07-26 16:51:08 -07:00
Doug Cole
892128366a change 'conjunctions' to 'contractions' 2016-07-23 11:53:45 -07:00
Your NameRonaldo
723e12a87d Airbnb React/JSX Style Guide translation for PT-BR 2016-07-18 18:20:32 -03:00
Your NameRonaldo
97da7b65c6 Airbnb React/JSX Style Guide translation for PT-br 2016-07-18 18:17:59 -03:00
Kevin Grandon
36d1561596 Prevent using string refs.
According to the official React documentation string refs are considered legacy and will be deprecated in the future.
2016-06-28 10:13:36 -07:00
Anton Backer
343dc2c34a Remove parens around single argument in React example
Parens around a single argument aren't in line with the js guide:

    If your function takes a single argument and doesn’t use braces,
    omit the parentheses.

0814be638f/README.md (arrows--one-arg-parens)

Another rule violation:

    Wrap JSX tags in parentheses when they span more than one line.

0814be638f/react/README.md (parentheses)
2016-06-17 17:33:49 -07:00
hunyong-song
22f59b6e1b Adding link korean translation 2016-06-16 10:20:03 +09:00
Lukasz Pietraszek
29eb575a52 Adding link polish translation 2016-06-11 09:39:03 +01:00
Alanna Scott
c247fd754b Avoid using an array index as key prop, prefer unique ID 2016-05-25 12:30:34 -07:00
Jordan Harband
4c4210f23d Remove trailing whitespace. 2016-05-25 18:19:19 +02:00
Jason
a8839173cc add chinese simplified for React/JSX style guide 2016-05-25 16:50:37 +08:00
Jimmy Jia
79af88d9d6 Clarify stateless component function naming 2016-04-22 12:13:22 -04:00
Jordan Harband
2dfd520930 [eslint config] [react] Add guide section on react/jsx-curly-spacing
Per #693.
2016-04-19 20:54:45 -07:00
Joe Lencioni
02414502b6 Upgrade eslint-plugin-jsx-a11y 0.6.2 -> 1.0.1
This new version renames most of the rules, and adds a number of new
rules that we will need to evaluate. I simply added them for now with
TODO comments so we remember to come back to them and make decisions
about each one. I also alphabetized the list to make it easier to find
what you are looking for.
2016-04-19 17:22:43 -07:00
Joe Lencioni
a929776d67 Improve guideline for image alt text
After digging into this rule a little more with @evcohen, we believe that
it is okay for images to have an empty string for alt text and have
updated the plugin to reflect that understanding. This commit bumps our
dependency on the rule to include this fix and updates our guideline to
match.
2016-04-08 18:42:51 -07:00
Jordan Harband
7c0bb0a6de [eslint config] [breaking] enable react/require-render-return 2016-04-06 22:57:44 -07:00
Joe Lencioni
3f73e35b18 Use jsx fenced codeblocks for JSX code
GitHub knows how to do JSX syntax highlighting. Since we are using JSX
in this document, I figured we might as well tell GitHub to highlight
the syntax as JSX here. This will lead to a better reading experience.
2016-04-06 14:51:45 -07:00
Joe Lencioni
f697a15e50 Add note and rule about not using accessKey
Inconsistencies between keyboard shortcuts and keyboard commands used by
people using screenreaders and keyboards complicate accessibility.
2016-04-06 14:51:44 -07:00
Joe Lencioni
0c3b13fe93 Add note and rule about valid, non-abstract ARIA roles
This rule will help people use only valid roles, which might save people
from simple, accessibility-busting mistakes.
2016-04-06 14:51:44 -07:00
Joe Lencioni
f2aca29ed9 Add note and rule about redundant alt text
Screenreaders already announce `img` elements as images, so there is no
need to include this information in the alt text. This will give people
using assistive technologies a smoother experience.
2016-04-06 14:51:44 -07:00
Joe Lencioni
acbddc1083 Add note and rule about image alt text
We want our React apps to be accessible. One thing that developers can
do is properly use alt text on images. Thankfully, there is an ESLint
rule that will enforce these things for us.
2016-04-06 14:51:22 -07:00
Gil Birman
94ace27f46 Allow arrow functions in JSX props 2016-03-21 14:53:48 -07:00
David Petersen
03d0054a46 Enable react/prefer-stateless-function rule 2016-03-02 09:19:16 -06:00
Joe Lencioni
e007ec5be9 Sort static methods above constructor for React
I think it makes more sense to put static methods above the constructor
in classes. I would like to update the ESLint configuration to match
this, but it looks like the react/sort-comp rule does not support it
quite yet.

  https://github.com/yannickcr/eslint-plugin-react/issues/128
2016-02-04 11:01:17 -08:00
Jordan Harband
da1d031ff8 [guide] [react] add a note preferring normal functions for functional stateless components. 2016-01-26 15:03:13 -08:00
Matt Brennan
94776c35eb Remove language interpretable as an ableist slur 2016-01-26 14:20:55 +00:00
Harrison Shoff
992a9cea58 [react][rule links] add eslint labels back 2016-01-25 22:23:16 -08:00
Harrison Shoff
d852f5190e [react][rule links] condense lines 2016-01-25 22:19:01 -08:00
Juan Lulkin
4d2578cc83 Fix PR comments
- Space between function name and args;
- use `render(){}` syntax in object literal;
- Fix link to section;
2016-01-20 22:36:11 +02:00
Juan Lulkin
a568c7cf18 Remove space from jsx literal and add space to function definition
According to PR comments.
2016-01-20 19:10:20 +02:00
Juan Lulkin
45834dde1c Favour stateless functions over classes when there's no state 2016-01-20 16:53:59 +02:00
Kevin Ivan
93a957f4f6 fix typo 2016-01-17 14:55:16 +01:00
Simen Bekkhus
96ef087bdf Allow multiple stateless components in a single file 2016-01-07 19:22:18 +01:00
Austin Witherow
fd6867d964 missing 's', create(s) under Method 2016-01-04 16:19:24 +01:00
Iurii Kucherov
bbaaf746db Add missing back tick 2015-12-29 22:54:02 +01:00
Jordan Gensler
e12e5f0480 Removing name prefix rules. 2015-12-23 14:57:22 -08:00
Jordan Gensler
ae69188304 Removing file extensions. Fixing typos. 2015-12-23 14:57:22 -08:00
Jordan Gensler
5c3137d736 Cleaning up the react styleguide. Adding additional info in props. 2015-12-23 14:57:22 -08:00
Joe Lencioni
474087c426 [readme] Use consistent whitespace in react readme
I noticed that some newlines and indentation were a little inconsistent
in this file, so I decided to smooth things out a bit. This should help
people who decide to modify this document in the future. When
determining which is the "right" way to format these things, I decided
to use the style used by base readme as a guide.
2015-12-23 10:12:42 -08:00
Joe Lencioni
a7d3e02a77 [readme] Add missing heading to react TOC
I noticed that this heading wasn't listed in the table of contents.
Adding it will help people see at-a-glance what they might find in this
document.
2015-12-23 10:12:42 -08:00
Joe Lencioni
450e64c9d2 [readme] Add backticks around code items in react readme
I noticed a number of places in this document where code was being
referenced but it was not marked as such. Adding backticks will instruct
the markdown parser to format these bits as code, which should improve
the readability of this document.
2015-12-23 10:12:42 -08:00
Joe Lencioni
055aa14518 [readme] Clean up isMounted section in react readme
When I added this section in f2dc5043a I didn't do a very good job of
following the style used in other parts of this repo. This commit
remedies that.
2015-12-22 22:46:25 -08:00
Joe Lencioni
f2dc5043a1 [eslint-config] [minor] Enable react/no-is-mounted rule
isMounted is an anti-pattern [0], is not available when using ES6
classes, and is on its way to being officially deprecated.
eslint-plugin-react recently added the react/no-is-mounted rule in
3.12.0 that prevents its use.

[0]: https://facebook.github.io/react/blog/2015/12/16/ismounted-antipattern.html

Finishes #633
2015-12-22 12:04:03 -08:00
Billy Janitsch
bbcb1371e5 Remove deprecated react/jsx-quotes 2015-12-15 15:59:40 -05:00