Rules get exported via a single function in a single file. Each scanner looks at relevant files and passes each file through a parser which then hands off to a set of rules that look for specific things. ![]() For example: CSS files use CSSScanner JavaScript files use JavaScriptScanner. ![]() We are heavily relying on ESLint for JavaScript linting, cheerio for HTML parsing as well as fluent.js for parsing language packs. In a nutshell the way the linter works is to take an add-on package, extract the metadata from the xpi (zip) format and then process the files it finds through various content scanners. This script automates all the steps described in the addons-frontend docs, without any confirmation step. In order to update the locales (when new localized strings are added to the codebase), run the following script from the master branch. The localization process is very similar to how we do it for addons-frontend: locales are always updated on the master branch, any PR that changes or introduces new localized strings should be merged on master first. As a developer, you have to run it (with npm run prettier-dev) before submitting a Pull Request. We use Prettier to automatically format our JavaScript code and stop all the on-going debates over styles. Logging on the CLI can be enabled with -log-level.Logging in tests can be enabled using an env var e.g: LOG_LEVEL=debug jest test.By default logging is off (level is set to 'fatal').Please make sure you read their documentation for more details. Jest is being used as a test-runner but also provides helpful tools. ![]() We are using using Sinon for assertions, mocks, stubs and more see the Sinon docs for the API available. Use the coverage data in the test output to work out what lines aren't covered and ensure they're covered. We're looking to maintain coverage at 100%. This will watch for file-changes and re-runs the test suite. Once you build the library you can use the CLI in bin/addons-linter. You can run npm run build to build the library. Run Prettier and fail if some code has been changed without being formattedĪutomatically compare and format modified source files against the master branch Runs the tests with coverage (watches for changes)Īutomatically format the whole code-base with Prettier
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |