Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-demofortutorial

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-demofortutorial - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

lib/rules/no-object-values.js

6

lib/index.js

@@ -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 @@ };

6

package.json
{
"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,
},
],
});
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