initial commit of actions
This commit is contained in:
commit
949ece5785
44660 changed files with 12034344 additions and 0 deletions
45
github/codeql-action-v2/node_modules/eslint-plugin-no-async-foreach/README.md
generated
vendored
Normal file
45
github/codeql-action-v2/node_modules/eslint-plugin-no-async-foreach/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# eslint-plugin-no-async-foreach
|
||||
|
||||
No async forEach
|
||||
|
||||
## Installation
|
||||
|
||||
You'll first need to install [ESLint](http://eslint.org):
|
||||
|
||||
```
|
||||
$ npm i eslint --save-dev
|
||||
```
|
||||
|
||||
Next, install `eslint-plugin-no-async-foreach`:
|
||||
|
||||
```
|
||||
$ npm install eslint-plugin-no-async-foreach --save-dev
|
||||
```
|
||||
|
||||
**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-no-async-foreach` globally.
|
||||
|
||||
## Usage
|
||||
|
||||
Add `no-async-foreach` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
"no-async-foreach"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Then configure the rules you want to use under the rules section.
|
||||
|
||||
```json
|
||||
{
|
||||
"rules": {
|
||||
"no-async-foreach/no-async-foreach": 2
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
5
github/codeql-action-v2/node_modules/eslint-plugin-no-async-foreach/index.js
generated
vendored
Normal file
5
github/codeql-action-v2/node_modules/eslint-plugin-no-async-foreach/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
rules: {
|
||||
"no-async-foreach": require('./lib/no-async-foreach')
|
||||
}
|
||||
};
|
||||
34
github/codeql-action-v2/node_modules/eslint-plugin-no-async-foreach/lib/no-async-foreach.js
generated
vendored
Normal file
34
github/codeql-action-v2/node_modules/eslint-plugin-no-async-foreach/lib/no-async-foreach.js
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* @fileoverview Blah
|
||||
* @author El
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
create: function(context) {
|
||||
|
||||
return {
|
||||
ExpressionStatement: function(node) {
|
||||
const { callee } = node.expression
|
||||
if (!callee || !callee.property || !callee.property.name) return;
|
||||
if (callee.property.name === "forEach") {
|
||||
const functionArguments = node.expression.arguments.find(n => {
|
||||
return n.type === 'ArrowFunctionExpression' || n.type === 'FunctionExpression'
|
||||
})
|
||||
if(functionArguments){
|
||||
if (functionArguments.async) {
|
||||
context.report(node, "No async function in forEachs");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
26
github/codeql-action-v2/node_modules/eslint-plugin-no-async-foreach/package.json
generated
vendored
Normal file
26
github/codeql-action-v2/node_modules/eslint-plugin-no-async-foreach/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "eslint-plugin-no-async-foreach",
|
||||
"version": "0.1.1",
|
||||
"description": "No async forEachs",
|
||||
"keywords": [
|
||||
"eslint",
|
||||
"eslintplugin",
|
||||
"eslint-plugin"
|
||||
],
|
||||
"author": "Elliott McNary",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "mocha tests --recursive"
|
||||
},
|
||||
"dependencies": {
|
||||
"requireindex": "~1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "~3.9.1",
|
||||
"mocha": "^3.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"license": "ISC"
|
||||
}
|
||||
52
github/codeql-action-v2/node_modules/eslint-plugin-no-async-foreach/tests/lib/rules/no-async-foreach.js
generated
vendored
Normal file
52
github/codeql-action-v2/node_modules/eslint-plugin-no-async-foreach/tests/lib/rules/no-async-foreach.js
generated
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* @fileoverview Blah
|
||||
* @author El
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
var rule = require("../../../lib/no-async-foreach"),
|
||||
|
||||
RuleTester = require("eslint").RuleTester;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Tests
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const ERROR_MSG = 'No async function in forEachs';
|
||||
|
||||
var ruleTester = new RuleTester();
|
||||
ruleTester.run("no-async-foreach", rule, {
|
||||
|
||||
valid: [
|
||||
{
|
||||
code: "[].forEach(() => {})",
|
||||
parserOptions: { ecmaVersion: 8 }
|
||||
},
|
||||
{
|
||||
code: "[].forEach(function() {})",
|
||||
parserOptions: { ecmaVersion: 8 }
|
||||
}
|
||||
],
|
||||
|
||||
invalid: [
|
||||
{
|
||||
code: "[].forEach(async () => {});",
|
||||
parserOptions: { ecmaVersion: 8 },
|
||||
errors: [{
|
||||
message: ERROR_MSG,
|
||||
}]
|
||||
},
|
||||
{
|
||||
code: "[].forEach(async function() {});",
|
||||
parserOptions: { ecmaVersion: 8 },
|
||||
errors: [{
|
||||
message: ERROR_MSG,
|
||||
}]
|
||||
}
|
||||
]
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue