New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fis3-lint-eslint-with-jsx

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fis3-lint-eslint-with-jsx

A javascript linter plugin for fis3 based on eslint

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

fis3-lint-eslint

npm version npm

基于 eslint 的 fis3 javascript linter。插件使用遵循 fis3 规则。


使用

安装

全局安装:

	npm install -g fis3-lint-eslint

安装到当前目录:

	npm install fis3-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

Keywords

FAQs

Package last updated on 17 Aug 2016

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