eslint-plugin-no-implicit-any-function-args 1.1.2 → 1.1.4

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/index.js CHANGED
@@ -27,18 +27,18 @@ exports.rules = {
27
27
  },
28
28
  defaultOptions: [{}],
29
29
  create: (context, [options]) => {
30
- if (!context.parserServices ||
31
- !context.parserServices.program ||
32
- !context.parserServices.esTreeNodeToTSNodeMap) {
30
+ if (!context.sourceCode.parserServices ||
31
+ !context.sourceCode.parserServices.program ||
32
+ !context.sourceCode.parserServices.esTreeNodeToTSNodeMap) {
33
33
  throw new Error('You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.');
34
34
  }
35
35
  const ignoreRegex = options.ignorePattern ? new RegExp(options.ignorePattern) : undefined;
36
- const service = context.parserServices;
36
+ const service = context.sourceCode.parserServices;
37
37
  const typeChecker = service.program.getTypeChecker();
38
38
  function functionTest(node) {
39
39
  for (const param of node.params) {
40
40
  if (!param.typeAnnotation && !param.right) {
41
- const typescriptParam = context.parserServices.esTreeNodeToTSNodeMap.get(param);
41
+ const typescriptParam = context.sourceCode.parserServices.esTreeNodeToTSNodeMap.get(param);
42
42
  const type = typeChecker.getTypeAtLocation(typescriptParam);
43
43
  if ((type.flags & typescript_1.TypeFlags.Any) === 0)
44
44
  continue;
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,oDAAuD;AACvD,2CAAuC;AAEvC,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,GAAG,EAAE,CAAC,2EAA2E,CAClF,CAAC;AASW,QAAA,KAAK,GAAG;IACnB,+BAA+B,EAAE,UAAU,CAAsB;QAC/D,IAAI,EAAE,+BAA+B;QACrC,IAAI,EAAE;YACJ,IAAI,EAAE,SAAS;YACf,IAAI,EAAE;gBACJ,WAAW,EAAE,qDA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CAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;4BAAE,SAAS;wBAE5C,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI,EAAE,KAAK;4BACX,SAAS,EAAE,kBAAkB;4BAC7B,IAAI,EAAE;gCACJ,IAAI,EAAE,KAAK,CAAC,IAAI;6BACjB;yBACF,CAAC,CAAC;qBACJ;iBACF;YACH,CAAC;YAED,OAAO;gBACL,mBAAmB,EAAE,YAAY;gBACjC,kBAAkB,EAAE,YAAY;gBAChC,uBAAuB,EAAE,YAAY;aACtC,CAAC;QACJ,CAAC;KACF,CAAC;CACH,CAAC","sourcesContent":["import { ESLintUtils } from '@typescript-eslint/utils';\nimport { TypeFlags } from 'typescript';\n\nconst createRule = ESLintUtils.RuleCreator(\n () => 'https://github.com/fast-facts/eslint-plugin-no-implicit-any-function-args'\n);\n\nexport type Options = [\n {\n ignorePattern?: string,\n }\n];\nexport type MessageIds = 'noImplicitAnyArg';\n\nexport const rules = {\n 'no-implicit-any-function-args': createRule<Options, MessageIds>({\n name: 'no-implicit-any-function-args',\n meta: {\n type: 'problem',\n docs: {\n description: 'No implicit any for a function argument is allowed.',\n requiresTypeChecking: true\n },\n messages: {\n noImplicitAnyArg: 'Argument \\'{{ name }}\\' requires a type'\n },\n schema: [{\n type: 'object',\n properties: {\n ignorePattern: {\n type: 'string'\n }\n }\n }]\n },\n defaultOptions: [{}],\n create: (context, [options]) => {\n if (\n !context.parserServices ||\n !context.parserServices.program ||\n !context.parserServices.esTreeNodeToTSNodeMap\n ) {\n throw new Error(\n 'You have used a rule which requires parserServices to be generated. You must therefore provide a value for the \"parserOptions.project\" property for @typescript-eslint/parser.'\n );\n }\n\n const ignoreRegex = options.ignorePattern ? new RegExp(options.ignorePattern) : undefined;\n\n const service = context.parserServices;\n const typeChecker = service.program.getTypeChecker();\n\n function functionTest(node: any) {\n for (const param of node.params) {\n if (!param.typeAnnotation && !param.right) {\n const typescriptParam = context.parserServices!.esTreeNodeToTSNodeMap.get(param);\n const type = typeChecker.getTypeAtLocation(typescriptParam);\n\n if ((type.flags & TypeFlags.Any) === 0) continue;\n if (ignoreRegex?.test(param.name)) continue;\n\n context.report({\n node: param,\n messageId: 'noImplicitAnyArg',\n data: {\n name: param.name\n }\n });\n }\n }\n }\n\n return {\n FunctionDeclaration: functionTest,\n FunctionExpression: functionTest,\n ArrowFunctionExpression: functionTest\n };\n }\n })\n};"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,oDAAuD;AACvD,2CAAuC;AAEvC,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,GAAG,EAAE,CAAC,2EAA2E,CAClF,CAAC;AASW,QAAA,KAAK,GAAG;IACnB,+BAA+B,EAAE,UAAU,CAAsB;QAC/D,IAAI,EAAE,+BAA+B;QACrC,IAAI,EAAE;YACJ,IAAI,EAAE,SAAS;YACf,IAAI,EAAE;gBACJ,WAAW,EAAE,qDAAqD;gBAClE,oBAAoB,EAAE,IAAI;aAC3B;YACD,QAAQ,EAAE;gBACR,gBAAgB,EAAE,yCAAyC;aAC5D;YACD,MAAM,EAAE,CAAC;oBACP,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,aAAa,EAAE;4BACb,IAAI,EAAE,QAAQ;yBACf;qBACF;iBACF,CAAC;SACH;QACD,cAAc,EAAE,CAAC,EAAE,CAAC;QACpB,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE;YAC7B,IACE,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc;gBAClC,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,OAAO;gBAC1C,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,qBAAqB,EACxD;gBACA,MAAM,IAAI,KAAK,CACb,gLAAgL,CACjL,CAAC;aACH;YAED,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAE1F,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC;YAClD,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;YAErD,SAAS,YAAY,CAAC,IAAS;gBAC7B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE;oBAC/B,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;wBACzC,MAAM,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;wBAC3F,MAAM,IAAI,GAAG,WAAW,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;wBAE5D,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,sBAAS,CAAC,GAAG,CAAC,KAAK,CAAC;4BAAE,SAAS;wBACjD,IAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;4BAAE,SAAS;wBAE5C,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI,EAAE,KAAK;4BACX,SAAS,EAAE,kBAAkB;4BAC7B,IAAI,EAAE;gCACJ,IAAI,EAAE,KAAK,CAAC,IAAI;6BACjB;yBACF,CAAC,CAAC;qBACJ;iBACF;YACH,CAAC;YAED,OAAO;gBACL,mBAAmB,EAAE,YAAY;gBACjC,kBAAkB,EAAE,YAAY;gBAChC,uBAAuB,EAAE,YAAY;aACtC,CAAC;QACJ,CAAC;KACF,CAAC;CACH,CAAC","sourcesContent":["import { ESLintUtils } from '@typescript-eslint/utils';\nimport { TypeFlags } from 'typescript';\n\nconst createRule = ESLintUtils.RuleCreator(\n () => 'https://github.com/fast-facts/eslint-plugin-no-implicit-any-function-args'\n);\n\nexport type Options = [\n {\n ignorePattern?: string,\n }\n];\nexport type MessageIds = 'noImplicitAnyArg';\n\nexport const rules = {\n 'no-implicit-any-function-args': createRule<Options, MessageIds>({\n name: 'no-implicit-any-function-args',\n meta: {\n type: 'problem',\n docs: {\n description: 'No implicit any for a function argument is allowed.',\n requiresTypeChecking: true\n },\n messages: {\n noImplicitAnyArg: 'Argument \\'{{ name }}\\' requires a type'\n },\n schema: [{\n type: 'object',\n properties: {\n ignorePattern: {\n type: 'string'\n }\n }\n }]\n },\n defaultOptions: [{}],\n create: (context, [options]) => {\n if (\n !context.sourceCode.parserServices ||\n !context.sourceCode.parserServices.program ||\n !context.sourceCode.parserServices.esTreeNodeToTSNodeMap\n ) {\n throw new Error(\n 'You have used a rule which requires parserServices to be generated. You must therefore provide a value for the \"parserOptions.project\" property for @typescript-eslint/parser.'\n );\n }\n\n const ignoreRegex = options.ignorePattern ? new RegExp(options.ignorePattern) : undefined;\n\n const service = context.sourceCode.parserServices;\n const typeChecker = service.program.getTypeChecker();\n\n function functionTest(node: any) {\n for (const param of node.params) {\n if (!param.typeAnnotation && !param.right) {\n const typescriptParam = context.sourceCode.parserServices.esTreeNodeToTSNodeMap.get(param);\n const type = typeChecker.getTypeAtLocation(typescriptParam);\n\n if ((type.flags & TypeFlags.Any) === 0) continue;\n if (ignoreRegex?.test(param.name)) continue;\n\n context.report({\n node: param,\n messageId: 'noImplicitAnyArg',\n data: {\n name: param.name\n }\n });\n }\n }\n }\n\n return {\n FunctionDeclaration: functionTest,\n FunctionExpression: functionTest,\n ArrowFunctionExpression: functionTest\n };\n }\n })\n};"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-no-implicit-any-function-args",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,19 +16,19 @@
16
16
  "author": "",
17
17
  "license": "ISC",
18
18
  "dependencies": {
19
- "@typescript-eslint/utils": "^6.10.0"
19
+ "@typescript-eslint/utils": "^6.12.0"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "typescript": "^4.2.4 || ^5.0.0"
23
23
  },
24
24
  "devDependencies": {
25
- "@types/jest": "^29.5.7",
26
- "@types/node": "^20.8.10",
27
- "@typescript-eslint/eslint-plugin": "^6.10.0",
28
- "@typescript-eslint/parser": "^6.10.0",
29
- "@typescript-eslint/rule-tester": "^6.10.0",
25
+ "@types/jest": "^29.5.9",
26
+ "@types/node": "^20.9.3",
27
+ "@typescript-eslint/eslint-plugin": "^6.12.0",
28
+ "@typescript-eslint/parser": "^6.12.0",
29
+ "@typescript-eslint/rule-tester": "^6.12.0",
30
30
  "copyfiles": "^2.4.1",
31
- "eslint": "^8.53.0",
31
+ "eslint": "^8.54.0",
32
32
  "eslint-plugin-deprecation": "^2.0.0",
33
33
  "jest": "^29.7.0",
34
34
  "rimraf": "^5.0.5",