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

@megalo/cli-plugin-eslint

v1.0.0-beta.2

Published

eslint plugin for megalo-cli

Downloads

11

Readme

@megalo/cli-plugin-mp

eslint plugin for megalo-cli

注入的命令

  • megalo-cli-service lint

    Usage: megalo-cli-service lint [options] [...files]
    
    Options:
    
      --format [formatter] specify formatter (default: codeframe)
      --no-fix             do not fix errors
      --max-errors         specify number of errors to make build failed (default: 0)
      --max-warnings       specify number of warnings to make build failed (default: Infinity)

    检查提示以及修复文件格式。 如果没有特别指定文件或目录,默认情况下它会检查 srctest 目录下的所有文件

    另外 ESLint CLI options 这里的选项也是支持的.

配置

ESLint可以通过 .eslintrcpackage.json 中的 eslintConfig 字段进行配置。

默认情况下启用 eslint-loader 进行开发时的保存。 可以使用 megalo.config.js 中的 lintOnSave 选项禁用它:

module.exports = {
  lintOnSave: false
}

设置为 true 时,eslint-loader 会将 lint 错误输出为编译警告。默认情况下,警告仅仅会被输出到命令行,且不会使得编译失败。

如果你希望让 lint 错误在开发时直接显示在浏览器中,你可以使用 lintOnSave: 'error'。这会强制 eslint-loaderlint 错误输出为编译错误,同时也意味着 lint 错误将会导致编译失败。

或者,你也可以通过设置让浏览器 overlay 同时显示警告和错误:

// megalo.config.js
module.exports = {
  // 编译小程序不支持该选项
  devServer: {
    overlay: {
      warnings: true,
      errors: true
    }
  }
}

lintOnSave 是一个 truthy 的值时,eslint-loader 在开发和生产构建下都会被启用。如果你想要在生产构建时禁用 eslint-loader,你可以用如下配置:

// megalo.config.js
module.exports = {
  lintOnSave: process.env.NODE_ENV !== 'production'
}

注入的 webpack-chain 规则

  • config.module.rule('eslint')
  • config.module.rule('eslint').use('eslint-loader')