You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
3.8 KiB

7 months ago
  1. # How to contribute
  2. - [Getting help](#getting-help)
  3. - [Submitting bug reports](#submitting-bug-reports)
  4. - [Contributing code](#contributing-code)
  5. ## Getting help
  6. Community discussion, questions, and informal bug reporting is done on the
  7. [discuss.CodeMirror forum](http://discuss.codemirror.net).
  8. ## Submitting bug reports
  9. The preferred way to report bugs is to use the
  10. [GitHub issue tracker](http://github.com/codemirror/CodeMirror/issues). Before
  11. reporting a bug, read these pointers.
  12. **Note:** The issue tracker is for *bugs*, not requests for help. Questions
  13. should be asked on the
  14. [discuss.CodeMirror forum](http://discuss.codemirror.net) instead.
  15. ### Reporting bugs effectively
  16. - CodeMirror is maintained by volunteers. They don't owe you anything, so be
  17. polite. Reports with an indignant or belligerent tone tend to be moved to the
  18. bottom of the pile.
  19. - Include information about **the browser in which the problem occurred**. Even
  20. if you tested several browsers, and the problem occurred in all of them,
  21. mention this fact in the bug report. Also include browser version numbers and
  22. the operating system that you're on.
  23. - Mention which release of CodeMirror you're using. Preferably, try also with
  24. the current development snapshot, to ensure the problem has not already been
  25. fixed.
  26. - Mention very precisely what went wrong. "X is broken" is not a good bug
  27. report. What did you expect to happen? What happened instead? Describe the
  28. exact steps a maintainer has to take to make the problem occur. We can not
  29. fix something that we can not observe.
  30. - If the problem can not be reproduced in any of the demos included in the
  31. CodeMirror distribution, please provide an HTML document that demonstrates
  32. the problem. The best way to do this is to go to
  33. [jsbin.com](http://jsbin.com/ihunin/edit), enter it there, press save, and
  34. include the resulting link in your bug report.
  35. ## Contributing code
  36. Note that we are not accepting any new addons or modes into the main
  37. distribution. If you've written such a module, please distribute it as
  38. a separate NPM package.
  39. - Make sure you have a [GitHub Account](https://github.com/signup/free)
  40. - Fork [CodeMirror](https://github.com/codemirror/CodeMirror/)
  41. ([how to fork a repo](https://help.github.com/articles/fork-a-repo))
  42. - Make your changes
  43. - If your changes are easy to test or likely to regress, add tests.
  44. Tests for the core go into `test/test.js`, some modes have their own
  45. test suite under `mode/XXX/test.js`. Feel free to add new test
  46. suites to modes that don't have one yet (be sure to link the new
  47. tests into `test/index.html`).
  48. - Follow the general code style of the rest of the project (see
  49. below). Run `bin/lint` to verify that the linter is happy.
  50. - Make sure all tests pass. Visit `test/index.html` in your browser to
  51. run them.
  52. - Submit a pull request
  53. ([how to create a pull request](https://help.github.com/articles/fork-a-repo)).
  54. Don't put more than one feature/fix in a single pull request.
  55. By contributing code to CodeMirror you
  56. - agree to license the contributed code under CodeMirror's [MIT
  57. license](https://codemirror.net/5/LICENSE).
  58. - confirm that you have the right to contribute and license the code
  59. in question. (Either you hold all rights on the code, or the rights
  60. holder has explicitly granted the right to use it like this,
  61. through a compatible open source license or through a direct
  62. agreement with you.)
  63. ### Coding standards
  64. - 2 spaces per indentation level, no tabs.
  65. - Note that the linter (`bin/lint`) which is run after each commit
  66. complains about unused variables and functions. Prefix their names
  67. with an underscore to muffle it.
  68. - CodeMirror does *not* follow JSHint or JSLint prescribed style.
  69. Patches that try to 'fix' code to pass one of these linters will be
  70. unceremoniously discarded.