Git Product home page Git Product logo

prettier-eslint-webpack-plugin's Introduction

Prettier Eslint Webpack Plugin

Webpack 2.* plugin for prettier-eslint

Installation

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

Usage

key type description default
encoding ?String Encoding to use when reading / writing files 'utf-8'
extensions ?Array Only process these file extensions ['.js', '.jsx']

Furthermore the entire prettier-eslint API is exposed:

key type description default
filePath ?String The path of the file being formatted can be used in leu of eslintConfig (eslint will be used to find the relevant config for the file). undefined
eslintConfig ?Object The config to use for formatting with ESLint. If this is provided, then filePath is not necessary. JavaScript Standard 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. 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. 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. 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. Copyright (c) Daniël Terwiel

prettier-eslint-webpack-plugin's People

Contributors

egidius avatar

Watchers

James Cloos avatar Tyler Martinez avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.