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

@fictiv/prettier-eslint-webpack-plugin

v1.0.0

Published

Webpack plugin that formats your JavaScript using prettier followed by eslint --fix

Downloads

4

Readme

Prettier Eslint Webpack Plugin

Webpack 2.* plugin for prettier-eslint

Installation

yarn add prettier-eslint-webpack-plugin --dev

Options

encoding (?String)

Encoding to use when reading / writing files

Default: 'utf-8'

extensions (?Array)

Only process these file extensions

Default: ['.js', '.jsx']

... Furthermore the entire prettier-eslint API is exposed:

filePath (?String)

The path of the file being formatted can be used to override eslintConfig (eslint will be used to find the relevant config for the file).

Default: undefined

eslintConfig (?Object)

The config to use for formatting with ESLint. Can be overridden with filePath.

Default: Fictiv Style

prettierOptions (?Object)

The options to pass for formatting with prettier. If not provided, prettier-eslint will attempt to create the options based on the eslintConfig (whether that's provided or derived via filePath). You can also provide some of the options and have the remaining options derived via your eslint config. This is useful for options like parser.

Default: undefined

logLevel (?Enum: ['trace', 'debug', 'info', 'warn', 'error', 'silent'])

prettier-eslint does quite a bit of logging if you want it to. Pass this to set the amount of logs you want to see.

*Default: process.env.LOG_LEVEL

eslintPath (?String)

By default, prettier-eslint will try to find the relevant eslint (and prettier) module based on the filePath. If it cannot find one, then it will use the version that prettier-eslint has installed locally. If you'd like to specify a path to the eslint module you would like to have prettier-eslint use, then you can provide the full path to it with the eslintPath option.

Default: undefined

Example

Your webpack.dev.js file:

import { PrettierEslintPlugin } from 'prettier-eslint-webpack-plugin'
import fs from 'fs'

...

const eslintConfig = fs.readFileSync('path/to/.eslintrc')

module.exports = {
  ...
  plugins: {
    ...
    new PrettierEslintPlugin({
      encoding: ['utf-16'],
      extensions: '.jsf00',
      eslintConfig: eslintConfig,
      logLevel: 'trace',
      prettierOptions: {
        singleQuote: false,
      }
    })
    ...
  }
  ...
}

Pull requests

Welcome

Roadmap

  • More tests
  • Possibility to use a pre-enforced webpack 2 loader to prevent multiple builds
  • Add Flow support

Inspiration

Licence

MIT