Skip to content

Commit

Permalink
use [] syntax instead of Array<>
Browse files Browse the repository at this point in the history
  • Loading branch information
bttmly committed Jul 12, 2016
1 parent db99c8a commit 795c6d8
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 16 deletions.
6 changes: 3 additions & 3 deletions doc/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
```typescript
interface MutatorPlugin {
name: string;
nodeTypes: Array<string>;
nodeTypes: string[];
filter?: (n: ESTree.Node): boolean;
mutator: (n: ESTree.Node): ESTree.Node;
}
Expand Down Expand Up @@ -70,7 +70,7 @@ A runner plugin describes how to run a single mutation. As such, it needs to und
interface ReporterPlugin {
name: string:
onResult: (r: RunnerResult): void;
onFinish: (rs: Array<RunnerResult>): void;
onFinish: (rs: RunnerResult[]): void;
}
```

Expand All @@ -85,7 +85,7 @@ A reporter plugin describes how to transmit the results of running tests on muta
```typescript
interface SkipperPlugin {
name: string
skipper: (node: ESTree.Node, path: Array<string>): boolean;
skipper: (node: ESTree.Node, path: string[]): boolean;
}
```

Expand Down
2 changes: 1 addition & 1 deletion src/make-mutants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = function makeMutants (match: Match): Mutant[] {
}
}

type Path = Array<string>;
type Path = string[];

function getMutationPaths (ast: ESTree.Node) {
const mutationPaths: Path[] = [];
Expand Down
3 changes: 0 additions & 3 deletions src/mutators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ function isMutatorEnabled (m: MutatorPlugin): boolean {
return true;
}

// temporary stub -- plugin mutators will go into this array
// const mutatorPlugins: Array<Mutator> = [];

// creating the internal state of this module should happen in the exported function
// so we can pass in config, which is necessary for filtering out disabled mutators

Expand Down
2 changes: 1 addition & 1 deletion src/mutators/reverse-function-parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const FUNC_NODES = require("../constants/func-nodes");
import { MutatorPlugin } from "../types";

interface FunctionNode extends ESTree.Node {
params: Array<ESTree.Identifier>
params: ESTree.Identifier[];
}

// reverse the perameter order for a function expression or declaration
Expand Down
2 changes: 1 addition & 1 deletion src/reporters/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = <ReporterPlugin>{
onResult: function(r: RunnerResult) {
console.log(generateReport(r));
},
onFinish: function(rs: Array<RunnerResult>) {
onFinish: function(rs: RunnerResult[]) {
const [killed, alive] = R.partition(r => r.error, rs);
const total = rs.length;
const killCount = killed.length;
Expand Down
12 changes: 6 additions & 6 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface ResultReporter {
}

export interface AggregateReporter {
(rs: Array<RunnerResult>): void;
(rs: RunnerResult[]): void;
}

// runner plugin function types
Expand All @@ -33,7 +33,7 @@ export interface NodeFilter {

// skipper plugin function types
export interface Skipper {
(node: ESTree.Node, path: Array<string>): boolean;
(node: ESTree.Node, path: string[]): boolean;
}

// matcher plugin function types
Expand All @@ -56,7 +56,7 @@ export interface ReporterPlugin extends Plugin {
}

export interface MutatorPlugin extends Plugin {
nodeTypes: Array<string>;
nodeTypes: string[];
filter?: NodeFilter;
mutator: NodeMutator;
}
Expand Down Expand Up @@ -111,8 +111,8 @@ export interface PerturbConfig {
export interface Mutant {
mutatorName: string; // name of mutator plugin
sourceFile: string;
testFiles: Array<string>;
path: Array<string>; // path to AST node under mutation
testFiles: string[];
path: string[]; // path to AST node under mutation
astBefore: ESTree.Node;
astAfter: ESTree.Node;
loc: ESTree.SourceLocation; // line of code where mutation occurred
Expand All @@ -126,6 +126,6 @@ export interface RunnerResult extends Mutant {

export interface Match {
source: string;
tests: Array<string>;
tests: string[];
}

2 changes: 1 addition & 1 deletion src/util/update-in.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const R = require("ramda");

type Prop = string | number;
type Target = Array<any> | Object
type Target = any[] | Object

function assoc(prop: Prop, val: any, target: Target): Target {
if (Array.isArray(target)) {
Expand Down

0 comments on commit 795c6d8

Please sign in to comment.