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

@cailiao/eslint-plugin-prettier

v0.2.8

Published

eslint-plugin-prettier

Downloads

261

Readme

eslint-plugin-prettier 预览版

各场景稳定性尚在测试中。

描述(Description)

本插件旨在帮助解决 prettier 和 eslint 规则冲突的问题,希望能同时满足偏爱 prettier 风格或 eslint 风格但又需要同时使用两个格式化插件的两种人群的需求。

(This plugin is designed to help solve the problem of conflicting rules between prettier and eslint, hoping to meet the needs of both people who prefer prettier style or eslint style but need to use both formatting plugins.)

eslint-plugin-prettier 的拓展,支持配置 eslint 以 prettier 为最终输出,还是以 eslint 的默认规则(或其他自定义规则)为最终输出。

开始使用

npm install @cailiao/eslint-plugin-prettier@latest --save-dev

注意: 如果报依赖缺失需要自行安装 eslint >= 7.28 prettier >= 2:

npm install eslint@7 prettier@2 --save-dev

eslintrc

{
  "plugins": ["@cailiao/prettier"],
  "rules": {
    "@cailiao/prettier/prettier": "warn"
     // 其它rule
  }
}

拓展的设置

Options

  • 第一个参数 Object

    是一个对象,对象中的一个字段mode是本项目拓展的一个配置项,允许的值为'prettier-eslint''eslint-prettier'

    'prettier-eslint'为默认值,表示以 prettier 规则和 eslint 默认规则(或其他自定义规则)格式化自动修复冲突时,以 eslint 默认规则(或其他自定义规则)为最终输出;

    'eslint-prettier'表示行为和原插件一样,以 prettier 规则为最终输出(原插件的行为在不同规则之间发生冲突时,输出可能不稳定)。

{
  "@cailiao/prettier/prettier": [1, { 
      "mode": "eslint-prettier" // 缺省值: "prettier-eslint"
  }]
}

原有设置:(以下信息来自 eslint-plugin-prettier 4.x)

Options

  • The first option:

    • An object representing options that will be passed into prettier. Example:

      {
        "prettier/prettier": ["error", { "singleQuote": true, "parser": "flow" }]
      }

      NB: This option will merge and override any config set with .prettierrc files

  • The second option:

    • An object with the following options

      • usePrettierrc: Enables loading of the Prettier configuration file, (default: true). May be useful if you are using multiple tools that conflict with each other, or do not wish to mix your ESLint settings with your Prettier configuration.

        {
          "prettier/prettier": [
            "error",
            {},
            {
              "usePrettierrc": false
            }
          ]
        }
      • fileInfoOptions: Options that are passed to prettier.getFileInfo to decide whether a file needs to be formatted. Can be used for example to opt-out from ignoring files located in node_modules directories.

        {
          "prettier/prettier": [
            "error",
            {},
            {
              "fileInfoOptions": {
                "withNodeModules": true
              }
            }
          ]
        }