Skip to content

Commit

Permalink
Merge pull request #1253 from guardian/aa-linter-rule
Browse files Browse the repository at this point in the history
chore(linter rule): Fix valid constructor linting rule
  • Loading branch information
akash1810 authored May 11, 2022
2 parents 5ccb3c1 + 930cc77 commit 5840385
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tools/eslint/rules/valid-constructors.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ RULES
1. Private constructors don't get linted
2. Must be 1, 2 or 3 parameters
3. First parameter must be called scope
4. First parameter must be of type GuStack or GuStackForInfrastructure
4. First parameter must be of type GuStack
5. If 2 parameters:
- The second parameter must be called props
- The second parameter must be a custom type
Expand Down Expand Up @@ -77,7 +77,7 @@ const lintParameter = (param, node, context, { name, type, allowOptional, allowD

const scopeParamSpec = {
name: "scope",
type: new RegExp("^(GuStackForInfrastructure|GuStack)$"),
type: "GuStack",
allowOptional: false,
allowDefault: false,
position: "first",
Expand Down
8 changes: 1 addition & 7 deletions tools/eslint/rules/valid-constructors.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-vars -- testing file */

import type { GuStack, GuStackForInfrastructure } from "../../../src/constructs/core";
import type { GuStack } from "../../../src/constructs/core";

interface MyProps {
name: string;
Expand Down Expand Up @@ -50,9 +50,3 @@ class PrivateConstructor {
console.log(number);
}
}

class InfraConstructor {
constructor(scope: GuStackForInfrastructure) {
console.log(scope);
}
}

0 comments on commit 5840385

Please sign in to comment.