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

fiss-lint-eslint

v1.0.5

Published

a linter of fiss based on eslint

Downloads

6

Readme

fiss-lint-eslint

npm version npm

基于 eslint 的 fiss javascript linter。由于 fiss 基于 fis3 拓展,fis-conf.js 以及插件使用等都需遵循 fis3 规则。


使用

安装

全局安装:

	npm install -g fiss-lint-eslint

安装到当前目录:

	npm install fiss-lint-eslint

配置

example:

// fis-conf.js

var eslintConf = {
	ignoreFiles: ['js/lib/**.js', 'js-conf.js'],
	envs: ['browser', 'node'],
	globals: ['$'],
	rules: {
		"semi": [1],
        "no-undef": [2]
        "no-use-before-define": [1],
        "no-unused-vars": [1],
        "no-eval": [1]
	}
};

fis.match('js/*.js', {
	lint: fis.plugin('eslint', eslintConf)
});

eslintConf 是对 eslint 的配置,参见 Configuring ESLint 。其属性类型参见 CLIEngine

eslintConf.ignoreFiles: 一个数组,配置应该忽略掉的文件,数组成员为文件的匹配模式。

默认配置

	{
	  "envs": ["browser", "node"],
	  "useEslintrc": false,
	  "ignoreFiles": ["fis-conf.js"],
	  "globals": [
	    "__inline",
	    "__uri",
	    "__RESOURCE_MAP__",
	    "fis"
	  ],
	  "rules": {
	      "no-undef": [2],
	      "no-use-before-define": [1],
	      "no-unused-vars": [1],
	      "no-eval": [1],
	      "use-isnan": [2],
	      "valid-typeof": [2],
	      "no-unreachable": [1],
	      "no-dupe-args": [1],
	      "no-dupe-keys": [1]
	  }
	}

当自定义配置的属性与默认配置属性相同时,除了 rulesglobals 会叠加外,其他属性值均被覆盖。

默认配置规则(rules)说明:

  • [no-undef] 变量不通过 var 进行声明或引用未定义变量。
  • [no-eval] 不使用 eval()。
  • [no-use-befor-define] 避免在变量定义之前使用变量。
  • [no-unused-vars] 变量声明但未使用。
  • [use-isnan] 判断一个数是否是NaN的时候不允许使用foo === NaN这样的操作,而是使用isNaN函数进行判断。
  • [valid-typeof] typeof的结果必须和一个有效的字符串进行比较,如typeof foo === 'strnig'即是不合法的字符串。
  • [no-unreachable] 不允许在return、throw、continue、break等中断语句之后出现代码。
  • [no-dupe-args] 方法的参数中不允许有重复值。
  • [no-dupe-keys] 定义对象时不允许有重复的键。

规则错误级别说明:

0 :关闭当前规则

1 :warning

2 :error

更多规则请参见 eslint rules