Socket
Socket
Sign inDemoInstall

prettier-eslint

Package Overview
Dependencies
Maintainers
2
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettier-eslint

Formats your JavaScript using prettier followed by eslint --fix


Version published
Maintainers
2
Created

What is prettier-eslint?

The prettier-eslint npm package is a tool that combines the functionality of Prettier and ESLint. It allows developers to format their code using Prettier while also applying ESLint rules to ensure code quality and consistency. This package is particularly useful for projects that require both code formatting and linting.

What are prettier-eslint's main functionalities?

Format and Lint Code

This feature allows you to format and lint your code using both Prettier and ESLint. The code sample demonstrates how to use the prettier-eslint package to format a piece of JavaScript code according to specified ESLint rules and Prettier options.

const prettierEslint = require('prettier-eslint');

const formatted = prettierEslint({
  text: 'const foo = ( ) => { console.log("hello world") }',
  eslintConfig: {
    rules: {
      semi: ['error', 'always'],
      quotes: ['error', 'single']
    }
  },
  prettierOptions: {
    singleQuote: true
  }
});

console.log(formatted);

Custom Configuration

This feature allows you to use custom configuration files for ESLint and Prettier. The code sample shows how to load ESLint and Prettier configurations from external files and apply them to format and lint the code.

const prettierEslint = require('prettier-eslint');

const formatted = prettierEslint({
  text: 'const foo = ( ) => { console.log("hello world") }',
  eslintConfig: require('./.eslintrc'),
  prettierOptions: require('./.prettierrc')
});

console.log(formatted);

Other packages similar to prettier-eslint

FAQs

Package last updated on 07 Jun 2020

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