eslint-plugin-demofortutorial
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -10,2 +10,3 @@ /** | ||
'no-console-time': require('./rules/no-console-time'), | ||
"no-object-values": require("./rules/no-object-values"), | ||
}, | ||
@@ -18,2 +19,7 @@ configs: { | ||
}, | ||
"no-2017": { | ||
rules: { | ||
"demofortutorial/no-object-values": "error", | ||
} | ||
} | ||
}, | ||
@@ -20,0 +26,0 @@ }; |
{ | ||
"name": "eslint-plugin-demofortutorial", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "no console time", | ||
@@ -16,6 +16,6 @@ "keywords": [ | ||
"dependencies": { | ||
"requireindex": "~1.1.0" | ||
"eslint-utils": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "~3.9.1", | ||
"eslint": "^5.16.0", | ||
"mocha": "^3.1.2" | ||
@@ -22,0 +22,0 @@ }, |
@@ -1,51 +0,27 @@ | ||
# eslint-plugin-demo | ||
# eslint-plugin-demofortutorial | ||
no console time | ||
* 本文用于讲解如何自己开发 eslint 插件以及如何在项目中使用。[详细讲解](https://juejin.im/post/5d91be23f265da5ba532a07e) | ||
## Installation | ||
## 本插件用途 | ||
在项目禁用 `console.time()` 方法。 | ||
You'll first need to install [ESLint](http://eslint.org): | ||
## 本插件如何使用? | ||
安装包 | ||
``` | ||
$ npm i eslint --save-dev | ||
npm install eslint-plugin-demofortutorial -D | ||
``` | ||
Next, install `eslint-plugin-demo`: | ||
## 项目中配置 | ||
`.eslintrc.js` | ||
``` | ||
$ npm install eslint-plugin-demo --save-dev | ||
``` | ||
**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-demo` globally. | ||
## Usage | ||
Add `demo` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: | ||
```json | ||
{ | ||
"plugins": [ | ||
"demo" | ||
module.exports = { | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:eslint-plugin-demofortutorial/recommended' | ||
], | ||
plugins: [ | ||
'demofortutorial' | ||
] | ||
} | ||
}; | ||
``` | ||
Then configure the rules you want to use under the rules section. | ||
```json | ||
{ | ||
"rules": { | ||
"demo/rule-name": 2 | ||
} | ||
} | ||
``` | ||
## Supported Rules | ||
* Fill in provided rules here | ||
@@ -1,26 +0,31 @@ | ||
/** | ||
* @fileoverview no console.time() | ||
* @author Allan91 | ||
*/ | ||
"use strict"; | ||
'use strict'; | ||
//------------------------------------------------------------------------------ | ||
// ------------------------------------------------------------------------------ | ||
// Requirements | ||
//------------------------------------------------------------------------------ | ||
// ------------------------------------------------------------------------------ | ||
var rule = require("../../../lib/rules/no-console-time"), | ||
let rule = require('../../../lib/rules/no-console-time'); | ||
RuleTester = require("eslint").RuleTester; | ||
let RuleTester = require('eslint').RuleTester; | ||
//------------------------------------------------------------------------------ | ||
// ------------------------------------------------------------------------------ | ||
// Tests | ||
//------------------------------------------------------------------------------ | ||
// ------------------------------------------------------------------------------ | ||
var ruleTester = new RuleTester(); | ||
ruleTester.run("no-console-time", rule, { | ||
let ruleTester = new RuleTester({ | ||
parserOptions: { | ||
ecmaVersion: 10, | ||
}, | ||
}); | ||
ruleTester.run('no-console-time', rule, { | ||
valid: [ | ||
// give me some code that won't trigger a warning | ||
'_.time({a:1});', | ||
"_.time('abc');", | ||
"_.time(['a', 'b', 'c']);", | ||
"lodash.time('abc');", | ||
'lodash.time({a:1});', | ||
'abc.time', | ||
"lodash.time(['a', 'b', 'c']);", | ||
], | ||
@@ -30,9 +35,30 @@ | ||
{ | ||
code: "console.time('test');", | ||
errors: [{ | ||
message: "Fill me in.", | ||
type: "Me too" | ||
}] | ||
} | ||
] | ||
code: 'console.time()', | ||
errors: [ | ||
{ | ||
messageId: 'avoidMethod', | ||
}, | ||
], | ||
}, | ||
{ | ||
code: "console.time.call({}, 'hello')", | ||
errors: [ | ||
{ | ||
messageId: 'avoidMethod', | ||
}, | ||
], | ||
}, | ||
{ | ||
code: "console.time.apply({}, ['hello'])", | ||
errors: [ | ||
{ | ||
messageId: 'avoidMethod', | ||
}, | ||
], | ||
}, | ||
{ | ||
code: 'console.time.call(new Int32Array([1, 2, 3, 4, 5]));', | ||
errors: 1, | ||
}, | ||
], | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6818
8
176
28
+ Addedeslint-utils@^2.0.0
+ Addedeslint-utils@2.1.0(transitive)
+ Addedeslint-visitor-keys@1.3.0(transitive)
- Removedrequireindex@~1.1.0
- Removedrequireindex@1.1.0(transitive)