eslint-plugin-func-params-args 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 Abdulrahman (Abdu) Assabri
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Abdulrahman (Abdu) Assabri
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -4,7 +4,7 @@ Limit the number of function parameters and arguments with ease and flexibility!
4
4
 
5
5
  This plugin intends to give you control over how many parameters are used in function definitions (declarations), function expressions, arrow function expressions, and TypeScript function type annotations. In addition to this, you can also set limits on how many arguments can be used when calling functions, where you can set a global limit, and have even finer control by providing limits for specific function calls (set by configuring/providing the name of a function).
6
6
 
7
- [![Travis (.com) branch](https://img.shields.io/travis/com/abdusabri/eslint-plugin-func-params-args/master)](https://app.travis-ci.com/github/abdusabri/eslint-plugin-func-params-args) [![Coveralls github branch](https://img.shields.io/coveralls/github/abdusabri/eslint-plugin-func-params-args/master?logo=coveralls&style=flat-square)](https://coveralls.io/github/abdusabri/eslint-plugin-func-params-args) ![Depfu](https://img.shields.io/depfu/abdusabri/eslint-plugin-func-params-args?style=flat-square)
7
+ [![Travis (.com) branch](https://img.shields.io/travis/com/abdusabri/eslint-plugin-func-params-args/master)](https://app.travis-ci.com/github/abdusabri/eslint-plugin-func-params-args) [![Coveralls github branch](https://img.shields.io/coveralls/github/abdusabri/eslint-plugin-func-params-args/master?logo=coveralls&style=flat-square)](https://coveralls.io/github/abdusabri/eslint-plugin-func-params-args) [![Renovate](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)
8
8
 
9
9
  ## Table of contents
10
10
 
@@ -178,7 +178,6 @@ All contributions are welcome and appreciated. If you want to help out, please f
178
178
  - If the changes you are working on require documentation updates, please update the docs accordingly
179
179
 
180
180
  - When you are ready to open a PR (all pull requests should be opened against master branch):
181
-
182
181
  - Add a summary explaining your changes
183
182
 
184
183
  - Add `Fixes #[issue number]` or `Closes #[issue number]` in the PR description
@@ -195,7 +194,7 @@ All contributions are welcome and appreciated. If you want to help out, please f
195
194
 
196
195
  ## Code of conduct
197
196
 
198
- This project adopts Contributor Covenant's Code of Conduct. You can read it in full [here](./CODE_OF_CONDUCT.md), which has my email address included.
197
+ This project adopts Contributor Covenant's Code of Conduct. You can read it in full in [CODE_OF_CONDUCT](./CODE_OF_CONDUCT.md), which has my email address included.
199
198
 
200
199
  ## Inspiration and credits
201
200
 
@@ -205,8 +204,7 @@ This work wouldn't have been possible without the power of open source and peopl
205
204
 
206
205
  - [AST explorer](https://astexplorer.net/)
207
206
 
208
- - ESLint's developer guide, especially [Working with Plugins](https://eslint.org/docs/developer-guide/working-with-plugins) and [Working with Rules
209
- ](https://eslint.org/docs/developer-guide/working-with-rules)
207
+ - ESLint's developer guide, especially [Working with Plugins](https://eslint.org/docs/developer-guide/working-with-plugins) and [Working with Rules](https://eslint.org/docs/developer-guide/working-with-rules)
210
208
 
211
209
  - ESlint's [max-params rule](https://eslint.org/docs/rules/max-params#enforce-a-maximum-number-of-parameters-in-function-definitions-max-params), and its linked sources on GitHub
212
210
 
@@ -215,7 +213,6 @@ This work wouldn't have been possible without the power of open source and peopl
215
213
  - [You-Dont-Need-Lodash-Underscore](https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore)
216
214
 
217
215
  - Articles and Q&A
218
-
219
216
  - [Create custom ESLint rules in 2 minutes](https://blog.webiny.com/create-custom-eslint-rules-in-2-minutes-e3d41cb6a9a0)
220
217
 
221
218
  - [Writing custom EsLint rules](https://www.kenneth-truyers.net/2016/05/27/writing-custom-eslint-rules/)
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var requireIndex=require("requireindex");module.exports.rules=requireIndex(__dirname+"/rules");
1
+ "use strict";var requireIndex=require("requireindex");module.exports.rules=requireIndex(__dirname+"/rules");
@@ -1 +1 @@
1
- 'use strict';const{BASE_URL,isOptionConfigured}=require("../utils"),getFuncName=a=>{switch(a.callee.type){case"MemberExpression":return a.callee.property.name;case"Identifier":return a.callee.name;}};module.exports={meta:{type:"problem",docs:{description:"enforce the number of arguments used in a function call",url:BASE_URL+"func-args.md"},schema:[{type:"object",properties:{global:{type:"integer",minimum:-1}},additionalProperties:{type:"integer",minimum:-1}}],messages:{exceed:"{{name}} has been called with too many arguments ({{count}}). Maximum allowed is ({{max}})."}},create(a){function b(b,c){a.report({node:b,messageId:"exceed",data:c})}function c(a,c,d){0<=d&&a.arguments.length>d&&b(a,{name:c,count:a.arguments.length,max:d})}const d=a.options[0]||{};return{CallExpression(a){const b=getFuncName(a);let e=-1;isOptionConfigured(d,b)?e=d[b]:isOptionConfigured(d,"global")&&(e=d.global),c(a,b,e)}}}};
1
+ "use strict";const{BASE_URL,isOptionConfigured}=require("../utils"),getFuncName=a=>{switch(a.callee.type){case"MemberExpression":return a.callee.property.name;case"Identifier":return a.callee.name}};module.exports={meta:{type:"problem",docs:{description:"enforce the number of arguments used in a function call",url:BASE_URL+"func-args.md"},schema:[{type:"object",properties:{global:{type:"integer",minimum:-1}},additionalProperties:{type:"integer",minimum:-1}}],messages:{exceed:"{{name}} has been called with too many arguments ({{count}}). Maximum allowed is ({{max}})."}},create(a){function b(b,c){a.report({node:b,messageId:"exceed",data:c})}function c(a,c,d){0<=d&&a.arguments.length>d&&b(a,{name:c,count:a.arguments.length,max:d})}const d=a.options[0]||{};return{CallExpression(a){const b=getFuncName(a);let e=-1;isOptionConfigured(d,b)?e=d[b]:isOptionConfigured(d,"global")&&(e=d.global),c(a,b,e)}}}};
@@ -1 +1 @@
1
- 'use strict';const{BASE_URL,isOptionConfigured}=require("../utils"),utils=require("eslint-utils");function mapTypeToConfigKey(a){return"FunctionDeclaration"===a?"funcDefinition":"ArrowFunctionExpression"===a?"arrowFuncExpression":"FunctionExpression"===a?"funcExpression":"TSFunctionType"===a||"TSMethodSignature"===a?"funcTypeAnnotation":void 0}function getFunctionNameWithKind(a){return"TSFunctionType"===a.type?"TSTypeAliasDeclaration"===a.parent?.type?`function '${a.parent.id.name}'`:"TSTypeAnnotation"===a.parent?.type&&"Identifier"===a.parent.parent?.type?`function '${a.parent.parent.name}'`:`function '${a.parent?.parent?.key?.name}'`:"TSMethodSignature"===a.type?`function '${a.key?.name}'`:utils.getFunctionNameWithKind(a)}module.exports={meta:{type:"problem",docs:{description:"enforce the number of parameters used in a function definition or expression",url:BASE_URL+"func-params.md"},schema:[{type:"object",properties:{global:{type:"integer",minimum:-1},funcDefinition:{type:"integer",minimum:-1},funcExpression:{type:"integer",minimum:-1},arrowFuncExpression:{type:"integer",minimum:-1},funcTypeAnnotation:{type:"integer",minimum:-1}},additionalProperties:!1}],messages:{exceed:"{{name}} has too many parameters ({{count}}). Maximum allowed is ({{max}})."}},create(a){function b(b,c){a.report({node:b,messageId:"exceed",data:c})}function c(a,c){0<=c&&a.params.length>c&&b(a,{count:a.params.length,max:c,name:getFunctionNameWithKind(a)})}function d(a){const b=mapTypeToConfigKey(a.type);let d=-1;isOptionConfigured(e,b)?d=e[b]:isOptionConfigured(e,"global")&&(d=e.global),c(a,d)}const e=a.options[0]||{};return{FunctionDeclaration:d,ArrowFunctionExpression:d,FunctionExpression:d,TSFunctionType:d,TSMethodSignature:d}}};
1
+ "use strict";const{BASE_URL,isOptionConfigured}=require("../utils"),utils=require("eslint-utils");function mapTypeToConfigKey(a){return"FunctionDeclaration"===a?"funcDefinition":"ArrowFunctionExpression"===a?"arrowFuncExpression":"FunctionExpression"===a?"funcExpression":"TSFunctionType"===a||"TSMethodSignature"===a?"funcTypeAnnotation":void 0}function getFunctionNameWithKind(a){return"TSFunctionType"===a.type?"TSTypeAliasDeclaration"===a.parent?.type?`function '${a.parent.id.name}'`:"TSTypeAnnotation"===a.parent?.type&&"Identifier"===a.parent.parent?.type?`function '${a.parent.parent.name}'`:`function '${a.parent?.parent?.key?.name}'`:"TSMethodSignature"===a.type?`function '${a.key?.name}'`:utils.getFunctionNameWithKind(a)}module.exports={meta:{type:"problem",docs:{description:"enforce the number of parameters used in a function definition or expression",url:BASE_URL+"func-params.md"},schema:[{type:"object",properties:{global:{type:"integer",minimum:-1},funcDefinition:{type:"integer",minimum:-1},funcExpression:{type:"integer",minimum:-1},arrowFuncExpression:{type:"integer",minimum:-1},funcTypeAnnotation:{type:"integer",minimum:-1}},additionalProperties:!1}],messages:{exceed:"{{name}} has too many parameters ({{count}}). Maximum allowed is ({{max}})."}},create(a){function b(b,c){a.report({node:b,messageId:"exceed",data:c})}function c(a,c){0<=c&&a.params.length>c&&b(a,{count:a.params.length,max:c,name:getFunctionNameWithKind(a)})}function d(a){const b=mapTypeToConfigKey(a.type);let d=-1;isOptionConfigured(e,b)?d=e[b]:isOptionConfigured(e,"global")&&(d=e.global),c(a,d)}const e=a.options[0]||{};return{FunctionDeclaration:d,ArrowFunctionExpression:d,FunctionExpression:d,TSFunctionType:d,TSMethodSignature:d}}};
package/dist/utils.js CHANGED
@@ -1 +1 @@
1
- 'use strict';function isOptionConfigured(a,b=""){return a&&b in a}module.exports={isOptionConfigured,BASE_URL:"https://github.com/abdusabri/eslint-plugin-func-params-args/blob/master/docs/rules/"};
1
+ "use strict";function isOptionConfigured(a,b=""){return a&&b in a}module.exports={isOptionConfigured,BASE_URL:"https://github.com/abdusabri/eslint-plugin-func-params-args/blob/master/docs/rules/"};
package/package.json CHANGED
@@ -1,74 +1,74 @@
1
- {
2
- "name": "eslint-plugin-func-params-args",
3
- "version": "4.0.0",
4
- "description": "Limit the number of function parameters and arguments with ease and flexibility",
5
- "author": "Abdulrahman (Abdu) Assabri <abdusabri@abdusabri.com>",
6
- "keywords": [
7
- "eslint",
8
- "eslintplugin",
9
- "eslint-plugin",
10
- "function",
11
- "func",
12
- "args",
13
- "params",
14
- "parameters",
15
- "arguments"
16
- ],
17
- "repository": {
18
- "type": "git",
19
- "url": "https://github.com/abdusabri/eslint-plugin-func-params-args.git"
20
- },
21
- "homepage": "https://github.com/abdusabri/eslint-plugin-func-params-args",
22
- "bugs": {
23
- "url": "https://github.com/abdusabri/eslint-plugin-func-params-args/issues"
24
- },
25
- "license": "MIT",
26
- "engines": {
27
- "node": ">=16"
28
- },
29
- "main": "dist/index.js",
30
- "scripts": {
31
- "prettier:fix": "prettier --write **/*.{js,json,md}",
32
- "prettier:check": "prettier --check **/*.{js,json,md}",
33
- "test:unit": "mocha tests --recursive",
34
- "test": "nyc mocha tests --recursive",
35
- "check-coverage": "nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100",
36
- "cover": "nyc report --reporter=lcov",
37
- "coveralls": "cat ./coverage/lcov.info | coveralls",
38
- "build": "rimraf dist && minify lib -d dist"
39
- },
40
- "dependencies": {
41
- "requireindex": "~1.2.0",
42
- "eslint-utils": "^3.0.0"
43
- },
44
- "peerDependencies": {
45
- "eslint": "^6 || ^7.1.0 || ^8.0.0"
46
- },
47
- "devDependencies": {
48
- "@typescript-eslint/parser": "^6.12.0",
49
- "babel-minify": "^0.5.1",
50
- "coveralls": "^3.1.0",
51
- "eslint": "^8.2.0",
52
- "husky": "^8.0.2",
53
- "lint-staged": "^15.0.2",
54
- "mocha": "^10.0.0",
55
- "nyc": "^15.1.0",
56
- "prettier": "^3.1.0",
57
- "rimraf": "^5.0.5",
58
- "typescript": "^5.0.2"
59
- },
60
- "files": [
61
- "*.md",
62
- "LICENSE",
63
- "docs",
64
- "dist"
65
- ],
66
- "husky": {
67
- "hooks": {
68
- "pre-commit": "lint-staged"
69
- }
70
- },
71
- "lint-staged": {
72
- "*.{js,json,md}": "prettier --write"
73
- }
74
- }
1
+ {
2
+ "name": "eslint-plugin-func-params-args",
3
+ "version": "4.0.1",
4
+ "description": "Limit the number of function parameters and arguments with ease and flexibility",
5
+ "author": "Abdulrahman (Abdu) Assabri <abdusabri@abdusabri.com>",
6
+ "keywords": [
7
+ "eslint",
8
+ "eslintplugin",
9
+ "eslint-plugin",
10
+ "function",
11
+ "func",
12
+ "args",
13
+ "params",
14
+ "parameters",
15
+ "arguments"
16
+ ],
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/abdusabri/eslint-plugin-func-params-args.git"
20
+ },
21
+ "homepage": "https://github.com/abdusabri/eslint-plugin-func-params-args",
22
+ "bugs": {
23
+ "url": "https://github.com/abdusabri/eslint-plugin-func-params-args/issues"
24
+ },
25
+ "license": "MIT",
26
+ "engines": {
27
+ "node": ">=16"
28
+ },
29
+ "main": "dist/index.js",
30
+ "scripts": {
31
+ "prettier:fix": "prettier --write **/*.{js,json,md}",
32
+ "prettier:check": "prettier --check **/*.{js,json,md}",
33
+ "test:unit": "mocha tests --recursive",
34
+ "test": "nyc mocha tests --recursive",
35
+ "check-coverage": "nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100",
36
+ "cover": "nyc report --reporter=lcov",
37
+ "coveralls": "cat ./coverage/lcov.info | coveralls",
38
+ "build": "rimraf dist && minify lib -d dist"
39
+ },
40
+ "dependencies": {
41
+ "requireindex": "~1.2.0",
42
+ "eslint-utils": "^3.0.0"
43
+ },
44
+ "peerDependencies": {
45
+ "eslint": "^6 || ^7.1.0 || ^8.0.0"
46
+ },
47
+ "devDependencies": {
48
+ "@typescript-eslint/parser": "^6.12.0",
49
+ "babel-minify": "^0.5.1",
50
+ "coveralls": "^3.1.0",
51
+ "eslint": "^8.2.0",
52
+ "husky": "^8.0.2",
53
+ "lint-staged": "^15.0.2",
54
+ "mocha": "^10.0.0",
55
+ "nyc": "^15.1.0",
56
+ "prettier": "^3.1.0",
57
+ "rimraf": "^5.0.5",
58
+ "typescript": "^5.0.2"
59
+ },
60
+ "files": [
61
+ "*.md",
62
+ "LICENSE",
63
+ "docs",
64
+ "dist"
65
+ ],
66
+ "husky": {
67
+ "hooks": {
68
+ "pre-commit": "lint-staged"
69
+ }
70
+ },
71
+ "lint-staged": {
72
+ "*.{js,json,md}": "prettier --write"
73
+ }
74
+ }