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

eslint-config-oceanprotocol

v2.0.4

Published

ESLint configuration for all of Ocean Protocol's JavaScript

Downloads

7,377

Readme

banner

💅 🦋 Shareable ESLint config for keeping JavaScript consistent across all of Ocean Protocol's projects, built upon JavaScript Standard Style.

npm Build Status js oceanprotocol code style: prettier

This cat clearly forgot to lint her JavaScript before deployment:

cat not linting correctlyExhibit A: cat not linting correctly

Don't be like that cat.

Table of Contents


Usage

For every project containing JavaScript, ESLint should be set up with this base setup.

npm install --save-dev eslint eslint-config-oceanprotocol

Then, create a new file .eslintrc in the root of your project and fill with:

{
  "extends": "oceanprotocol"
}

React

When using within a React project use this to get set up:

npm i -D eslint eslint-config-oceanprotocol

And in your .eslintrc:

{
  "extends": ["oceanprotocol", "oceanprotocol/react"]
}

Prettier

Additionally, you should add Prettier to your project and work with it through ESLint:

npm i -D prettier eslint-config-prettier eslint-plugin-prettier

Then add a .prettierrc file to the root of your project with this content:

{
  "semi": false,
  "singleQuote": true,
  "trailingComma": "none"
}

Finally, modify your .eslintrc:

{
  "extends": [
    "oceanprotocol",
    "prettier/standard",
    "plugin:prettier/recommended"
  ],
  "plugins": ["prettier"]
}

Editor Plugins

For maximum fun during coding, install an ESLint plugin in your favorite editor to get suggestions and autofixes as you type.

Rules

We keep it simple and follow almost everything defined in the JavaScript Standard Style. Only deviations are:

  • indentation: 2
  • no space before function parenthesis
  • double quotes for jsx attributes
  • prefer destructuring from objects & arrays
  • enforce spacing inside curly braces

Development

Again, keeping it simple with 2 files for now:

  • index.js: holds all the custom JavaScript linting rules
  • react.js: holds all the custom React linting rules

For local development, clone this repo and install all dependencies:

git clone [email protected]:oceanprotocol/eslint-config-oceanprotocol.git
cd eslint-config-oceanprotocol/

npm i

Linting is setup against the actual rules within this repo so for testing new rules against every js file in this repo, you can run:

npm test

⬆️ Releases

Releases are managed semi-automatically. They are always manually triggered from a developer's machine with release scripts.

Production

From a clean main branch you can run the release task bumping the version accordingly based on semantic versioning:

npm run release

The task does the following:

  • bumps the project version in package.json, package-lock.json
  • auto-generates and updates the CHANGELOG.md file from commit messages
  • creates a Git tag
  • commits and pushes everything
  • creates a GitHub release with commit messages as description
  • Git tag push will trigger a GitHub Action workflow to do a npm release

For the GitHub releases steps a GitHub personal access token, exported as GITHUB_TOKEN is required. Setup

Pre-Releases

For pre-releases, this is required for the first one like v0.18.0-next.0:

./node_modules/.bin/release-it major|minor|patch --preRelease=next

Further releases afterwards can be done with npm run release again and selecting the appropriate next version, in this case v0.18.0-next.1 and so on.

Changelog

See the CHANGELOG.md file. This file is auto-generated during the above mentioned release process.

Contributing

See the page titled "Ways to Contribute" in the Ocean Protocol documentation.

🏛 License

Copyright ((C)) 2022 Ocean Protocol Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.