Skip to content

Commit 24b98cf

Browse files
Initial Files
0 parents  commit 24b98cf

31 files changed

+6902
-0
lines changed

.eslintrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
"extends": ["godaddy", "plugin:jest/recommended"]
3+
};

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.idea
2+
.DS_Store
3+
node_modules
4+
coverage

.npmignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.idea
2+
.DS_Store
3+
node_modules
4+
coverage
5+
6+
tests
7+
*.spec.js
8+
jest.config.js
9+
locales

.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tag-version-prefix=""
2+

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# CHANGELOG
2+
3+
### 1.0.0
4+
5+
- Initial release.

CODE_OF_CONDUCT.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Contributing
2+
3+
Everyone is welcome to contribute to GoDaddy's Open Source Software. Contributing doesn’t just mean
4+
submitting pull requests. To get involved you can, report or triage bugs and participate in
5+
discussions on the evolution of each project.
6+
7+
No matter how you want to get involved, we ask that you first learn what’s expected of anyone who
8+
participates in the project by reading the Contribution Guidelines.
9+
10+
**Please Note:** GitHub is for bug reports and contributions primarily - if you have a support
11+
question head over to [GoDaddy's Open Source Software Slack channel][slack].
12+
13+
## Answering Questions
14+
15+
One of the most important and immediate ways you can support this project is to answer questions on [Slack][slack] or
16+
[Github][issues]. Whether you’re helping a newcomer understand a feature or troubleshooting an edge case with a
17+
seasoned developer, your knowledge and experience with JS can go a long way to help others.
18+
19+
## Reporting Bugs
20+
21+
**Do not report potential security vulnerabilities here. Refer to [SECURITY.md](./SECURITY.md) for more
22+
details about the process of reporting security vulnerabilities.**
23+
24+
Before submitting a ticket, please be sure to have a simple replication of the behavior.
25+
If the issue is isolated to one of the dependencies of this project. Please create a Github issue in that project.
26+
All dependencies are open source software and can be easily found through [npm].
27+
28+
Submit a ticket for your issue, assuming one does not already exist:
29+
- Create it on our [Issue Tracker][issues]
30+
- Clearly describe the issue by following the template layout
31+
- Make sure to include steps to reproduce the bug.
32+
- A reproducible (unit) test could be helpful in solving the bug.
33+
- Describe the environment that (re)produced the problem.
34+
35+
> For a bug to be actionable, it needs to be reproducible. If you or contributors can’t reproduce the bug,
36+
> try to figure out why. Please take care to stay involved in discussions around solving the problem.
37+
38+
## Triaging bugs or contributing code
39+
40+
If you're triaging a bug, try to reduce it. Once a bug can be reproduced, reduce it to the smallest amount of
41+
code possible. Reasoning about a sample or unit test that reproduces a bug in just a few lines of code is
42+
easier than reasoning about a longer sample.
43+
44+
From a practical perspective, contributions are as simple as:
45+
- Forking the repository on GitHub.
46+
- Making changes to your forked repository.
47+
- When committing, reference your issue (if present) and include a note about the fix.
48+
- If possible, and if applicable, please also add/update unit tests for your changes.
49+
- Push the changes to your fork and submit a pull request to the 'master' branch of the projects' repository.
50+
51+
If you are interested in making a large change and feel unsure about its overall effect,
52+
please make sure to first discuss the change and reach a consensus with core contributors through [slack].
53+
Then ask about the best way to go about making the change.
54+
55+
## Code Review
56+
57+
Any open source project relies heavily on code review to improve software quality:
58+
59+
> All significant changes, by all developers, must be reviewed before they are committed to the repository.
60+
> Code reviews are conducted on GitHub through comments on pull requests or commits.
61+
> The developer responsible for a code change is also responsible for making all necessary review-related changes.
62+
63+
Sometimes code reviews will take longer than you would hope for, especially for larger features.
64+
Here are some accepted ways to speed up review times for your patches:
65+
66+
- Review other people’s changes. If you help out, everybody will be more willing to do the same for you.
67+
Goodwill is our currency.
68+
- Split your change into multiple smaller changes. The smaller your change, the higher the probability that
69+
somebody will take a quick look at it.
70+
- Ping the change on [slack]. If it is urgent, provide reasons why it is important to get this change landed.
71+
Remember that you’re asking for valuable time from other professional developers.
72+
73+
**Note that anyone is welcome to review and give feedback on a change, but only people with commit access
74+
to the repository can approve it.**
75+
76+
## Attribution of Changes
77+
78+
When contributors submit a change to this project, after that change is approved,
79+
other developers with commit access may commit it for the author. When doing so,
80+
it is important to retain correct attribution of the contribution. Generally speaking,
81+
Git handles attribution automatically.
82+
83+
## Code Documentation
84+
85+
Ensure that every function in `eslint-plugin-react-intl` is documented and follows the standards
86+
set by [JSDoc]. Finally, please stick to the code style as defined by the [Godaddy JS styleguide][style].
87+
88+
# Additional Resources
89+
90+
- [General GitHub Documentation](https://help.github.com/)
91+
- [GitHub Pull Request documentation](https://help.github.com/send-pull-requests/)
92+
- [JSDoc]
93+
94+
[issues]: https://github.com/godaddy/eslint-plugin-react-intl/issues
95+
[slack]: https://godaddy-oss.slack.com/messages/CHXEP5DNH
96+
[JSDoc]: http://usejsdoc.org/
97+
[npm]: http://npmjs.org/
98+
[style]: https://github.com/godaddy/javascript/#godaddy-style

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019 GoDaddy Operating Company, LLC.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# @godaddy/eslint-plugin-react-intl
2+
3+
Validation of locale ids used with react-intl functions/components like `<FormattedMessage />`, `formatMessage` and `defineMessages`.
4+
5+
## Installation
6+
7+
You'll first need to install [ESLint](http://eslint.org):
8+
9+
```
10+
$ npm install eslint --save-dev
11+
```
12+
13+
Next, install `@godaddy/eslint-plugin-react-intl`:
14+
15+
```
16+
$ npm install @godaddy/eslint-plugin-react-intl --save-dev
17+
```
18+
19+
**Note:** If you installed ESLint globally (using the `-g` flag) than you must also install `@godaddy/eslint-plugin-react-intl` globally.
20+
21+
## Usage
22+
23+
Add `@godaddy/react-intl` to the config. You can omit the `eslint-plugin-` prefix:
24+
```json
25+
{
26+
"extends": ["godaddy/react-intl"]
27+
}
28+
```
29+
30+
Alternatively, you can add `@godaddy/react-intl` to the plugins section of config:
31+
32+
```json
33+
{
34+
"plugins": [
35+
"@godaddy/react-intl"
36+
]
37+
}
38+
```
39+
40+
By default, `id-missing` and `no-default` rules are enabled to show as errors, and `id-prefix` rule is disabled.
41+
If you need to set any of these rules differently, then configure the rules under the rules section.
42+
43+
```json
44+
{
45+
"rules": {
46+
"@godaddy/react-intl/<rule-name>": 2
47+
}
48+
}
49+
```
50+
51+
By default, the plugin reads `locales/en-US.json` to apply these eslint rules. The default can be
52+
changed by adding this setting to the config
53+
54+
```json
55+
{
56+
"settings": {
57+
"localeFiles": [
58+
"<path to locale file.json>",
59+
"<path to any other locale file.json>"
60+
]
61+
}
62+
}
63+
```
64+
65+
If your IDE integrates with eslint, and you are working on multiple packages in a project such as a monorepo,
66+
then it may have trouble finding which locale files to check keys against.
67+
To help with this, you can specify the `projectRoot` setting.
68+
This will need to be an absolute path to the package, which can be determined dynamically from one machine to
69+
another by using `__dirname` in a .eslintrc.js file.
70+
71+
```js
72+
module.exports = {
73+
"settings": {
74+
"projectRoot": __dirname
75+
}
76+
}
77+
```
78+
79+
## Locale Files
80+
81+
The locale files should be named with their market id (like en-US.json) and should contain data
82+
in key-value pair format
83+
84+
```json
85+
{
86+
"in_a_example": "Example",
87+
"in_a_another_example": "Another Example"
88+
}
89+
```
90+
91+
92+
## Supported Rules
93+
94+
* [id-missing](docs/rules/id-missing.md) Enforces react-intl message ids to be in locale file
95+
* [id-prefix](docs/rules/id-prefix.md) Enforces react-intl message ids to use predefined prefixes
96+
* [no-default](docs/rules/no-default.md) Disallows use of defaultMessage with react-intl

SECURITY.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Reporting Security Issues
2+
3+
We take security very seriously at GoDaddy. We appreciate your efforts to
4+
responsibly disclose your findings, and will make every effort to acknowledge
5+
your contributions.
6+
7+
## Where should I report security issues?
8+
9+
In order to give the community time to respond and upgrade, we strongly urge you
10+
report all security issues privately.
11+
12+
To report a security issue in one of our Open Source projects email us directly
13+
at **[email protected]** and include the word "SECURITY" in the subject line.
14+
15+
This mail is delivered to our Open Source Security team.
16+
17+
After the initial reply to your report, the team will keep you informed of the
18+
progress being made towards a fix and announcement, and may ask for additional
19+
information or guidance.

0 commit comments

Comments
 (0)