Skip to content

Latest commit

 

History

History
78 lines (70 loc) · 3.46 KB

CONTRIBUTING.md

File metadata and controls

78 lines (70 loc) · 3.46 KB

Contributing

Contributions are always welcome. If you don't know what how you can help, you can check issues or ask @zloirock.

How to add a new polyfill

Style and standards

Coding style should follow our .eslintrc. You can test it by calling npm run eslint. Different places have different syntax and standard library limitations:

  • Polyfill implementations should use only ES3 syntax and standard library. Polyfills should not use another polyfill from the global namespace.
  • In unit tests should be used modern syntax with our minimalistic Babel config. Unit tests for the pure version should not use any modern standard library features.
  • In building tools and tests, performed in Node.js, should be used only available in Node.js 4 syntax and standard library.

File names should be in kebab-case. Name of files with polyfills should follow naming convention namespace.subnamespase-where-required.feature-name, for example, esnext.promise.try. Top level namespace could be es for stable ECMAScript features, esnext for ECMAScript proposals, web for another web standards and core for helpers. Internal core-js modules should use _ prefix.

Testing

Before testing, you should install dependencies:

$ npm i

You can run all tests by

$ npm run test

You can run parts of the test case separately:

  • Linting:
$ npm run lint
  • Global version unit tests:
$ npm run unit-tests
  • pure version unit tests:
$ npm run unit-tests-pure
$ npm run promises-tests
$ npm run observables-tests
  • CommonJS entry points tests:
$ npm run commonjs-tests

If you want to run tests in a certain browser at first you should build packages and test bundles:

$ npm run build
  • For running global version unit test case use this file:
tests/tests.html
  • For running the pure version unit test case use this file:
tests/pure.html
$ npm run bundle-promises-tests

and after that use this file:

tests/promises-aplus.html