# fis3-lint-eslint

> A javascript linter plugin for fis3 based on eslint

Latest version **1.1.0** (published 2019-04-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install fis3-lint-eslint
pnpm add fis3-lint-eslint
yarn add fis3-lint-eslint
bun add fis3-lint-eslint
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2019-04-26 |
| First published | 2016-03-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | zhangyihua |
| Maintainers | zhangyihua |
| Keywords | fis3-lint-eslint, fis, fis3, fis3, fis-lint-eslint |

## Links

- npm: https://www.npmjs.com/package/fis3-lint-eslint
- Repository: https://github.com/fis3-scaffold/fis3-lint-eslint
- Homepage: https://github.com/fis3-scaffold/fis3-lint-eslint#readme
- Issues: https://github.com/fis3-scaffold/fis3-lint-eslint/issues
- npm.io page: https://npm.io/package/fis3-lint-eslint

## Dependencies (2)

- [eslint](https://npm.io/package/eslint.md) ^5.16.0
- [mixin-deep](https://npm.io/package/mixin-deep.md) ^1.1.3

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2019-04-26
- 1.0.1 — 2017-03-07
- 1.0.0 — 2016-03-23

## README

# fis3-lint-eslint

[![npm version](https://badge.fury.io/js/fis3-lint-eslint.svg)](https://badge.fury.io/js/fis3-lint-eslint)  [![npm](https://img.shields.io/npm/dt/fis3-lint-eslint.svg)](http://npm-stat.com/charts.html?package=fis3-lint-eslint&author=zhangyihua&from=2016-01-01&to=2116-01-24)

基于 [eslint](http://eslint.org/) 的 fis3 javascript linter。插件使用遵循 fis3 规则。

----


## 使用

### 安装

全局安装：

```cli
	npm install -g fis3-lint-eslint
```

安装到当前目录：

```cli
	npm install fis3-lint-eslint
```

### 配置

**example:**

```javascript
// 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](http://eslint.org/docs/user-guide/configuring) 。其属性类型参见 [CLIEngine](http://eslint.org/docs/developer-guide/nodejs-api#cliengine)。

`eslintConf.ignoreFiles`： 一个数组，配置应该忽略掉的文件。数组成员为目标文件的匹配规则，遵循 [glob](https://en.wikipedia.org/wiki/Glob_(programming)) 语法。


### 默认配置

```js
	{
	  "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]
	  }
	}
```


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


默认配置规则（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](http://eslint.org/docs/rules/)。

---
_Source: https://npm.io/package/fis3-lint-eslint · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
