0
0
mirror of https://github.com/Doodle3D/Doodle3D-API synced 2024-12-23 14:13:47 +01:00
Doodle3D-API/jspm_packages/npm/babel-core@5.6.20/CONTRIBUTING.md
2015-07-15 15:06:18 +02:00

6.2 KiB

NOTE: BEFORE OPENING AN ISSUE PLEASE SEE THE README.


Setup | Running tests | Workflow | Dependencies | Code Standards | Internals


Contributing

Contributions are always welcome, no matter how large or small. Before contributing, please read the code of conduct.

Developing

Note: Babel moves fast. Only the latest release is guaranteed to build correctly. Older releases are not officially supported. If you attempt to build them, do that at your own risk.

Setup

$ git clone https://github.com/babel/babel
$ cd babel
$ make bootstrap

Then you can either run:

$ make build-core

to build Babel once or:

$ make watch-core

to have Babel build itself then incrementally build files on change.

Running tests

You can run tests via:

$ make test

This is mostly overkill and you can limit the tests to a select few by directly running them with mocha:

$ mocha test/core/transformation.js

Use mocha's --grep option to run a subset of tests by name:

$ mocha test/core/transformation.js --grep es7

If you don't have mocha installed globally, you can still use it from Babel's dependencies in node_modules, but make sure node_modules/.bin is added to your $PATH environment variable.

Workflow

  • Fork the repository
  • Clone your fork and change directory to it (git clone git@github.com:yourUserName/babel.git && cd babel)
  • Install the project dependencies (make bootstrap)
  • Link your forked clone (npm link)
  • Develop your changes ensuring you're fetching updates from upstream often
  • Ensure the test are passing (make test)
  • Create new pull request explaining your proposed change or reference an issue in your commit message

Dependencies

  • ast-types This is required to monkeypatch regenerators AST definitions. Could be improved in the future.

  • chalk This is used for terminal color highlighting for syntax errors.

  • convert-source-map Turns a source map object into a comment etc.

  • core-js Used for the polyfill.

  • debug Used to output debugging information when NODE_DEBUG is set to babel.

  • detect-indent This is used in the code generator so it can infer indentation.

  • estraverse The only method on this is attachComments. I'd like to implement our own comment attachment algorithm eventually though.

  • esutils Various ES related utilities. Check whether something is a keyword etc.

  • fs-readdir-recursive Recursively search a directory for.

  • globals A list of JavaScript global variables. This is used by the scope tracking to check for colliding variables.

  • is-integer Checks if something is an integer.

  • js-tokens This is used to get tokens for syntax error highlighting.

  • line-numbers Used to produce the code frames in syntax errors.

  • lodash Used for various utilities.

  • minimatch This is used to match glob-style ignore/only filters.

  • output-file-sync Synchronously writes a file and create its ancestor directories if needed.

  • path-is-absolute Checks if a path is absolute. C:\foo and \foo are considered absolute.

  • regenerator This is used to transform generators/async functions.

  • regexpu Used to transform unicode regex patterns.

  • repeating Repeats a string.

  • shebang-regex Literally just a regex that matches shebangs.

  • slash Normalises path separators.

  • source-map Generates sourcemaps.

  • source-map-support Adds source map support to babel-node/babel/register.

  • strip-json-comments Remove comments from a JSON string. This is used for .babelrc files.

  • to-fast-properties A V8 trick to put an object into fast properties mode.

  • trim-right Trims the rightside whitespace.

  • path-exists Checks if a path exists. (replaces the deprecated fs.exists methods)

  • home-or-tmp Gets the user home directory with fallback to the system temporary directory. This is used to resolve the babel-node/babel/register cache.

  • resolve Implements the require.resolve() algorithm such that we can require.resolve() on behalf of a file asynchronously and synchronously.

Code Standards

  • General

    • Max of five arguments for functions
    • Max depth of four nested blocks
    • 2-spaced soft tabs
  • Naming

    • CamelCase all class names
    • camelBack all variable names
  • Spacing

    • Spaces after all keywords
    • Spaces before all left curly braces
  • Comments

    • Use JSDoc-style comments for methods
    • Single-line comments for ambiguous code
  • Quotes

    • Always use double quotes
    • Only use single quotes when the string contains a double quote
  • Declaration

    • No unused variables
    • No pollution of global variables and prototypes

Internals

Please see /doc for internals documentation relevant to developing babel.