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

@frontendfixer/vite-react-boilerplate

v1.0.1

Published

React Boilerplate using Vite , Prettier, Eslint, Stylelint, and SASS

Downloads

3

Readme

React Template using Vite.Js

React Boilerplate using Vite , Prettier, Eslint, Stylelint, SASS and SVGO


Table of Contents

Official Resources

Get Started

# clone the official repository
git clone https://github.com/frontendfixer/vite_react_boilerplate.git
cd vite_react_boilerplate

# install all packages using your favorites node installer
pnpm install
# if you wish to use yarn then delete 'pnpm-lock.yaml' and
yarn install

Features

  1. SASS as css preprocessor
  2. Terser to minify JS
  3. SVGO for svg minification
  4. ESLint for JS/JSX linting

Scripts

"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"lint:eslint": "eslint . --ext .js,.jsx",
"fix:eslint": "eslint --fix  . --ext .js,.jsx",
"lint:stylelint": "stylelint ./src/**/*.{css,scss,jsx}",
"fix:stylelint": "stylelint --fix  ./src/**/*.{css,scss,jsx}"
  • you can run those scripts by terminal command
    • start dev server
      pnpm run dev
    • start preview build
      pnpm run preview
    • eslint
      # start eslint
      pnpm run lint:eslint
      # fix all fixable problems
      pnpm run fix:eslint
    • stylelint
      # start stylelint
      pnpm run lint:stylelint
      # fix all fixable problems
      pnpm run fix:stylelint

Settings

If you'd like to overwrite vite or prettier or eslint or stylelint settings, you can add the rules in vite.config.js , .prettierrc.json , .eslintrc.json , .stylelintrc.json respectively.

vite config

  • plugins

    import { ViteImageOptimizer } from 'vite-plugin-image-optimizer';
    import svgr from 'vite-plugin-svgr';
    
    // add those plugins
    plugins: [ViteImageOptimizer(), svgr()];
    import { ReactComponent as Logo } from './logo.svg';
  • settings

    • By default server and preview port are 5555 and 8888 you can change it here
      server: {
        port: 5555,
      }
      preview: {
        port: 8080,
      },
    • sourcemap and code split is enable for css and js
      build: {
      cssCodeSplit: true,
      sourcemap: true,
      },

prettier config

{
  "trailingComma": "es5",
  "arrowParens": "avoid",
  "printWidth": 80,
  "quoteProps": "as-needed",
  "semi": true,
  "singleQuote": true,
  "tabWidth": 2,
  "bracketSameLine": false,
  "bracketSpacing": true,
  "jsxSingleQuote": false
}

eslint config

  • plugins

    "extends": [,
      "airbnb",
      "airbnb/hooks",
      "prettier",
      "plugin:prettier/recommended"
    ],
    "plugins": [
      "jsx-a11y",
      "prettier",
      "unused-imports"
    ]
  • rules you can change any rule define here

    "rules": {
    
    },
    
    // some default reules is overwritten you can take a look at here or completely remove it
    "overrides": [
      {
        "files": ["src/**/*.{js,jsx}"],
        "rules": {
    
        }
      }
    ]

stylelint config

  • plugins
    "plugins": [
      // change all color format to either hsl or rgb
      "stylelint-color-format",
      // convert all px value to rem(base 16)
      "stylelint-rem-over-px"
    ]
    more details here
    • stylelint-color-format
    • stylelint-rem-over-px
      • I have disabled it for SCSS function rem() I had created. You can enable it here
      "rules": {
        "rem-over-px/rem-over-px": false,
        // "rem-over-px/rem-over-px": [true, { "ignore": "1px", "ignoreFunctions": ["url"] , "ignoreAtRules": ["media"], fontSize: 16 }],
      }