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

@gasket/plugin-lint

v7.0.3

Published

Adds GoDaddy standard linting to your application

Downloads

672

Readme

@gasket/plugin-lint

Enables code style linting to be configured for Gasket apps.

Installation

This plugin is only used by presets for create-gasket-app and is not installed for apps.

Usage

The features of this plugin hooks are in the lifecycles it hooks during the create process.

Prompts

During the create process, this plugin will prompt for selections to help choose the linting configuration.

Which code style do you want configured?

Choices are:

  • GoDaddy
  • Standard
  • Airbnb
  • other - This allows manual eslint-config entry in the following prompt.
  • none - This exits the create hook for the plugin.

What is the name of the eslint config?

If the code style chosen is other, the plugin will then prompt for the name of an ESLint shared config.

Do you want stylelint configured?

Some code style allow for stylelint to also be configured. Choose yes to include config for it, also.

What is the name of the stylelint config?

If the previous prompt was yes, and the chosen code style is other, the plugin will then prompt for the name of an ESLint stylelint shared config.

Scripts

Once completed, additional scripts will be added to the app's package for linting; lint or stylelint or both. These can be run individually, and also a posttest script is added so that linting will automatically run after npm test or yarn test.

In the postCreate stage of the create command, the lint:fix script will be run which will attempt to fixup any generated files to match the code style. Sometimes, additional fixup may be required by the user, depending on the code style and generated content. In these cases, a note will be added to the warnings section of the create report display in the terminal.

Code Styles

GoDaddy

GoDaddy JavaScript Style

When choosing godaddy as the codeStyle, the eslint config will set up based on what other packages are added for the app. These include react, flow, react + flow, or otherwise just the base.

Standard

JavaScript Standard Style

This will install the standard node binary and use it in the lint scripts. There is no Standard stylelint config at this time.

Airbnb

Airbnb JavaScript Style

When choosing airbnb as the codeStyle, the eslint config will set up based on if react package is added for the app or not. If react is not present, the base airbnb config will be used.

Presets

Presets can also pre-determine the code style to use. This is useful for teams to avoid prompts and enforce a particular code style setup. This can be done in the module for the preset, in the presetPrompt hook.

Options

  • codeStyle - (string) One of the choices of code styles:
    • godaddy
    • standard
    • airbnb
  • addStylelint - (boolean) Enable to add stylelint for the codeStyle if set.
  • eslintConfig - (string) Name of a ESLint shared config to add. Only when no codeStyle.
  • stylelintConfig - (string) Name of a stylelint shared config to add. Only when no codeStyle.

For example, say we have some team that wants to always use Airbnb style and with stylelint for their apps:

// preset-prompt.js

export default async function presetPrompt(gasket, context, { prompt }) {
  context.codeStyle = 'airbnb';
  context.addStylelint = true;
};

Or, say we have another team with an internal ESLint config

// preset-prompt.js
export default async function presetPrompt(gasket, context, { prompt }) {
  context.eslintConfig = '@another/eslint-config';
};

Contribute!

If there is an important and widely used code style that you feel would be a good addition to the default choices of Code Styles, reach out or submit a PR with your suggestion.

License

MIT