New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fictiv/prettier-eslint-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fictiv/prettier-eslint-webpack-plugin

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

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 05 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc