npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@balena/lint

v9.1.3

Published

Balena.io eslint & prettier wrapper

Downloads

41,953

Readme

@balena/lint

@balena/lint is a linter & formatter based on eslint and prettier to detect style errors based on balena.io coding guidelines.

Overview

@balena/lint uses balena's .eslintrc.js and .prettierrc. If a .eslintrc.js is found in the to-be-linted project directory or its parents then the rules found in it will be merged with the default @balena/lint ones. Another way to to override the default balena lint rules is by specifying a configuration file with the -f parameter.

Files checked

By default.ts and .tsx files are linted. You can also specify additional file extensions to be parse by using the -e option. Eg: "-e js -e jsx"

Prettier

You can reference the prettier configuration file to your consumer project from ./config/.prettierrc.

Usage

You can use this module as:

  1. A standalone project by installing it with npm install -g @balena/lint:
kostas@macbook:~/balena/test$ balena-lint src/
  ✓ src/test.ts

  ✓ Ok! » 0 errors and 0 warnings in 1 file
  1. A development dependency in package.json with npm install --save-dev @balena/lint. Then you can use the module in your build/testing process:
package.json
------------
...
"scripts": {
  "lint": "balena-lint src/ && echo \"Done!\""
},
...

kostas@macbook:~/balena/test$ npm run lint

> [email protected] lint /Users/kostas/balena/test
> balena-lint src/ && echo "Done!"

  ✓ src/test.ts

  ✓ Ok! » 0 errors and 0 warnings in 1 file

  Done!
  1. A development dependency, that will get picked up by your IDE/Editor eslint/prettier.

Manually create these config files in your project root:

.eslintrc.js

{
  "extends": [
    "./node_modules/@balena/lint/config/.eslintrc.js"
  ]
}

For prettier config create .prettierrc.js

const fs = require('fs');

module.exports = JSON.parse(fs.readFileSync('./node_modules/@balena/lint/config/.prettierrc', 'utf8'));

Rules that require type information

Some linting rules such as no-floating-promises require Typescript type information. To enable these rules, use the -t option to point to your project's tsconfig.json file, if any. Without the -t option, those rules will be disabled but may still print a warning message such as:
Warning: The 'no-floating-promises' rule requires type information.
To prevent this warning message from being printed, override the rules by creating a .eslintrc.js file as described in the previous sections. For example:

{
    "extends": "./node_modules/@balena/lint/config/.eslintrc.js",
    "rules": {
        "no-floating-promises": false
    }
}

Support

If you're having any problem, please raise an issue on GitHub and the balena.io team will be happy to help.

Tests

Run the test suite by doing:

$ npm install && npm test

Contribute

Before submitting a PR, please make sure that you include tests, and that npm run lint runs without a warning.

License

The project is licensed under the Apache 2.0 license.