Major refactoring using ESLint with rules from AirBnb and Vue. Enable most of the ESLint rules and do necessary linting in the code. Also add more information for rules that are disabled to describe what they are and why they are disabled. Allow logging (`console.log`) in test files, and in development mode (e.g. when working with `npm run serve`), but disable it when environment is production (as pre-configured by Vue). Also add flag (`--mode production`) in `lint:eslint` command so production linting is executed earlier in lifecycle. Disable rules that requires a separate work. Such as ESLint rules that are broken in TypeScript: no-useless-constructor (eslint/eslint#14118) and no-shadow (eslint/eslint#13014).
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { IFunctionParameter } from '@/application/Parser/Script/Compiler/Function/Parameter/IFunctionParameter';
|
|
import { IFunctionParameterCollection } from '@/application/Parser/Script/Compiler/Function/Parameter/IFunctionParameterCollection';
|
|
import { FunctionParameterStub } from './FunctionParameterStub';
|
|
|
|
export class FunctionParameterCollectionStub implements IFunctionParameterCollection {
|
|
private parameters = new Array<IFunctionParameter>();
|
|
|
|
public addParameter(parameter: IFunctionParameter): void {
|
|
this.parameters.push(parameter);
|
|
}
|
|
|
|
public get all(): readonly IFunctionParameter[] {
|
|
return this.parameters;
|
|
}
|
|
|
|
public withParameterName(parameterName: string, isOptional = true) {
|
|
const parameter = new FunctionParameterStub()
|
|
.withName(parameterName)
|
|
.withOptionality(isOptional);
|
|
this.addParameter(parameter);
|
|
return this;
|
|
}
|
|
|
|
public withParameterNames(parameterNames: readonly string[], isOptional = true) {
|
|
for (const parameterName of parameterNames) {
|
|
this.withParameterName(parameterName, isOptional);
|
|
}
|
|
return this;
|
|
}
|
|
}
|